.
This commit is contained in:
@@ -29,9 +29,14 @@
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.SimpliTend"
|
||||
tools:targetApi="31">
|
||||
<activity
|
||||
android:name=".patient_dashboard.fragments.CallsActivity"
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait"/>
|
||||
<activity
|
||||
android:name=".patient_dashboard.DirectionToHomeActivity"
|
||||
android:exported="false" />
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".caregiverdashboard.activities.deactivateacc.DeActivateAccountActivity"
|
||||
android:exported="false"
|
||||
|
||||
@@ -290,4 +290,11 @@ public abstract class AppUtil {
|
||||
phone_number, null));
|
||||
if (activity != null) activity.startActivity(intent);
|
||||
}
|
||||
|
||||
public static void messageNumber(Activity activity, String phone_number){
|
||||
Uri uri = Uri.parse("smsto:" + phone_number);
|
||||
Intent intent = new Intent(Intent.ACTION_SENDTO, uri);
|
||||
// intent.putExtra("sms_body", "The SMS text");
|
||||
if (activity != null) activity.startActivity(intent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,15 +2,20 @@ package com.ssb.simplitend.apputils;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.ssb.simplitend.patientprofile.PatientProfileAPIService;
|
||||
import com.ssb.simplitend.welcome.welcomecg.WelcomeApiService;
|
||||
import com.ssb.simplitend.welcome.welcomecg.mvvm.CareGiverData;
|
||||
import com.ssb.simplitend.welcome.welcomepatient.fragments.contacts.mvvm.models.ContactData;
|
||||
import com.ssb.simplitend.welcome.welcomepatient.fragments.contacts.mvvm.models.ContactListResponse;
|
||||
import com.ssb.simplitend.welcome.welcomepatient.mvvm.WelcomeApiService;
|
||||
import com.ssb.simplitend.welcome.welcomepatient.mvvm.models.CallResponse;
|
||||
import com.ssb.simplitend.welcome.welcomepatient.mvvm.models.PatientData;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
@@ -19,6 +24,64 @@ public class PatientDataCache {
|
||||
|
||||
private static PatientData patientData;
|
||||
|
||||
private static ArrayList<ContactData> contactList;
|
||||
|
||||
public synchronized static void setContactList(ArrayList<ContactData> newContactList){
|
||||
contactList = newContactList;
|
||||
}
|
||||
|
||||
public synchronized static void getContactList(Context context,
|
||||
String token,
|
||||
@NonNull PatientDataCache.GetContactList callBack,
|
||||
boolean show_progress){
|
||||
if (contactList != null){
|
||||
callBack.contactList(contactList);
|
||||
return;
|
||||
}
|
||||
|
||||
updateContactList(context, token, callBack, show_progress);
|
||||
}
|
||||
|
||||
private static void updateContactList(Context context, String token, GetContactList callBack, boolean show_progress) {
|
||||
WelcomeApiService apiService = RetrofitHelper.getRetrofit().create(WelcomeApiService.class);
|
||||
|
||||
ProgressDialog progressDialog = new ProgressDialog(context);
|
||||
progressDialog.setTitle("Please wait...");
|
||||
progressDialog.setMessage("while we fetch details for you...");
|
||||
progressDialog.setCancelable(false);
|
||||
if (show_progress) {
|
||||
progressDialog.show();
|
||||
}
|
||||
|
||||
apiService.getContactList(token)
|
||||
.enqueue(new Callback<CallResponse<List<ContactListResponse>>>() {
|
||||
@Override
|
||||
public void onResponse(Call<CallResponse<List<ContactListResponse>>> call, Response<CallResponse<List<ContactListResponse>>> response) {
|
||||
progressDialog.dismiss();
|
||||
if (response.code() == 200 && response.body() != null && response.body().result != null){
|
||||
ArrayList<ContactData> contactList = new ArrayList<>();
|
||||
|
||||
for (ContactListResponse contactResponse : response.body().result){
|
||||
contactResponse.contact_data.contact_id = contactResponse.id;
|
||||
contactResponse.contact_data.is_doctor = contactResponse.is_doctor;
|
||||
contactList.add(contactResponse.contact_data);
|
||||
}
|
||||
|
||||
setContactList(contactList);
|
||||
callBack.contactList(contactList);
|
||||
}else{
|
||||
callBack.contactList(null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<CallResponse<List<ContactListResponse>>> call, Throwable t) {
|
||||
progressDialog.dismiss();
|
||||
callBack.contactList(null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public synchronized static void setPatientData(PatientData data){
|
||||
patientData = data;
|
||||
}
|
||||
@@ -77,4 +140,9 @@ public class PatientDataCache {
|
||||
public interface GetPatientCallBack{
|
||||
void patientData(PatientData patientData);
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface GetContactList{
|
||||
void contactList(ArrayList<ContactData> contactList);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
package com.ssb.simplitend.caregiverdashboard.activities;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.databinding.ActivityPatientProfileShowerBinding;
|
||||
import com.ssb.simplitend.patientprofile.medicalinfo.MedicalInfoFragment;
|
||||
|
||||
@@ -377,6 +377,8 @@ public class CgDashBoardFragment extends Fragment implements
|
||||
|
||||
if (nearestReminder.upcoming_time == null){
|
||||
binding.nearestReminder.setText(R.string.all_reminder_done);
|
||||
viewModel.upcomingReminderText = binding.nearestReminder.getText().toString();
|
||||
viewModel.dailyReminderText = binding.dailyReminder.getText().toString();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -460,6 +462,9 @@ public class CgDashBoardFragment extends Fragment implements
|
||||
|
||||
if (nearestActivity.upcoming_time == null){
|
||||
binding.upcomingActivity.setText(R.string.no_upcoming_activities);
|
||||
|
||||
viewModel.upcomingActivityText = binding.upcomingActivity.getText().toString();
|
||||
viewModel.ongoingActivityText = binding.onGoingActivity.getText().toString();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,8 +5,11 @@ import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.location.Location;
|
||||
import android.location.LocationManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.activity.result.ActivityResultLauncher;
|
||||
@@ -27,9 +30,9 @@ import com.google.android.gms.maps.OnMapReadyCallback;
|
||||
import com.google.android.gms.maps.SupportMapFragment;
|
||||
import com.google.android.gms.maps.model.LatLng;
|
||||
import com.google.android.gms.maps.model.LatLngBounds;
|
||||
import com.google.android.gms.maps.model.Marker;
|
||||
import com.google.android.gms.maps.model.MarkerOptions;
|
||||
import com.google.android.gms.maps.model.PolylineOptions;
|
||||
import com.google.android.material.bottomsheet.BottomSheetBehavior;
|
||||
import com.google.maps.DirectionsApi;
|
||||
import com.google.maps.GeoApiContext;
|
||||
import com.google.maps.android.PolyUtil;
|
||||
@@ -46,6 +49,12 @@ public class DirectionToHomeActivity extends AppCompatActivity
|
||||
|
||||
protected ActivityDirectionToHomeBinding binding;
|
||||
|
||||
public static final String LAT_KEY = "lat_key";
|
||||
public static final String LNG_KEY = "lng_key";
|
||||
|
||||
private double pat_lat, pat_lng;
|
||||
private double pat_cur_lat, pat_cur_lng;
|
||||
|
||||
private ActivityResultLauncher<String[]> locationPermissionLauncher;
|
||||
private ActivityResultLauncher<Intent> enableLocationIntent;
|
||||
private FusedLocationProviderClient fusedLocationProviderClient;
|
||||
@@ -53,16 +62,49 @@ public class DirectionToHomeActivity extends AppCompatActivity
|
||||
private LocationRequest locationRequest;
|
||||
private GoogleMap mGoogleMap;
|
||||
|
||||
private BottomSheetBehavior<LinearLayout> bottomSheetBehavior;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
binding = ActivityDirectionToHomeBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
|
||||
Intent intent = getIntent();
|
||||
if (intent != null && intent.hasExtra(LAT_KEY) && intent.hasExtra(LNG_KEY)){
|
||||
pat_lat = intent.getDoubleExtra(LAT_KEY, 0);
|
||||
pat_lng = intent.getDoubleExtra(LNG_KEY, 0);
|
||||
}else {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
getLocationPermission();
|
||||
|
||||
initViews();
|
||||
|
||||
clickEvents();
|
||||
|
||||
}
|
||||
|
||||
private void clickEvents() {
|
||||
binding.closeBtn.setOnClickListener(v -> {
|
||||
if(bottomSheetBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED){
|
||||
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
|
||||
}
|
||||
});
|
||||
|
||||
binding.goBtn.setOnClickListener(v -> {
|
||||
String cur_location = pat_cur_lat + "," + pat_cur_lng;
|
||||
String pat_location = pat_lat + "," + pat_lng;
|
||||
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
|
||||
Uri.parse("http://maps.google.com/maps?saddr=" + cur_location + "&daddr=" + pat_location));
|
||||
startActivity(intent);
|
||||
});
|
||||
|
||||
binding.backBtn.setOnClickListener(v -> {
|
||||
onBackPressed();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -86,6 +128,23 @@ public class DirectionToHomeActivity extends AppCompatActivity
|
||||
fusedLocationProviderClient = LocationServices.getFusedLocationProviderClient(this);
|
||||
locationRequest = new LocationRequest.Builder(LocationRequest.PRIORITY_HIGH_ACCURACY, 5000)
|
||||
.build();
|
||||
|
||||
bottomSheetBehavior = BottomSheetBehavior.from(binding.directionBs);
|
||||
bottomSheetBehavior.addBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() {
|
||||
@Override
|
||||
public void onStateChanged(@NonNull View bottomSheet, int newState) {
|
||||
if (newState == BottomSheetBehavior.STATE_COLLAPSED){
|
||||
binding.closeBtn.setVisibility(View.GONE);
|
||||
}else if (newState == BottomSheetBehavior.STATE_EXPANDED){
|
||||
binding.closeBtn.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSlide(@NonNull View bottomSheet, float slideOffset) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void getLocationPermission() {
|
||||
@@ -168,6 +227,8 @@ public class DirectionToHomeActivity extends AppCompatActivity
|
||||
}
|
||||
|
||||
private void addMarkersToMap(DirectionsResult results, GoogleMap mMap) throws Exception {
|
||||
pat_cur_lat = results.routes[0].legs[0].startLocation.lat;
|
||||
pat_cur_lng = results.routes[0].legs[0].startLocation.lng;
|
||||
mMap.addMarker(new MarkerOptions().position(new com.google.android.gms.maps.model.LatLng(results.routes[0].legs[0].startLocation.lat,results.routes[0].legs[0].startLocation.lng)).title("Your location"));
|
||||
mMap.addMarker(new MarkerOptions().position(new com.google.android.gms.maps.model.LatLng(results.routes[0].legs[0].endLocation.lat,results.routes[0].legs[0].endLocation.lng)).title("Senior's location"));
|
||||
}
|
||||
@@ -184,7 +245,7 @@ public class DirectionToHomeActivity extends AppCompatActivity
|
||||
int padding = ((getWindowManager().getDefaultDisplay().getWidth() * 10) / 100); // offset from edges of the map
|
||||
// in pixels
|
||||
CameraUpdate cu = CameraUpdateFactory.newLatLngBounds(bounds,
|
||||
padding);
|
||||
padding+100);
|
||||
mMap.animateCamera(cu);
|
||||
}
|
||||
|
||||
@@ -232,15 +293,21 @@ public class DirectionToHomeActivity extends AppCompatActivity
|
||||
.apiKey(getString(R.string.GOOGLE_MAPS_API_KEY))
|
||||
.build())
|
||||
.origin(new com.google.maps.model.LatLng(location.getLatitude(), location.getLongitude()))
|
||||
.destination(new com.google.maps.model.LatLng(28.42104670992253, 76.92862066485148))
|
||||
.destination(new com.google.maps.model.LatLng(pat_lat, pat_lng))
|
||||
.alternatives(true)
|
||||
.await();
|
||||
|
||||
addMarkersToMap(directionsResult, mGoogleMap);
|
||||
positionCamera(directionsResult.routes[0], mGoogleMap);
|
||||
addPolyline(directionsResult, mGoogleMap);
|
||||
|
||||
binding.progress.setVisibility(View.GONE);
|
||||
binding.progress.setEnabled(false);
|
||||
binding.directionBs.setVisibility(View.VISIBLE);
|
||||
} catch (Exception e) {
|
||||
Toast.makeText(this, "Couldn't load routes", Toast.LENGTH_SHORT).show();
|
||||
binding.progress.setVisibility(View.GONE);
|
||||
binding.progress.setEnabled(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,178 @@
|
||||
package com.ssb.simplitend.patient_dashboard.fragments;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.os.Bundle;
|
||||
import android.text.InputFilter;
|
||||
import android.view.View;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.TableLayout;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialog;
|
||||
import com.google.i18n.phonenumbers.PhoneNumberUtil;
|
||||
import com.google.i18n.phonenumbers.Phonenumber;
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.apputils.AppUtil;
|
||||
import com.ssb.simplitend.databinding.ActivityCallsBinding;
|
||||
import com.ssb.simplitend.databinding.CallListDialogBinding;
|
||||
import com.ssb.simplitend.databinding.CreateContactViewHolderBinding;
|
||||
import com.ssb.simplitend.welcome.welcomepatient.fragments.contacts.mvvm.AddContactAdapter;
|
||||
import com.ssb.simplitend.welcome.welcomepatient.fragments.contacts.mvvm.models.ContactData;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class CallsActivity extends AppCompatActivity implements AddContactAdapter.ContactClickListener {
|
||||
|
||||
protected ActivityCallsBinding binding;
|
||||
|
||||
public static final String CALL_CONTACT_LIST_KEY = "contact_list_key";
|
||||
|
||||
protected AddContactAdapter contactAdapter;
|
||||
protected ArrayList<ContactData> contactList;
|
||||
|
||||
private String select_phone_number;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
binding = ActivityCallsBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
|
||||
contactList = (ArrayList<ContactData>) getIntent().getSerializableExtra(CALL_CONTACT_LIST_KEY);
|
||||
|
||||
initViews();
|
||||
|
||||
clickEvents();
|
||||
}
|
||||
|
||||
private void clickEvents() {
|
||||
binding.backBtn.setOnClickListener(view -> onBackPressed());
|
||||
}
|
||||
|
||||
private void initViews() {
|
||||
binding.contactRv.setLayoutManager(new GridLayoutManager(this, 2, LinearLayoutManager.VERTICAL, false));
|
||||
contactAdapter = new AddContactAdapter();
|
||||
binding.contactRv.setAdapter(contactAdapter);
|
||||
contactAdapter.setContactClickListener(this);
|
||||
|
||||
if (contactList != null){
|
||||
contactAdapter.submitList(contactList);
|
||||
}else{
|
||||
Toast.makeText(this, "Couldn't load contact list", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
private void showContactDialog(ContactData contactData) {
|
||||
CallListDialogBinding dialogBinding = CallListDialogBinding.inflate(getLayoutInflater());
|
||||
BottomSheetDialog bsd = new BottomSheetDialog(this, R.style.BottomSheetDialog);
|
||||
bsd.setContentView(dialogBinding.getRoot());
|
||||
|
||||
boolean default_contact_set = false;
|
||||
if (contactData.phone_number != null) {
|
||||
addContactView(contactData.phone_number, default_contact_set = true, dialogBinding.contactTable, contactData);
|
||||
select_phone_number = contactData.phone_number;
|
||||
}
|
||||
|
||||
// adding contacts to Contact_rv
|
||||
if (contactData.extra_phone_numbers != null && !contactData.extra_phone_numbers.isEmpty()) {
|
||||
String[] phone_numbers = contactData.extra_phone_numbers.split(",");
|
||||
|
||||
for (String phone_number : phone_numbers) {
|
||||
addContactView(phone_number, phone_numbers.length == 1 && !default_contact_set, dialogBinding.contactTable, contactData);
|
||||
}
|
||||
}
|
||||
|
||||
dialogBinding.callBtn.setOnClickListener(v -> {
|
||||
if (select_phone_number == null){
|
||||
Toast.makeText(this, "Select a contact", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
AppUtil.dialPhone(this, select_phone_number);
|
||||
});
|
||||
|
||||
dialogBinding.messageBtn.setOnClickListener(v -> {
|
||||
if (select_phone_number == null){
|
||||
Toast.makeText(this, "Select a contact", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
AppUtil.messageNumber(this, select_phone_number);
|
||||
});
|
||||
|
||||
bsd.show();
|
||||
}
|
||||
|
||||
private void addContactView(String contact_number, boolean id_default,
|
||||
TableLayout tableLayout, ContactData contactData) {
|
||||
CreateContactViewHolderBinding contact_binding = CreateContactViewHolderBinding.inflate(getLayoutInflater());
|
||||
|
||||
contact_binding.createCountryCodes.setVisibility(View.GONE);
|
||||
contact_binding.createCountryCodes.setEnabled(false);
|
||||
|
||||
contact_binding.createPhoneNumber.setText(contact_number);
|
||||
contact_binding.createPhoneNumber.setEnabled(false);
|
||||
|
||||
contact_binding.defaultCheck.setOnClickListener(v -> {
|
||||
if (!contact_binding.defaultCheck.isSelected()) {
|
||||
selectDefaultContact(tableLayout.indexOfChild(contact_binding.getRoot()), tableLayout);
|
||||
select_phone_number = contact_number;
|
||||
}
|
||||
});
|
||||
|
||||
contact_binding.delete.setOnClickListener(v -> {
|
||||
if (tableLayout.getChildCount() == 1) {
|
||||
Toast.makeText(this, "Cannot be deleted", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
tableLayout.removeView(contact_binding.getRoot());
|
||||
} catch (Exception e) {
|
||||
Toast.makeText(this, "Couldn't delete contact.", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
|
||||
contact_binding.defaultCheck.setSelected(id_default);
|
||||
|
||||
// if contact is a doctor we wont allow the contact to be changes
|
||||
if (contactData != null && contactData.is_doctor != null && contactData.is_doctor.equals("1")){
|
||||
contact_binding.createPhoneNumber.setEnabled(false);
|
||||
contact_binding.createCountryCodes.setEnabled(false);
|
||||
contact_binding.defaultCheck.setEnabled(false);
|
||||
}
|
||||
|
||||
tableLayout.addView(contact_binding.getRoot());
|
||||
}
|
||||
|
||||
private void selectDefaultContact(int index, TableLayout tableLayout) {
|
||||
int count = tableLayout.getChildCount();
|
||||
if (index >= 0 && index < count) {
|
||||
// unselecting all other editBoxes
|
||||
for (int i = 0; i < count; i++) {
|
||||
View view = tableLayout.getChildAt(i);
|
||||
if (view != null) {
|
||||
ImageButton default_check = view.findViewById(R.id.default_check);
|
||||
if (default_check != null) {
|
||||
|
||||
if (i == index) {
|
||||
default_check.setSelected(true);
|
||||
} else {
|
||||
default_check.setSelected(false);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onContactClick(ContactData contactData, int position) {
|
||||
showContactDialog(contactData);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,9 @@
|
||||
package com.ssb.simplitend.patient_dashboard.fragments;
|
||||
|
||||
import static com.ssb.simplitend.patient_dashboard.DirectionToHomeActivity.LAT_KEY;
|
||||
import static com.ssb.simplitend.patient_dashboard.DirectionToHomeActivity.LNG_KEY;
|
||||
import static com.ssb.simplitend.patient_dashboard.fragments.CallsActivity.CALL_CONTACT_LIST_KEY;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
@@ -9,6 +13,7 @@ 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;
|
||||
@@ -24,9 +29,11 @@ import com.ssb.simplitend.apputils.PatientDataCache;
|
||||
import com.ssb.simplitend.databinding.PatientDashboardFragmentBinding;
|
||||
import com.ssb.simplitend.patient_dashboard.DirectionToHomeActivity;
|
||||
import com.ssb.simplitend.welcome.activities.WelcomeActivity;
|
||||
import com.ssb.simplitend.welcome.welcomepatient.fragments.contacts.mvvm.models.ContactData;
|
||||
import com.ssb.simplitend.welcome.welcomepatient.mvvm.models.PatientData;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Locale;
|
||||
|
||||
@@ -37,6 +44,8 @@ public class PatientDashboardFragment extends Fragment {
|
||||
|
||||
private PatientData patientData;
|
||||
|
||||
private ArrayList<ContactData> contactList;
|
||||
|
||||
// date suffixes
|
||||
String[] suffixes =
|
||||
// 0 1 2 3 4 5 6 7 8 9
|
||||
@@ -79,6 +88,11 @@ public class PatientDashboardFragment extends Fragment {
|
||||
setDetails();
|
||||
}), true);
|
||||
|
||||
PatientDataCache.getContactList(requireContext(),"Bearer " + AppUtil.getPatientToken(requireContext()),
|
||||
(contactList1 -> {
|
||||
this.contactList = contactList1;
|
||||
}), false);
|
||||
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
@@ -140,7 +154,24 @@ public class PatientDashboardFragment extends Fragment {
|
||||
binding.closeReminder.setOnClickListener(v -> removeReminder());
|
||||
|
||||
binding.calls.setOnClickListener(v -> {
|
||||
PatientDataCache.getContactList(requireContext(),
|
||||
"Bearer " + AppUtil.getPatientToken(requireContext()), (contactList1 -> {
|
||||
this.contactList = contactList1;
|
||||
|
||||
if (contactList != null){
|
||||
Intent intent = new Intent(requireActivity(), CallsActivity.class);
|
||||
intent.putExtra(CALL_CONTACT_LIST_KEY, contactList);
|
||||
startActivity(intent);
|
||||
|
||||
}else{
|
||||
Toast.makeText(requireContext(), "Couldn't load contact list", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}), true);
|
||||
});
|
||||
|
||||
binding.calls.setOnLongClickListener(v -> {
|
||||
addReminder();
|
||||
return true;
|
||||
});
|
||||
|
||||
binding.profile.setOnClickListener(v -> {
|
||||
@@ -153,9 +184,21 @@ public class PatientDashboardFragment extends Fragment {
|
||||
});
|
||||
|
||||
binding.directions.setOnClickListener(v -> {
|
||||
Intent intent = new Intent(requireActivity(), DirectionToHomeActivity.class);
|
||||
startActivity(intent);
|
||||
if (patientData == null) return;
|
||||
|
||||
try {
|
||||
Intent intent = new Intent(requireActivity(), DirectionToHomeActivity.class);
|
||||
double lat = Double.parseDouble(patientData.lat);
|
||||
double lng = Double.parseDouble(patientData.lng);
|
||||
intent.putExtra(LAT_KEY, lat);
|
||||
intent.putExtra(LNG_KEY, lng);
|
||||
startActivity(intent);
|
||||
}catch (Exception e){
|
||||
Toast.makeText(requireContext(), "Couldn't load your home location", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void updateTime() {
|
||||
|
||||
13
app/src/main/res/drawable/ic_close_cross.xml
Normal file
13
app/src/main/res/drawable/ic_close_cross.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="19.5dp"
|
||||
android:height="18.5dp"
|
||||
android:viewportWidth="19.5"
|
||||
android:viewportHeight="18.5">
|
||||
<path
|
||||
android:pathData="M13.75,5.472 L5.75,13.028M5.75,5.472l8,7.556M18.75,9.25A8.761,8.761 0,0 1,9.75 17.75a8.761,8.761 0,0 1,-9 -8.5A8.761,8.761 0,0 1,9.75 0.75,8.761 8.761,0 0,1 18.75,9.25Z"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="1.5"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#000"
|
||||
android:strokeLineCap="round"/>
|
||||
</vector>
|
||||
12
app/src/main/res/drawable/ic_dotted_dash.xml
Normal file
12
app/src/main/res/drawable/ic_dotted_dash.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="0.5dp"
|
||||
android:height="23dp"
|
||||
android:viewportWidth="1"
|
||||
android:viewportHeight="46">
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0.5,0.5L0.5,45.5"
|
||||
android:strokeWidth="1"
|
||||
android:strokeColor="#707070"
|
||||
android:strokeLineCap="round" />
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/ic_plus.xml
Normal file
9
app/src/main/res/drawable/ic_plus.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="20dp"
|
||||
android:height="20dp"
|
||||
android:viewportWidth="20"
|
||||
android:viewportHeight="20">
|
||||
<path
|
||||
android:pathData="M10,0A10,10 0,1 0,20 10,10.016 10.016,0 0,0 10,0ZM14,10.75L10.75,10.75L10.75,14a0.75,0.75 0,0 1,-1.5 0L9.25,10.75L6,10.75a0.75,0.75 0,0 1,0 -1.5h3.25L9.25,6a0.75,0.75 0,0 1,1.5 0v3.25L14,9.25a0.75,0.75 0,0 1,0 1.5Z"
|
||||
android:fillColor="#292d32"/>
|
||||
</vector>
|
||||
55
app/src/main/res/layout/activity_calls.xml
Normal file
55
app/src/main/res/layout/activity_calls.xml
Normal file
@@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white_bg"
|
||||
android:overScrollMode="never">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/back_btn"
|
||||
android:layout_width="25dp"
|
||||
android:layout_height="25dp"
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:layout_marginVertical="25dp"
|
||||
android:contentDescription="@string/back_button"
|
||||
android:src="@drawable/ic_home_nav_up"
|
||||
app:tint="@android:color/black" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:fontFamily="@font/nunito_medium"
|
||||
android:text="@string/call_and_message_your_loved_ones"
|
||||
android:textAppearance="@style/TextAppearance.Material3.TitleLarge"
|
||||
android:textColor="@color/black" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress_bar"
|
||||
android:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:layout_gravity="center_horizontal"
|
||||
|
||||
android:layout_marginTop="50dp"
|
||||
|
||||
/>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/contact_rv"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:overScrollMode="never" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -1,38 +1,177 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:background="@color/white"
|
||||
android:orientation="vertical"
|
||||
tools:context=".patient_dashboard.DirectionToHomeActivity">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/back_btn"
|
||||
android:layout_width="35sp"
|
||||
android:layout_height="35sp"
|
||||
android:contentDescription="@string/back_button"
|
||||
android:padding="5dp"
|
||||
app:srcCompat="@drawable/ic_home_nav_up"
|
||||
android:layout_marginTop="25dp"
|
||||
android:layout_marginHorizontal="15dp"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/direction_to_home"
|
||||
android:fontFamily="@font/nunito_medium"
|
||||
android:textSize="@dimen/_18ssp"
|
||||
android:textColor="@color/black"
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:layout_marginVertical="15dp"
|
||||
/>
|
||||
|
||||
<fragment
|
||||
android:id="@+id/direction_map"
|
||||
android:name="com.google.android.gms.maps.SupportMapFragment"
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
</LinearLayout>
|
||||
<ImageView
|
||||
android:id="@+id/back_btn"
|
||||
android:layout_width="35sp"
|
||||
android:layout_height="35sp"
|
||||
android:contentDescription="@string/back_button"
|
||||
android:padding="5dp"
|
||||
app:srcCompat="@drawable/ic_home_nav_up"
|
||||
android:layout_marginTop="25dp"
|
||||
android:layout_marginHorizontal="15dp"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/direction_to_home"
|
||||
android:fontFamily="@font/nunito_medium"
|
||||
android:textSize="@dimen/_18ssp"
|
||||
android:textColor="@color/black"
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:layout_marginVertical="15dp"
|
||||
/>
|
||||
|
||||
<fragment
|
||||
android:id="@+id/direction_map"
|
||||
android:name="com.google.android.gms.maps.SupportMapFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/progress"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@android:color/darker_gray"
|
||||
android:alpha="0.7"
|
||||
>
|
||||
|
||||
<ProgressBar
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:layout_centerInParent="true"
|
||||
android:indeterminate="true"
|
||||
android:indeterminateTint="@color/color_primary_dark"
|
||||
|
||||
/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/direction_bs"
|
||||
android:visibility="gone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:behavior_hideable="false"
|
||||
app:behavior_peekHeight="70dp"
|
||||
android:background="@drawable/top_round_corner"
|
||||
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingVertical="15dp"
|
||||
android:paddingHorizontal="15dp">
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2dp"
|
||||
android:background="@color/black"
|
||||
android:layout_marginHorizontal="150dp"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:text="@string/directions"
|
||||
android:fontFamily="@font/nunito_medium"
|
||||
android:textColor="@color/black"
|
||||
android:textAppearance="@style/TextAppearance.Material3.TitleLarge"
|
||||
|
||||
android:layout_marginTop="10dp"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/close_btn"
|
||||
android:visibility="gone"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
|
||||
android:src="@drawable/ic_close_cross"
|
||||
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginTop="15dp"
|
||||
|
||||
/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="15dp"
|
||||
android:layout_margin="15dp"
|
||||
android:background="@drawable/edit_text_bg_2"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:text="@string/your_location"
|
||||
android:fontFamily="@font/nunito_medium"
|
||||
android:textColor="@color/black"
|
||||
android:textAppearance="@style/TextAppearance.Material3.TitleSmall"
|
||||
|
||||
android:drawablePadding="15dp"
|
||||
app:drawableStartCompat="@drawable/ic_plus" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:src="@drawable/ic_dotted_dash"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginVertical="5dp"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:text="@string/home_address_txt"
|
||||
android:fontFamily="@font/nunito_medium"
|
||||
android:textColor="@color/black"
|
||||
android:textAppearance="@style/TextAppearance.Material3.TitleSmall"
|
||||
|
||||
android:drawablePadding="15dp"
|
||||
app:drawableStartCompat="@drawable/ic_plus" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/go_btn"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
|
||||
android:text="@string/go"
|
||||
android:fontFamily="@font/nunito_bold"
|
||||
android:textColor="@color/white"
|
||||
|
||||
app:cornerRadius="5dp"
|
||||
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
104
app/src/main/res/layout/call_list_dialog.xml
Normal file
104
app/src/main/res/layout/call_list_dialog.xml
Normal file
@@ -0,0 +1,104 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/round_corners"
|
||||
android:orientation="vertical"
|
||||
style="@style/BottomSheetDialog"
|
||||
android:backgroundTint="@color/white">
|
||||
|
||||
<View
|
||||
android:id="@+id/dash"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/black"
|
||||
android:layout_marginHorizontal="150dp"
|
||||
android:layout_marginTop="15dp"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:layout_below="@id/dash"
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:text="@string/select_number_to_cal_or_message"
|
||||
android:fontFamily="@font/nunito_medium"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:textColor="@color/black"
|
||||
android:textAppearance="@style/TextAppearance.Material3.TitleMedium"
|
||||
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:layout_marginTop="10dp"
|
||||
|
||||
android:layout_centerHorizontal="true"
|
||||
/>
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/title"
|
||||
>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TableLayout
|
||||
android:id="@+id/contact_table"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="15dp"
|
||||
android:isScrollContainer="true"
|
||||
/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/btns"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:weightSum="10"
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/call_btn"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="5"
|
||||
|
||||
android:text="@string/call"
|
||||
android:fontFamily="@font/nunito_bold"
|
||||
android:textColor="@color/black"
|
||||
android:textAllCaps="false"
|
||||
|
||||
app:backgroundTint="@color/white"
|
||||
app:strokeWidth="1dp"
|
||||
app:strokeColor="@color/color_accent"
|
||||
|
||||
/>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/message_btn"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="5"
|
||||
|
||||
android:text="@string/message"
|
||||
android:fontFamily="@font/nunito_bold"
|
||||
android:textColor="@color/white"
|
||||
android:textAllCaps="false"
|
||||
|
||||
android:layout_marginStart="15dp"
|
||||
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -89,8 +89,9 @@
|
||||
<ImageButton
|
||||
android:id="@+id/default_check"
|
||||
android:layout_width="25dp"
|
||||
android:layout_height="25dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:background="@color/white"
|
||||
android:src="@drawable/sub_check_drawable"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/delete"
|
||||
|
||||
@@ -413,5 +413,12 @@
|
||||
<string name="no_ongoing_activity">No ongoing activity</string>
|
||||
<string name="no_upcoming_activities">No upcoming activities</string>
|
||||
<string name="direction_to_home">Direction to home</string>
|
||||
<string name="directions">Directions</string>
|
||||
<string name="your_location">Your location</string>
|
||||
<string name="home_address_txt">Home Address</string>
|
||||
<string name="go">go</string>
|
||||
<string name="call_and_message_your_loved_ones">Call and message your loved ones</string>
|
||||
<string name="select_number_to_cal_or_message">Select number to cal or message</string>
|
||||
<string name="call">Call</string>
|
||||
|
||||
</resources>
|
||||
Reference in New Issue
Block a user