.
This commit is contained in:
@@ -26,7 +26,6 @@ public abstract class AppUtil {
|
||||
private static final String TAG = "AppUtil";
|
||||
|
||||
// fields
|
||||
|
||||
public static final String USER_DETAILS = "user_details";
|
||||
|
||||
public static final String USER_TOKEN = "user_token";
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.ssb.simplitend.apputils;
|
||||
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.widget.EditText;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class EditTextErrorRemover implements TextWatcher {
|
||||
|
||||
private final ArrayList<EditText> editTexts;
|
||||
|
||||
public EditTextErrorRemover(EditText... editText){
|
||||
this.editTexts = new ArrayList<>();
|
||||
|
||||
editTexts.addAll(Arrays.asList(editText));
|
||||
|
||||
for (EditText e: editText){
|
||||
e.addTextChangedListener(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable editable) {
|
||||
for (EditText editText: editTexts){
|
||||
editText.setError(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,8 @@ import com.ssb.simplitend.patientprofile.medreminder.mvvm.models.Reminder;
|
||||
import com.ssb.simplitend.patientprofile.medreminder.mvvm.models.ReminderResult;
|
||||
import com.ssb.simplitend.patientprofile.setuproutine.mvvm.RoutineDetails;
|
||||
import com.ssb.simplitend.welcome.mvvm.models.CallResponse;
|
||||
import com.ssb.simplitend.welcome.mvvm.models.PatientData;
|
||||
import com.ssb.simplitend.welcome.mvvm.models.PatientResult;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -23,6 +25,9 @@ import retrofit2.http.Query;
|
||||
|
||||
public interface PatientProfileAPIService {
|
||||
|
||||
@GET("api/auth-user-data")
|
||||
Call<CallResponse<PatientData>> getUsrProfileProgress(@Header("Authorization") String token);
|
||||
|
||||
@GET("api/patient-reminder-list/{id}")
|
||||
Call<CallResponse<List<ReminderResult>>> getRemindersList(@Path("id") int patient_id,
|
||||
@Query("weekday") int week_day,
|
||||
|
||||
@@ -4,12 +4,19 @@ import com.ssb.simplitend.patientprofile.medicalinfo.mvvm.MedicationInfo;
|
||||
import com.ssb.simplitend.patientprofile.medreminder.mvvm.models.FreqNMedTypeResult;
|
||||
import com.ssb.simplitend.patientprofile.medreminder.mvvm.models.ReminderResult;
|
||||
import com.ssb.simplitend.patientprofile.setuproutine.mvvm.RoutineDetails;
|
||||
import com.ssb.simplitend.welcome.mvvm.models.PatientData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ProfileContracts {
|
||||
|
||||
|
||||
interface ProfileProgressCallback{
|
||||
void onProfileProgressFetched(PatientData patientData);
|
||||
|
||||
void onProfileProgressFetchFailed(Throwable t, String message);
|
||||
}
|
||||
|
||||
interface GetRemindersListCallback {
|
||||
void onRemindersListFetched(List<ReminderResult> reminderResult);
|
||||
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.ssb.simplitend.patientprofile;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -12,15 +14,25 @@ import androidx.fragment.app.Fragment;
|
||||
import androidx.navigation.Navigation;
|
||||
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.apputils.AppUtil;
|
||||
import com.ssb.simplitend.apputils.RetrofitHelper;
|
||||
import com.ssb.simplitend.careperson_dashboard.DashBoardActivityCP;
|
||||
import com.ssb.simplitend.databinding.ProfileProgressFragmentBinding;
|
||||
import com.ssb.simplitend.welcome.mvvm.models.CallResponse;
|
||||
import com.ssb.simplitend.welcome.mvvm.models.PatientData;
|
||||
|
||||
public class ProfileProgressFragment extends Fragment {
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
public class ProfileProgressFragment extends Fragment implements ProfileContracts.ProfileProgressCallback {
|
||||
|
||||
// view binding
|
||||
protected ProfileProgressFragmentBinding binding;
|
||||
|
||||
public ProfileProgressFragment(){
|
||||
private ProgressDialog progressDialog;
|
||||
|
||||
public ProfileProgressFragment() {
|
||||
// required empty const.
|
||||
}
|
||||
|
||||
@@ -29,9 +41,6 @@ public class ProfileProgressFragment extends Fragment {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
binding = ProfileProgressFragmentBinding.inflate(inflater, container, false);
|
||||
|
||||
// binding.medReminderImg.setImageResource(0);
|
||||
// binding.medReminderImg.setBackgroundResource(R.drawable.ic_done);
|
||||
|
||||
initProgress();
|
||||
|
||||
clickEvents();
|
||||
@@ -40,10 +49,46 @@ public class ProfileProgressFragment extends Fragment {
|
||||
}
|
||||
|
||||
private void initProgress() {
|
||||
|
||||
progressDialog = new ProgressDialog(requireContext());
|
||||
progressDialog.setTitle("Please wait...");
|
||||
progressDialog.setMessage("while we load the profile progress.");
|
||||
progressDialog.setCancelable(false);
|
||||
progressDialog.show();
|
||||
|
||||
PatientProfileAPIService apiService = RetrofitHelper.getRetrofit().create(PatientProfileAPIService.class);
|
||||
|
||||
String token = "Bearer " + AppUtil.getUserToken(requireContext());
|
||||
|
||||
apiService.getUsrProfileProgress(token)
|
||||
.enqueue(new Callback<CallResponse<PatientData>>() {
|
||||
@Override
|
||||
public void onResponse(Call<CallResponse<PatientData>> call, Response<CallResponse<PatientData>> response) {
|
||||
if (response.body() != null) {
|
||||
if (response.body().status != 200 || response.body().result == null) {
|
||||
onProfileProgressFetchFailed(new Exception(), response.body().message);
|
||||
return;
|
||||
}
|
||||
|
||||
onProfileProgressFetched(response.body().result);
|
||||
} else {
|
||||
onProfileProgressFetchFailed(new Exception(), "Please try again later.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<CallResponse<PatientData>> call, Throwable t) {
|
||||
onProfileProgressFetchFailed(new Exception(), "Please try again later.");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void clickEvents() {
|
||||
|
||||
binding.addContact.setOnClickListener(v ->
|
||||
Navigation.findNavController(v).navigate(R.id.action_profileProgressFragment_to_addContactFragment)
|
||||
);
|
||||
|
||||
binding.medicReminder.setOnClickListener(v ->
|
||||
Navigation.findNavController(v).navigate(R.id.action_profileProgressFragment_to_reminderFragment)
|
||||
);
|
||||
@@ -64,4 +109,34 @@ public class ProfileProgressFragment extends Fragment {
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProfileProgressFetched(@NonNull PatientData patientData) {
|
||||
if (patientData.isCareGiverLink == 1) {
|
||||
// TODO: 25-07-2023 look into this
|
||||
}
|
||||
|
||||
if (patientData.isPatientReminderData == 1) {
|
||||
binding.medReminderImg.setImageResource(0);
|
||||
binding.medReminderImg.setBackgroundResource(R.drawable.ic_done);
|
||||
}
|
||||
|
||||
if (patientData.isPatientMedicalData == 1) {
|
||||
binding.medInfoImg.setImageResource(0);
|
||||
binding.medInfoImg.setBackgroundResource(R.drawable.ic_done);
|
||||
}
|
||||
|
||||
if (patientData.isPatientRoutineData == 1) {
|
||||
binding.setupRoutineImg.setImageResource(0);
|
||||
binding.setupRoutineImg.setBackgroundResource(R.drawable.ic_done);
|
||||
}
|
||||
|
||||
progressDialog.dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProfileProgressFetchFailed(Throwable t, String message) {
|
||||
progressDialog.dismiss();
|
||||
Toast.makeText(requireContext(), "Couldn't load profile progress.", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,7 +110,6 @@ public class ReminderFragment extends Fragment implements RecyclerTouchListener.
|
||||
}
|
||||
|
||||
private void loadReminderList(int day_of_week){
|
||||
Toast.makeText(requireContext(), "loading for " + reminderViewModel.getDayOfWeek(day_of_week-1), Toast.LENGTH_SHORT).show();
|
||||
progressDialog.setTitle("Please wait...");
|
||||
progressDialog.setMessage("while we fetch reminders list for you.");
|
||||
progressDialog.setCancelable(false);
|
||||
@@ -140,7 +139,7 @@ public class ReminderFragment extends Fragment implements RecyclerTouchListener.
|
||||
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
|
||||
String today_date = reminderViewModel.getMonthOfYear(calendar.get(Calendar.MONTH));
|
||||
String today_date = reminderViewModel.getMonthOfYear(calendar.get(Calendar.MONTH) + 1);
|
||||
today_date = today_date.concat(", " + calendar.get(Calendar.DAY_OF_MONTH));
|
||||
|
||||
binding.todayDate.setText(today_date);
|
||||
|
||||
@@ -104,8 +104,6 @@ public class RoutineFragment extends Fragment implements RoutineAdapter.ClickLis
|
||||
}
|
||||
|
||||
private void loadRoutineList(int day_of_week) {
|
||||
Toast.makeText(requireContext(), "loading for " + routineViewModel.getDayOfWeek(day_of_week-1), Toast.LENGTH_SHORT).show();
|
||||
|
||||
progressDialog.setTitle("Please wait...");
|
||||
progressDialog.setMessage("while we fetch reminders list for you.");
|
||||
progressDialog.setCancelable(false);
|
||||
@@ -130,7 +128,7 @@ public class RoutineFragment extends Fragment implements RoutineAdapter.ClickLis
|
||||
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
|
||||
String today_date = routineViewModel.getMonthOfYear(calendar.get(Calendar.MONTH));
|
||||
String today_date = routineViewModel.getMonthOfYear(calendar.get(Calendar.MONTH) + 1);
|
||||
today_date = today_date.concat(", " + calendar.get(Calendar.DAY_OF_MONTH));
|
||||
|
||||
binding.todayDate.setText(today_date);
|
||||
|
||||
@@ -17,6 +17,7 @@ import androidx.navigation.Navigation;
|
||||
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.apputils.AppUtil;
|
||||
import com.ssb.simplitend.apputils.EditTextErrorRemover;
|
||||
import com.ssb.simplitend.careperson_dashboard.DashBoardActivityCP;
|
||||
import com.ssb.simplitend.databinding.SignInFragmentBinding;
|
||||
import com.ssb.simplitend.welcome.mvvm.WelcomeContracts;
|
||||
@@ -60,6 +61,12 @@ public class SignInFragment extends Fragment implements WelcomeContracts.Registe
|
||||
|
||||
private void initViews() {
|
||||
progressDialog = new ProgressDialog(requireContext());
|
||||
|
||||
new EditTextErrorRemover(
|
||||
binding.email,
|
||||
binding.pin
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
private void clickEvents() {
|
||||
@@ -110,10 +117,10 @@ public class SignInFragment extends Fragment implements WelcomeContracts.Registe
|
||||
|
||||
if (Objects.requireNonNull(binding.pin.getText()).toString().trim().isEmpty()){
|
||||
allOkay = false;
|
||||
binding.pin.setError("Required");
|
||||
Toast.makeText(requireContext(), "Enter your security pin.", Toast.LENGTH_SHORT).show();
|
||||
}else if (binding.pin.getText().toString().trim().length() != 4){
|
||||
allOkay = false;
|
||||
binding.pin.setError("Pin should be 4 digit.");
|
||||
Toast.makeText(requireContext(), "Enter a valid pin.", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
return allOkay;
|
||||
|
||||
@@ -38,6 +38,13 @@ public class WelcomeFragment extends Fragment {
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
Navigation.findNavController(binding.getRoot())
|
||||
.popBackStack(R.id.welcomeFragment, false);
|
||||
}
|
||||
|
||||
// Initialize views
|
||||
private void initViews(Bundle savedInstanceState) {
|
||||
WelcomeViewModel wv = new ViewModelProvider(requireActivity()).get(WelcomeViewModel.class);
|
||||
|
||||
@@ -9,6 +9,7 @@ import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.text.InputFilter;
|
||||
import android.util.Log;
|
||||
import android.util.Patterns;
|
||||
import android.view.LayoutInflater;
|
||||
@@ -27,6 +28,8 @@ 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.PhoneNumberUtil;
|
||||
import com.google.i18n.phonenumbers.Phonenumber;
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.apputils.AppUtil;
|
||||
import com.ssb.simplitend.databinding.CreateEditContactFragmentBinding;
|
||||
@@ -170,6 +173,52 @@ public class CreateContactFragment extends Fragment implements WelcomeContracts.
|
||||
Toast.makeText(requireContext(), "Task Cancelled", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
|
||||
// phone number formatting
|
||||
// to deal with input pasting in the edit text
|
||||
InputFilter phoneFilter = (charSequence, i, i1, spanned, i2, i3) -> {
|
||||
String phone_number_str = charSequence.toString();
|
||||
|
||||
String country_code;
|
||||
|
||||
if (binding.countryCodes.getSelectedIndex() == -2){
|
||||
country_code = "+1";
|
||||
}else{
|
||||
country_code = countryCodeList.get(binding.countryCodes.getSelectedIndex());
|
||||
}
|
||||
|
||||
try {
|
||||
PhoneNumberUtil phoneNumberUtil = PhoneNumberUtil.getInstance();
|
||||
Phonenumber.PhoneNumber phoneNumber = phoneNumberUtil.parse(charSequence, "US");
|
||||
|
||||
phone_number_str = String.valueOf(phoneNumber.getNationalNumber());
|
||||
country_code = "+" + phoneNumber.getCountryCode();
|
||||
} catch (Exception e) {
|
||||
// nothing
|
||||
}
|
||||
|
||||
if (!countryCodeList.contains(country_code)){
|
||||
countryCodeList.add(country_code);
|
||||
}
|
||||
|
||||
binding.countryCodes.selectItemByIndex(countryCodeList.indexOf(country_code));
|
||||
|
||||
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){
|
||||
// max length should be 10
|
||||
return "";
|
||||
}else{
|
||||
return phone_number_str;
|
||||
}
|
||||
};
|
||||
|
||||
binding.phoneNumber.setFilters(new InputFilter[]{phoneFilter});
|
||||
}
|
||||
|
||||
private void clickEvents() {
|
||||
|
||||
@@ -18,6 +18,7 @@ import androidx.navigation.Navigation;
|
||||
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.apputils.AppUtil;
|
||||
import com.ssb.simplitend.apputils.EditTextErrorRemover;
|
||||
import com.ssb.simplitend.databinding.ChangePinFragmentBinding;
|
||||
import com.ssb.simplitend.welcome.mvvm.WelcomeContracts;
|
||||
import com.ssb.simplitend.welcome.mvvm.WelcomeViewModel;
|
||||
@@ -79,6 +80,11 @@ public class ChangePinFragment extends Fragment implements WelcomeContracts.Upda
|
||||
|
||||
private void initViews() {
|
||||
progressDialog = new ProgressDialog(requireContext());
|
||||
|
||||
new EditTextErrorRemover(
|
||||
binding.pin,
|
||||
binding.confirmPin
|
||||
);
|
||||
}
|
||||
|
||||
private void clickEvents() {
|
||||
@@ -121,11 +127,11 @@ public class ChangePinFragment extends Fragment implements WelcomeContracts.Upda
|
||||
|
||||
if (binding.pin.getText() == null || binding.pin.getText().toString().length() != 4) {
|
||||
allOkay = false;
|
||||
binding.pin.setError("Invalid pin");
|
||||
Toast.makeText(requireContext(), "Enter a 4 digit security pin.", Toast.LENGTH_SHORT).show();
|
||||
} else if (binding.confirmPin.getText() == null ||
|
||||
!binding.confirmPin.getText().toString().equals(binding.pin.getText().toString())) {
|
||||
allOkay = false;
|
||||
binding.confirmPin.setError("Pin doesn't match");
|
||||
Toast.makeText(requireContext(), "Confirm pin doesn't match.", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
return allOkay;
|
||||
|
||||
@@ -16,6 +16,7 @@ import androidx.navigation.Navigation;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.apputils.AppUtil;
|
||||
import com.ssb.simplitend.apputils.EditTextErrorRemover;
|
||||
import com.ssb.simplitend.databinding.ForgotPinFragmentBinding;
|
||||
import com.ssb.simplitend.welcome.mvvm.WelcomeContracts;
|
||||
import com.ssb.simplitend.welcome.mvvm.WelcomeViewModel;
|
||||
@@ -60,6 +61,10 @@ public class ForgotPinFragment extends Fragment implements WelcomeContracts.Send
|
||||
.load(R.raw.email_sending_anim)
|
||||
.placeholder(R.drawable.forgot_pin_email_img)
|
||||
.into(binding.image);
|
||||
|
||||
new EditTextErrorRemover(
|
||||
binding.emailAddress
|
||||
);
|
||||
}
|
||||
|
||||
private void clickEvents() {
|
||||
@@ -68,6 +73,7 @@ public class ForgotPinFragment extends Fragment implements WelcomeContracts.Send
|
||||
Navigation.findNavController(v).popBackStack());
|
||||
|
||||
binding.submit.setOnClickListener(v -> {
|
||||
AppUtil.closeKeyboard(requireActivity());
|
||||
|
||||
if (allOkay()){
|
||||
sendOTP();
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -99,11 +100,11 @@ public class CreatePinFragment extends Fragment implements WelcomeContracts.Regi
|
||||
|
||||
if (binding.pin.getText() == null || binding.pin.getText().toString().length() != 4) {
|
||||
allOkay = false;
|
||||
binding.pin.setError("Invalid pin");
|
||||
Toast.makeText(requireContext(), "Enter a 4 digit security pin.", Toast.LENGTH_SHORT).show();
|
||||
} else if (binding.confirmPin.getText() == null ||
|
||||
!binding.confirmPin.getText().toString().equals(binding.pin.getText().toString())) {
|
||||
allOkay = false;
|
||||
binding.confirmPin.setError("Pin doesn't match");
|
||||
Toast.makeText(requireContext(), "Confirm pin doesn't match.", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
return allOkay;
|
||||
|
||||
@@ -63,7 +63,6 @@ import java.util.List;
|
||||
|
||||
public class LocationFragment extends Fragment implements OnMapReadyCallback,
|
||||
GoogleMap.OnMapClickListener, LocationListener {
|
||||
|
||||
private static final String TAG = "LocationFragment";
|
||||
|
||||
private static final String UNITED_STATES = "United States";
|
||||
@@ -182,7 +181,7 @@ public class LocationFragment extends Fragment implements OnMapReadyCallback,
|
||||
currentLocation = new LatLng(lat, lng);
|
||||
}else{
|
||||
// default current location // washington DC
|
||||
currentLocation = new LatLng(38.9072, 77.0369);
|
||||
currentLocation = new LatLng(0, 0);
|
||||
}
|
||||
|
||||
if (patientData.address_line1 != null){
|
||||
|
||||
@@ -6,6 +6,12 @@ import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.telephony.PhoneNumberFormattingTextWatcher;
|
||||
import android.telephony.PhoneNumberUtils;
|
||||
import android.text.Editable;
|
||||
import android.text.InputFilter;
|
||||
import android.text.Spanned;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Log;
|
||||
import android.util.Patterns;
|
||||
import android.view.LayoutInflater;
|
||||
@@ -20,8 +26,12 @@ 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;
|
||||
import com.ssb.simplitend.apputils.AppUtil;
|
||||
import com.ssb.simplitend.apputils.EditTextErrorRemover;
|
||||
import com.ssb.simplitend.databinding.RegisterFragmentBinding;
|
||||
import com.ssb.simplitend.welcome.mvvm.WelcomeContracts;
|
||||
import com.ssb.simplitend.welcome.mvvm.WelcomeViewModel;
|
||||
@@ -33,7 +43,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";
|
||||
|
||||
@@ -83,6 +93,64 @@ public class RegisterFragment extends Fragment implements WelcomeContracts.Verif
|
||||
|
||||
loadPatientDataSavedState();
|
||||
|
||||
setErrorRemovers();
|
||||
|
||||
}
|
||||
|
||||
// This adds textChangeListener to all the EditTexts available to remove error if available
|
||||
private void setErrorRemovers() {
|
||||
new EditTextErrorRemover(
|
||||
binding.name,
|
||||
binding.contactNumber,
|
||||
binding.email
|
||||
);
|
||||
|
||||
// phone number formatting
|
||||
// to deal with input pasting in the edit text
|
||||
InputFilter phoneFilter = (charSequence, i, i1, spanned, i2, i3) -> {
|
||||
String phone_number_str = charSequence.toString();
|
||||
|
||||
String country_code;
|
||||
|
||||
if (binding.countryCodes.getSelectedIndex() == -2){
|
||||
country_code = "+1";
|
||||
}else{
|
||||
country_code = countryCodeList.get(binding.countryCodes.getSelectedIndex());
|
||||
}
|
||||
|
||||
try {
|
||||
PhoneNumberUtil phoneNumberUtil = PhoneNumberUtil.getInstance();
|
||||
Phonenumber.PhoneNumber phoneNumber = phoneNumberUtil.parse(charSequence, "US");
|
||||
|
||||
phone_number_str = String.valueOf(phoneNumber.getNationalNumber());
|
||||
country_code = "+" + phoneNumber.getCountryCode();
|
||||
} catch (Exception e) {
|
||||
// nothing
|
||||
}
|
||||
|
||||
if (!countryCodeList.contains(country_code)){
|
||||
countryCodeList.add(country_code);
|
||||
}
|
||||
|
||||
binding.countryCodes.selectItemByIndex(countryCodeList.indexOf(country_code));
|
||||
|
||||
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){
|
||||
// max length should be 10
|
||||
return "";
|
||||
}else{
|
||||
return phone_number_str;
|
||||
}
|
||||
};
|
||||
|
||||
binding.contactNumber.setFilters(new InputFilter[]{phoneFilter});
|
||||
|
||||
}
|
||||
|
||||
private void loadPatientDataSavedState() {
|
||||
|
||||
@@ -9,6 +9,7 @@ import android.view.ViewGroup;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.navigation.NavOptions;
|
||||
import androidx.navigation.Navigation;
|
||||
|
||||
import com.ssb.simplitend.R;
|
||||
@@ -26,7 +27,12 @@ public class SplashFragment extends Fragment {
|
||||
|
||||
new Handler().postDelayed(() -> {
|
||||
|
||||
Navigation.findNavController(binding.mainIcon).navigate(R.id.action_splashFragment_to_welcomeFragment);
|
||||
NavOptions navOptions = new NavOptions.Builder()
|
||||
.setPopUpTo(R.id.splashFragment, true)
|
||||
.build();
|
||||
|
||||
Navigation.findNavController(binding.mainIcon)
|
||||
.navigate(R.id.action_splashFragment_to_welcomeFragment, null, navOptions);
|
||||
|
||||
}, 1000);
|
||||
|
||||
|
||||
@@ -11,6 +11,9 @@ import androidx.fragment.app.Fragment;
|
||||
import androidx.navigation.Navigation;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||
import com.bumptech.glide.load.resource.gif.GifDrawable;
|
||||
import com.bumptech.glide.request.target.ImageViewTarget;
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.databinding.ThankYouFragmentBinding;
|
||||
|
||||
@@ -40,6 +43,7 @@ public class ThankYouFragment extends Fragment {
|
||||
Glide.with(requireContext())
|
||||
.asGif()
|
||||
.load(R.raw.done_anim)
|
||||
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
|
||||
.into(binding.animIv);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,12 @@ public class PatientData {
|
||||
// for payload purpose
|
||||
public String pin_code, c_pin_code;
|
||||
|
||||
// progress flags
|
||||
public int isCareGiverLink
|
||||
, isPatientReminderData
|
||||
, isPatientRoutineData
|
||||
, isPatientMedicalData;
|
||||
|
||||
public PatientData() {
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user