.
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
package com.ssb.simplitend.caregiverdashboard.activities;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.os.Bundle;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import com.ssb.simplitend.R;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.ssb.simplitend.databinding.ActivityContactAdminBinding;
|
||||
|
||||
public class ContactAdminActivity extends AppCompatActivity {
|
||||
@@ -46,17 +45,6 @@ public class ContactAdminActivity extends AppCompatActivity {
|
||||
return false;
|
||||
});
|
||||
|
||||
binding.query.setOnTouchListener((v, event) -> {
|
||||
if (binding.query.hasFocus()) {
|
||||
v.getParent().requestDisallowInterceptTouchEvent(true);
|
||||
if ((event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_SCROLL) {
|
||||
v.getParent().requestDisallowInterceptTouchEvent(false);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void clickEvents() {
|
||||
|
||||
@@ -2,13 +2,23 @@ package com.ssb.simplitend.cg_subscription;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.text.SpannableString;
|
||||
import android.text.Spanned;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.text.style.ClickableSpan;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.google.firebase.crashlytics.FirebaseCrashlytics;
|
||||
import com.google.firebase.crashlytics.internal.common.CrashlyticsCore;
|
||||
import com.google.firebase.crashlytics.internal.model.CrashlyticsReport;
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.apputils.AppUtil;
|
||||
import com.ssb.simplitend.apputils.CaregiverDataCache;
|
||||
@@ -90,6 +100,10 @@ public class CgSubscriptionActivity extends AppCompatActivity
|
||||
}
|
||||
});
|
||||
|
||||
binding.contactAdmin.setOnClickListener(view -> {
|
||||
contactMail();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void payForSubscription() {
|
||||
@@ -170,6 +184,39 @@ public class CgSubscriptionActivity extends AppCompatActivity
|
||||
presenter.getSubscriptionPlans(token, this);
|
||||
|
||||
paymentSheet = new PaymentSheet(this, this::onPaymentSheetResult);
|
||||
|
||||
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 contactMail() {
|
||||
String contact_email = getString(R.string.contact_email);
|
||||
|
||||
Intent intent = new Intent(Intent.ACTION_SENDTO);
|
||||
intent.setData(Uri.fromParts("mailto", contact_email, null));
|
||||
|
||||
if (intent.resolveActivity(getPackageManager()) != null) {
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
|
||||
// payment callback
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.ssb.simplitend.patientprofile;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.Drawable;
|
||||
@@ -150,8 +149,10 @@ public class RegisterCompleteFragment extends Fragment implements ProfileContrac
|
||||
gotoPatientDashBoard();
|
||||
}else{
|
||||
AppUtil.showAlert(requireContext(),
|
||||
"Ask Caregiver to Subscribe",
|
||||
"Kindly ask CareGiver to complete SimpliTend subscription.",
|
||||
"Kindly ask Caregiver to complete SimpliTend subscription.",
|
||||
"Once your caregiver has completed the " +
|
||||
"subscription, you will be able to use the " +
|
||||
"application.",
|
||||
"OK",
|
||||
((dialogInterface, i) -> {
|
||||
|
||||
@@ -159,8 +160,10 @@ public class RegisterCompleteFragment extends Fragment implements ProfileContrac
|
||||
}
|
||||
} else {
|
||||
AppUtil.showAlert(requireContext(),
|
||||
"Ask Caregiver to register",
|
||||
"Kindly ask CareGiver to complete registration.",
|
||||
"Kindly ask Caregiver to complete registration",
|
||||
"Once your caregiver has completed the " +
|
||||
"registration, you will be able to use the " +
|
||||
"application.",
|
||||
"OK",
|
||||
((dialogInterface, i) -> {
|
||||
|
||||
|
||||
@@ -144,6 +144,7 @@ public class AddReminderFragment extends Fragment implements CompoundButton.OnCh
|
||||
});
|
||||
|
||||
binding.dosageDrop.setOnClickListener(v -> {
|
||||
AppUtil.closeKeyboard(requireActivity());
|
||||
binding.dosageSpinner.show();
|
||||
});
|
||||
|
||||
|
||||
@@ -99,6 +99,15 @@ public class ReminderAdapter extends RecyclerView.Adapter<ReminderAdapter.Remind
|
||||
public void setReminder(ReminderResult reminder, int position){
|
||||
binding.medName.setText(reminder.medicine_name);
|
||||
|
||||
String instruction;
|
||||
if (reminder.medication_instruction == null || reminder.medication_instruction.trim().isEmpty()){
|
||||
instruction = "None";
|
||||
}else{
|
||||
instruction = reminder.medication_instruction;
|
||||
}
|
||||
|
||||
binding.instruction.setText(instruction);
|
||||
|
||||
SimpleDateFormat input_sdf = new SimpleDateFormat("HH:mm:ss", Locale.getDefault());
|
||||
SimpleDateFormat output_sdf = new SimpleDateFormat("hh:mm a", Locale.getDefault());
|
||||
|
||||
@@ -163,27 +172,27 @@ public class ReminderAdapter extends RecyclerView.Adapter<ReminderAdapter.Remind
|
||||
if (routine_calendar.get(Calendar.DAY_OF_MONTH) == selected_calendar.get(Calendar.DAY_OF_MONTH)){
|
||||
// it is the same day on which routine is checked
|
||||
// as routine done date is equal to selected_tab date
|
||||
binding.sideBar.setBackgroundTintList(AppCompatResources.getColorStateList(itemView.getContext(), R.color.color_primary));
|
||||
binding.card.setCardBackgroundColor(AppCompatResources.getColorStateList(itemView.getContext(), R.color.color_accent));
|
||||
binding.card.setCardBackgroundColor(AppCompatResources.getColorStateList(itemView.getContext(), R.color.color_primary));
|
||||
binding.innerCard.setBackgroundTintList(AppCompatResources.getColorStateList(itemView.getContext(), R.color.color_accent));
|
||||
binding.done.setImageResource(R.drawable.ic_done_accent_2);
|
||||
}else{
|
||||
// item selected. un-selecting now
|
||||
binding.sideBar.setBackgroundTintList(null);
|
||||
binding.card.setCardBackgroundColor(AppCompatResources.getColorStateList(itemView.getContext(), R.color.white_bg));
|
||||
binding.card.setCardBackgroundColor(AppCompatResources.getColorStateList(itemView.getContext(), R.color.color_accent));
|
||||
binding.innerCard.setBackgroundTintList(AppCompatResources.getColorStateList(itemView.getContext(), R.color.white));
|
||||
binding.done.setImageResource(R.drawable.ic_done_accent);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
Toast.makeText(itemView.getContext(), "Couldn't mark it done.", Toast.LENGTH_SHORT).show();
|
||||
// item selected. un-selecting now
|
||||
binding.sideBar.setBackgroundTintList(null);
|
||||
binding.card.setCardBackgroundColor(AppCompatResources.getColorStateList(itemView.getContext(), R.color.white_bg));
|
||||
binding.card.setCardBackgroundColor(AppCompatResources.getColorStateList(itemView.getContext(), R.color.color_accent));
|
||||
binding.innerCard.setBackgroundTintList(AppCompatResources.getColorStateList(itemView.getContext(), R.color.white));
|
||||
binding.done.setImageResource(R.drawable.ic_done_accent);
|
||||
}
|
||||
}else{
|
||||
// item selected. un-selecting now
|
||||
binding.sideBar.setBackgroundTintList(null);
|
||||
binding.card.setCardBackgroundColor(AppCompatResources.getColorStateList(itemView.getContext(), R.color.white_bg));
|
||||
binding.card.setCardBackgroundColor(AppCompatResources.getColorStateList(itemView.getContext(), R.color.color_accent));
|
||||
binding.innerCard.setBackgroundTintList(AppCompatResources.getColorStateList(itemView.getContext(), R.color.white));
|
||||
binding.done.setImageResource(R.drawable.ic_done_accent);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,9 +3,7 @@ package com.ssb.simplitend.welcome.welcomepatient.fragments.contacts;
|
||||
import static com.ssb.simplitend.apputils.RetrofitHelper.CREATE_CONTACT;
|
||||
import static com.ssb.simplitend.apputils.RetrofitHelper.UPDATE_CONTACT;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
@@ -14,7 +12,6 @@ import android.os.Handler;
|
||||
import android.text.InputFilter;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.EditText;
|
||||
@@ -92,6 +89,9 @@ public class CreateContactFragment extends Fragment implements WelcomeContracts.
|
||||
// Remote contact list
|
||||
protected List<ContactListResponse> contactList;
|
||||
|
||||
private boolean isSosSet, current_contact_sos;
|
||||
private String sos_contact_name;
|
||||
|
||||
public CreateContactFragment() {
|
||||
// required empty const.
|
||||
}
|
||||
@@ -147,8 +147,9 @@ public class CreateContactFragment extends Fragment implements WelcomeContracts.
|
||||
loadRemoteContactList();
|
||||
|
||||
binding.sosCheck.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||
if (isChecked) {
|
||||
contactViewModel.showSOSDecision(requireContext());
|
||||
if (isChecked && !current_contact_sos) {
|
||||
contactViewModel.showSOSDecision(requireContext(), isSosSet, sos_contact_name,
|
||||
binding.name.getText().toString());
|
||||
}
|
||||
});
|
||||
|
||||
@@ -341,35 +342,42 @@ public class CreateContactFragment extends Fragment implements WelcomeContracts.
|
||||
binding.relationship.setText(getString(R.string.caregiver));
|
||||
binding.relationship.setEnabled(false);
|
||||
|
||||
//email is important
|
||||
binding.emailTitle.setText(getString(R.string.email_address)); // with asterisk
|
||||
|
||||
binding.caregiverCheckView.setVisibility(View.VISIBLE);
|
||||
this.mustBeeCaregiver = true;
|
||||
binding.caregiverCheck.setChecked(true);
|
||||
}
|
||||
|
||||
// checking if there is any SOS contact already in list
|
||||
boolean isSosSet = false;
|
||||
isSosSet = false;
|
||||
int sos_contact_id = -1;
|
||||
|
||||
for (ContactListResponse contact : contactList) {
|
||||
if (contact.is_sos_contact.equals("1")) {
|
||||
isSosSet = true;
|
||||
sos_contact_id = contact.contact_data.id;
|
||||
if (contact.contact_data != null){
|
||||
sos_contact_id = contact.contact_data.id;
|
||||
sos_contact_name = contact.contact_data.first_name;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
current_contact_sos = false;
|
||||
|
||||
if (isSosSet) {
|
||||
binding.sosCheckView.setVisibility(View.GONE);
|
||||
binding.defaultSos.setVisibility(View.GONE);
|
||||
|
||||
if (contactData != null && sos_contact_id != -1 && sos_contact_id == contactData.id) {
|
||||
// current contact being edited is the SOS contact
|
||||
// thus, sos switch can be edited
|
||||
current_contact_sos = true;
|
||||
binding.sosCheckView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
} else {
|
||||
binding.sosCheckView.setVisibility(View.VISIBLE);
|
||||
binding.defaultSos.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@@ -472,10 +480,11 @@ public class CreateContactFragment extends Fragment implements WelcomeContracts.
|
||||
binding.sosCheck.setChecked(true);
|
||||
}
|
||||
|
||||
// if caregiver cannot change email and phone number
|
||||
// if caregiver, cannot change email and phone number
|
||||
if (contactData.care_giver_data != null && contactData.care_giver_data.id != null) {
|
||||
binding.email.setClickable(false);
|
||||
binding.email.setFocusable(false);
|
||||
binding.emailTitle.setText(getString(R.string.email_address));
|
||||
|
||||
binding.caregiverCheck.setChecked(true);
|
||||
binding.caregiverCheck.setEnabled(false);
|
||||
|
||||
@@ -92,15 +92,22 @@ public class AddContactAdapter extends ListAdapter<ContactData, AddContactAdapte
|
||||
// no contact yet added
|
||||
binding.addImeg.setVisibility(View.VISIBLE);
|
||||
binding.imag.setVisibility(View.GONE);
|
||||
binding.relationship.setVisibility(View.GONE);
|
||||
|
||||
binding.name.setText(itemView.getContext().getString(R.string.add_contact));
|
||||
|
||||
binding.card.setCardBackgroundColor(itemView.getContext().getColor(R.color.color_accent));
|
||||
|
||||
}else{
|
||||
// TODO: 17-07-2023 work on \" part of the string
|
||||
binding.name.setText(contact.first_name);
|
||||
|
||||
if (contact.relationship != null && !contact.relationship.trim().isEmpty()){
|
||||
binding.relationship.setVisibility(View.VISIBLE);
|
||||
binding.relationship.setText(contact.relationship);
|
||||
}else{
|
||||
binding.relationship.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if (contact.contact_photo == null || contact.contact_photo.isEmpty()){
|
||||
binding.addImeg.setVisibility(View.VISIBLE);
|
||||
binding.imag.setVisibility(View.GONE);
|
||||
|
||||
@@ -26,10 +26,8 @@ import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import okhttp3.MultipartBody;
|
||||
import okhttp3.RequestBody;
|
||||
@@ -128,7 +126,7 @@ public class ContactViewModel extends AndroidViewModel {
|
||||
if (gotoAddContactInterface != null) gotoAddContactInterface.gotoAddFragment(bsd);
|
||||
}
|
||||
|
||||
public void showSOSDecision(Context context) {
|
||||
public void showSOSDecision(Context context, boolean isSosSet, String sos_contact_name, String current_name) {
|
||||
|
||||
DecisionBottomsheetBinding binding = DecisionBottomsheetBinding.inflate(LayoutInflater.from(context));
|
||||
|
||||
@@ -136,7 +134,16 @@ public class ContactViewModel extends AndroidViewModel {
|
||||
bsd.setContentView(binding.getRoot());
|
||||
bsd.setCancelable(false);
|
||||
|
||||
binding.text.setText(context.getString(R.string.make_sos));
|
||||
String title;
|
||||
|
||||
if (isSosSet && sos_contact_name != null){
|
||||
title = "Are you sure you want to remove " + sos_contact_name + " as Sos? & add " + current_name +
|
||||
" as Sos?";
|
||||
}else{
|
||||
title = context.getString(R.string.make_sos);
|
||||
}
|
||||
|
||||
binding.text.setText(title);
|
||||
|
||||
binding.positiveBtn.setText(context.getString(R.string.yes));
|
||||
binding.negativeBtn.setText(context.getString(R.string.no));
|
||||
|
||||
@@ -8,6 +8,7 @@ import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Resources;
|
||||
import android.location.Address;
|
||||
import android.location.Geocoder;
|
||||
import android.location.Location;
|
||||
@@ -21,6 +22,8 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.ScrollView;
|
||||
import android.widget.Toast;
|
||||
|
||||
@@ -112,6 +115,16 @@ public class LocationFragment extends Fragment implements OnMapReadyCallback,
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
binding = LocationFragmentBinding.inflate(inflater, container, false);
|
||||
|
||||
try {
|
||||
// setting height of mapview w.r.t screen size
|
||||
int map_height = (int) (Resources.getSystem().getDisplayMetrics().heightPixels * 0.7f);
|
||||
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) binding.mapView.getLayoutParams();
|
||||
layoutParams.height = map_height;
|
||||
binding.mapView.setLayoutParams(layoutParams);
|
||||
} catch (Exception e) {
|
||||
// do nothing as default height is 350sdp
|
||||
}
|
||||
|
||||
viewModel = new ViewModelProvider(requireActivity()).get(WelcomeViewModel.class);
|
||||
|
||||
initViews();
|
||||
@@ -325,7 +338,9 @@ public class LocationFragment extends Fragment implements OnMapReadyCallback,
|
||||
|
||||
binding.search.setOnClickListener(v -> {
|
||||
|
||||
List<Place.Field> fields = Arrays.asList(Place.Field.ID, Place.Field.NAME, Place.Field.LAT_LNG);
|
||||
List<Place.Field> fields = Arrays.asList(Place.Field.ID
|
||||
,Place.Field.NAME,
|
||||
Place.Field.LAT_LNG, Place.Field.ADDRESS);
|
||||
|
||||
Intent intent = new Autocomplete.IntentBuilder(AutocompleteActivityMode.OVERLAY, fields)
|
||||
.build(requireContext());
|
||||
@@ -445,7 +460,7 @@ public class LocationFragment extends Fragment implements OnMapReadyCallback,
|
||||
googleMap.setOnMapClickListener(this);
|
||||
|
||||
if (currentLocation != null) {
|
||||
addMarker(currentLocation, "Selected location");
|
||||
addMarker(currentLocation, null);
|
||||
googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(currentLocation, 14));
|
||||
}else{
|
||||
googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(40.75796541422796, -73.98557368665934), 14));
|
||||
@@ -454,7 +469,7 @@ public class LocationFragment extends Fragment implements OnMapReadyCallback,
|
||||
|
||||
@Override
|
||||
public void onMapClick(@NonNull LatLng latLng) {
|
||||
addMarker(latLng, "Selected location");
|
||||
addMarker(latLng, null);
|
||||
}
|
||||
|
||||
private void addMarker(LatLng latLng, String title) {
|
||||
@@ -463,9 +478,7 @@ public class LocationFragment extends Fragment implements OnMapReadyCallback,
|
||||
if (marker != null && marker.isVisible()) marker.remove();
|
||||
marker = null;
|
||||
marker = googleMap.addMarker(new MarkerOptions()
|
||||
.position(latLng).draggable(false)
|
||||
.title(title));
|
||||
|
||||
.position(latLng).draggable(false));
|
||||
|
||||
try {
|
||||
// fetching address from the lag lng
|
||||
@@ -477,7 +490,11 @@ public class LocationFragment extends Fragment implements OnMapReadyCallback,
|
||||
|
||||
binding.zipCode.setText(address.getPostalCode());
|
||||
|
||||
if (address.getThoroughfare() == null || address.getThoroughfare().isEmpty()) {
|
||||
if (title != null){
|
||||
if (marker != null) marker.setTitle(title);
|
||||
|
||||
binding.street.setText(title);
|
||||
}else if (address.getThoroughfare() == null || address.getThoroughfare().isEmpty()) {
|
||||
binding.street.setText(null);
|
||||
} else {
|
||||
binding.street.setText(address.getThoroughfare());
|
||||
@@ -523,6 +540,8 @@ public class LocationFragment extends Fragment implements OnMapReadyCallback,
|
||||
// do nothing as we couldn't load the location from the lat lng
|
||||
}
|
||||
|
||||
binding.addressView.setVisibility(View.VISIBLE);
|
||||
|
||||
binding.street.clearFocus();
|
||||
binding.scrollView.fullScroll(ScrollView.FOCUS_DOWN);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user