.
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package com.ssb.simplitend.patientprofile;
|
||||
|
||||
import static com.ssb.simplitend.patientprofile.RegisterCompleteFragment.PROFILE_PROGRESS;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
@@ -30,6 +32,8 @@ public class ProfileProgressFragment extends Fragment implements ProfileContract
|
||||
|
||||
private ProgressDialog progressDialog;
|
||||
|
||||
int profile_progress;
|
||||
|
||||
public ProfileProgressFragment() {
|
||||
// required empty const.
|
||||
}
|
||||
@@ -100,30 +104,43 @@ public class ProfileProgressFragment extends Fragment implements ProfileContract
|
||||
);
|
||||
|
||||
binding.proceed.setOnClickListener(v -> {
|
||||
Navigation.findNavController(v).navigate(R.id.action_profileProgressFragment_to_registerCompleteFragment);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putInt(PROFILE_PROGRESS, profile_progress);
|
||||
|
||||
Navigation.findNavController(v).navigate(R.id.action_profileProgressFragment_to_registerCompleteFragment, bundle);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProfileProgressFetched(@NonNull PatientData patientData) {
|
||||
|
||||
profile_progress = 0;
|
||||
|
||||
if (patientData.isCareGiverLink == 1) {
|
||||
// TODO: 25-07-2023 look into this
|
||||
profile_progress++;
|
||||
}
|
||||
|
||||
if (patientData.isPatientReminderData == 1) {
|
||||
profile_progress++;
|
||||
|
||||
binding.medReminderImg.setImageResource(0);
|
||||
binding.medReminderImg.setBackgroundResource(R.drawable.ic_done);
|
||||
binding.medReminderImg.setPaddingRelative(15, 15, 15, 15);
|
||||
}
|
||||
|
||||
if (patientData.isPatientMedicalData == 1) {
|
||||
profile_progress++;
|
||||
|
||||
binding.medInfoImg.setImageResource(0);
|
||||
binding.medInfoImg.setBackgroundResource(R.drawable.ic_done);
|
||||
binding.medInfoImg.setPadding(15, 15, 15, 15);
|
||||
}
|
||||
|
||||
if (patientData.isPatientRoutineData == 1) {
|
||||
profile_progress++;
|
||||
|
||||
binding.setupRoutineImg.setImageResource(0);
|
||||
binding.setupRoutineImg.setBackgroundResource(R.drawable.ic_done);
|
||||
binding.setupRoutineImg.setPadding(15, 15, 15, 15);
|
||||
|
||||
@@ -20,6 +20,10 @@ public class RegisterCompleteFragment extends Fragment {
|
||||
|
||||
public RegisterationDoneFragmentBinding binding;
|
||||
|
||||
public static final String PROFILE_PROGRESS = "profile_progress";
|
||||
|
||||
int profile_progress;
|
||||
|
||||
public RegisterCompleteFragment(){
|
||||
// required
|
||||
}
|
||||
@@ -29,6 +33,10 @@ public class RegisterCompleteFragment extends Fragment {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
binding = RegisterationDoneFragmentBinding.inflate(inflater, container, false);
|
||||
|
||||
if (getArguments() != null){
|
||||
profile_progress = getArguments().getInt(PROFILE_PROGRESS, 20);
|
||||
}
|
||||
|
||||
binding.animIv.setAnimation(R.raw.done_anim_2);
|
||||
binding.animIv.playAnimation();
|
||||
|
||||
@@ -40,7 +48,10 @@ public class RegisterCompleteFragment extends Fragment {
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(@NonNull Animator animator) {
|
||||
binding.title.setText(getString(R.string.your_profile_is_100_complete));
|
||||
|
||||
String title = "Your profile is " + (profile_progress * 20) + "% complete!";
|
||||
|
||||
binding.title.setText(title);
|
||||
YoYo.with(Techniques.FadeIn)
|
||||
.duration(100)
|
||||
.playOn(binding.title);
|
||||
|
||||
@@ -14,6 +14,7 @@ import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.navigation.Navigation;
|
||||
|
||||
import com.google.i18n.phonenumbers.NumberParseException;
|
||||
import com.google.i18n.phonenumbers.PhoneNumberUtil;
|
||||
import com.google.i18n.phonenumbers.Phonenumber;
|
||||
import com.ssb.simplitend.R;
|
||||
@@ -147,7 +148,10 @@ public class AddMedicalInfoFragment extends Fragment implements
|
||||
binding.diagnosis.setText(medicalInfo.diagnosis);
|
||||
binding.primaryDoc.setText(medicalInfo.primary_care_doctor);
|
||||
|
||||
binding.phoneNumber.setText(medicalInfo.doctor_phone_number);
|
||||
if (medicalInfo.doctor_phone_number != null)
|
||||
{
|
||||
binding.phoneNumber.setText(medicalInfo.doctor_phone_number);
|
||||
}
|
||||
|
||||
binding.hospitalPref.setText(medicalInfo.hospital_preference);
|
||||
binding.allergies.setText(medicalInfo.allergies);
|
||||
@@ -161,7 +165,6 @@ public class AddMedicalInfoFragment extends Fragment implements
|
||||
binding.backBtn.setOnClickListener(v -> Navigation.findNavController(v).popBackStack());
|
||||
|
||||
binding.addBtn.setOnClickListener(v -> {
|
||||
ProfileProgress.MEDICAL_INFO_ADDED = true;
|
||||
|
||||
if (allOkay()){
|
||||
if (medicalInfo != null){
|
||||
@@ -268,6 +271,24 @@ public class AddMedicalInfoFragment extends Fragment implements
|
||||
|| binding.phoneNumber.getText().toString().trim().length() < 10){
|
||||
allOkay = false;
|
||||
binding.phoneNumber.setError("Invalid");
|
||||
}else if (binding.countryCodes.getSelectedIndex() == -1 ||
|
||||
binding.countryCodes.getSelectedIndex() >= countryCodeList.size()){
|
||||
allOkay = false;
|
||||
Toast.makeText(requireContext(), "Select a coutnry code.", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
else{
|
||||
// validating phone number
|
||||
try {
|
||||
Phonenumber.PhoneNumber phone_number = PhoneNumberUtil.getInstance().parse(countryCodeList.get(binding.countryCodes.getSelectedIndex())+
|
||||
binding.phoneNumber.getText().toString(), "US");
|
||||
|
||||
if (!PhoneNumberUtil.getInstance().isValidNumber(phone_number)) {
|
||||
binding.phoneNumber.setError("Invalid phone number");
|
||||
allOkay = false;
|
||||
}
|
||||
} catch (NumberParseException e) {
|
||||
// do nothing as we couldn't validate phone number
|
||||
}
|
||||
}
|
||||
|
||||
if (binding.hospitalPref.getText().toString().trim().isEmpty()){
|
||||
|
||||
@@ -109,7 +109,6 @@ ReminderAdapter.ReminderCheckClickListener{
|
||||
|
||||
binding.done.setOnClickListener(v -> {
|
||||
Navigation.findNavController(v).popBackStack();
|
||||
ProfileProgress.PROFILE_PROGRESS[0] = true;
|
||||
});
|
||||
|
||||
binding.backBtn.setOnClickListener(v -> Navigation.findNavController(v).popBackStack());
|
||||
@@ -156,7 +155,7 @@ ReminderAdapter.ReminderCheckClickListener{
|
||||
// show days of week
|
||||
setDayOfWeekViews();
|
||||
|
||||
setDayOfWeek(reminderViewModel.selected_dow);
|
||||
setDayOfWeek(reminderViewModel.selected_dow = 0);
|
||||
|
||||
loadReminderList(weekDayViewsList.get(reminderViewModel.selected_dow).day_of_week);
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ public class RoutineFragment extends Fragment implements RoutineAdapter.ClickLis
|
||||
// show days of week
|
||||
setDayOfWeekViews();
|
||||
|
||||
setDayOfWeek(routineViewModel.selected_dow);
|
||||
setDayOfWeek(routineViewModel.selected_dow = 0);
|
||||
|
||||
loadRoutineList(weekDayViewsList.get(routineViewModel.selected_dow).day_of_week);
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.navigation.Navigation;
|
||||
|
||||
import com.google.i18n.phonenumbers.NumberParseException;
|
||||
import com.google.i18n.phonenumbers.PhoneNumberUtil;
|
||||
import com.google.i18n.phonenumbers.Phonenumber;
|
||||
import com.ssb.simplitend.apputils.AppUtil;
|
||||
@@ -346,9 +347,24 @@ public class CgRegisterFragment extends Fragment implements WelcomeContracts.Reg
|
||||
binding.contactNumber.getText().toString().trim().length() <10) {
|
||||
binding.contactNumber.setError("Invalid");
|
||||
allOkay = false;
|
||||
} else if (!Patterns.PHONE.matcher(binding.contactNumber.getText().toString()).matches()) {
|
||||
binding.contactNumber.setError("Invalid contact");
|
||||
} else if (binding.countryCodes.getSelectedIndex() == -1 ||
|
||||
binding.countryCodes.getSelectedIndex() >= countryCodeList.size()){
|
||||
allOkay = false;
|
||||
Toast.makeText(requireContext(), "Select a country code.", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
else{
|
||||
// validating phone number
|
||||
try {
|
||||
Phonenumber.PhoneNumber phone_number = PhoneNumberUtil.getInstance().parse(countryCodeList.get(binding.countryCodes.getSelectedIndex())+
|
||||
binding.contactNumber.getText().toString(), "US");
|
||||
|
||||
if (!PhoneNumberUtil.getInstance().isValidNumber(phone_number)) {
|
||||
binding.contactNumber.setError("Invalid phone number");
|
||||
allOkay = false;
|
||||
}
|
||||
} catch (NumberParseException e) {
|
||||
// do nothing as we couldn't validate phone number
|
||||
}
|
||||
}
|
||||
|
||||
if (binding.email.getText().toString().trim().isEmpty()) {
|
||||
|
||||
@@ -28,6 +28,7 @@ import androidx.navigation.Navigation;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.github.dhaval2404.imagepicker.ImagePicker;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialog;
|
||||
import com.google.i18n.phonenumbers.NumberParseException;
|
||||
import com.google.i18n.phonenumbers.PhoneNumberUtil;
|
||||
import com.google.i18n.phonenumbers.Phonenumber;
|
||||
import com.ssb.simplitend.R;
|
||||
@@ -117,11 +118,11 @@ public class CreateContactFragment extends Fragment implements WelcomeContracts.
|
||||
|
||||
binding.countryCodes.setItems(countryCodeList);
|
||||
|
||||
if (!countryCodeList.contains("+1")){
|
||||
if (!countryCodeList.contains("+1")) {
|
||||
countryCodeList.add("+1");
|
||||
}
|
||||
|
||||
binding.countryCodes.selectItemByIndex(countryCodeList.indexOf("+91"));
|
||||
binding.countryCodes.selectItemByIndex(countryCodeList.indexOf("+1"));
|
||||
|
||||
binding.countryCodes.setDismissWhenNotifiedItemSelected(true);
|
||||
|
||||
@@ -136,7 +137,7 @@ public class CreateContactFragment extends Fragment implements WelcomeContracts.
|
||||
|
||||
String country_code = null;
|
||||
|
||||
if (binding.countryCodes.getSelectedIndex() != -1){
|
||||
if (binding.countryCodes.getSelectedIndex() != -1) {
|
||||
country_code = countryCodeList.get(binding.countryCodes.getSelectedIndex());
|
||||
}
|
||||
|
||||
@@ -150,25 +151,25 @@ public class CreateContactFragment extends Fragment implements WelcomeContracts.
|
||||
// nothing
|
||||
}
|
||||
|
||||
if (country_code != null && !countryCodeList.contains(country_code)){
|
||||
if (country_code != null && !countryCodeList.contains(country_code)) {
|
||||
countryCodeList.add(country_code);
|
||||
}
|
||||
|
||||
if (country_code != null){
|
||||
if (country_code != null) {
|
||||
binding.countryCodes.selectItemByIndex(countryCodeList.indexOf(country_code));
|
||||
}
|
||||
|
||||
if (phone_number_str.length() > 10){
|
||||
if (phone_number_str.length() > 10) {
|
||||
// pasted number length is greater than 10
|
||||
return phone_number_str.substring(0, 10);
|
||||
}
|
||||
|
||||
String total_phone_number = binding.phoneNumber.getText().toString() + phone_number_str;
|
||||
|
||||
if (total_phone_number.length() > 10){
|
||||
if (total_phone_number.length() > 10) {
|
||||
// max length should be 10
|
||||
return "";
|
||||
}else{
|
||||
} else {
|
||||
return phone_number_str;
|
||||
}
|
||||
};
|
||||
@@ -233,23 +234,21 @@ public class CreateContactFragment extends Fragment implements WelcomeContracts.
|
||||
|
||||
binding.nextBtn.setOnClickListener(v -> {
|
||||
|
||||
if (to_edit) {
|
||||
// editing existing contact
|
||||
if (allOkay()) {
|
||||
if (to_edit) {
|
||||
// editing existing contact
|
||||
|
||||
AppUtil.showSOSDecision(requireContext(),
|
||||
getString(R.string.make_changes),
|
||||
getString(R.string.yes),
|
||||
getString(R.string.no),
|
||||
yes -> {
|
||||
if (allOkay()){
|
||||
createEditContact("While we update your contact details.", true, UPDATE_CONTACT + contactData.contact_id);
|
||||
}
|
||||
}, no -> {
|
||||
AppUtil.showSOSDecision(requireContext(),
|
||||
getString(R.string.make_changes),
|
||||
getString(R.string.yes),
|
||||
getString(R.string.no),
|
||||
yes -> {
|
||||
createEditContact("While we update your contact details.", true, UPDATE_CONTACT + contactData.contact_id);
|
||||
}, no -> {
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
} else {
|
||||
if (allOkay()) {
|
||||
} else {
|
||||
createEditContact("While we save the contact details.", false, CREATE_CONTACT);
|
||||
}
|
||||
}
|
||||
@@ -280,20 +279,20 @@ public class CreateContactFragment extends Fragment implements WelcomeContracts.
|
||||
progressDialog.show();
|
||||
|
||||
Map<String, RequestBody> body = new HashMap<>();
|
||||
RequestBody user_first_name = RequestBody.create(binding.name.getText().toString().trim(), MediaType.parse("text/plain;charset=utf-8") );
|
||||
body.put("full_name", user_first_name );
|
||||
RequestBody user_first_name = RequestBody.create(binding.name.getText().toString().trim(), MediaType.parse("text/plain;charset=utf-8"));
|
||||
body.put("full_name", user_first_name);
|
||||
|
||||
String contact_number = countryCodeList.get(binding.countryCodes.getSelectedIndex()) + " " +
|
||||
binding.phoneNumber.getText().toString();
|
||||
|
||||
RequestBody contact_number_part = RequestBody.create(contact_number, MediaType.parse("text/plain;charset=utf-8") );
|
||||
RequestBody contact_number_part = RequestBody.create(contact_number, MediaType.parse("text/plain;charset=utf-8"));
|
||||
|
||||
body.put("contact_number", contact_number_part);
|
||||
|
||||
RequestBody email_ = RequestBody.create(binding.email.getText().toString().trim(), MediaType.parse("text/plain;charset=utf-8") );
|
||||
RequestBody email_ = RequestBody.create(binding.email.getText().toString().trim(), MediaType.parse("text/plain;charset=utf-8"));
|
||||
body.put("email_address", email_);
|
||||
|
||||
RequestBody relationship_ = RequestBody.create(binding.relationship.getText().toString().trim(), MediaType.parse("text/plain;charset=utf-8") );
|
||||
RequestBody relationship_ = RequestBody.create(binding.relationship.getText().toString().trim(), MediaType.parse("text/plain;charset=utf-8"));
|
||||
body.put("relationship", relationship_);
|
||||
|
||||
Map<String, Integer> intBody = new HashMap<>();
|
||||
@@ -334,17 +333,29 @@ public class CreateContactFragment extends Fragment implements WelcomeContracts.
|
||||
binding.phoneNumber.getText().toString().trim().length() < 10) {
|
||||
allOkay = false;
|
||||
binding.phoneNumber.setError("Invalid");
|
||||
} else if (!Patterns.PHONE.matcher(binding.phoneNumber.getText().toString()).matches()) {
|
||||
}else if (binding.countryCodes.getSelectedIndex() == -1||
|
||||
binding.countryCodes.getSelectedIndex() >= countryCodeList.size()){
|
||||
allOkay = false;
|
||||
binding.phoneNumber.setError("Invalid number");
|
||||
Toast.makeText(requireContext(), "Select a coutnry code.", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
else{
|
||||
// validating phone number
|
||||
try {
|
||||
Phonenumber.PhoneNumber phone_number = PhoneNumberUtil.getInstance().parse(countryCodeList.get(binding.countryCodes.getSelectedIndex())+
|
||||
binding.phoneNumber.getText().toString(), "US");
|
||||
|
||||
if (!PhoneNumberUtil.getInstance().isValidNumber(phone_number)) {
|
||||
binding.phoneNumber.setError("Invalid phone number");
|
||||
allOkay = false;
|
||||
}
|
||||
} catch (NumberParseException e) {
|
||||
// do nothing as we couldn't validate phone number
|
||||
}
|
||||
}
|
||||
|
||||
if (binding.email.getText().toString().trim().isEmpty()) {
|
||||
allOkay = false;
|
||||
binding.email.setError("Required");
|
||||
} else if (!Patterns.EMAIL_ADDRESS.matcher(binding.email.getText().toString()).matches()) {
|
||||
allOkay = false;
|
||||
binding.email.setError("Invalid email");
|
||||
}
|
||||
|
||||
if (binding.countryCodes.getSelectedIndex() == -1 && allOkay) {
|
||||
@@ -357,11 +368,11 @@ public class CreateContactFragment extends Fragment implements WelcomeContracts.
|
||||
|
||||
private boolean phoneAlreadyAdded() {
|
||||
|
||||
for (ContactListResponse contact: contactList){
|
||||
for (ContactListResponse contact : contactList) {
|
||||
String contact_number = countryCodeList.get(binding.countryCodes.getSelectedIndex()) + " " +
|
||||
binding.phoneNumber.getText().toString();
|
||||
|
||||
if (contact.contact_data.phone_number.equals(contact_number)){
|
||||
if (contact.contact_data.phone_number.equals(contact_number)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -401,7 +412,7 @@ public class CreateContactFragment extends Fragment implements WelcomeContracts.
|
||||
binding.caregiverCheckView.setVisibility(View.VISIBLE);
|
||||
this.mustBeeCaregiver = true;
|
||||
binding.caregiverCheck.setChecked(true);
|
||||
}else{
|
||||
} else {
|
||||
binding.caregiverCheckView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@@ -409,7 +420,7 @@ public class CreateContactFragment extends Fragment implements WelcomeContracts.
|
||||
boolean isSosSet = false;
|
||||
int sos_contact_id = -1;
|
||||
|
||||
for (ContactListResponse contact: contactList){
|
||||
for (ContactListResponse contact : contactList) {
|
||||
if (contact.is_sos_contact.equals("1")) {
|
||||
isSosSet = true;
|
||||
sos_contact_id = contact.contact_data.id;
|
||||
@@ -417,17 +428,17 @@ public class CreateContactFragment extends Fragment implements WelcomeContracts.
|
||||
}
|
||||
}
|
||||
|
||||
if (isSosSet){
|
||||
if (isSosSet) {
|
||||
binding.sosCheckView.setVisibility(View.GONE);
|
||||
binding.defaultSos.setVisibility(View.GONE);
|
||||
|
||||
if (contactData != null && sos_contact_id != -1 && sos_contact_id == contactData.id){
|
||||
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{
|
||||
} else {
|
||||
binding.sosCheckView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@@ -491,8 +502,7 @@ public class CreateContactFragment extends Fragment implements WelcomeContracts.
|
||||
|
||||
private void setDetails() {
|
||||
|
||||
if (contactData.contact_photo != null)
|
||||
{
|
||||
if (contactData.contact_photo != null) {
|
||||
Glide.with(requireContext())
|
||||
.load("https://simplitend.betadelivery.com/storage/upload/" + contactData.contact_photo)
|
||||
.placeholder(android.R.color.darker_gray)
|
||||
@@ -501,11 +511,12 @@ public class CreateContactFragment extends Fragment implements WelcomeContracts.
|
||||
}
|
||||
|
||||
if (contactData.first_name != null)
|
||||
{
|
||||
binding.name.setText(contactData.first_name);
|
||||
}
|
||||
|
||||
binding.phoneNumber.setText(contactData.phone_number);
|
||||
if (contactData.country_code != null && countryCodeList.contains(contactData.country_code)){
|
||||
binding.countryCodes.selectItemByIndex(countryCodeList.indexOf(contactData.country_code));
|
||||
if (contactData.phone_number != null){
|
||||
binding.phoneNumber.setText(contactData.phone_number);
|
||||
}
|
||||
|
||||
if (contactData.email_address != null)
|
||||
@@ -514,7 +525,7 @@ public class CreateContactFragment extends Fragment implements WelcomeContracts.
|
||||
if (contactData.relationship != null)
|
||||
binding.relationship.setText(contactData.relationship);
|
||||
|
||||
if (contactData.is_sos != null && contactData.is_sos.equals("1")){
|
||||
if (contactData.is_sos != null && contactData.is_sos.equals("1")) {
|
||||
binding.sosCheck.setChecked(true);
|
||||
}
|
||||
|
||||
@@ -532,7 +543,7 @@ public class CreateContactFragment extends Fragment implements WelcomeContracts.
|
||||
binding.caregiverCheck.setChecked(true);
|
||||
binding.caregiverCheck.setEnabled(false);
|
||||
binding.relationship.setEnabled(false);
|
||||
}else{
|
||||
} else {
|
||||
binding.caregiverCheckView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
|
||||
@@ -186,7 +186,7 @@ public class UserContactRepository {
|
||||
final int nameIndex = cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME);
|
||||
final int numberIndex = cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER);
|
||||
|
||||
String name, number, country_code = null;
|
||||
String name, number;
|
||||
while (cursor.moveToNext()) {
|
||||
name = cursor.getString(nameIndex);
|
||||
number = cursor.getString(numberIndex);
|
||||
@@ -194,24 +194,7 @@ public class UserContactRepository {
|
||||
if (number == null) continue;
|
||||
|
||||
if (!mobileNoSet.contains(number)) {
|
||||
try {
|
||||
PhoneNumberUtil phoneNumberUtil = PhoneNumberUtil.getInstance();
|
||||
Phonenumber.PhoneNumber phoneNumber = phoneNumberUtil.parse(number, "US");
|
||||
|
||||
number = String.valueOf(phoneNumber.getNationalNumber());
|
||||
country_code = "+" + phoneNumber.getCountryCode();
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
number = number.replace("-", "");
|
||||
number = number.replace("(", "");
|
||||
number = number.replace(")", "");
|
||||
}catch (Exception e2){
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
|
||||
Contact contact = new Contact(name, number);
|
||||
contact.country_code = country_code;
|
||||
|
||||
contactList.add(contact);
|
||||
mobileNoSet.add(number);
|
||||
|
||||
@@ -17,8 +17,6 @@ public class ContactData implements Serializable {
|
||||
public String contact_photo;
|
||||
public CareGiverData care_giver_data;
|
||||
|
||||
public String country_code;
|
||||
|
||||
public int contact_id;
|
||||
|
||||
public ContactData() {
|
||||
@@ -27,7 +25,6 @@ public class ContactData implements Serializable {
|
||||
public ContactData(Contact contact){
|
||||
this.first_name = contact.first_name;
|
||||
this.phone_number = contact.phone_number;
|
||||
this.country_code = contact.country_code;
|
||||
}
|
||||
|
||||
public ContactData(int id) {
|
||||
|
||||
@@ -22,6 +22,7 @@ import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.navigation.Navigation;
|
||||
|
||||
import com.google.i18n.phonenumbers.NumberParseException;
|
||||
import com.google.i18n.phonenumbers.PhoneNumberUtil;
|
||||
import com.google.i18n.phonenumbers.Phonenumber;
|
||||
import com.ssb.simplitend.R;
|
||||
@@ -38,7 +39,7 @@ import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
public class RegisterFragment extends Fragment implements WelcomeContracts.VerifyEmailCallBack{
|
||||
public class RegisterFragment extends Fragment implements WelcomeContracts.VerifyEmailCallBack {
|
||||
|
||||
private static final String TAG = "RegisterFragment";
|
||||
|
||||
@@ -95,7 +96,7 @@ public class RegisterFragment extends Fragment implements WelcomeContracts.Verif
|
||||
|
||||
binding.countryCodes.setItems(countryCodeList);
|
||||
|
||||
if (!countryCodeList.contains("+1")){
|
||||
if (!countryCodeList.contains("+1")) {
|
||||
countryCodeList.add("+1");
|
||||
}
|
||||
|
||||
@@ -105,7 +106,7 @@ public class RegisterFragment extends Fragment implements WelcomeContracts.Verif
|
||||
|
||||
binding.countryCodes.setIsFocusable(true);
|
||||
|
||||
setErrorRemovers();
|
||||
setPhoneNumberInputFilter();
|
||||
|
||||
loadPatientDataSavedState();
|
||||
|
||||
@@ -125,13 +126,7 @@ public class RegisterFragment extends Fragment implements WelcomeContracts.Verif
|
||||
}
|
||||
|
||||
// This adds textChangeListener to all the EditTexts available to remove error if available
|
||||
private void setErrorRemovers() {
|
||||
new EditTextErrorRemover(
|
||||
binding.name,
|
||||
binding.contactNumber,
|
||||
binding.email
|
||||
);
|
||||
|
||||
private void setPhoneNumberInputFilter() {
|
||||
// phone number formatting
|
||||
// to deal with input pasting in the edit text
|
||||
InputFilter phoneFilter = (charSequence, i, i1, spanned, i2, i3) -> {
|
||||
@@ -139,9 +134,9 @@ public class RegisterFragment extends Fragment implements WelcomeContracts.Verif
|
||||
|
||||
String country_code;
|
||||
|
||||
if (binding.countryCodes.getSelectedIndex() == -1){
|
||||
if (binding.countryCodes.getSelectedIndex() == -1) {
|
||||
country_code = "+1";
|
||||
}else{
|
||||
} else {
|
||||
country_code = countryCodeList.get(binding.countryCodes.getSelectedIndex());
|
||||
}
|
||||
|
||||
@@ -155,23 +150,23 @@ public class RegisterFragment extends Fragment implements WelcomeContracts.Verif
|
||||
// nothing
|
||||
}
|
||||
|
||||
if (!countryCodeList.contains(country_code)){
|
||||
if (!countryCodeList.contains(country_code)) {
|
||||
countryCodeList.add(country_code);
|
||||
}
|
||||
|
||||
binding.countryCodes.selectItemByIndex(countryCodeList.indexOf(country_code));
|
||||
|
||||
if (phone_number_str.length() > 10){
|
||||
if (phone_number_str.length() > 10) {
|
||||
// pasted number length is greater than 10
|
||||
return phone_number_str.substring(0, 10);
|
||||
}
|
||||
|
||||
String total_phone_number = binding.contactNumber.getText().toString() + phone_number_str;
|
||||
|
||||
if (total_phone_number.length() > 10){
|
||||
if (total_phone_number.length() > 10) {
|
||||
// max length should be 10
|
||||
return "";
|
||||
}else{
|
||||
} else {
|
||||
return phone_number_str;
|
||||
}
|
||||
};
|
||||
@@ -199,6 +194,9 @@ public class RegisterFragment extends Fragment implements WelcomeContracts.Verif
|
||||
binding.backBtn.setOnClickListener(v -> Navigation.findNavController(v).popBackStack());
|
||||
|
||||
binding.nextBtn.setOnClickListener(v -> {
|
||||
|
||||
removeExistingErrors();
|
||||
|
||||
if (allOkay()) {
|
||||
AppUtil.closeKeyboard(requireActivity());
|
||||
|
||||
@@ -236,6 +234,13 @@ public class RegisterFragment extends Fragment implements WelcomeContracts.Verif
|
||||
|
||||
}
|
||||
|
||||
private void removeExistingErrors() {
|
||||
binding.name.setError(null);
|
||||
binding.dob.setError(null);
|
||||
binding.contactNumber.setError(null);
|
||||
binding.email.setError(null);
|
||||
}
|
||||
|
||||
private boolean allOkay() {
|
||||
|
||||
boolean allOkay = true;
|
||||
@@ -272,12 +277,27 @@ public class RegisterFragment extends Fragment implements WelcomeContracts.Verif
|
||||
}
|
||||
|
||||
if (binding.contactNumber.getText().toString().trim().isEmpty() ||
|
||||
binding.contactNumber.getText().toString().trim().length() <10) {
|
||||
binding.contactNumber.getText().toString().trim().length() < 10) {
|
||||
binding.contactNumber.setError("Invalid");
|
||||
allOkay = false;
|
||||
} else if (!Patterns.PHONE.matcher(binding.contactNumber.getText().toString()).matches()) {
|
||||
binding.contactNumber.setError("Invalid contact");
|
||||
}else if (binding.countryCodes.getSelectedIndex() == -1 ||
|
||||
binding.countryCodes.getSelectedIndex() >= countryCodeList.size()){
|
||||
allOkay = false;
|
||||
Toast.makeText(requireContext(), "Select a coutnry code.", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
else{
|
||||
// validating phone number
|
||||
try {
|
||||
Phonenumber.PhoneNumber phone_number = PhoneNumberUtil.getInstance().parse(countryCodeList.get(binding.countryCodes.getSelectedIndex())+
|
||||
binding.contactNumber.getText().toString(), "US");
|
||||
|
||||
if (!PhoneNumberUtil.getInstance().isValidNumber(phone_number)) {
|
||||
binding.contactNumber.setError("Invalid phone number");
|
||||
allOkay = false;
|
||||
}
|
||||
} catch (NumberParseException e) {
|
||||
// do nothing as we couldn't validate phone number
|
||||
}
|
||||
}
|
||||
|
||||
if (binding.email.getText().toString().trim().isEmpty()) {
|
||||
|
||||
@@ -1,48 +1,57 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/white_bg"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
android:weightSum="10"
|
||||
>
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:layout_above="@id/ll"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="6.5"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="fitXY"
|
||||
android:layout_marginHorizontal="15sp"
|
||||
android:src="@drawable/onboard_one"
|
||||
android:layout_marginHorizontal="@dimen/_5sdp"
|
||||
app:srcCompat="@drawable/onboard_one"
|
||||
android:contentDescription="@string/onboard_image"
|
||||
|
||||
android:layout_marginBottom="@dimen/_20sdp"
|
||||
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1.5"
|
||||
android:text="@string/avoid_unwanted_phone_calls"
|
||||
android:textSize="@dimen/_22ssp"
|
||||
android:textColor="@color/black"
|
||||
android:fontFamily="@font/nunito_bold"
|
||||
android:gravity="bottom"
|
||||
android:textAlignment="center"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginHorizontal="25dp"
|
||||
/>
|
||||
<LinearLayout
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center"
|
||||
android:id="@+id/ll">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="2"
|
||||
android:text="@string/continue_using_your_smartphone_without_the_annoying_robocalls_and_spam_text_messages"
|
||||
android:textColor="@color/black"
|
||||
android:fontFamily="@font/nunito_regular"
|
||||
android:layout_marginVertical="10dp"
|
||||
android:textAlignment="center"
|
||||
android:textSize="@dimen/_18ssp"
|
||||
android:layout_marginHorizontal="15dp"/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/avoid_unwanted_phone_calls"
|
||||
android:textSize="@dimen/_19ssp"
|
||||
android:textColor="@color/black"
|
||||
android:fontFamily="@font/nunito_bold"
|
||||
android:gravity="bottom"
|
||||
android:textAlignment="center"
|
||||
android:layout_marginTop="@dimen/_5sdp"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/continue_using_your_smartphone_without_the_annoying_robocalls_and_spam_text_messages"
|
||||
android:textColor="@color/black"
|
||||
android:fontFamily="@font/nunito_regular"
|
||||
android:layout_marginBottom="@dimen/_15sdp"
|
||||
android:layout_marginTop="@dimen/_20sdp"
|
||||
android:textAlignment="center"
|
||||
android:textSize="@dimen/_16ssp"
|
||||
android:layout_marginHorizontal="15dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -1,48 +1,57 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/white_bg"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
android:weightSum="10">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:layout_above="@id/ll"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="6"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="fitXY"
|
||||
android:layout_marginHorizontal="15sp"
|
||||
android:layout_marginHorizontal="@dimen/_5sdp"
|
||||
app:srcCompat="@drawable/onboard_three"
|
||||
android:contentDescription="@string/onboard_image"
|
||||
|
||||
android:layout_marginBottom="@dimen/_20sdp"
|
||||
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="2"
|
||||
android:text="@string/never_miss_a_med_or_forget_a_refill_again"
|
||||
android:textAppearance="@style/TextAppearance.Material3.HeadlineMedium"
|
||||
android:textColor="@color/black"
|
||||
android:fontFamily="@font/nunito_bold"
|
||||
android:gravity="bottom"
|
||||
android:textAlignment="center"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginHorizontal="25dp"
|
||||
/>
|
||||
<LinearLayout
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center"
|
||||
android:id="@+id/ll">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="2"
|
||||
android:text="@string/configure_medication_reminders_and_alerts_include_the_dosage_instructions_and_refill_date"
|
||||
android:textColor="@color/black"
|
||||
android:fontFamily="@font/nunito_regular"
|
||||
android:layout_marginVertical="10dp"
|
||||
android:textAlignment="center"
|
||||
android:textAppearance="@style/TextAppearance.Material3.TitleLarge"
|
||||
android:layout_marginHorizontal="15dp"/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/have_a_worry_nfree_stroll"
|
||||
android:textSize="@dimen/_19ssp"
|
||||
android:textColor="@color/black"
|
||||
android:fontFamily="@font/nunito_bold"
|
||||
android:gravity="bottom"
|
||||
android:textAlignment="center"
|
||||
android:layout_marginTop="@dimen/_5sdp"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/get_direction_to_home_with_a_push_a_button_from_your_smartphone_home_screen"
|
||||
android:textColor="@color/black"
|
||||
android:fontFamily="@font/nunito_regular"
|
||||
android:layout_marginBottom="@dimen/_15sdp"
|
||||
android:layout_marginTop="@dimen/_20sdp"
|
||||
android:textAlignment="center"
|
||||
android:textSize="@dimen/_16ssp"
|
||||
android:layout_marginHorizontal="15dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -1,48 +1,57 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/white_bg"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
android:weightSum="10">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:layout_above="@id/ll"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="6"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="fitXY"
|
||||
android:layout_marginHorizontal="15sp"
|
||||
android:layout_marginHorizontal="@dimen/_5sdp"
|
||||
app:srcCompat="@drawable/onboard_two"
|
||||
android:contentDescription="@string/onboard_image"
|
||||
|
||||
android:layout_marginBottom="@dimen/_20sdp"
|
||||
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="2"
|
||||
android:text="@string/have_a_worry_nfree_stroll"
|
||||
android:textAppearance="@style/TextAppearance.Material3.HeadlineMedium"
|
||||
android:textColor="@color/black"
|
||||
android:fontFamily="@font/nunito_bold"
|
||||
android:gravity="bottom"
|
||||
android:textAlignment="center"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginHorizontal="25dp"
|
||||
/>
|
||||
<LinearLayout
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center"
|
||||
android:id="@+id/ll">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="2"
|
||||
android:text="@string/get_direction_to_home_with_a_push_a_button_from_your_smartphone_home_screen"
|
||||
android:textColor="@color/black"
|
||||
android:fontFamily="@font/nunito_regular"
|
||||
android:layout_marginVertical="10dp"
|
||||
android:textAlignment="center"
|
||||
android:textAppearance="@style/TextAppearance.Material3.TitleLarge"
|
||||
android:layout_marginHorizontal="15dp"/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/have_a_worry_nfree_stroll"
|
||||
android:textSize="@dimen/_19ssp"
|
||||
android:textColor="@color/black"
|
||||
android:fontFamily="@font/nunito_bold"
|
||||
android:gravity="bottom"
|
||||
android:textAlignment="center"
|
||||
android:layout_marginTop="@dimen/_5sdp"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/get_direction_to_home_with_a_push_a_button_from_your_smartphone_home_screen"
|
||||
android:textColor="@color/black"
|
||||
android:fontFamily="@font/nunito_regular"
|
||||
android:layout_marginBottom="@dimen/_15sdp"
|
||||
android:layout_marginTop="@dimen/_20sdp"
|
||||
android:textAlignment="center"
|
||||
android:textSize="@dimen/_16ssp"
|
||||
android:layout_marginHorizontal="15dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -67,7 +67,7 @@
|
||||
android:background="@drawable/login_btn_bg"
|
||||
|
||||
android:layout_marginVertical="5dp"
|
||||
app:backgroundTint="@color/color_accent"
|
||||
app:backgroundTint="#EEF5FC"
|
||||
|
||||
android:textAlignment="center"
|
||||
android:gravity="center"
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<string name="onboard_image">onboard_image</string>
|
||||
<string name="avoid_unwanted_phone_calls">Avoid unwanted phone calls!</string>
|
||||
<string name="continue_using_your_smartphone_without_the_annoying_robocalls_and_spam_text_messages">Continue using your Smartphone without the annoying robocalls and spam text messages.</string>
|
||||
<string name="have_a_worry_nfree_stroll">Have a worry\nfree stroll!</string>
|
||||
<string name="have_a_worry_nfree_stroll">Have a worry free stroll!</string>
|
||||
<string name="get_direction_to_home_with_a_push_a_button_from_your_smartphone_home_screen">Get direction to home with a push a button from your smartphone home screen.</string>
|
||||
<string name="never_miss_a_med_or_forget_a_refill_again">Never miss a med or forget a refill again!</string>
|
||||
<string name="configure_medication_reminders_and_alerts_include_the_dosage_instructions_and_refill_date">Configure medication reminders and alerts. Include the dosage, instructions, and refill date.</string>
|
||||
@@ -113,7 +113,7 @@
|
||||
<string name="caregiver_setup">Caregiver setup</string>
|
||||
<string name="ask_your_caregiver_to_download_the_app_on_his_her_phone_and_create_an_account">Ask your caregiver to download the app on his/her phone and create an account.</string>
|
||||
<string name="_4">4</string>
|
||||
<string name="are_you_ready">Are you Ready!</string>
|
||||
<string name="are_you_ready">You are Ready!</string>
|
||||
<string name="take_your_time_and_finish_your_profile_add_contacts_reminders_and_so_on">Take your time and finish your profile, add contacts, reminders and so on.</string>
|
||||
<string name="lets_complete_nthe_rest_of_your_profile">Lets complete\nthe rest of your profile</string>
|
||||
<string name="personal_information">Personal information</string>
|
||||
@@ -245,9 +245,8 @@
|
||||
<string name="faqs">FAQs</string>
|
||||
<string name="contact_admin">Contact admin</string>
|
||||
<string name="settings">Settings</string>
|
||||
<string name="your_profile_is_100_complete">Your profile is 100% complete!</string>
|
||||
<string name="sync_with_caregiver_app_to_proceed">Sync with Caregiver App to proceed.</string>
|
||||
<string name="your_setup_is_in_proceed">Your setup is in proceed</string>
|
||||
<string name="sync_with_caregiver_app_to_proceed">Install Caregiver app to proceed.</string>
|
||||
<string name="your_setup_is_in_proceed">Your profile is being updated</string>
|
||||
<string name="reinventing_connected_ncaregiving">Reinventing connected\nCaregiving</string>
|
||||
<string name="check_your_loved_one_s_medication_schedule">Check your loved one’s medication schedule.</string>
|
||||
<string name="setup_a_geofence_to_protect_your_loved_one">Setup a geofence to\nprotect your loved one.</string>
|
||||
|
||||
Reference in New Issue
Block a user