.
This commit is contained in:
1
.idea/misc.xml
generated
1
.idea/misc.xml
generated
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
|
||||
|
||||
@@ -207,16 +207,21 @@ public class AddMedicalInfoFragment extends Fragment implements
|
||||
public void onMedicalInfoAdded(MedicationInfo medicationInfo) {
|
||||
progressDialog.dismiss();
|
||||
|
||||
String title;
|
||||
|
||||
if (this.medicalInfo == null){
|
||||
Toast.makeText(requireContext(), "Medical information added successfully", Toast.LENGTH_SHORT).show();
|
||||
Navigation.findNavController(binding.getRoot()).popBackStack(R.id.medicalInfoFragment, false);
|
||||
title = getString(R.string.med_added_successful);
|
||||
}else{
|
||||
AppUtil.showAnimateDBS(requireContext(), getString(R.string.changes_successful),
|
||||
R.raw.done_anim_primary, 3000,
|
||||
yes -> {
|
||||
Navigation.findNavController(binding.getRoot()).popBackStack(R.id.medicalInfoFragment, false);
|
||||
});
|
||||
title = getString(R.string.changes_successful);
|
||||
}
|
||||
|
||||
AppUtil.showAnimateDBS(requireContext(),
|
||||
title,
|
||||
R.raw.done_anim_primary, 3000,
|
||||
yes -> {
|
||||
Navigation.findNavController(binding.getRoot()).popBackStack(R.id.medicalInfoFragment, false);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -568,6 +568,12 @@ public class AddReminderFragment extends Fragment implements CompoundButton.OnCh
|
||||
Bundle bundle = getArguments();
|
||||
if (bundle != null) {
|
||||
setLayoutDetails(reminder = (ReminderResult) bundle.getSerializable(REMINDER_KEY));
|
||||
}else{
|
||||
// selecting default week day as current
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
int day_of_week = calendar.get(Calendar.DAY_OF_WEEK) - 1;
|
||||
|
||||
setSelectionState(day_of_week, week_state[day_of_week] = true);
|
||||
}
|
||||
|
||||
progressDialog.dismiss();
|
||||
|
||||
@@ -77,6 +77,12 @@ public class AddRoutineFragment extends Fragment implements CompoundButton.OnChe
|
||||
if (bundle != null && bundle.getSerializable(ROUTINE_KEY) != null){
|
||||
routine = (RoutineDetails) bundle.getSerializable(ROUTINE_KEY);
|
||||
setLayoutDetails();
|
||||
}else{
|
||||
// selecting default week day as current
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
int day_of_week = calendar.get(Calendar.DAY_OF_WEEK) - 1;
|
||||
|
||||
setSelectionState(day_of_week, week_state[day_of_week] = true);
|
||||
}
|
||||
|
||||
// scrolling instruction edit text
|
||||
|
||||
@@ -4,6 +4,7 @@ import static com.ssb.simplitend.welcome.fragments.contacts.CreateContactFragmen
|
||||
import static com.ssb.simplitend.welcome.fragments.contacts.CreateContactFragment.TO_EDIT_KEY;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Bundle;
|
||||
@@ -35,7 +36,7 @@ import com.ssb.simplitend.welcome.fragments.contacts.mvvm.models.ContactData;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ContactListFragment extends Fragment{
|
||||
public class ContactListFragment extends Fragment {
|
||||
|
||||
private static final String TAG = "aditya";
|
||||
|
||||
@@ -48,18 +49,14 @@ public class ContactListFragment extends Fragment{
|
||||
|
||||
protected ActivityResultLauncher<String> permissionLauncher;
|
||||
|
||||
protected ActivityResultLauncher<Intent> insertContactLauncher;
|
||||
|
||||
private ArrayList<Contact> contactList;
|
||||
|
||||
public ContactListFragment() {
|
||||
// required empty const.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
loadContacts();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
@@ -79,9 +76,10 @@ public class ContactListFragment extends Fragment{
|
||||
binding.createContact.setOnClickListener(v ->
|
||||
{
|
||||
// insert contact intent
|
||||
Intent intent = new Intent(Intent.ACTION_INSERT);
|
||||
intent.setType(ContactsContract.Contacts.CONTENT_TYPE);
|
||||
startActivity(intent);
|
||||
Intent intent = new Intent(ContactsContract.Intents.Insert.ACTION);
|
||||
intent.setType(ContactsContract.RawContacts.CONTENT_TYPE);
|
||||
|
||||
insertContactLauncher.launch(intent);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -92,7 +90,7 @@ public class ContactListFragment extends Fragment{
|
||||
bundle.putSerializable(CONTACT_KEY, new ContactData(contact));
|
||||
Navigation.findNavController(binding.getRoot()).navigate(R.id.action_contactListFragment_to_createContactFragment, bundle);
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
binding.search.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
@@ -118,21 +116,21 @@ public class ContactListFragment extends Fragment{
|
||||
|
||||
new Thread(() -> {
|
||||
|
||||
if(searchInput.isEmpty()) {
|
||||
if (searchInput.isEmpty()) {
|
||||
contactListAdapter.submitList(contactList);
|
||||
return;
|
||||
}
|
||||
|
||||
ArrayList<Contact> filteredList = new ArrayList<>();
|
||||
|
||||
for (Contact contact: contactList){
|
||||
if (contact.first_name != null && contact.first_name.trim().toLowerCase().contains(searchInput)){
|
||||
for (Contact contact : contactList) {
|
||||
if (contact.first_name != null && contact.first_name.trim().toLowerCase().contains(searchInput)) {
|
||||
filteredList.add(contact);
|
||||
}else if (contact.phone_number != null && contact.phone_number.trim().contains(searchInput)){
|
||||
} else if (contact.phone_number != null && contact.phone_number.trim().contains(searchInput)) {
|
||||
filteredList.add(contact);
|
||||
}else if (contact.email_address != null && contact.email_address.trim().toLowerCase().contains(searchInput)){
|
||||
} else if (contact.email_address != null && contact.email_address.trim().toLowerCase().contains(searchInput)) {
|
||||
filteredList.add(contact);
|
||||
}else if (contact.relationship != null && contact.relationship.trim().toLowerCase().contains(searchInput)){
|
||||
} else if (contact.relationship != null && contact.relationship.trim().toLowerCase().contains(searchInput)) {
|
||||
filteredList.add(contact);
|
||||
}
|
||||
}
|
||||
@@ -151,12 +149,15 @@ public class ContactListFragment extends Fragment{
|
||||
|
||||
}
|
||||
|
||||
@SuppressLint("Range")
|
||||
private void initializeViews() {
|
||||
// initiating recycler view for contact list
|
||||
contactListAdapter = new ContactListAdapter();
|
||||
binding.contactRv.setLayoutManager(new LinearLayoutManager(requireContext()));
|
||||
binding.contactRv.setAdapter(contactListAdapter);
|
||||
|
||||
loadContacts();
|
||||
|
||||
permissionLauncher = registerForActivityResult(new ActivityResultContracts.RequestPermission(),
|
||||
granted -> {
|
||||
if (granted) {
|
||||
@@ -169,6 +170,13 @@ public class ContactListFragment extends Fragment{
|
||||
}
|
||||
);
|
||||
|
||||
insertContactLauncher = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(),
|
||||
result -> {
|
||||
|
||||
loadContacts();
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -133,17 +133,16 @@ public class CreateContactFragment extends Fragment implements WelcomeContracts.
|
||||
|
||||
} else {
|
||||
setLayoutDetails(getString(R.string.create_contact), getString(R.string.add_photo), getString(R.string.create_contact));
|
||||
loadRemoteContactList();
|
||||
}
|
||||
|
||||
if (bundle.getSerializable(CONTACT_KEY) != null) {
|
||||
contactData = (ContactData) bundle.getSerializable(CONTACT_KEY);
|
||||
setDetails();
|
||||
}
|
||||
} else {
|
||||
loadRemoteContactList();
|
||||
}
|
||||
|
||||
loadRemoteContactList();
|
||||
|
||||
binding.sosCheck.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||
if (isChecked) {
|
||||
contactViewModel.showSOSDecision(requireContext());
|
||||
@@ -379,6 +378,31 @@ public class CreateContactFragment extends Fragment implements WelcomeContracts.
|
||||
binding.caregiverCheck.setChecked(true);
|
||||
}
|
||||
|
||||
// checking if there is any SOS contact already in list
|
||||
boolean isSosSet = false;
|
||||
int sos_contact_id = -1;
|
||||
|
||||
for (ContactListResponse contact: contactList){
|
||||
if (contact.is_sos_contact.equals("1")) {
|
||||
isSosSet = true;
|
||||
sos_contact_id = contact.contact_data.id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (isSosSet){
|
||||
binding.sosCheckView.setVisibility(View.GONE);
|
||||
|
||||
if (contactData != null && sos_contact_id != -1 && sos_contact_id == contactData.id){
|
||||
// current contact being edited is the SOS contact
|
||||
// thus, sos switch can be edited
|
||||
binding.sosCheckView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
}else{
|
||||
binding.sosCheckView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
progressDialog.dismiss();
|
||||
}
|
||||
|
||||
|
||||
@@ -140,6 +140,8 @@
|
||||
android:drawableStart="@drawable/ic_doc_contact"
|
||||
android:drawablePadding="10dp"
|
||||
|
||||
android:maxLength="10"
|
||||
|
||||
android:autofillHints="phone"
|
||||
android:inputType="phone"
|
||||
android:maxLines="1"
|
||||
|
||||
@@ -123,6 +123,8 @@
|
||||
android:drawableStart="@drawable/ic_dosage"
|
||||
android:drawablePadding="10dp"
|
||||
|
||||
android:maxLength="3"
|
||||
|
||||
android:autofillHints="@null"
|
||||
android:inputType="numberDecimal"
|
||||
/>
|
||||
@@ -569,6 +571,8 @@
|
||||
android:drawableStart="@drawable/ic_quantity"
|
||||
android:drawablePadding="10dp"
|
||||
|
||||
android:maxLength="3"
|
||||
|
||||
android:autofillHints="@null"
|
||||
android:inputType="number"
|
||||
|
||||
|
||||
@@ -292,6 +292,7 @@
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/sos_check_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
|
||||
@@ -310,6 +310,8 @@
|
||||
android:drawableStart="@drawable/ic_home"
|
||||
android:drawablePadding="10dp"
|
||||
|
||||
android:maxLength="6"
|
||||
|
||||
android:autofillHints="postalAddress"
|
||||
android:inputType="number"
|
||||
/>
|
||||
|
||||
@@ -94,6 +94,7 @@
|
||||
<string name="no">No</string>
|
||||
|
||||
<string name="changes_successful">Changes successful</string>
|
||||
<string name="med_added_successful">Details added successfully</string>
|
||||
<string name="add_10_family_and_friend_contact_information">Add 10 family and friend contact information</string>
|
||||
<string name="atleast_add_one_contact">*Atleast add one contact</string>
|
||||
<string name="contact_information">Contact information</string>
|
||||
|
||||
Reference in New Issue
Block a user