.
This commit is contained in:
27
app/src/main/java/com/app/simplitend/apputils/TextUtils.java
Normal file
27
app/src/main/java/com/app/simplitend/apputils/TextUtils.java
Normal file
@@ -0,0 +1,27 @@
|
||||
package com.app.simplitend.apputils;
|
||||
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
|
||||
public abstract class TextUtils {
|
||||
|
||||
public static final TextWatcher LEADING_SPACE_WATCHER = new TextWatcher() {
|
||||
@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) {
|
||||
if (editable.toString().trim().isEmpty()){
|
||||
editable.delete(0, editable.length());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.app.simplitend.apputils.AppUtil;
|
||||
@@ -17,6 +18,7 @@ import com.app.simplitend.databinding.ActivityDeactivateAccBinding;
|
||||
import com.app.simplitend.welcome.activities.WelcomeActivity;
|
||||
import com.app.simplitend.welcome.welcomecg.mvvm.CareGiverData;
|
||||
import com.app.simplitend.welcome.welcomepatient.mvvm.models.PatientData;
|
||||
import com.google.android.material.radiobutton.MaterialRadioButton;
|
||||
|
||||
public class DeActivateAccountActivity extends AppCompatActivity implements AccountPresenter.AccountReDeActivateCallback {
|
||||
|
||||
@@ -83,6 +85,7 @@ public class DeActivateAccountActivity extends AppCompatActivity implements Acco
|
||||
String token;
|
||||
|
||||
if (isPatient){
|
||||
|
||||
if (patientData == null){
|
||||
Toast.makeText(this, "Couldn't load data", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
@@ -101,6 +104,21 @@ public class DeActivateAccountActivity extends AppCompatActivity implements Acco
|
||||
return;
|
||||
}
|
||||
|
||||
int selected_radio_id = binding.reasonRadio.getCheckedRadioButtonId();
|
||||
if (selected_radio_id <= 0){
|
||||
Toast.makeText(this, "Kindly select a reason", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
String reason;
|
||||
try {
|
||||
reason = ((MaterialRadioButton) findViewById(selected_radio_id)).getText().toString();
|
||||
}catch (Exception e){
|
||||
reason = "Other";
|
||||
}
|
||||
|
||||
// TODO: 25/10/23 use the reason
|
||||
|
||||
progressDialog.setTitle("Please wait....");
|
||||
progressDialog.setMessage("while we de-activate your account");
|
||||
progressDialog.setCancelable(false);
|
||||
|
||||
@@ -38,6 +38,7 @@ import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import java.util.TimeZone;
|
||||
|
||||
public class AddReminderFragment extends Fragment implements CompoundButton.OnCheckedChangeListener,
|
||||
ProfileContracts.FreqNMedTypesCallback,
|
||||
@@ -192,6 +193,18 @@ public class AddReminderFragment extends Fragment implements CompoundButton.OnCh
|
||||
reminderResult.time3 = null;
|
||||
}
|
||||
|
||||
// Sending time zone
|
||||
TimeZone timeZone = TimeZone.getDefault();
|
||||
// Getting the GMT offset in milliseconds
|
||||
int gmtOffsetMillis = timeZone.getRawOffset();
|
||||
// Converting milliseconds to hours and minutes
|
||||
int hours = gmtOffsetMillis / 3600000;
|
||||
int minutes = (gmtOffsetMillis % 3600000) / 60000;
|
||||
|
||||
String gmtStandard = "GMT" + (gmtOffsetMillis >= 0 ? "+" : "") + hours + ":" + String.format(Locale.getDefault(), "%02d", minutes);
|
||||
Toast.makeText(requireContext(), "" + gmtStandard, Toast.LENGTH_SHORT).show();
|
||||
reminderResult.timezone = gmtStandard;
|
||||
|
||||
reminderResult.medication_quantity = binding.quantity.getText().toString();
|
||||
reminderResult.medication_refill_date = binding.getDate.getText().toString();
|
||||
reminderResult.medication_instruction = binding.instructions.getText().toString().trim();
|
||||
|
||||
@@ -43,6 +43,7 @@ public class ReminderResult implements Serializable {
|
||||
public String reminder_marked;
|
||||
|
||||
public String is_update;
|
||||
public String timezone;
|
||||
|
||||
public ReminderResult(){}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.app.Activity;
|
||||
import android.app.ProgressDialog;
|
||||
import android.app.TimePickerDialog;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
@@ -31,6 +32,7 @@ import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
import java.util.TimeZone;
|
||||
|
||||
public class AddRoutineFragment extends Fragment implements CompoundButton.OnCheckedChangeListener,
|
||||
ProfileContracts.AddNUpdateRoutineCallback {
|
||||
@@ -224,6 +226,18 @@ public class AddRoutineFragment extends Fragment implements CompoundButton.OnChe
|
||||
routineDetails.routine_start_time = binding.startTime.getHint().toString();
|
||||
routineDetails.routine_end_time = binding.endTime.getHint().toString();
|
||||
|
||||
// Sending time zone
|
||||
TimeZone timeZone = TimeZone.getDefault();
|
||||
// Getting the GMT offset in milliseconds
|
||||
int gmtOffsetMillis = timeZone.getRawOffset();
|
||||
// Converting milliseconds to hours and minutes
|
||||
int hours = gmtOffsetMillis / 3600000;
|
||||
int minutes = (gmtOffsetMillis % 3600000) / 60000;
|
||||
|
||||
String gmtStandard = "GMT" + (gmtOffsetMillis >= 0 ? "+" : "") + hours + ":" + String.format(Locale.getDefault(), "%02d", minutes);
|
||||
Toast.makeText(requireContext(), "" + gmtStandard, Toast.LENGTH_SHORT).show();
|
||||
routineDetails.timezone = gmtStandard;
|
||||
|
||||
routineDetails.sun = week_state[0] ? "1" : "0";
|
||||
routineDetails.mon = week_state[1] ? "1" : "0";
|
||||
routineDetails.tue = week_state[2] ? "1" : "0";
|
||||
|
||||
@@ -30,6 +30,7 @@ public class RoutineDetails implements Serializable {
|
||||
public String updated_at;
|
||||
|
||||
public String routine_marked;
|
||||
public String timezone;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
|
||||
@@ -90,7 +90,7 @@ public class CgCheckEmailFragment extends Fragment implements WelcomeContracts.F
|
||||
if (checkOTPInputs()){
|
||||
verifyOTP();
|
||||
}else{
|
||||
Toast.makeText(requireContext(), "Enter OTP received on your email.", Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(requireContext(), "Enter PIN received on your email.", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.text.InputFilter;
|
||||
import android.text.Spanned;
|
||||
import android.util.Log;
|
||||
import android.util.Patterns;
|
||||
import android.view.LayoutInflater;
|
||||
@@ -25,6 +26,7 @@ import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.navigation.NavOptions;
|
||||
import androidx.navigation.Navigation;
|
||||
|
||||
import com.app.simplitend.apputils.TextUtils;
|
||||
import com.google.i18n.phonenumbers.NumberParseException;
|
||||
import com.google.i18n.phonenumbers.PhoneNumberUtil;
|
||||
import com.google.i18n.phonenumbers.Phonenumber;
|
||||
@@ -122,6 +124,11 @@ 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());
|
||||
|
||||
// max age 120 years
|
||||
calendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR) + 18 - 122);
|
||||
datePickerDialog.getDatePicker().setMinDate(calendar.getTimeInMillis());
|
||||
|
||||
datePickerDialog.setTitle("Select a date");
|
||||
datePickerDialog.setMessage("Note: Click on the date, month or year to edit manually");
|
||||
|
||||
@@ -147,6 +154,9 @@ public class CgRegisterFragment extends Fragment implements WelcomeContracts.Reg
|
||||
|
||||
setFocusManager();
|
||||
|
||||
// not allowing leading spaces
|
||||
binding.name.addTextChangedListener(TextUtils.LEADING_SPACE_WATCHER);
|
||||
binding.email.addTextChangedListener(TextUtils.LEADING_SPACE_WATCHER);
|
||||
}
|
||||
|
||||
private void clickEvents() {
|
||||
|
||||
@@ -163,7 +163,7 @@ public class AddContactFragment extends Fragment implements WelcomeContracts.Con
|
||||
// and doctor not yet set
|
||||
AppUtil.showAlert(requireContext(),
|
||||
"This contact is reserved",
|
||||
"Contact is reserved for your primary doctor, Please add medical information.",
|
||||
"Last contact is reserved for your primary doctor. Once you complete your medical information, the contact information will be filled in automatically.",
|
||||
getString(R.string.ok), ((dialogInterface, i) -> {}), null, null);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -181,9 +181,7 @@ 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.trim().isEmpty())?"this contact":current_name) +
|
||||
" as Sos?";
|
||||
title = "You are about to change emergency number from " + sos_contact_name + " to this contact. Please confirm";
|
||||
}else{
|
||||
title = context.getString(R.string.make_sos);
|
||||
}
|
||||
|
||||
@@ -221,7 +221,7 @@ public class CheckMailFragment extends Fragment implements WelcomeContracts.Veri
|
||||
if (checkOTPInputs()){
|
||||
verifyOTP();
|
||||
}else {
|
||||
Toast.makeText(requireContext(), "Enter OTP received on your email.", Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(requireContext(), "Enter PIN received on your email.", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -73,10 +73,12 @@ public class ReActivateFragment extends Fragment implements AccountPresenter.Acc
|
||||
|
||||
// setting message
|
||||
String message;
|
||||
String title = null;
|
||||
if (AccountPresenter.ACC_DEACTIVATE_BY_USER == caregiver_status){
|
||||
// deactivated by cg
|
||||
if (is_caregiver){
|
||||
message = getString(R.string.re_activate_msg_cg_by_cg);
|
||||
title = getString(R.string.deactivate_title_cg);
|
||||
|
||||
binding.reActivateBtn.setVisibility(View.VISIBLE);
|
||||
}else {
|
||||
@@ -96,6 +98,9 @@ public class ReActivateFragment extends Fragment implements AccountPresenter.Acc
|
||||
}
|
||||
|
||||
binding.message.setText(message);
|
||||
if (title != null){
|
||||
binding.title.setText(title);
|
||||
}
|
||||
}
|
||||
|
||||
private void clickEvents() {
|
||||
|
||||
@@ -5,7 +5,10 @@ import android.app.ProgressDialog;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
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,6 +23,7 @@ import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.navigation.Navigation;
|
||||
|
||||
import com.app.simplitend.apputils.TextUtils;
|
||||
import com.google.i18n.phonenumbers.NumberParseException;
|
||||
import com.google.i18n.phonenumbers.PhoneNumberUtil;
|
||||
import com.google.i18n.phonenumbers.Phonenumber;
|
||||
@@ -95,6 +99,10 @@ 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());
|
||||
|
||||
// max age 120 years
|
||||
calendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR) + 18 - 122);
|
||||
datePickerDialog.getDatePicker().setMinDate(calendar.getTimeInMillis());
|
||||
datePickerDialog.setTitle("Select a date");
|
||||
datePickerDialog.setMessage("Note: Click on the date, month or year to edit manually");
|
||||
|
||||
@@ -120,6 +128,9 @@ public class RegisterFragment extends Fragment implements WelcomeContracts.Verif
|
||||
|
||||
setFocusManager();
|
||||
|
||||
// not allowing leading spaces
|
||||
binding.name.addTextChangedListener(TextUtils.LEADING_SPACE_WATCHER);
|
||||
binding.email.addTextChangedListener(TextUtils.LEADING_SPACE_WATCHER);
|
||||
}
|
||||
|
||||
private void setFocusManager() {
|
||||
|
||||
Reference in New Issue
Block a user