This commit is contained in:
2023-08-16 21:05:21 +05:30
parent 335402cf06
commit 8ba46a9567
37 changed files with 538 additions and 209 deletions

View File

@@ -1,6 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetDropDown">
<runningDeviceTargetSelectedWithDropDown>
<Target>
<type value="RUNNING_DEVICE_TARGET" />
<deviceKey>
<Key>
<type value="SERIAL_NUMBER" />
<value value="RZCW41EJRPN" />
</Key>
</deviceKey>
</Target>
</runningDeviceTargetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2023-08-16T15:08:19.392731600Z" />
<runningDeviceTargetsSelectedWithDialog>
<Target>
<type value="RUNNING_DEVICE_TARGET" />

View File

@@ -56,15 +56,6 @@ public class CgSubscriptionActivity extends AppCompatActivity
presenter = SubscriptionPresenter.getPresenter();
// static
AppUtil.showAlert(this,
"Testing!",
"Payment is in testing phase. So each time u open app it ill bring to subsription screen. This ill be updated in next build.",
"Ok, got it.",
((dialogInterface, i) -> {
}),
null, null);
initViews();
clickEvents();

View File

@@ -47,7 +47,11 @@ public class ChatFragment extends Fragment {
}
private void clickEvents() {
binding.backBtn.setOnClickListener(v -> Navigation.findNavController(v).popBackStack());
binding.backBtn.setOnClickListener(v -> {
if (getActivity() != null){
getActivity().onBackPressed();
}
});
binding.sendBtn.setOnClickListener(v -> {
if (!binding.messageEt.getText().toString().trim().isEmpty()){

View File

@@ -2,14 +2,17 @@ package com.ssb.simplitend.patientprofile;
import android.animation.Animator;
import android.content.Intent;
import android.graphics.drawable.Drawable;
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;
import androidx.fragment.app.Fragment;
import androidx.vectordrawable.graphics.drawable.Animatable2Compat;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.DataSource;
@@ -58,7 +61,21 @@ public class RegisterCompleteFragment extends Fragment {
@Override
public boolean onResourceReady(GifDrawable resource, Object model, Target<GifDrawable> target, DataSource dataSource, boolean isFirstResource) {
if (resource == null) return false;
resource.setLoopCount(1);
resource.registerAnimationCallback(new Animatable2Compat.AnimationCallback() {
@Override
public void onAnimationEnd(Drawable drawable) {
super.onAnimationEnd(drawable);
String title = "Your profile is " + (profile_progress * 20) + "% complete!";
binding.title.setText(title);
YoYo.with(Techniques.FadeIn)
.duration(100)
.playOn(binding.title);
}
});
return false;
}
})

View File

@@ -162,7 +162,11 @@ public class AddMedicalInfoFragment extends Fragment implements
private void clickEvents() {
binding.backBtn.setOnClickListener(v -> Navigation.findNavController(v).popBackStack());
binding.backBtn.setOnClickListener(v -> {
if (getActivity() != null){
getActivity().onBackPressed();
}
});
binding.addBtn.setOnClickListener(v -> {

View File

@@ -69,7 +69,11 @@ public class MedicalInfoFragment extends Fragment implements ProfileContracts.Ge
private void clickEvents() {
binding.backBtn.setOnClickListener(v -> Navigation.findNavController(v).popBackStack());
binding.backBtn.setOnClickListener(v -> {
if (getActivity() != null){
getActivity().onBackPressed();
}
});
binding.addMedInfo.setOnClickListener(v -> {
Navigation.findNavController(v).navigate(R.id.action_medicalInfoFragment_to_addMedicalInfoFragment);
@@ -88,7 +92,11 @@ public class MedicalInfoFragment extends Fragment implements ProfileContracts.Ge
});
binding.done.setOnClickListener(v -> Navigation.findNavController(v).popBackStack());
binding.done.setOnClickListener(v -> {
if (getActivity() != null){
getActivity().onBackPressed();
}
});
}

View File

@@ -32,7 +32,6 @@ import com.ssb.simplitend.patientprofile.medreminder.mvvm.models.Frequency;
import com.ssb.simplitend.patientprofile.medreminder.mvvm.models.MedicationType;
import com.ssb.simplitend.patientprofile.medreminder.mvvm.models.ReminderResult;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
@@ -55,6 +54,8 @@ public class AddReminderFragment extends Fragment implements CompoundButton.OnCh
*/
boolean[] week_state;
private DatePickerDialog datePickerDialog;
// arguments keys
public static final String REMINDER_KEY = "reminder_key";
@@ -88,7 +89,11 @@ public class AddReminderFragment extends Fragment implements CompoundButton.OnCh
private void clickEvents() {
binding.backBtn.setOnClickListener(v -> Navigation.findNavController(v).popBackStack());
binding.backBtn.setOnClickListener(v -> {
if (getActivity() != null){
getActivity().onBackPressed();
}
});
binding.getTime.setOnClickListener(v -> {
binding.getTime.setError(null);
@@ -114,12 +119,6 @@ public class AddReminderFragment extends Fragment implements CompoundButton.OnCh
getDate();
});
// TODO: 20-07-2023 remove
binding.getDate.setOnLongClickListener(v -> {
binding.getDate.setText("20-07-2023");
return false;
});
binding.addReminder.setOnClickListener(v -> {
AppUtil.closeKeyboard(requireActivity());
@@ -215,6 +214,25 @@ public class AddReminderFragment extends Fragment implements CompoundButton.OnCh
progressDialog = new ProgressDialog(requireContext());
Calendar calendar = Calendar.getInstance();
datePickerDialog = new DatePickerDialog(requireContext(),
(datePicker, year, month, dayOfMonth) -> {
Calendar cal = Calendar.getInstance();
cal.set(Calendar.YEAR, year);
cal.set(Calendar.MONTH, month);
cal.set(Calendar.DAY_OF_MONTH, dayOfMonth);
SimpleDateFormat sdf = new SimpleDateFormat("MM-dd-yyyy", Locale.getDefault());
String selected_time = sdf.format(cal.getTime());
binding.getDate.setText(selected_time);
}, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH));
datePickerDialog.getDatePicker().setMinDate(System.currentTimeMillis());
frequencyList = new ArrayList<>();
medicationTypeList = new ArrayList<>();
@@ -431,8 +449,8 @@ public class AddReminderFragment extends Fragment implements CompoundButton.OnCh
}
private String formatDate(String medication_refill_date) {
String inputPattern = "yyyy-dd-MM";
String outputPattern = "dd-MM-yyyy";
String inputPattern = "yyyy-MM-dd";
String outputPattern = "MM-dd-yyyy";
SimpleDateFormat inputFormat = new SimpleDateFormat(inputPattern, Locale.getDefault());
SimpleDateFormat outputFormat = new SimpleDateFormat(outputPattern, Locale.getDefault());
@@ -441,8 +459,15 @@ public class AddReminderFragment extends Fragment implements CompoundButton.OnCh
try {
date = inputFormat.parse(medication_refill_date);
if (date == null) throw new Exception();
str = outputFormat.format(date);
} catch (ParseException e) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
if (datePickerDialog != null)
{
datePickerDialog.getDatePicker().updateDate(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH));
}
} catch (Exception e) {
Log.e(TAG, "formatDate: ", e);
}
@@ -574,27 +599,9 @@ public class AddReminderFragment extends Fragment implements CompoundButton.OnCh
// shows date picker to pick date and set to tv
private void getDate() {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
DatePickerDialog dpd = new DatePickerDialog(requireContext());
if (datePickerDialog == null) return;
dpd.setOnDateSetListener((view, year, month, dayOfMonth) -> {
Calendar cal = Calendar.getInstance();
cal.set(Calendar.YEAR, year);
cal.set(Calendar.MONTH, month);
cal.set(Calendar.DAY_OF_MONTH, dayOfMonth);
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy", Locale.getDefault());
String selected_time = sdf.format(cal.getTime());
binding.getDate.setText(selected_time);
});
dpd.getDatePicker().setMinDate(System.currentTimeMillis());
dpd.show();
}
datePickerDialog.show();
// TODO: 05-07-2023 for lower version

View File

@@ -33,7 +33,8 @@ import java.util.Locale;
public class ReminderFragment extends Fragment implements RecyclerTouchListener.OnSwipeOptionsClickListener,
ProfileContracts.GetRemindersListCallback, ProfileContracts.ReminderDeleteCallback,
ProfileContracts.AddReminderCallBack,
ReminderAdapter.ReminderCheckClickListener{
ReminderAdapter.ReminderCheckClickListener,
ReminderAdapter.ReminderClickListener{
// view binding
protected RemindersFragmentBinding binding;
@@ -52,7 +53,7 @@ ReminderAdapter.ReminderCheckClickListener{
private ArrayList<ReminderResult> remindersList;
public ReminderFragment(){
public ReminderFragment() {
// required empty const.
}
@@ -104,18 +105,24 @@ ReminderAdapter.ReminderCheckClickListener{
// add button
binding.addReminder.setOnClickListener(v ->
Navigation.findNavController(v).navigate(R.id.action_reminderFragment_to_addReminderFragment)
Navigation.findNavController(v).navigate(R.id.action_reminderFragment_to_addReminderFragment)
);
binding.done.setOnClickListener(v -> {
Navigation.findNavController(v).popBackStack();
if (getActivity() != null){
getActivity().onBackPressed();
}
});
binding.backBtn.setOnClickListener(v -> Navigation.findNavController(v).popBackStack());
binding.backBtn.setOnClickListener(v -> {
if (getActivity() != null){
getActivity().onBackPressed();
}
});
}
private void loadReminderList(int day_of_week){
private void loadReminderList(int day_of_week) {
progressDialog.setTitle("Please wait...");
progressDialog.setMessage("while we fetch reminders list for you.");
progressDialog.setCancelable(false);
@@ -136,6 +143,7 @@ ReminderAdapter.ReminderCheckClickListener{
remindersList = new ArrayList<>();
reminderAdapter = new ReminderAdapter(remindersList);
reminderAdapter.setCheckClickListener(this);
reminderAdapter.setReminderClickListener(this);
binding.remindersRv.setAdapter(reminderAdapter);
recyclerTouchListener = new RecyclerTouchListener(requireActivity(), binding.remindersRv);
@@ -187,7 +195,7 @@ ReminderAdapter.ReminderCheckClickListener{
Calendar calendar = Calendar.getInstance();
for (int i = 0; i<7; i++){
for (int i = 0; i < 7; i++) {
WeekDayViewHolder dayViewHolder = weekDayViewsList.get(i);
dayViewHolder.day_of_week = calendar.get(Calendar.DAY_OF_WEEK);
@@ -199,8 +207,8 @@ ReminderAdapter.ReminderCheckClickListener{
}
}
private void clearSelection(){
switch (reminderViewModel.selected_dow){
private void clearSelection() {
switch (reminderViewModel.selected_dow) {
case 0:
binding.day.setBackgroundColor(getResources().getColor(R.color.white_bg));
binding.dayT1.setTextColor(getResources().getColor(R.color.black));
@@ -245,14 +253,14 @@ ReminderAdapter.ReminderCheckClickListener{
}
}
private void setDayOfWeek(int selection){
private void setDayOfWeek(int selection) {
// setting selected date in adapter
reminderAdapter.setSelected_date(weekDayViewsList.get(selection).mDate);
clearSelection();
switch (reminderViewModel.selected_dow = selection){
switch (reminderViewModel.selected_dow = selection) {
case 0:
binding.day.setBackgroundResource(R.drawable.seleted_item_primary);
binding.dayT1.setTextColor(getResources().getColor(R.color.white_bg));
@@ -303,14 +311,14 @@ ReminderAdapter.ReminderCheckClickListener{
public void onRemindersListFetched(List<ReminderResult> reminderResultList) {
progressDialog.dismiss();
if (reminderResultList != null && reminderResultList.size() > 0){
if (reminderResultList != null && reminderResultList.size() > 0) {
// reminders are present
binding.remindersRv.setVisibility(View.VISIBLE);
binding.noData.setVisibility(View.GONE);
reminderAdapter.submitLIst(reminderResultList);
}else{
} else {
binding.remindersRv.setVisibility(View.GONE);
binding.noData.setVisibility(View.VISIBLE);
}
@@ -353,10 +361,16 @@ ReminderAdapter.ReminderCheckClickListener{
}), null, null);
}
// reminder clicked listener
@Override
public void onReminderClicked(ReminderResult reminderResult, int position) {
editReminder(position);
}
// swipe option menu click listener for reminder list
@Override
public void onSwipeOptionClicked(int viewID, int position) {
if (viewID == R.id.reminder_delete){
if (viewID == R.id.reminder_delete) {
AppUtil.showSOSDecision(requireContext(),
getString(R.string.delete_med_reminder),
@@ -381,16 +395,22 @@ ReminderAdapter.ReminderCheckClickListener{
// no button clicked
});
}else if (viewID == R.id.reminder_edit){
Bundle bundle = new Bundle();
bundle.putSerializable(AddReminderFragment.REMINDER_KEY, reminderAdapter.getReminderResultList().get(position));
Navigation.findNavController(binding.getRoot())
.navigate(R.id.action_reminderFragment_to_addReminderFragment, bundle);
} else if (viewID == R.id.reminder_edit) {
editReminder(position);
}
}
private void editReminder(int position) {
if (reminderAdapter == null) return;
Bundle bundle = new Bundle();
bundle.putSerializable(AddReminderFragment.REMINDER_KEY, reminderAdapter.getReminderResultList().get(position));
Navigation.findNavController(binding.getRoot())
.navigate(R.id.action_reminderFragment_to_addReminderFragment, bundle);
}
@Override
public void onReminderAdded(ReminderResult reminderDetails) {
progressDialog.dismiss();
@@ -414,7 +434,7 @@ ReminderAdapter.ReminderCheckClickListener{
public void onCheck(ReminderResult reminderResult, int position) {
// is user checking only today's check
if (reminderResult.reminder_marked == null){
if (reminderResult.reminder_marked == null) {
/*
now, we don't want to allow checking of routine of other day
*/
@@ -422,7 +442,7 @@ ReminderAdapter.ReminderCheckClickListener{
int today_date = Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
int selected_date = Integer.parseInt(weekDayViewsList.get(reminderViewModel.selected_dow).date.getText().toString());
if (today_date == selected_date){
if (today_date == selected_date) {
AppUtil.showAlert(requireContext(),
"Are you sure?",
"Do yuo want to check this reminder?\nThis cannot be undone.",
@@ -436,11 +456,11 @@ ReminderAdapter.ReminderCheckClickListener{
(dialog, which) -> {
dialog.dismiss();
});
}else{
} else {
Toast.makeText(requireContext(), "Cannot mark future routine.", Toast.LENGTH_SHORT).show();
}
}catch (Exception e){
} catch (Exception e) {
Toast.makeText(requireContext(), "Couldn't be done.", Toast.LENGTH_SHORT).show();
}
@@ -470,7 +490,7 @@ ReminderAdapter.ReminderCheckClickListener{
try {
Date date = date_f1.parse(reminderResult.medication_refill_date);
refill_date = date_f2.format(date);
}catch (Exception e){
} catch (Exception e) {
refill_date = date_f2.format(Calendar.getInstance().getTime());
}

View File

@@ -22,6 +22,7 @@ import java.util.Locale;
public class ReminderAdapter extends RecyclerView.Adapter<ReminderAdapter.ReminderViewHolder> {
private ReminderCheckClickListener checkClickListener;
private ReminderClickListener reminderClickListener;
private volatile Date selected_date;
@@ -35,6 +36,10 @@ public class ReminderAdapter extends RecyclerView.Adapter<ReminderAdapter.Remind
this.checkClickListener = checkClickListener;
}
public void setReminderClickListener(ReminderClickListener reminderClickListener) {
this.reminderClickListener = reminderClickListener;
}
public void submitLIst(List<ReminderResult> reminderResultList){
this.reminderResultList = null;
this.reminderResultList = reminderResultList;
@@ -68,6 +73,13 @@ public class ReminderAdapter extends RecyclerView.Adapter<ReminderAdapter.Remind
if (checkClickListener != null) checkClickListener.onCheck(reminderResultList.get(position), position);
});
holder.binding.card.setOnClickListener(v -> {
if (reminderClickListener != null)
{
reminderClickListener.onReminderClicked(reminderResultList.get(position), position);
}
});
}
@Override
@@ -294,4 +306,8 @@ public class ReminderAdapter extends RecyclerView.Adapter<ReminderAdapter.Remind
void onCheck(ReminderResult reminderResult, int position);
}
public interface ReminderClickListener{
void onReminderClicked(ReminderResult reminderResult, int position);
}
}

View File

@@ -18,6 +18,7 @@ public class ReminderResult implements Serializable {
public String reminder_time;
public String medication_quantity;
public String medication_refill_date;
public String formatted_medication_refill_date;
public String medication_instruction;
public String mon;
public String tue;

View File

@@ -143,7 +143,11 @@ public class AddRoutineFragment extends Fragment implements CompoundButton.OnChe
}
private void clickEvents() {
binding.backBtn.setOnClickListener(v -> Navigation.findNavController(v).popBackStack());
binding.backBtn.setOnClickListener(v -> {
if (getActivity() != null){
getActivity().onBackPressed();
}
});
binding.startTime.setOnClickListener(v -> {
AppUtil.closeKeyboard(requireActivity());

View File

@@ -107,12 +107,22 @@ public class RoutineFragment extends Fragment implements RoutineAdapter.ClickLis
loadRoutineList(weekDayViewsList.get(6).day_of_week);
});
binding.backBtn.setOnClickListener(v -> Navigation.findNavController(v).popBackStack());
binding.backBtn.setOnClickListener(v -> {
if (getActivity() != null){
getActivity().onBackPressed();
}
});
binding.addRoutine.setOnClickListener(v -> {
Navigation.findNavController(v).navigate(R.id.action_routineFragment_to_addRoutineFragment);
});
binding.done.setOnClickListener(v -> {
if (getActivity() != null){
getActivity().onBackPressed();
}
});
}
private void loadRoutineList(int day_of_week) {

View File

@@ -42,6 +42,10 @@ public interface WelcomeApiService {
@POST("api/auth/patient-caregiver-connect")
Call<CallResponse<ConnectCgResult>> connectCg(@Body Map<String, String> body);
@POST("api/resent-patient-caregiver-link-code")
Call<CallResponse<Object>> resendCgCode(@Body Map<String, String> body,
@Header("Authorization") String token);
@GET("api/caregiver-user-data")
Call<CallResponse<CareGiverData>> getCgUserData(@Header("Authorization") String token);

View File

@@ -60,4 +60,12 @@ public interface WelcomeContracts {
}
interface ResendCgCodeCallback{
void onCgCodeResent();
void onCgCodeResentFailed(Throwable t, String message);
}
}

View File

@@ -178,6 +178,8 @@ public class CgAuthActivity extends AppCompatActivity {
case BiometricManager.BIOMETRIC_ERROR_HW_UNAVAILABLE:
binding.fingerprintOr.setVisibility(View.GONE);
binding.fingerprintView.setVisibility(View.GONE);
// no fingerprint sensor or some error occurred thus, skipping this screen
gotoCgDash();
break;
case BiometricManager.BIOMETRIC_SUCCESS:
case BiometricManager.BIOMETRIC_ERROR_NONE_ENROLLED:

View File

@@ -28,7 +28,9 @@ import com.ssb.simplitend.welcome.welcomecg.mvvm.ConnectCgResult;
import java.util.HashMap;
import java.util.Map;
public class CgConnectFragment extends Fragment implements WelcomeContracts.ConnectCgCallback{
public class CgConnectFragment extends Fragment implements
WelcomeContracts.ConnectCgCallback,
WelcomeContracts.ResendCgCodeCallback {
protected ConnectCaregiverFragmentBinding binding;
@@ -60,20 +62,40 @@ public class CgConnectFragment extends Fragment implements WelcomeContracts.Conn
private void clickEvents() {
binding.connectBtn.setOnClickListener(v -> {
if (binding.code.getText().toString().length() != 4){
if (binding.code.getText().toString().length() != 4) {
binding.code.setError("Invalid code.");
return;
}
connectCG();
});
binding.resendCode.setOnClickListener(v -> {
if (cg_email == null) {
Toast.makeText(requireContext(), "Something went wrong", Toast.LENGTH_SHORT).show();
return;
}
progressDialog.setTitle("Please wait...");
progressDialog.setMessage("while we resend a 4 digit Caregiver code to your email.");
progressDialog.setCancelable(false);
progressDialog.show();
Map<String, String> body = new HashMap<>();
body.put("email", cg_email);
String token = "Bearer " + AppUtil.getCgToken(requireContext());
viewModel.resendCgCode(body, token, this);
});
}
private void connectCG() {
if (cg_email == null){
if (cg_email == null) {
Toast.makeText(requireContext(), "Something went wrong", Toast.LENGTH_SHORT).show();
return;
};
}
progressDialog.setTitle("Please wait...");
progressDialog.setMessage("while we verify your code.");
@@ -112,7 +134,7 @@ public class CgConnectFragment extends Fragment implements WelcomeContracts.Conn
@Override
public void afterTextChanged(Editable editable) {
if (editable.length() == 4){
if (editable.length() == 4) {
AppUtil.closeKeyboard(requireActivity());
}
}
@@ -132,7 +154,7 @@ public class CgConnectFragment extends Fragment implements WelcomeContracts.Conn
// Thus, asking cg_user to sign in again
Navigation.findNavController(binding.getRoot())
.popBackStack(R.id.cgSignInFragment, false);
}else{
} else {
cg_email = bundle.getString(CAREGIVER_EMAIL);
binding.emailAddress.setText(cg_email);
@@ -157,6 +179,22 @@ public class CgConnectFragment extends Fragment implements WelcomeContracts.Conn
public void onCgConnectFailed(Throwable throwable, String message) {
progressDialog.dismiss();
binding.code.setText("");
Toast.makeText(requireContext(), "" + message, Toast.LENGTH_SHORT).show();
}
// resend code callback
@Override
public void onCgCodeResent() {
progressDialog.dismiss();
Toast.makeText(requireContext(), "Caregiver code resent successfully.", Toast.LENGTH_SHORT).show();
}
@Override
public void onCgCodeResentFailed(Throwable t, String message) {
progressDialog.dismiss();
Toast.makeText(requireContext(), "" + message, Toast.LENGTH_SHORT).show();
}
}

View File

@@ -6,7 +6,6 @@ import android.app.DatePickerDialog;
import android.app.ProgressDialog;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.text.InputFilter;
import android.util.Log;
@@ -21,9 +20,9 @@ import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider;
import androidx.navigation.NavOptions;
import androidx.navigation.Navigation;
import com.google.i18n.phonenumbers.NumberParseException;
@@ -50,7 +49,7 @@ import java.util.Map;
import okhttp3.MediaType;
import okhttp3.RequestBody;
public class CgRegisterFragment extends Fragment implements WelcomeContracts.RegisterCareGiverCallback{
public class CgRegisterFragment extends Fragment implements WelcomeContracts.RegisterCareGiverCallback {
private static final String TAG = "CgRegisterFragment";
@@ -70,7 +69,7 @@ public class CgRegisterFragment extends Fragment implements WelcomeContracts.Reg
private Calendar dob_selected;
public CgRegisterFragment(){
public CgRegisterFragment() {
// required
}
@@ -88,7 +87,7 @@ public class CgRegisterFragment extends Fragment implements WelcomeContracts.Reg
viewModel = new ViewModelProvider(requireActivity()).get(CgWelcomeViewModel.class);
initViews();
clickEvents();
return binding.getRoot();
@@ -107,9 +106,21 @@ public class CgRegisterFragment extends Fragment implements WelcomeContracts.Reg
progressDialog = new ProgressDialog(requireContext());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
datePickerDialog = new DatePickerDialog(requireContext());
}
// date picker dialog
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR) - 18);
datePickerDialog = new DatePickerDialog(requireContext(), (datePicker, year, month, dayOfMonth) -> {
setDOB(year, month, dayOfMonth);
binding.contactNumber.requestFocus();
if (getActivity() != null) {
getActivity().getWindow()
.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
}
}, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH));
datePickerDialog.getDatePicker().setMaxDate(calendar.getTimeInMillis());
dob_selected = Calendar.getInstance();
@@ -119,7 +130,7 @@ public class CgRegisterFragment extends Fragment implements WelcomeContracts.Reg
binding.countryCodes.setItems(countryCodeList);
if (!countryCodeList.contains("+1")){
if (!countryCodeList.contains("+1")) {
countryCodeList.add("+1");
}
@@ -138,7 +149,9 @@ public class CgRegisterFragment extends Fragment implements WelcomeContracts.Reg
private void clickEvents() {
binding.backBtn.setOnClickListener(v -> {
Navigation.findNavController(v).popBackStack();
if (getActivity() != null) {
getActivity().onBackPressed();
}
});
binding.submit.setOnClickListener(v -> {
@@ -160,7 +173,7 @@ public class CgRegisterFragment extends Fragment implements WelcomeContracts.Reg
String phone_number = "";
if (binding.countryCodes.getSelectedIndex() != -1){
if (binding.countryCodes.getSelectedIndex() != -1) {
phone_number += countryCodeList.get(binding.countryCodes.getSelectedIndex()) + " ";
}
@@ -172,9 +185,9 @@ public class CgRegisterFragment extends Fragment implements WelcomeContracts.Reg
RequestBody email_body = RequestBody.create(binding.email.getText().toString().trim(), MediaType.parse("text/plain"));
body.put("email", email_body);
if (binding.password.getText() == null){
if (binding.password.getText() == null) {
mPassword = "";
}else{
} else {
mPassword = binding.password.getText().toString();
}
@@ -188,11 +201,9 @@ public class CgRegisterFragment extends Fragment implements WelcomeContracts.Reg
binding.dob.setOnClickListener(v -> {
binding.dob.setError(null);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
AppUtil.closeKeyboard(requireActivity());
AppUtil.closeKeyboard(requireActivity());
pickDate();
}
pickDate();
});
binding.tncBtn.setOnClickListener(v -> {
@@ -201,14 +212,6 @@ public class CgRegisterFragment extends Fragment implements WelcomeContracts.Reg
startActivity(intent);
});
// static thing for lower android versions
// todo should be removed afterwards
binding.dob.setOnLongClickListener(v -> {
binding.dob.setText("12-12-2001");
binding.dob.setHint("12-12-2001");
return false;
});
binding.pwdInfo.setOnClickListener(v -> {
passwordWindow.showAsDropDown(binding.pwdTitle);
});
@@ -229,9 +232,9 @@ public class CgRegisterFragment extends Fragment implements WelcomeContracts.Reg
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());
}
@@ -245,23 +248,23 @@ public class CgRegisterFragment extends Fragment implements WelcomeContracts.Reg
// 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;
}
};
@@ -274,35 +277,16 @@ public class CgRegisterFragment extends Fragment implements WelcomeContracts.Reg
binding.name.setOnEditorActionListener((textView, i, keyEvent) -> {
AppUtil.closeKeyboard(requireActivity());
binding.name.clearFocus();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
pickDate();
}
pickDate();
return true;
});
}
@RequiresApi(api = Build.VERSION_CODES.N)
private void pickDate() {
if (datePickerDialog == null) return;
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR) - 18);
datePickerDialog.getDatePicker().setMaxDate(calendar.getTimeInMillis());
datePickerDialog.setOnDateSetListener((view, year, month, dayOfMonth) -> {
setDOB(year, month, dayOfMonth);
binding.contactNumber.requestFocus();
if (getActivity() != null) {
getActivity().getWindow()
.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
}
});
datePickerDialog.show();
}
private void setDOB(int year, int month, int dayOfMonth) {
@@ -357,18 +341,17 @@ public class CgRegisterFragment extends Fragment implements WelcomeContracts.Reg
}
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 (binding.countryCodes.getSelectedIndex() == -1 ||
binding.countryCodes.getSelectedIndex() >= countryCodeList.size()){
binding.countryCodes.getSelectedIndex() >= countryCodeList.size()) {
allOkay = false;
Toast.makeText(requireContext(), "Select a country code.", Toast.LENGTH_SHORT).show();
}
else{
} else {
// validating phone number
try {
Phonenumber.PhoneNumber phone_number = PhoneNumberUtil.getInstance().parse(countryCodeList.get(binding.countryCodes.getSelectedIndex())+
Phonenumber.PhoneNumber phone_number = PhoneNumberUtil.getInstance().parse(countryCodeList.get(binding.countryCodes.getSelectedIndex()) +
binding.contactNumber.getText().toString(), "US");
if (!PhoneNumberUtil.getInstance().isValidNumber(phone_number)) {
@@ -388,20 +371,20 @@ public class CgRegisterFragment extends Fragment implements WelcomeContracts.Reg
allOkay = false;
}
if (allOkay && binding.password.getText() != null && binding.confirmPassword.getText() != null){
if (allOkay && binding.password.getText() != null && binding.confirmPassword.getText() != null) {
String password = binding.password.getText().toString();
if (password.length() < 8){
if (password.length() < 8) {
allOkay = false;
Toast.makeText(requireContext(), "Password must be at least 8 characters.", Toast.LENGTH_SHORT).show();
}else if (password.contains(" ")){
} else if (password.contains(" ")) {
allOkay = false;
Toast.makeText(requireContext(), "Password should not contains white spaces.", Toast.LENGTH_SHORT).show();
}else if (!password.matches("^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[^a-zA-Z0-9]).{8,}$")){
} 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();
passwordWindow.showAsDropDown(binding.pwdTitle);
}else if (!binding.confirmPassword.getText().toString().equals(password)){
} else if (!binding.confirmPassword.getText().toString().equals(password)) {
allOkay = false;
Toast.makeText(requireContext(), "Confirm password doesn't match.", Toast.LENGTH_SHORT).show();
}
@@ -435,18 +418,23 @@ public class CgRegisterFragment extends Fragment implements WelcomeContracts.Reg
progressDialog.dismiss();
NavOptions navOptions = new NavOptions.Builder()
.setPopUpTo(R.id.welcomeFragment, true)
.build();
Navigation.findNavController(binding.getRoot())
.navigate(R.id.action_cgRegisterFragment_to_cgConnectFragment, bundle);
.navigate(R.id.action_cgRegisterFragment_to_cgConnectFragment, bundle, navOptions);
}
@Override
public void onRegisterFailed(Throwable t, String message) {
progressDialog.dismiss();
AppUtil.showAlert(requireContext(),
AppUtil.showAlert(requireContext(),
getString(R.string.something_went_wrong),
message,
getString(R.string.ok),
((dialogInterface, i) -> {}),
((dialogInterface, i) -> {
}),
null, null);
}
}

View File

@@ -225,4 +225,32 @@ public class CgWelcomeRepository {
}
public void resendCgCode(Map<String, String> body,
String token,
@NonNull WelcomeContracts.ResendCgCodeCallback cgCodeCallback){
apiService.resendCgCode(body, token)
.enqueue(new Callback<CallResponse<Object>>() {
@Override
public void onResponse(Call<CallResponse<Object>> call, Response<CallResponse<Object>> response) {
if (response.body() != null){
if (response.body().status != 200 || response.body().result == null){
cgCodeCallback.onCgCodeResentFailed(new Exception(), response.body().message);
return;
}
cgCodeCallback.onCgCodeResent();
}else{
cgCodeCallback.onCgCodeResentFailed(new Exception(), "Please try again later.");
}
}
@Override
public void onFailure(Call<CallResponse<Object>> call, Throwable t) {
cgCodeCallback.onCgCodeResentFailed(new Exception(), t.getMessage());
}
});
}
}

View File

@@ -66,6 +66,12 @@ public class CgWelcomeViewModel extends ViewModel {
repository.connectCg(body, connectCgCallback);
}
public void resendCgCode(Map<String, String> body,
String token,
WelcomeContracts.ResendCgCodeCallback codeCallback){
repository.resendCgCode(body, token, codeCallback);
}
public ArrayList<String> loadCountryCodeDropDown(Context context) {
ArrayList<String> countryCodeList = new ArrayList<>();

View File

@@ -194,7 +194,7 @@ public class SignInFragment extends Fragment implements WelcomeContracts.Registe
private void gotoProfileProgress(){
NavOptions navOptions = new NavOptions.Builder()
.setPopUpTo(R.id.signInFragment, true)
.setPopUpTo(R.id.welcomeFragment, true)
.build();
Navigation.findNavController(binding.getRoot())

View File

@@ -84,7 +84,11 @@ public class AddContactFragment extends Fragment implements WelcomeContracts.Con
private void clickEvents() {
binding.backBtn.setOnClickListener(v -> Navigation.findNavController(v).popBackStack());
binding.backBtn.setOnClickListener(v -> {
if (getActivity() != null){
getActivity().onBackPressed();
}
});
binding.nextBtn.setOnClickListener(v ->
Navigation.findNavController(v).navigate(R.id.action_addContactFragment_to_profileProgressFragment));

View File

@@ -106,7 +106,11 @@ public class ContactInfoFragment extends Fragment implements WelcomeContracts.De
private void clickEvents() {
binding.backBtn.setOnClickListener(v -> Navigation.findNavController(v).popBackStack());
binding.backBtn.setOnClickListener(v -> {
if (getActivity() != null){
getActivity().onBackPressed();
}
});
binding.delete.setOnClickListener(v -> {

View File

@@ -4,10 +4,12 @@ import android.Manifest;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.provider.ContactsContract;
import android.provider.Settings;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
@@ -31,12 +33,9 @@ import com.ssb.simplitend.welcome.welcomepatient.fragments.contacts.mvvm.Contact
import com.ssb.simplitend.welcome.welcomepatient.fragments.contacts.mvvm.models.ContactData;
import java.util.ArrayList;
import java.util.HashMap;
public class ContactListFragment extends Fragment {
private static final String TAG = "aditya";
// view binding
protected ContactListFragmentBinding binding;
@@ -45,6 +44,7 @@ public class ContactListFragment extends Fragment {
protected ContactViewModel contactViewModel;
protected ActivityResultLauncher<String> permissionLauncher;
protected ActivityResultLauncher<Intent> settingsIntent;
protected ActivityResultLauncher<Intent> insertContactLauncher;
@@ -91,6 +91,10 @@ public class ContactListFragment extends Fragment {
}
);
binding.askPermission.setOnClickListener(v -> {
askContactPermission();
});
binding.search.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
@@ -110,13 +114,34 @@ public class ContactListFragment extends Fragment {
}
private void askContactPermission() {
if (requireActivity().checkSelfPermission(Manifest.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED) {
if(!shouldShowRequestPermissionRationale(Manifest.permission.READ_CONTACTS)){
// user has selected to never ask them again for the permission
binding.errorView.setVisibility(View.VISIBLE);
binding.title.setText(getString(R.string.we_understand_your_privacy));
binding.subTitle.setText(getString(R.string.to_help_you_connect_with_your_loved_ones_allow_simplitend_to_access_your_contacts));
binding.askPermission.setVisibility(View.VISIBLE);
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS, Uri.fromParts("package", requireContext().getPackageName(), null));
settingsIntent.launch(intent);
return;
}
permissionLauncher.launch(Manifest.permission.READ_CONTACTS);
}
// permission is already granted
loadContacts();
}
// filters contact list w.r.t searchInput
private void filterContactList(String searchInput) {
new Thread(() -> {
if (searchInput.isEmpty()) {
contactListAdapter.submitList(contactList);
submitContactList(contactList);
return;
}
@@ -145,6 +170,21 @@ public class ContactListFragment extends Fragment {
}
private void submitContactList(ArrayList<ArrayList<Contact>> list) {
if (contactList != null && contactList.isEmpty()){
binding.errorView.setVisibility(View.VISIBLE);
binding.askPermission.setVisibility(View.GONE);
binding.title.setText(getString(R.string.no_contacts_found));
binding.subTitle.setText(getString(R.string.there_are_no_contacts_added_in_your_contact_directory_please_click_on_the_create_new_contact_button_above));
}else{
binding.errorView.setVisibility(View.GONE);
binding.contactRv.setVisibility(View.VISIBLE);
if (contactListAdapter != null) contactListAdapter.submitList(list);
}
}
@SuppressLint("Range")
private void initializeViews() {
// initiating recycler view for contact list
@@ -156,7 +196,14 @@ public class ContactListFragment extends Fragment {
granted -> {
if (granted) {
// user granted the READ_CONTACT permission
binding.errorView.setVisibility(View.GONE);
loadContacts();
} else {
// user didn't allow permission to read contacts
binding.errorView.setVisibility(View.VISIBLE);
binding.title.setText(getString(R.string.we_understand_your_privacy));
binding.subTitle.setText(getString(R.string.to_help_you_connect_with_your_loved_ones_allow_simplitend_to_access_your_contacts));
binding.askPermission.setVisibility(View.VISIBLE);
}
}
);
@@ -168,6 +215,11 @@ public class ContactListFragment extends Fragment {
});
settingsIntent = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(),
result -> {
loadContacts();
});
loadContacts();
}
@@ -187,9 +239,12 @@ public class ContactListFragment extends Fragment {
contactList = contactViewModel.getContactList(requireContext());
if (binding.search.getText().toString().trim().isEmpty())
contactListAdapter.submitList(contactList);
else
{
submitContactList(contactList);
}
else {
binding.errorView.setVisibility(View.GONE);
filterContactList(binding.search.getText().toString().trim().toLowerCase());
}
}
}

View File

@@ -229,7 +229,11 @@ public class CreateContactFragment extends Fragment implements WelcomeContracts.
private void clickEvents() {
binding.backBtn.setOnClickListener(v -> Navigation.findNavController(v).popBackStack());
binding.backBtn.setOnClickListener(v -> {
if (getActivity() != null){
getActivity().onBackPressed();
}
});
binding.nextBtn.setOnClickListener(v -> {

View File

@@ -127,7 +127,11 @@ public class ChangePinFragment extends Fragment implements WelcomeContracts.Upda
private void clickEvents() {
binding.backBtn.setOnClickListener(v -> Navigation.findNavController(v).popBackStack());
binding.backBtn.setOnClickListener(v -> {
if (getActivity() != null){
getActivity().onBackPressed();
}
});
binding.resetPin.setOnClickListener(v -> {
if (allOkay()){

View File

@@ -210,7 +210,11 @@ public class CheckMailFragment extends Fragment implements WelcomeContracts.Veri
private void clickEvents() {
binding.backBtn.setOnClickListener(v -> Navigation.findNavController(v).popBackStack());
binding.backBtn.setOnClickListener(v -> {
if (getActivity() != null){
getActivity().onBackPressed();
}
});
binding.submit.setOnClickListener(v -> {

View File

@@ -69,8 +69,11 @@ public class ForgotPinFragment extends Fragment implements WelcomeContracts.Send
private void clickEvents() {
binding.backBtn.setOnClickListener(v ->
Navigation.findNavController(v).popBackStack());
binding.backBtn.setOnClickListener(v -> {
if (getActivity() != null){
getActivity().onBackPressed();
}
});
binding.submit.setOnClickListener(v -> {
AppUtil.closeKeyboard(requireActivity());

View File

@@ -107,7 +107,11 @@ public class CreatePinFragment extends Fragment implements WelcomeContracts.Regi
private void clickEvents() {
binding.backBtn.setOnClickListener(v -> Navigation.findNavController(v).popBackStack());
binding.backBtn.setOnClickListener(v -> {
if (getActivity() != null){
getActivity().onBackPressed();
}
});
binding.setPin.setOnClickListener(v ->
{

View File

@@ -284,7 +284,11 @@ public class LocationFragment extends Fragment implements OnMapReadyCallback,
private void clickEvents() {
binding.backBtn.setOnClickListener(v -> Navigation.findNavController(v).popBackStack());
binding.backBtn.setOnClickListener(v -> {
if (getActivity() != null){
getActivity().onBackPressed();
}
});
binding.submit.setOnClickListener(v ->
{

View File

@@ -4,7 +4,6 @@ import android.app.DatePickerDialog;
import android.app.ProgressDialog;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.text.InputFilter;
import android.util.Log;
@@ -13,11 +12,11 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.DatePicker;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider;
import androidx.navigation.Navigation;
@@ -54,10 +53,6 @@ public class RegisterFragment extends Fragment implements WelcomeContracts.Verif
private DatePickerDialog datePickerDialog;
public RegisterFragment() {
// required empty const.
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
@@ -85,9 +80,22 @@ public class RegisterFragment extends Fragment implements WelcomeContracts.Verif
progressDialog = new ProgressDialog(requireContext());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
datePickerDialog = new DatePickerDialog(requireContext());
}
// date picker dialog
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR) - 18);
datePickerDialog = new DatePickerDialog(requireContext(),
(datePicker, year, month, dayOfMonth) -> {
setDOB(year, month, dayOfMonth);
binding.contactNumber.requestFocus();
if (getActivity() != null) {
getActivity().getWindow()
.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
}
}, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH));
datePickerDialog.getDatePicker().setMaxDate(calendar.getTimeInMillis());
countryCodeList = viewModel.loadCountryCodeDropDown(requireContext());
@@ -117,9 +125,8 @@ public class RegisterFragment extends Fragment implements WelcomeContracts.Verif
binding.name.setOnEditorActionListener((textView, i, keyEvent) -> {
AppUtil.closeKeyboard(requireActivity());
binding.name.clearFocus();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
pickDate();
}
pickDate();
return true;
});
}
@@ -190,7 +197,11 @@ public class RegisterFragment extends Fragment implements WelcomeContracts.Verif
private void clickEvents() {
binding.backBtn.setOnClickListener(v -> Navigation.findNavController(v).popBackStack());
binding.backBtn.setOnClickListener(v -> {
if (getActivity() != null){
getActivity().onBackPressed();
}
});
binding.nextBtn.setOnClickListener(v -> {
@@ -211,11 +222,8 @@ public class RegisterFragment extends Fragment implements WelcomeContracts.Verif
binding.dob.setOnClickListener(v -> {
binding.dob.setError(null);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
AppUtil.closeKeyboard(requireActivity());
pickDate();
}
pickDate();
});
binding.tncBtn.setOnClickListener(v -> {
@@ -224,13 +232,6 @@ public class RegisterFragment extends Fragment implements WelcomeContracts.Verif
startActivity(intent);
});
// static thing for lower android versions
// todo should be removed afterwards
binding.dob.setOnLongClickListener(v -> {
binding.dob.setText("12-12-2001");
return false;
});
}
private void removeExistingErrors() {
@@ -279,16 +280,15 @@ public class RegisterFragment extends Fragment implements WelcomeContracts.Verif
binding.contactNumber.getText().toString().trim().length() < 10) {
binding.contactNumber.setError("Invalid");
allOkay = false;
}else if (binding.countryCodes.getSelectedIndex() == -1 ||
binding.countryCodes.getSelectedIndex() >= countryCodeList.size()){
} 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{
} else {
// validating phone number
try {
Phonenumber.PhoneNumber phone_number = PhoneNumberUtil.getInstance().parse(countryCodeList.get(binding.countryCodes.getSelectedIndex())+
binding.contactNumber.getText().toString(), "US");
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");
@@ -357,26 +357,10 @@ public class RegisterFragment extends Fragment implements WelcomeContracts.Verif
goForward();
}
@RequiresApi(api = Build.VERSION_CODES.N)
private void pickDate() {
if (datePickerDialog == null) return;
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR) - 18);
datePickerDialog.getDatePicker().setMaxDate(calendar.getTimeInMillis());
datePickerDialog.setOnDateSetListener((view, year, month, dayOfMonth) -> {
setDOB(year, month, dayOfMonth);
binding.contactNumber.requestFocus();
if (getActivity() != null) {
getActivity().getWindow()
.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
}
});
datePickerDialog.show();
}

View File

@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="256dp"
android:height="256dp"
android:viewportWidth="256"
android:viewportHeight="256">
<path
android:pathData="M18,18c-1.4,1.4 -2,3.3 -2,6.2 0,4 0.5,4.6 16,20.3l16,16.1 0,9.7 0,9.7 -10,-0c-11.8,-0 -14,1.2 -14,8 0,6.8 2.2,8 14,8l10,-0 0,12 0,12 -10,-0c-11.8,-0 -14,1.2 -14,8 0,6.8 2.2,8 14,8l10,-0 0,12 0,12 -10,-0c-11.8,-0 -14,1.2 -14,8 0,6.8 2.2,8 14,8l10,-0 0,23.2c0,26 0.5,28.2 7.1,34.5 6.9,6.5 4,6.3 77.1,6.3 75.1,-0 70.8,0.4 78.4,-8.3l3.9,-4.5 6.7,6.4c5.9,5.7 7,6.4 10.7,6.4 5.5,-0 8.1,-2.6 8.1,-8.2 0,-3.9 -0.5,-4.7 -12,-16.3l-12,-12.1 0,-84.7c0,-93.5 0.3,-88.6 -6.3,-95.6 -7,-7.4 -3.4,-7.1 -77.7,-7.1 -62.2,-0 -66.8,0.2 -70.5,1.9 -5,2.2 -10.9,8.6 -12.5,13.6l-1.2,3.7 -9.8,-9.6c-9.1,-9 -10,-9.6 -13.9,-9.6 -2.8,-0 -4.7,0.6 -6.1,2zM197.2,34.8l2.3,2.3 0.3,75.2 0.2,75.2 -8.1,-8.2 -8.2,-8.1 -0.1,-10.4c-0.1,-11.9 -1.9,-16.9 -8.7,-23.7 -6.7,-6.6 -11.8,-8.5 -23.9,-8.9l-10.5,-0.4 -3.8,-3.6 -3.8,-3.7 6.3,-0.6c11.3,-1 21,-7.6 26,-17.7 1.9,-3.9 2.3,-6.3 2.3,-14.2 0,-11.1 -1.9,-16.2 -8.6,-22.9 -6.7,-6.7 -11.8,-8.6 -22.9,-8.6 -7.9,-0 -10.3,0.4 -14.2,2.3 -10,5 -16.7,14.7 -17.7,25.9l-0.6,6.3 -19.9,-19.9 -19.9,-19.9 0.5,-7.1c0.6,-7.6 2.2,-10.6 6.2,-11.4 1.1,-0.3 29.7,-0.4 63.3,-0.3l61.2,0.1 2.3,2.3zM143.8,75c13,7.9 7.4,28 -7.8,28 -15.2,-0 -20.8,-20.1 -7.8,-28 4.3,-2.6 11.3,-2.6 15.6,-0zM109.9,129.2c-9.8,3.3 -18.3,11.9 -20.9,21.2 -1.8,6.6 -0.9,18.1 1.8,23.8 3,6 9,12 15,15 4.4,2.2 6,2.3 28.2,2.6 24.9,0.4 28.6,-0.1 35.1,-4.3l3.6,-2.3 13.8,13.8 13.9,13.9 -1.2,3.9c-0.7,2.2 -2,4.6 -2.9,5.3 -1.3,1.2 -12.7,1.4 -64.4,1.4l-62.8,-0 -2.3,-2.3 -2.3,-2.3 -0.3,-71.2 -0.2,-71.2 25.5,25.5 25.5,25.5 -5.1,1.7zM145.9,158.4c14.2,14.2 14.3,14.4 12,15.7 -1.8,1.1 -7.3,1.4 -21.9,1.4 -17.9,-0 -19.8,-0.2 -23,-2.1 -12.6,-7.3 -9.9,-25.1 4.3,-28.4 1.7,-0.5 5.7,-0.8 8.7,-0.9l5.5,-0.1 14.4,14.4z"
android:fillColor="#000000"
android:strokeColor="#00000000"/>
</vector>

View File

@@ -144,7 +144,7 @@
app:cornerRadius="25dp" />
<TextView
android:id="@+id/register_btn"
android:id="@+id/resend_code"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"

View File

@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
@@ -87,10 +88,77 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/contact_rv"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:overScrollMode="never"
tools:listitem="@layout/contact_view_holder"
/>
<LinearLayout
android:id="@+id/error_view"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/_60sdp"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:layout_width="@dimen/_60sdp"
android:layout_height="@dimen/_60sdp"
android:contentDescription="@string/no_contacts_found"
android:layout_marginBottom="@dimen/_5sdp"
app:srcCompat="@drawable/ic_no_contacts"
app:tint="@color/color_primary" />
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="@string/no_contacts_found"
android:fontFamily="@font/nunito_semibold"
android:textColor="@color/black"
android:textSize="@dimen/_18ssp"
android:textAlignment="center"
android:layout_marginHorizontal="@dimen/_5sdp"
/>
<TextView
android:id="@+id/sub_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="@string/there_are_no_contacts_added_in_your_contact_directory_please_click_on_the_create_new_contact_button_above"
android:fontFamily="@font/nunito_regular"
android:textColor="@color/black"
android:textSize="@dimen/_14ssp"
android:textAlignment="center"
android:layout_marginTop="@dimen/_5sdp"
android:layout_marginHorizontal="@dimen/_15sdp"
/>
<TextView
android:visibility="gone"
android:id="@+id/ask_permission"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/continue_"
android:fontFamily="@font/nunito_semibold"
android:textColor="@color/black"
android:textSize="@dimen/_16ssp"
android:layout_marginTop="@dimen/_5sdp"
/>
</LinearLayout>
</LinearLayout>

View File

@@ -559,7 +559,7 @@
<com.google.android.material.button.MaterialButton
android:id="@+id/done"
android:visibility="gone"
android:visibility="visible"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="15dp"

View File

@@ -558,7 +558,7 @@
<com.google.android.material.button.MaterialButton
android:id="@+id/done"
android:visibility="gone"
android:visibility="visible"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="15dp"

View File

@@ -15,6 +15,9 @@
<item name="android:textColor">@color/black</item>
<item name="android:textCursorDrawable">@drawable/primary_cursor_drawable</item>
<item name="android:windowBackground">@drawable/splash_screen</item>
<!-- <item name="android:datePickerStyle">@style/myDatePickerStyle</item>-->
</style>
// top corner rounded bottom sheet
@@ -24,5 +27,10 @@
<style name="bottomSheetStyleWrapper" parent="Widget.Design.BottomSheet.Modal">
<item name="android:background">@android:color/transparent</item>
</style>
// date picker dialog theme
<style name="myDatePickerStyle" parent="android:Widget.Material.DatePicker">
<item name="android:datePickerMode">spinner</item>
</style>
</resources>

View File

@@ -121,7 +121,7 @@
<string name="family_and_friends_contacts">Family &amp; friends contacts</string>
<string name="medication_reminder">Medication Reminder</string>
<string name="medical_information">Medical Information</string>
<string name="setup_routine">Setup routine</string>
<string name="setup_routine">Setup Activity</string>
<string name="frequently_used_apps">Frequently used apps</string>
<string name="skip_to_dashboard">Skip to dashboard</string>
<string name="ast">*</string>
@@ -309,5 +309,10 @@
<string name="setup_with_fingerprint_or_faceid">Setup security</string>
<string name="no_new_gadgets_monitor_your_loved_one_s_activity_using_his_or_her_smartphone">No new gadgets! monitor your loved one\'s activity using his or her smartphone</string>
<string name="default_price">595</string>
<string name="we_understand_your_privacy">We understand your privacy.</string>
<string name="to_help_you_connect_with_your_loved_ones_allow_simplitend_to_access_your_contacts">To help you connect with your loved one allow SimpliTend to access your contacts.</string>
<string name="continue_"><u>Continue</u></string>
<string name="no_contacts_found">No contacts found.</string>
<string name="there_are_no_contacts_added_in_your_contact_directory_please_click_on_the_create_new_contact_button_above">There are no contacts added in your contact directory. Please click on the "Create New Contact" button above.</string>
</resources>