This commit is contained in:
2023-09-14 21:19:04 +05:30
parent 130d50f9f8
commit 4271df589f
20 changed files with 156 additions and 27 deletions

View File

@@ -12,7 +12,7 @@
</deviceKey>
</Target>
</runningDeviceTargetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2023-09-08T15:20:04.342466600Z" />
<timeTargetWasSelectedWithDropDown value="2023-09-14T15:35:51.557788700Z" />
<runningDeviceTargetsSelectedWithDialog>
<Target>
<type value="RUNNING_DEVICE_TARGET" />

View File

@@ -228,6 +228,8 @@ public class EditProfileInfoActivity extends AppCompatActivity implements
}, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH));
datePickerDialog.getDatePicker().setMaxDate(calendar.getTimeInMillis());
datePickerDialog.setTitle("Select a date");
datePickerDialog.setMessage("Note: Click on the date, month or year to edit manually");
// creating this view model here as it contains the fetching code
countryCodeList = AppUtil.loadCountryCodeDropDown(this);

View File

@@ -242,8 +242,8 @@ public class AddReminderFragment extends Fragment implements CompoundButton.OnCh
}, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH));
datePickerDialog.getDatePicker().setMinDate(System.currentTimeMillis());
datePickerDialog.setTitle("Select a refill date");
datePickerDialog.setMessage("click on the fields to enter date manually");
datePickerDialog.setTitle("Select a date");
datePickerDialog.setMessage("Note: Click on the date, month or year to edit manually");
frequencyList = new ArrayList<>();
medicationTypeList = new ArrayList<>();

View File

@@ -37,12 +37,12 @@ public class CgAuthActivity extends AppCompatActivity {
int cg_security = AppUtil.getWantSecurityFlag(this);
if (cg_security == AppUtil.NOT_ASKED_CG_SECURITY){
if (cg_security == AppUtil.NOT_ASKED_CG_SECURITY) {
// user has never been asked to setup security
// thus, showing that ui
binding.notAsked.setVisibility(View.VISIBLE);
binding.askedView.setVisibility(View.GONE);
}else{
} else {
// user was asked already
binding.notAsked.setVisibility(View.GONE);
binding.askedView.setVisibility(View.VISIBLE);
@@ -137,11 +137,12 @@ public class CgAuthActivity extends AppCompatActivity {
if (biometric_status == BiometricManager.BIOMETRIC_SUCCESS) {
// go ahead and do it.
biometricPrompt.authenticate(new BiometricPrompt.PromptInfo.Builder()
.setTitle("Unlock Simplitend")
.setTitle("Scan your fingerprint to unlock SimpliTend")
.setConfirmationRequired(false)
.setDescription("User your device's fingerprint sensor")
.setNegativeButtonText("Cancel")
.build());
} else if (biometric_status == BiometricManager.BIOMETRIC_ERROR_NONE_ENROLLED){
} else if (biometric_status == BiometricManager.BIOMETRIC_ERROR_NONE_ENROLLED) {
// no fingerprints enrolled
AppUtil.showAlert(this,
@@ -154,7 +155,7 @@ public class CgAuthActivity extends AppCompatActivity {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.R) {
enrollIntent = new Intent(Settings.ACTION_BIOMETRIC_ENROLL);
enrollIntent.putExtra(Settings.EXTRA_BIOMETRIC_AUTHENTICATORS_ALLOWED, BIOMETRIC_STRONG);
}else{
} else {
enrollIntent = new Intent(Settings.ACTION_SECURITY_SETTINGS);
}

View File

@@ -121,6 +121,8 @@ public class CgRegisterFragment extends Fragment implements WelcomeContracts.Reg
}
}, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH));
datePickerDialog.getDatePicker().setMaxDate(calendar.getTimeInMillis());
datePickerDialog.setTitle("Select a date");
datePickerDialog.setMessage("Note: Click on the date, month or year to edit manually");
dob_selected = Calendar.getInstance();

View File

@@ -45,6 +45,9 @@ public class AddContactFragment extends Fragment implements WelcomeContracts.Con
private ContactViewModel contactViewModel;
private int contacts_count;
private boolean is_doctor_set;
public AddContactFragment(){
// required empty const.
}
@@ -111,10 +114,16 @@ public class AddContactFragment extends Fragment implements WelcomeContracts.Con
@Override
public void onResponse(List<ContactListResponse> responseList) {
this.contacts_count = responseList.size();
ArrayList<ContactData> contactList = new ArrayList<>();
for (ContactListResponse response : responseList){
response.contact_data.contact_id = response.id;
response.contact_data.is_doctor = response.is_doctor;
if (response.is_doctor != null){
this.is_doctor_set = response.is_doctor.equals("1");
}
contactList.add(response.contact_data);
}
@@ -137,6 +146,14 @@ public class AddContactFragment extends Fragment implements WelcomeContracts.Con
@Override
public void onContactClick(ContactData contactData, int position) {
if (contacts_count == 9 && !is_doctor_set){
// last contact to be added
// and doctor not yet set
Toast.makeText(requireContext(), "Contact is reserved for doctor, Please add medical information.", Toast.LENGTH_SHORT).show();
return;
}
if (contactData.id == -1){
// a new contact should be added

View File

@@ -165,6 +165,12 @@ public class ContactInfoFragment extends Fragment implements WelcomeContracts.De
return;
}
if (contactData.is_doctor != null && contactData.is_doctor.equals("1")){
// cannot delete doctor
Toast.makeText(requireContext(), "You cannot delete your primary doctor.", Toast.LENGTH_SHORT).show();
return;
}
AppUtil.showSOSDecision(requireContext(),
getString(R.string.sure_delete),
getString(R.string.yes),

View File

@@ -139,7 +139,7 @@ public class CreateContactFragment extends Fragment implements WelcomeContracts.
if (bundle.getSerializable(CONTACT_KEY) != null) {
contactData = (ContactData) bundle.getSerializable(CONTACT_KEY);
setDetails();
}else{
} else {
addContactView("", true);
}
}
@@ -150,6 +150,14 @@ public class CreateContactFragment extends Fragment implements WelcomeContracts.
if (isChecked && !current_contact_sos) {
contactViewModel.showSOSDecision(requireContext(), isSosSet, sos_contact_name,
binding.name.getText().toString());
}else if (!isChecked && current_contact_sos){
// changing sos to 911
AppUtil.showSOSDecision(requireContext(),
getString(R.string.you_are_about_to_change_emergency_number_from_this_contact_to_911_please_confirm),
getString(R.string.yes), getString(R.string.no),
v -> {
}, v -> {
});
}
});
@@ -190,7 +198,7 @@ public class CreateContactFragment extends Fragment implements WelcomeContracts.
String[] phone_numbers = getAllPhoneNumbers();
if (!phone_numbers[3].equals("0")){
if (!phone_numbers[3].equals("0")) {
Toast.makeText(requireContext(), "Please select a default contact.", Toast.LENGTH_SHORT).show();
return;
}
@@ -355,13 +363,14 @@ public class CreateContactFragment extends Fragment implements WelcomeContracts.
int sos_contact_id = -1;
for (ContactListResponse contact : contactList) {
if (contact.is_sos_contact.equals("1")) {
isSosSet = true;
if (contact.contact_data != null){
if (contact.contact_data != null) {
if (contact.contact_data.is_sos.equals("1")) {
isSosSet = true;
sos_contact_id = contact.contact_data.id;
sos_contact_name = contact.contact_data.first_name;
break;
}
break;
}
}
@@ -493,8 +502,18 @@ public class CreateContactFragment extends Fragment implements WelcomeContracts.
binding.caregiverCheckView.setVisibility(View.GONE);
}
// checking if this contact is doctor
if (contactData.is_doctor != null && contactData.is_doctor.equals("1")){
// this contact is doctor
binding.name.setEnabled(false);
binding.relationship.setEnabled(false);
}else{
binding.name.setEnabled(true);
binding.relationship.setEnabled(true);
}
boolean default_contact_set = false;
if (contactData.phone_number != null){
if (contactData.phone_number != null) {
addContactView(contactData.phone_number, default_contact_set = true);
}
@@ -571,20 +590,27 @@ public class CreateContactFragment extends Fragment implements WelcomeContracts.
});
contact_binding.delete.setOnClickListener(v -> {
if (binding.contactTable.getChildCount() == 1){
if (binding.contactTable.getChildCount() == 1) {
Toast.makeText(requireContext(), "Cannot be deleted", Toast.LENGTH_SHORT).show();
return;
}
try {
binding.contactTable.removeView(contact_binding.getRoot());
}catch (Exception e){
} catch (Exception e) {
Toast.makeText(requireContext(), "Couldn't delete contact.", Toast.LENGTH_SHORT).show();
}
});
contact_binding.defaultCheck.setSelected(id_default);
// if contact is a doctor we wont allow the contact to be changes
if (contactData.is_doctor != null && contactData.is_doctor.equals("1")){
contact_binding.createPhoneNumber.setEnabled(false);
contact_binding.createCountryCodes.setEnabled(false);
contact_binding.defaultCheck.setEnabled(false);
}
binding.contactTable.addView(contact_binding.getRoot());
}

View File

@@ -126,7 +126,19 @@ public class AddContactAdapter extends ListAdapter<ContactData, AddContactAdapte
if (contact.care_giver_data.id != null){
// this contact is caregiver
binding.cgIc.setVisibility(View.VISIBLE);
}
if (contact.is_sos != null && contact.is_sos.equals("1")){
binding.sos.setVisibility(View.VISIBLE);
}else{
binding.sos.setVisibility(View.GONE);
}
if (contact.is_doctor != null && contact.is_doctor.equals("1")){
binding.docIc.setVisibility(View.VISIBLE);
}else{
binding.docIc.setVisibility(View.GONE);
}
}
}

View File

@@ -137,7 +137,8 @@ public class ContactViewModel extends AndroidViewModel {
String title;
if (isSosSet && sos_contact_name != null){
title = "Are you sure you want to remove " + sos_contact_name + " as Sos? & add " + current_name +
title = "Are you sure you want to remove " + sos_contact_name + " as Sos? & add " +
((current_name.trim().isEmpty())?"this contact":current_name) +
" as Sos?";
}else{
title = context.getString(R.string.make_sos);

View File

@@ -192,6 +192,10 @@ public class UserContactRepository {
if (name == null || name.isEmpty()) name = "No name";
Contact contact = new Contact(name, number);
if (name.equals("DONNA Saatchi")){
Log.d(TAG, "getContactList: ");
}
ArrayList<Contact> contactList;
@@ -228,12 +232,13 @@ public class UserContactRepository {
};
try (Cursor emailCursor = context.getContentResolver().query(emailUri, emailProjection, null, null, null)) {
if (emailCursor != null) {
final int email_index = emailCursor.getColumnIndex(ContactsContract.CommonDataKinds.Email.ADDRESS);
final int c_id_index = emailCursor.getColumnIndex(ContactsContract.CommonDataKinds.Email.CONTACT_ID);
final int count = emailCursor.getCount();
if (emailCursor.moveToNext())
while (emailCursor.moveToNext())
{
String email = emailCursor.getString(email_index);
String c_id = emailCursor.getString(c_id_index);

View File

@@ -21,6 +21,8 @@ public class ContactData implements Serializable {
public int contact_id;
public String is_doctor;
public ContactData() {
}

View File

@@ -6,9 +6,10 @@ public class ContactListResponse{
public int id;
public String patient_xid;
public String contact_xid;
public String is_sos_contact;
public ContactData contact_data;
public String is_doctor;
public ContactListResponse() {
}
@@ -19,7 +20,6 @@ public class ContactListResponse{
"id=" + id +
", patient_xid='" + patient_xid + '\'' +
", contact_xid='" + contact_xid + '\'' +
", is_sos_contact='" + is_sos_contact + '\'' +
", contact_data=" + contact_data +
'}';
}

View File

@@ -96,6 +96,8 @@ public class RegisterFragment extends Fragment implements WelcomeContracts.Verif
}
}, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH));
datePickerDialog.getDatePicker().setMaxDate(calendar.getTimeInMillis());
datePickerDialog.setTitle("Select a date");
datePickerDialog.setMessage("Note: Click on the date, month or year to edit manually");
countryCodeList = viewModel.loadCountryCodeDropDown(requireContext());

View File

@@ -26,6 +26,8 @@ public class PatientData {
public String profile_photo;
public String caregiver_status;
// progress flags
public int isCareGiverLink
, isPatientReminderData

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

View File

@@ -25,7 +25,7 @@
>
<ImageView
android:id="@+id/sos"
android:id="@+id/cg_ic"
android:visibility="gone"
android:layout_width="15dp"
android:layout_height="15dp"
@@ -39,6 +39,36 @@
/>
<ImageView
android:id="@+id/doc_ic"
android:visibility="gone"
android:layout_width="20dp"
android:layout_height="20dp"
android:contentDescription="@string/make_sos"
app:srcCompat="@drawable/ic_doctor"
android:layout_margin="10dp"
android:layout_gravity="end"
/>
<ImageView
android:id="@+id/sos"
android:visibility="gone"
android:layout_width="15dp"
android:layout_height="15dp"
android:contentDescription="@string/make_sos"
app:srcCompat="@drawable/ic_sos"
android:layout_margin="10dp"
android:layout_gravity="start"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"

View File

@@ -157,12 +157,32 @@
</LinearLayout>
<TableLayout
android:id="@+id/contact_table"
<RelativeLayout
android:id="@+id/contact_table_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
/>
>
<TableLayout
android:id="@+id/contact_table"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
/>
<View
android:id="@+id/contact_table_tint"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/darker_gray"
android:alpha="0.5"
android:clickable="false"
android:focusable="false"/>
</RelativeLayout>
<!-- <androidx.constraintlayout.widget.ConstraintLayout-->
<!-- android:visibility="gone"-->

View File

@@ -89,7 +89,7 @@
<string name="sos_is_set_to_e911_default">*SOS is set to E911 default</string>
<string name="enter_your_relationship">Enter your relationship</string>
<string name="make_sos">Are you sure you want to change the contact to SOS ?</string>
<string name="make_sos">You are about to change your emergency number from 911 to this contact. Please confirm</string>
<string name="make_changes">Are you sure you want to save the changes ?</string>
<string name="yes">Yes</string>
<string name="no">No</string>
@@ -395,5 +395,6 @@
<string name="subscribe_description">Your credit card will be charged 24 hours before your subscription period expires. The subscription will automatically renew at the same price. You can cancel your subscription 7 days before the renewal date by sending an email to contact.us@simplitent.com</string>
<string name="contact_email">contact.us@simplitent.com</string>
<string name="instructions_title">Instructions:</string>
<string name="you_are_about_to_change_emergency_number_from_this_contact_to_911_please_confirm">You are about to change emergency number from this contact to 911. Please confirm</string>
</resources>