.
This commit is contained in:
@@ -6,6 +6,8 @@ import static com.app.simplitend.apputils.Constants.REMINDER_EXTRA_KEY;
|
||||
import static com.app.simplitend.articles.ArticleShowerActivity.ARTICLE_TITLE;
|
||||
import static com.app.simplitend.articles.ArticleShowerActivity.ARTICLE_URL_KEY;
|
||||
import static com.app.simplitend.callwhitelisting.CallService.CONTACT_WHITE_LISTING_TAG;
|
||||
import static com.app.simplitend.locationupdates.LocationService.LOCATION_INTERVAL_BASE_TIME;
|
||||
import static com.app.simplitend.locationupdates.LocationService.LOCATION_UPDATE_MIN_INTERVAL;
|
||||
import static com.app.simplitend.patientgeofencing.GeoFenceHelper.GEOFENCE_ID;
|
||||
import static com.app.simplitend.patientgeofencing.GeoFenceHelper.GEOFENCE_TAG;
|
||||
|
||||
@@ -26,8 +28,10 @@ import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.RawRes;
|
||||
|
||||
import com.app.simplitend.locationupdates.LocationService;
|
||||
import com.app.simplitend.welcome.welcomepatient.fragments.contacts.mvvm.models.ContactData;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.google.android.gms.location.GeofencingClient;
|
||||
@@ -277,12 +281,16 @@ public abstract class AppUtil {
|
||||
|
||||
public static void showBottomAlert(Context context,
|
||||
String patient_name,
|
||||
String content_type, Intent intent) throws Exception {
|
||||
@Nullable String content_type, Intent intent) throws Exception {
|
||||
|
||||
if (content_type == null) return;
|
||||
|
||||
BottomSheetDialog bsd = new BottomSheetDialog(context, R.style.BottomSheetDialog);
|
||||
BottomSheetAlertBinding binding = BottomSheetAlertBinding.inflate(LayoutInflater.from(context));
|
||||
bsd.setContentView(binding.getRoot());
|
||||
|
||||
binding.close.setOnClickListener(v -> bsd.dismiss());
|
||||
|
||||
String title = intent.getStringExtra(NotificationService.NOTIFICATION_TITLE_KEY);
|
||||
String body = intent.getStringExtra(NotificationService.NOTIFICATION_BODY_KEY);
|
||||
|
||||
@@ -324,25 +332,26 @@ public abstract class AppUtil {
|
||||
try {
|
||||
RoutineDetails routine = (RoutineDetails) intent.getSerializableExtra(ACTIVITY_EXTRA_KEY);
|
||||
if (routine != null) {
|
||||
title = patient_name + " has " + routine.routine_title + " activity";
|
||||
title = "Remind " + patient_name;
|
||||
|
||||
String time;
|
||||
String start_time, end_time;
|
||||
try {
|
||||
SimpleDateFormat input_sdf = new SimpleDateFormat("HH:mm:ss", Locale.getDefault());
|
||||
SimpleDateFormat output_sdf = new SimpleDateFormat("hh:mm a", Locale.getDefault());
|
||||
|
||||
Date start_date = input_sdf.parse(routine.routine_start_time);
|
||||
time = output_sdf.format(Objects.requireNonNull(start_date));
|
||||
Date end_date = input_sdf.parse(routine.routine_end_time);
|
||||
|
||||
start_time = output_sdf.format(Objects.requireNonNull(start_date));
|
||||
end_time = output_sdf.format(Objects.requireNonNull(end_date));
|
||||
} catch (Exception e) {
|
||||
time = routine.routine_start_time;
|
||||
start_time = routine.routine_start_time;
|
||||
end_time = routine.routine_end_time;
|
||||
}
|
||||
|
||||
body = "Today at " + time;
|
||||
body = routine.routine_title;
|
||||
|
||||
if (routine.routine_description == null) routine.routine_description = "None";
|
||||
|
||||
routine_description = "Description: " + routine.routine_description;
|
||||
routine_description = start_time + " - " + end_time;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// do nothing
|
||||
@@ -379,13 +388,12 @@ public abstract class AppUtil {
|
||||
if (reminder != null) {
|
||||
title = "It's time for " + patient_name + "'s medicines";
|
||||
|
||||
body = reminder.medicine_name + " (" + reminder.medication_quantity;
|
||||
body = "Medication Reminder:\n" + reminder.medicine_name + "\n" + reminder.medication_quantity;
|
||||
try {
|
||||
body += " " + reminder.medication_type.get(0).title;
|
||||
}catch (Exception e){
|
||||
// do nothing
|
||||
}finally {
|
||||
body += ")";
|
||||
body += " unit";
|
||||
}
|
||||
|
||||
if (reminder.medication_instruction == null) reminder.medication_instruction = "None";
|
||||
@@ -586,6 +594,11 @@ public abstract class AppUtil {
|
||||
|
||||
// removing geofence of same tag
|
||||
removeGeofence(context);
|
||||
|
||||
// clearing location updates
|
||||
Intent intent = new Intent(context, LocationService.class);
|
||||
intent.setAction(LocationService.ACTION_STOP_LOCATION_UPDATES);
|
||||
context.startService(intent);
|
||||
}
|
||||
|
||||
public static void removeGeofence(Context context) {
|
||||
|
||||
@@ -18,8 +18,15 @@ public abstract class TextUtils {
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable editable) {
|
||||
if (editable.toString().trim().isEmpty()){
|
||||
if (editable.toString().trim().isEmpty()) {
|
||||
editable.delete(0, editable.length());
|
||||
}else if (editable.length() > 1 && editable.charAt(editable.length() - 1) == ' ' &&
|
||||
editable.charAt(editable.length() - 2) == ' '){
|
||||
// leading 2 spaces
|
||||
// only one allowed. Thus, removing last
|
||||
editable.delete(editable.length() - 1, editable.length());
|
||||
}else if (editable.length() > 0 && editable.charAt(0) == ' '){
|
||||
editable.delete(0, 1);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -111,6 +111,7 @@ public class CaregiverDashActivity extends AppCompatActivity implements
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
registerReceiver(notification_receiver, new IntentFilter(AppUtil.NOTIFICATION_ACTION));
|
||||
}
|
||||
|
||||
|
||||
@@ -95,6 +95,8 @@ public class CgChangePwdActivity extends AppCompatActivity implements CgHomeCont
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
binding.backBtn.setOnClickListener(view -> onBackPressed());
|
||||
}
|
||||
|
||||
private boolean allOkay() {
|
||||
@@ -112,6 +114,9 @@ public class CgChangePwdActivity extends AppCompatActivity implements CgHomeCont
|
||||
} else if (!password.matches("^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[^a-zA-Z0-9]).{8,}$")) {
|
||||
allOkay = false;
|
||||
Toast.makeText(this, "Password doesn't match the required criteria.", Toast.LENGTH_SHORT).show();
|
||||
} else if (binding.confirmPassword.getText().toString().isEmpty()){
|
||||
allOkay = false;
|
||||
Toast.makeText(this, "Please confirm your password.", Toast.LENGTH_SHORT).show();
|
||||
} else if (!binding.confirmPassword.getText().toString().equals(password)) {
|
||||
allOkay = false;
|
||||
Toast.makeText(this, "Confirm password doesn't match.", Toast.LENGTH_SHORT).show();
|
||||
|
||||
@@ -16,5 +16,11 @@ public class ChangePinActivity extends AppCompatActivity {
|
||||
binding = ChangePinFragmentBinding.inflate(getLayoutInflater());
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(binding.getRoot());
|
||||
|
||||
clickEvents();
|
||||
}
|
||||
|
||||
private void clickEvents() {
|
||||
binding.backBtn.setOnClickListener(view -> onBackPressed());
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,8 @@ import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import com.app.simplitend.apputils.EditTextErrorRemover;
|
||||
import com.app.simplitend.apputils.TextUtils;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.github.dhaval2404.imagepicker.ImagePicker;
|
||||
import com.google.i18n.phonenumbers.NumberParseException;
|
||||
@@ -263,6 +265,12 @@ public class EditProfileInfoActivity extends AppCompatActivity implements
|
||||
}
|
||||
});
|
||||
|
||||
binding.name.addTextChangedListener(TextUtils.LEADING_SPACE_WATCHER);
|
||||
binding.email.addTextChangedListener(TextUtils.LEADING_SPACE_WATCHER);
|
||||
binding.street.addTextChangedListener(TextUtils.LEADING_SPACE_WATCHER);
|
||||
|
||||
new EditTextErrorRemover(binding.name, binding.email, binding.contactNumber, binding.street);
|
||||
|
||||
}
|
||||
|
||||
private void clickEvents() {
|
||||
@@ -305,6 +313,11 @@ public class EditProfileInfoActivity extends AppCompatActivity implements
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
binding.countryCodes.setOnClickListener(v -> {
|
||||
AppUtil.closeKeyboard(this);
|
||||
binding.countryCodes.showOrDismiss();
|
||||
});
|
||||
}
|
||||
|
||||
private boolean allCgOkay() {
|
||||
@@ -319,6 +332,9 @@ public class EditProfileInfoActivity extends AppCompatActivity implements
|
||||
if (binding.name.getText().toString().trim().isEmpty()) {
|
||||
binding.name.setError("Required");
|
||||
allOkay = false;
|
||||
}else if (binding.name.getText().toString().trim().length() < 2){
|
||||
binding.name.setError("Minimum 2 characters");
|
||||
allOkay = false;
|
||||
}
|
||||
|
||||
if (binding.dob.getText().toString().trim().isEmpty()) {
|
||||
@@ -383,7 +399,7 @@ public class EditProfileInfoActivity extends AppCompatActivity implements
|
||||
RequestBody contact_number_part = RequestBody.create(country_code+binding.contactNumber.getText().toString(), MediaType.parse("text/plain;charset=utf-8"));
|
||||
body.put("contact_number", contact_number_part);
|
||||
|
||||
RequestBody email_part = RequestBody.create(binding.email.getText().toString(), MediaType.parse("text/plain;charset=utf-8"));
|
||||
RequestBody email_part = RequestBody.create(binding.email.getText().toString().trim(), MediaType.parse("text/plain;charset=utf-8"));
|
||||
body.put("email", email_part);
|
||||
|
||||
RequestBody dob_part = RequestBody.create(binding.dob.getText().toString(), MediaType.parse("text/plain;charset=utf-8"));
|
||||
@@ -436,7 +452,7 @@ public class EditProfileInfoActivity extends AppCompatActivity implements
|
||||
RequestBody contact_number_part = RequestBody.create(country_code+binding.contactNumber.getText().toString(), MediaType.parse("text/plain;charset=utf-8"));
|
||||
body.put("contact_number", contact_number_part);
|
||||
|
||||
RequestBody email_part = RequestBody.create(binding.email.getText().toString(), MediaType.parse("text/plain;charset=utf-8"));
|
||||
RequestBody email_part = RequestBody.create(binding.email.getText().toString().trim(), MediaType.parse("text/plain;charset=utf-8"));
|
||||
body.put("email", email_part);
|
||||
|
||||
RequestBody dob_part = RequestBody.create(binding.dob.getText().toString(), MediaType.parse("text/plain;charset=utf-8"));
|
||||
|
||||
@@ -16,7 +16,7 @@ import retrofit2.http.Path;
|
||||
public interface AccountApiService {
|
||||
|
||||
@POST("api/deactivate-reactivate-account/{id}")
|
||||
Call<CallResponse<Object>> de_re_ActivateAccount(@Body Map<String, Integer> body,
|
||||
Call<CallResponse<Object>> de_re_ActivateAccount(@Body Map<String, String> body,
|
||||
@Path("id") int caregiver_xid,
|
||||
@Header("Authorization") String token);
|
||||
|
||||
|
||||
@@ -40,12 +40,16 @@ public class AccountPresenter {
|
||||
|
||||
public void accountReDeActivate(int active_status,
|
||||
int caregiver_xid,
|
||||
String reason,
|
||||
String comment,
|
||||
@NonNull String token,
|
||||
@NonNull AccountReDeActivateCallback callback){
|
||||
|
||||
Map<String, Integer> body = new HashMap<>();
|
||||
Map<String, String> body = new HashMap<>();
|
||||
|
||||
body.put("status", active_status);
|
||||
body.put("status", active_status + "");
|
||||
if (reason != null) body.put("reason", reason);
|
||||
if (comment != null) body.put("description", comment);
|
||||
|
||||
apiService.de_re_ActivateAccount(body, caregiver_xid, token)
|
||||
.enqueue(new Callback<CallResponse<Object>>() {
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
package com.app.simplitend.caregiverdashboard.activities.deactivateacc;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.ProgressDialog;
|
||||
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 androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.app.simplitend.apputils.AppUtil;
|
||||
import com.app.simplitend.apputils.CaregiverDataCache;
|
||||
import com.app.simplitend.apputils.PatientDataCache;
|
||||
@@ -81,6 +80,19 @@ public class DeActivateAccountActivity extends AppCompatActivity implements Acco
|
||||
|
||||
binding.confirmDeactivate.setOnClickListener(v -> {
|
||||
|
||||
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";
|
||||
}
|
||||
|
||||
int id;
|
||||
String token;
|
||||
|
||||
@@ -104,19 +116,6 @@ 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....");
|
||||
@@ -130,6 +129,8 @@ public class DeActivateAccountActivity extends AppCompatActivity implements Acco
|
||||
|
||||
accountPresenter.accountReDeActivate(AccountPresenter.ACC_DEACTIVATE_BY_USER,
|
||||
id,
|
||||
reason,
|
||||
binding.commetInput.getText().toString(),
|
||||
"Bearer " + token,
|
||||
this);
|
||||
});
|
||||
@@ -140,8 +141,8 @@ public class DeActivateAccountActivity extends AppCompatActivity implements Acco
|
||||
private void smoothEditTextScroll() {
|
||||
// scrolling edit text
|
||||
|
||||
binding.reasonInput.setOnTouchListener((v, event) -> {
|
||||
if (binding.reasonInput.hasFocus()) {
|
||||
binding.commetInput.setOnTouchListener((v, event) -> {
|
||||
if (binding.commetInput.hasFocus()) {
|
||||
v.getParent().requestDisallowInterceptTouchEvent(true);
|
||||
if ((event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_SCROLL) {
|
||||
v.getParent().requestDisallowInterceptTouchEvent(false);
|
||||
|
||||
@@ -260,27 +260,29 @@ public class CgSubscriptionActivity extends AppCompatActivity
|
||||
// loading subscription plans
|
||||
progressDialog = new ProgressDialog(this);
|
||||
|
||||
try {
|
||||
String description = getString(R.string.subscribe_description);
|
||||
String contact_email = getString(R.string.contact_email);
|
||||
binding.description.setText(getString(R.string.subscribe_description));
|
||||
|
||||
// setting display text
|
||||
SpannableString ss = new SpannableString(description);
|
||||
ClickableSpan cs = new ClickableSpan() {
|
||||
@Override
|
||||
public void onClick(@NonNull View view) {
|
||||
contactMail();
|
||||
}
|
||||
};
|
||||
int start_index = description.indexOf(contact_email);
|
||||
ss.setSpan(cs, start_index, start_index + contact_email.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
|
||||
|
||||
binding.description.setText(ss);
|
||||
binding.description.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "initViews: ", e);
|
||||
binding.contactAdmin.setVisibility(View.VISIBLE);
|
||||
}
|
||||
// try {
|
||||
// String description = getString(R.string.subscribe_description);
|
||||
// String contact_email = getString(R.string.contact_email);
|
||||
//
|
||||
// // setting display text
|
||||
// SpannableString ss = new SpannableString(description);
|
||||
// ClickableSpan cs = new ClickableSpan() {
|
||||
// @Override
|
||||
// public void onClick(@NonNull View view) {
|
||||
// contactMail();
|
||||
// }
|
||||
// };
|
||||
// int start_index = description.indexOf(contact_email);
|
||||
// ss.setSpan(cs, start_index, start_index + contact_email.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
|
||||
//
|
||||
// binding.description.setText(ss);
|
||||
// binding.description.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
// } catch (Exception e) {
|
||||
// Log.e(TAG, "initViews: ", e);
|
||||
// binding.contactAdmin.setVisibility(View.VISIBLE);
|
||||
// }
|
||||
}
|
||||
|
||||
private void loadPlans() {
|
||||
@@ -372,6 +374,8 @@ public class CgSubscriptionActivity extends AppCompatActivity
|
||||
// subscription is cancelled
|
||||
binding.makePayment.setVisibility(View.GONE);
|
||||
|
||||
binding.description.setText(getString(R.string.subscribe_cancelled_description));
|
||||
|
||||
String cancelled_date = AppUtil.formatDate("yyyy-mm-dd", "mm-dd-yyyy", currentPlan.ended_at);
|
||||
if (cancelled_date != null){
|
||||
binding.cancelledDate.setText(cancelled_date);
|
||||
|
||||
@@ -14,6 +14,8 @@ import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import com.app.simplitend.apputils.EditTextErrorRemover;
|
||||
import com.app.simplitend.apputils.TextUtils;
|
||||
import com.google.i18n.phonenumbers.NumberParseException;
|
||||
import com.google.i18n.phonenumbers.PhoneNumberUtil;
|
||||
import com.google.i18n.phonenumbers.Phonenumber;
|
||||
@@ -23,6 +25,7 @@ import com.app.simplitend.databinding.AddMedicalInfoBinding;
|
||||
import com.app.simplitend.patientprofile.ProfileContracts;
|
||||
import com.app.simplitend.patientprofile.medicalinfo.mvvm.MedicalInfoViewModel;
|
||||
import com.app.simplitend.patientprofile.medicalinfo.mvvm.MedicationInfo;
|
||||
import com.skydoves.powerspinner.OnSpinnerItemSelectedListener;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -139,6 +142,13 @@ public class AddMedicalInfoFragment extends Fragment implements
|
||||
setLayoutInfo();
|
||||
}
|
||||
|
||||
binding.primaryDoc.addTextChangedListener(TextUtils.LEADING_SPACE_WATCHER);
|
||||
new EditTextErrorRemover(binding.diagnosis,
|
||||
binding.allergies,
|
||||
binding.primaryDoc,
|
||||
binding.phoneNumber,
|
||||
binding.hospitalPref,
|
||||
binding.dietRestrict);
|
||||
}
|
||||
|
||||
private void setLayoutInfo() {
|
||||
@@ -184,6 +194,11 @@ public class AddMedicalInfoFragment extends Fragment implements
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
binding.countryCodes.setOnClickListener(v -> {
|
||||
AppUtil.closeKeyboard(requireActivity());
|
||||
binding.countryCodes.showOrDismiss();
|
||||
});
|
||||
}
|
||||
|
||||
private void addMedicationInfo() {
|
||||
|
||||
@@ -196,7 +196,7 @@ public class AddReminderFragment extends Fragment implements CompoundButton.OnCh
|
||||
// Sending time zone
|
||||
TimeZone timeZone = TimeZone.getDefault();
|
||||
// Getting the GMT offset in milliseconds
|
||||
int gmtOffsetMillis = timeZone.getRawOffset();
|
||||
int gmtOffsetMillis = timeZone.getOffset(Calendar.getInstance().getTimeInMillis());
|
||||
// Converting milliseconds to hours and minutes
|
||||
int hours = gmtOffsetMillis / 3600000;
|
||||
int minutes = (gmtOffsetMillis % 3600000) / 60000;
|
||||
@@ -350,6 +350,16 @@ public class AddReminderFragment extends Fragment implements CompoundButton.OnCh
|
||||
if (binding.dosage.getText().toString().trim().isEmpty()) {
|
||||
allOkay = false;
|
||||
binding.dosage.setError("Required");
|
||||
}else{
|
||||
try {
|
||||
double dosage = Double.parseDouble(binding.dosage.getText().toString().trim());
|
||||
if (dosage <= 0){
|
||||
allOkay = false;
|
||||
binding.dosage.setError("Must be greater than 0");
|
||||
}
|
||||
}catch (Exception e){
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
|
||||
if (binding.frequencySpinner.getSelectedIndex() == -1) {
|
||||
@@ -382,6 +392,16 @@ public class AddReminderFragment extends Fragment implements CompoundButton.OnCh
|
||||
if (binding.quantity.getText().toString().trim().isEmpty()) {
|
||||
allOkay = false;
|
||||
binding.quantity.setError("Required");
|
||||
}else{
|
||||
try {
|
||||
long quantity = Long.parseLong(binding.quantity.getText().toString().trim());
|
||||
if (quantity <= 0){
|
||||
allOkay = false;
|
||||
binding.quantity.setError("Must be greater than 0");
|
||||
}
|
||||
}catch (Exception e){
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
|
||||
// if (binding.getDate.getText().toString().trim().isEmpty()) {
|
||||
|
||||
@@ -5,7 +5,6 @@ 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;
|
||||
@@ -190,6 +189,15 @@ public class AddRoutineFragment extends Fragment implements CompoundButton.OnChe
|
||||
binding.addRoutine.setOnClickListener(v -> {
|
||||
AppUtil.closeKeyboard(requireActivity());
|
||||
|
||||
// DateTimeZone dateTimeZone = DateTimeZone.getDefault();
|
||||
//
|
||||
// // Get the GMT offset in milliseconds
|
||||
// int gmtOffsetMillis = dateTimeZone.getOffset(adakTime);
|
||||
//
|
||||
// // Calculate the GMT offset in hours and minutes
|
||||
// int gmtOffsetHours = gmtOffsetMillis / 3600000;
|
||||
// int gmtOffsetMinutes = (gmtOffsetMillis % 3600000) / 60000;
|
||||
|
||||
if (allOkay()) {
|
||||
|
||||
if (routine != null){
|
||||
@@ -229,7 +237,7 @@ public class AddRoutineFragment extends Fragment implements CompoundButton.OnChe
|
||||
// Sending time zone
|
||||
TimeZone timeZone = TimeZone.getDefault();
|
||||
// Getting the GMT offset in milliseconds
|
||||
int gmtOffsetMillis = timeZone.getRawOffset();
|
||||
int gmtOffsetMillis = timeZone.getOffset(Calendar.getInstance().getTimeInMillis());
|
||||
// Converting milliseconds to hours and minutes
|
||||
int hours = gmtOffsetMillis / 3600000;
|
||||
int minutes = (gmtOffsetMillis % 3600000) / 60000;
|
||||
|
||||
@@ -110,6 +110,9 @@ public class CgChangePwdFragment extends Fragment implements WelcomeContracts.Ch
|
||||
} else if (!password.matches("^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[^a-zA-Z0-9]).{8,}$")) {
|
||||
allOkay = false;
|
||||
Toast.makeText(requireContext(), "Password doesn't match the required criteria.", Toast.LENGTH_SHORT).show();
|
||||
} else if (binding.confirmPassword.getText().toString().isEmpty()){
|
||||
allOkay = false;
|
||||
Toast.makeText(requireContext(), "Please confirm your password.", Toast.LENGTH_SHORT).show();
|
||||
} else if (!binding.confirmPassword.getText().toString().equals(password)) {
|
||||
allOkay = false;
|
||||
Toast.makeText(requireContext(), "Confirm password doesn't match.", Toast.LENGTH_SHORT).show();
|
||||
|
||||
@@ -76,7 +76,11 @@ public class CgCheckEmailFragment extends Fragment implements WelcomeContracts.F
|
||||
mUserXid = bundle.getString(CG_USER_XID);
|
||||
|
||||
binding.emailAt.setVisibility(View.VISIBLE);
|
||||
binding.email.setText(mEmail);
|
||||
try {
|
||||
binding.email.setText(encodeEmail(mEmail));
|
||||
} catch (Exception e) {
|
||||
binding.email.setText(mEmail);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -106,6 +110,21 @@ public class CgCheckEmailFragment extends Fragment implements WelcomeContracts.F
|
||||
});
|
||||
}
|
||||
|
||||
public String encodeEmail(String email) throws Exception{
|
||||
String[] arr = email.split("@");
|
||||
String email_name = arr[0];
|
||||
|
||||
StringBuilder encoded_email = new StringBuilder();
|
||||
|
||||
for (int i = 0; i<email_name.length()-1; i++){
|
||||
encoded_email.append("*");
|
||||
}
|
||||
|
||||
encoded_email.append(email_name.charAt(email_name.length()-1));
|
||||
|
||||
return encoded_email + "@" + arr[1];
|
||||
}
|
||||
|
||||
private void verifyOTP() {
|
||||
progressDialog.setTitle("Please wait");
|
||||
progressDialog.setMessage("while we verify your OTP.");
|
||||
|
||||
@@ -235,6 +235,11 @@ public class CgRegisterFragment extends Fragment implements WelcomeContracts.Reg
|
||||
passwordWindow.showAsDropDown(binding.pwdTitle);
|
||||
});
|
||||
|
||||
binding.countryCodes.setOnClickListener(v -> {
|
||||
AppUtil.closeKeyboard(requireActivity());
|
||||
binding.countryCodes.showOrDismiss();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void setErrorRemovers() {
|
||||
@@ -331,6 +336,9 @@ public class CgRegisterFragment extends Fragment implements WelcomeContracts.Reg
|
||||
if (binding.name.getText().toString().trim().isEmpty()) {
|
||||
binding.name.setError("Required");
|
||||
allOkay = false;
|
||||
}else if (binding.name.getText().toString().trim().length() < 2){
|
||||
binding.name.setError("Minimum 2 characters");
|
||||
allOkay = false;
|
||||
}
|
||||
|
||||
if (binding.dob.getText().toString().trim().isEmpty()) {
|
||||
|
||||
@@ -11,6 +11,7 @@ import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.text.InputFilter;
|
||||
import android.util.Log;
|
||||
import android.util.Patterns;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -48,6 +49,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.MultipartBody;
|
||||
@@ -307,6 +309,9 @@ public class CreateContactFragment extends Fragment implements WelcomeContracts.
|
||||
if (mustBeeCaregiver && binding.email.getText().toString().trim().isEmpty()) {
|
||||
allOkay = false;
|
||||
binding.email.setError("Required");
|
||||
}else if (mustBeeCaregiver && !Patterns.EMAIL_ADDRESS.matcher(binding.email.getText().toString()).matches()){
|
||||
allOkay = false;
|
||||
binding.email.setError("Invalid email");
|
||||
}
|
||||
|
||||
// if (binding.countryCodes.getSelectedIndex() == -1 && allOkay) {
|
||||
@@ -357,6 +362,8 @@ public class CreateContactFragment extends Fragment implements WelcomeContracts.
|
||||
|
||||
//email is important
|
||||
binding.emailTitle.setText(getString(R.string.email_address)); // with asterisk
|
||||
binding.emailOptional.setVisibility(View.GONE);
|
||||
binding.relationOptional.setVisibility(View.GONE);
|
||||
|
||||
binding.caregiverCheckView.setVisibility(View.VISIBLE);
|
||||
this.mustBeeCaregiver = true;
|
||||
@@ -513,6 +520,9 @@ public class CreateContactFragment extends Fragment implements WelcomeContracts.
|
||||
binding.caregiverCheck.setChecked(true);
|
||||
binding.caregiverCheck.setEnabled(false);
|
||||
binding.relationship.setEnabled(false);
|
||||
|
||||
binding.relationOptional.setVisibility(View.GONE);
|
||||
binding.emailOptional.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
// checking if this contact is doctor
|
||||
@@ -520,6 +530,8 @@ public class CreateContactFragment extends Fragment implements WelcomeContracts.
|
||||
// this contact is doctor
|
||||
binding.name.setEnabled(false);
|
||||
binding.relationship.setEnabled(false);
|
||||
|
||||
binding.relationOptional.setVisibility(View.GONE);
|
||||
}else{
|
||||
binding.name.setEnabled(true);
|
||||
binding.relationship.setEnabled(true);
|
||||
@@ -713,7 +725,6 @@ public class CreateContactFragment extends Fragment implements WelcomeContracts.
|
||||
int last_index = Math.max(phone_numbers[1].length() - 1, 0);
|
||||
phone_numbers[1] = phone_numbers[1].substring(0, last_index);
|
||||
|
||||
|
||||
return phone_numbers;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,8 @@ import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.navigation.Navigation;
|
||||
|
||||
import com.app.simplitend.apputils.EditTextErrorRemover;
|
||||
import com.app.simplitend.apputils.TextUtils;
|
||||
import com.google.android.gms.location.FusedLocationProviderClient;
|
||||
import com.google.android.gms.location.LocationListener;
|
||||
import com.google.android.gms.location.LocationRequest;
|
||||
@@ -311,7 +313,7 @@ public class LocationFragment extends Fragment implements OnMapReadyCallback,
|
||||
|
||||
PatientData patientData = viewModel.getPatientData();
|
||||
|
||||
patientData.address_line1 = binding.street.getText().toString();
|
||||
patientData.address_line1 = binding.street.getText().toString().trim();
|
||||
patientData.city = binding.town.getText().toString();
|
||||
patientData.post_code = binding.zipCode.getText().toString();
|
||||
|
||||
@@ -347,6 +349,9 @@ public class LocationFragment extends Fragment implements OnMapReadyCallback,
|
||||
startAutocompleteMapSearch.launch(intent);
|
||||
});
|
||||
|
||||
binding.street.addTextChangedListener(TextUtils.LEADING_SPACE_WATCHER);
|
||||
new EditTextErrorRemover(binding.street);
|
||||
|
||||
}
|
||||
|
||||
private boolean allOkay() {
|
||||
|
||||
@@ -133,7 +133,7 @@ public class ReActivateFragment extends Fragment implements AccountPresenter.Acc
|
||||
progressDialog.show();
|
||||
|
||||
accountPresenter.accountReDeActivate(AccountPresenter.ACC_ACTIVE,
|
||||
caregiver_xid, "Bearer " + token, this);
|
||||
caregiver_xid, null, null, "Bearer " + token, this);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.navigation.Navigation;
|
||||
|
||||
import com.app.simplitend.apputils.EditTextErrorRemover;
|
||||
import com.app.simplitend.apputils.TextUtils;
|
||||
import com.google.i18n.phonenumbers.NumberParseException;
|
||||
import com.google.i18n.phonenumbers.PhoneNumberUtil;
|
||||
@@ -131,6 +132,13 @@ public class RegisterFragment extends Fragment implements WelcomeContracts.Verif
|
||||
// not allowing leading spaces
|
||||
binding.name.addTextChangedListener(TextUtils.LEADING_SPACE_WATCHER);
|
||||
binding.email.addTextChangedListener(TextUtils.LEADING_SPACE_WATCHER);
|
||||
|
||||
// error remover
|
||||
new EditTextErrorRemover(
|
||||
binding.name,
|
||||
binding.email,
|
||||
binding.contactNumber
|
||||
);
|
||||
}
|
||||
|
||||
private void setFocusManager() {
|
||||
@@ -242,6 +250,11 @@ public class RegisterFragment extends Fragment implements WelcomeContracts.Verif
|
||||
getString(R.string.terms_conditions_));
|
||||
});
|
||||
|
||||
binding.countryCodes.setOnClickListener(v -> {
|
||||
AppUtil.closeKeyboard(requireActivity());
|
||||
binding.countryCodes.showOrDismiss();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void removeExistingErrors() {
|
||||
@@ -258,6 +271,9 @@ public class RegisterFragment extends Fragment implements WelcomeContracts.Verif
|
||||
if (binding.name.getText().toString().trim().isEmpty()) {
|
||||
binding.name.setError("Required");
|
||||
allOkay = false;
|
||||
}else if (binding.name.getText().toString().trim().length() < 2){
|
||||
binding.name.setError("Minimum 2 characters");
|
||||
allOkay = false;
|
||||
}
|
||||
|
||||
if (binding.dob.getText().toString().trim().isEmpty()) {
|
||||
@@ -336,11 +352,11 @@ public class RegisterFragment extends Fragment implements WelcomeContracts.Verif
|
||||
public void goForward() {
|
||||
PatientData patientData = viewModel.getPatientData();
|
||||
|
||||
patientData.first_name = patientData.user_name = binding.name.getText().toString();
|
||||
patientData.first_name = patientData.user_name = binding.name.getText().toString().trim();
|
||||
patientData.phone_number = countryCodeList.get(binding.countryCodes.getSelectedIndex())
|
||||
+ " " + binding.contactNumber.getText().toString();
|
||||
patientData.date_of_birth = binding.dob.getText().toString();
|
||||
patientData.email = binding.email.getText().toString();
|
||||
patientData.email = binding.email.getText().toString().trim();
|
||||
|
||||
Navigation.findNavController(binding.getRoot()).navigate(R.id.action_registerFragment_to_locationFragment);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user