diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 29bc014..53339f6 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -7,6 +7,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
whiteList;
+
+ List installed_app_list;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_fua);
+
+ swBlock = (SwitchCompat) findViewById(R.id.swBlock);
+ rvApps = (RecyclerView) findViewById(R.id.rvApps);
+ rvWhiteApps = (RecyclerView) findViewById(R.id.rv_white_apps);
+ mySharedPref = new MySharedPref(FUAActivity.this);
+
+ if (!isAccessibilityAppBlockingEnabled()) {
+ openAccessibilityDialog();
+ }
+
+ Intent serviceIntent = new Intent(getApplicationContext(), TopAppDetectionService.class);
+ getApplicationContext().startService(serviceIntent);
+
+ whiteList = getWhiteListApps();
+ Collections.sort(whiteList, (o1, o2) -> o1.getName().compareToIgnoreCase(o2.getName()));
+
+ adapter = new MyAppsAdapter(FUAActivity.this, getInstalledApps(), false, appList -> {
+ if (!isContainsWhiteList(appList)) {
+ whiteList.add(appList);
+ Collections.sort(whiteList, (o1, o2) -> o1.getName().compareToIgnoreCase(o2.getName()));
+ } else {
+ whiteList.remove(getPosition(appList));
+ }
+
+ whiteListAdapter.notifyDataSetChanged();
+ });
+
+ whiteListAdapter = new MyAppsAdapter(FUAActivity.this, whiteList, true, new MyAppsAdapter.ItemClicked() {
+ @Override
+ public void onCLick(AppList appList) {
+
+ }
+ });
+
+ rvApps.setLayoutManager(new GridLayoutManager(this, 4));
+ rvApps.setAdapter(adapter);
+
+ rvWhiteApps.setLayoutManager(new GridLayoutManager(this, 4));
+ rvWhiteApps.setAdapter(whiteListAdapter);
+
+ swBlock.setOnCheckedChangeListener((buttonView, isChecked) -> {
+
+ if (!isAccessibilityAppBlockingEnabled() && isChecked) {
+ Intent accessibilityIntent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
+ startActivity(accessibilityIntent);
+ }
+//
+// // Intent serviceIntent = new Intent(getApplicationContext(), service.class);
+//// ContextCompat.startForegroundService(getApplicationContext(), serviceIntent);
+//
+// // if (isChecked) {
+//
+// // startService(new Intent(MainActivity.this, ServiceTest.class));
+//
+//// Intent serviceIntent = new Intent(MainActivity.this, OverlayService.class);
+//// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+//// getApplicationContext().startForegroundService(serviceIntent);
+//// } else {
+//// getApplicationContext().startService(serviceIntent);
+//// }
+//
+// /* Intent serviceIntent = new Intent(MainActivity.this, OverlayService.class);
+// startService(serviceIntent);*/
+//
+// /* } else {
+// stopService(new Intent(MainActivity.this, OverlayService.class));
+// }*/
+
+ });
+
+ findViewById(R.id.done_btn).setOnClickListener(v -> {
+ onBackPressed();
+ });
+
+ findViewById(R.id.back_btn).setOnClickListener(v -> {
+ onBackPressed();
+ });
+ }
+
+ private int getPosition(AppList appList) {
+ for (int i = 0; i < whiteList.size(); i++) {
+ if (whiteList.get(i).getPackages().equals(appList.getPackages())) {
+ return i;
+ }
+ }
+ return 0;
+ }
+
+
+ private boolean isContainsWhiteList(AppList appList) {
+ for (AppList appList1 : whiteList) {
+ if (appList.getPackages().equals(appList1.getPackages())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private List getWhiteListApps() {
+ ArrayList appsList = new ArrayList<>();
+
+ List totalList = getInstalledApps();
+
+ for (AppList list : totalList) {
+ if (!isSelectedApp(list.getPackages())) {
+ appsList.add(list);
+ }
+ }
+
+ return appsList;
+ }
+
+ public boolean isSelectedApp(String packageName) {
+ if (mySharedPref.checkKey("APP_LIST")) {
+ ArrayList myList = new ArrayList<>(mySharedPref.getArrayList("APP_LIST"));
+ return myList.contains(packageName);
+ }
+ return false;
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ swBlock.setChecked(isAccessibilityAppBlockingEnabled());
+ }
+
+ private List getInstalledApps() {
+ if (installed_app_list != null) return installed_app_list;
+
+ PackageManager packageManager = getPackageManager();
+
+ Intent intent = new Intent(Intent.ACTION_MAIN, null);
+ intent.addCategory(Intent.CATEGORY_LAUNCHER);
+
+ List resolveInfoList = packageManager.queryIntentActivities(intent, 0);
+ ArrayList appsName = new ArrayList<>();
+ List apps = new ArrayList<>();
+
+ // Iterate over the resolved apps and extract their names
+ for (ResolveInfo resolveInfo : resolveInfoList) {
+ String appName1 = resolveInfo.loadLabel(packageManager).toString();
+ Drawable icon = resolveInfo.loadIcon(packageManager);
+ String packages = resolveInfo.activityInfo.packageName;
+ apps.add(new AppList(appName1, icon, packages));
+ appsName.add(packages);
+ }
+
+ Collections.sort(apps, (o1, o2) -> o1.getName().compareToIgnoreCase(o2.getName()));
+ Collections.sort(appsName);
+
+ if (mySharedPref.checkKey("APP_LIST")) {
+ if (mySharedPref.getArrayList("APP_LIST").size() == 0) {
+ mySharedPref.setArrayList("APP_LIST", appsName);
+ }
+ } else {
+ mySharedPref.setArrayList("APP_LIST", appsName);
+ }
+
+ return installed_app_list = apps;
+ }
+
+ private boolean isAccessibilityAppBlockingEnabled() {
+ int accessibilityEnabled = 0;
+ final String service = getPackageName() + "/" + TopAppDetectionService.class.getCanonicalName();
+
+ try {
+ accessibilityEnabled = Settings.Secure.getInt(
+ getContentResolver(),
+ Settings.Secure.ACCESSIBILITY_ENABLED);
+
+ } catch (Settings.SettingNotFoundException e) {
+ Log.e("TAG", "Error finding setting, default accessibility to not found: "
+ + e.getMessage());
+ }
+
+ TextUtils.SimpleStringSplitter colonSplitter = new TextUtils.SimpleStringSplitter(':');
+
+ if (accessibilityEnabled == 1) {
+ String settingValue = Settings.Secure.getString(
+ getContentResolver(),
+ Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES);
+ if (settingValue != null) {
+ colonSplitter.setString(settingValue);
+ while (colonSplitter.hasNext()) {
+ String accessibilityService = colonSplitter.next();
+ if (accessibilityService.equalsIgnoreCase(service)) {
+ return true;
+ }
+ }
+ }
+ }
+
+ return false;
+ }
+
+ private boolean isSystemPackage(PackageInfo pkgInfo) {
+ return (pkgInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0;
+ }
+
+ private void openAccessibilityDialog() {
+
+ AppUtil.showAlert(this,
+ "Accessibility Permission Dialog",
+ "Please allow app blocking accessibility.",
+ "Yes", (dialog, id) -> {
+ Intent accessibilityIntent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
+ startActivity(accessibilityIntent);
+ },
+ "No",(dialog, id) -> {
+ // Action for 'NO' Button
+ dialog.cancel();
+ });
+ }
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/ssb/simplitend/appblocking/MyAppsAdapter.java b/app/src/main/java/com/ssb/simplitend/appblocking/MyAppsAdapter.java
new file mode 100644
index 0000000..6f416aa
--- /dev/null
+++ b/app/src/main/java/com/ssb/simplitend/appblocking/MyAppsAdapter.java
@@ -0,0 +1,189 @@
+package com.ssb.simplitend.appblocking;
+
+import android.app.AlertDialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.provider.Settings;
+import android.text.TextUtils;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import androidx.appcompat.widget.SwitchCompat;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.ssb.simplitend.R;
+import com.ssb.simplitend.apputils.AppUtil;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class MyAppsAdapter extends RecyclerView.Adapter {
+ private List listdata;
+ private Context context;
+ private MySharedPref mySharedPref;
+ boolean isWhiteList;
+ ItemClicked itemClicked;
+
+ // RecyclerView recyclerView;
+ public MyAppsAdapter(Context context, List listdata, boolean isWhiteList, ItemClicked itemClicked) {
+ this.context = context;
+ this.listdata = listdata;
+ this.isWhiteList = isWhiteList;
+ this.itemClicked = itemClicked;
+ mySharedPref = new MySharedPref(context);
+ }
+
+ @Override
+ public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
+ LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext());
+ View listItem = layoutInflater.inflate(R.layout.app_list_item, parent, false);
+ ViewHolder viewHolder = new ViewHolder(listItem);
+ return viewHolder;
+ }
+
+ @Override
+ public void onBindViewHolder(ViewHolder holder, int position) {
+ holder.tvAppName.setText(listdata.get(position).getName());
+ holder.ivAppIcon.setImageDrawable(listdata.get(position).getIcon());
+
+ if (!isSelectedApp(listdata.get(position).getPackages())) {
+ holder.ivAddRemove.setImageResource(R.drawable.minus);
+ } else {
+ holder.ivAddRemove.setImageResource(R.drawable.plus);
+ }
+
+ if (isWhiteList) {
+ holder.ivAddRemove.setVisibility(View.GONE);
+ }
+
+ holder.ivAddRemove.setOnClickListener(v -> {
+
+ if (!isAccessibilityAppBlockingEnabled()) {
+ openAccessibilityDialog();
+ } else {
+ addAppsInList(listdata.get(position).getPackages());
+
+ if (!isSelectedApp(listdata.get(position).getPackages())) {
+ holder.ivAddRemove.setImageResource(R.drawable.minus);
+ } else {
+ holder.ivAddRemove.setImageResource(R.drawable.plus);
+ }
+
+ itemClicked.onCLick(listdata.get(position));
+ }
+
+ });
+
+ }
+
+ public boolean isSelectedApp(String packageName) {
+ if (mySharedPref.checkKey("APP_LIST")) {
+ ArrayList myList = new ArrayList<>(mySharedPref.getArrayList("APP_LIST"));
+ return myList.contains(packageName);
+ }
+ return false;
+ }
+
+ public void addAppsInList(String packageName) {
+ ArrayList myList = new ArrayList<>();
+
+ if (mySharedPref.checkKey("APP_LIST")) {
+
+ myList.addAll(mySharedPref.getArrayList("APP_LIST"));
+
+ if (myList.contains(packageName)) {
+ myList.remove(packageName);
+ mySharedPref.setArrayList("APP_LIST", myList);
+ } else {
+ myList.add(packageName);
+ mySharedPref.setArrayList("APP_LIST", myList);
+ }
+ } else {
+ myList.add(packageName);
+ mySharedPref.setArrayList("APP_LIST", myList);
+ }
+ }
+
+ @Override
+ public int getItemCount() {
+ return listdata.size();
+ }
+
+ @Override
+ public int getItemViewType(int position) {
+ return position;
+ }
+
+ interface ItemClicked {
+ void onCLick(AppList appList);
+ }
+
+ public static class ViewHolder extends RecyclerView.ViewHolder {
+
+ public TextView tvAppName;
+ public ImageView ivAppIcon, ivAddRemove;
+ public SwitchCompat swOnOff;
+
+ public ViewHolder(View itemView) {
+ super(itemView);
+ this.tvAppName = (TextView) itemView.findViewById(R.id.tvAppName);
+ this.ivAppIcon = (ImageView) itemView.findViewById(R.id.iv_app_icon);
+ this.ivAddRemove = (ImageView) itemView.findViewById(R.id.iv_add_remove);
+// this.swOnOff = (SwitchCompat) itemView.findViewById(R.id.swOnOff);
+ }
+ }
+
+ private boolean isAccessibilityAppBlockingEnabled() {
+ int accessibilityEnabled = 0;
+ final String service = context.getPackageName() + "/" + TopAppDetectionService.class.getCanonicalName();
+
+ try {
+ accessibilityEnabled = Settings.Secure.getInt(
+ context.getContentResolver(),
+ Settings.Secure.ACCESSIBILITY_ENABLED);
+
+ } catch (Settings.SettingNotFoundException e) {
+ Log.e("TAG", "Error finding setting, default accessibility to not found: "
+ + e.getMessage());
+ }
+
+ TextUtils.SimpleStringSplitter colonSplitter = new TextUtils.SimpleStringSplitter(':');
+
+ if (accessibilityEnabled == 1) {
+ String settingValue = Settings.Secure.getString(
+ context.getContentResolver(),
+ Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES);
+ if (settingValue != null) {
+ colonSplitter.setString(settingValue);
+ while (colonSplitter.hasNext()) {
+ String accessibilityService = colonSplitter.next();
+ if (accessibilityService.equalsIgnoreCase(service)) {
+ return true;
+ }
+ }
+ }
+ }
+
+ return false;
+ }
+
+ private void openAccessibilityDialog() {
+
+ AppUtil.showAlert(context,
+ "Accessibility Permission Dialog",
+ "Please allow app blocking accessibility.",
+ "Yes", (dialog, id) -> {
+ Intent accessibilityIntent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
+ context.startActivity(accessibilityIntent);
+ },
+ "No",(dialog, id) -> {
+ // Action for 'NO' Button
+ dialog.cancel();
+ });
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/ssb/simplitend/appblocking/MySharedPref.java b/app/src/main/java/com/ssb/simplitend/appblocking/MySharedPref.java
new file mode 100644
index 0000000..97bbad4
--- /dev/null
+++ b/app/src/main/java/com/ssb/simplitend/appblocking/MySharedPref.java
@@ -0,0 +1,59 @@
+package com.ssb.simplitend.appblocking;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.SharedPreferences;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Set;
+
+public class MySharedPref {
+ private static final String APP_SHARED_PREFS = "AppBlock";
+ private SharedPreferences appSharedPrefs;
+ private SharedPreferences.Editor prefsEditor;
+
+ public MySharedPref(Context activity) {
+ this.appSharedPrefs = activity.getSharedPreferences(APP_SHARED_PREFS,
+ Activity.MODE_PRIVATE);
+ this.prefsEditor = appSharedPrefs.edit();
+ }
+
+ public String getPrefsValue(String value) {
+ return appSharedPrefs.getString(value, "");
+ }
+
+ public void savePrefsValue(String key, String Value) {
+ prefsEditor.putString(key, Value);
+ prefsEditor.commit();
+ }
+
+ public String getString(String value) {
+ return appSharedPrefs.getString(value, "");
+ }
+
+ public void saveString(String key, String Value) {
+ prefsEditor.putString(key, Value);
+ prefsEditor.commit();
+ }
+
+ public Boolean checkKey(String Key) {
+ if (appSharedPrefs.contains(Key))
+ return true;
+ else
+ return false;
+ }
+
+ public Set getArrayList(String key) {
+ return appSharedPrefs.getStringSet(key, null);
+ }
+
+ public void setArrayList(String key, ArrayList list) {
+ Set set = new HashSet<>(list);
+ prefsEditor.putStringSet(key, set);
+ prefsEditor.commit();
+ }
+
+
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/ssb/simplitend/appblocking/TopAppDetectionService.java b/app/src/main/java/com/ssb/simplitend/appblocking/TopAppDetectionService.java
new file mode 100644
index 0000000..f499baa
--- /dev/null
+++ b/app/src/main/java/com/ssb/simplitend/appblocking/TopAppDetectionService.java
@@ -0,0 +1,92 @@
+package com.ssb.simplitend.appblocking;
+
+import android.accessibilityservice.AccessibilityService;
+import android.accessibilityservice.AccessibilityServiceInfo;
+import android.content.Intent;
+import android.os.Build;
+import android.util.Log;
+import android.view.accessibility.AccessibilityEvent;
+
+import com.ssb.simplitend.BuildConfig;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class TopAppDetectionService extends AccessibilityService {
+ MySharedPref sharedPref;
+ List appsList = new ArrayList<>();
+
+ @Override
+ public void onAccessibilityEvent(AccessibilityEvent event) {
+
+ Log.d("aditya", "onAccessibilityEvent: " + event);
+
+ sharedPref = new MySharedPref(getApplication());
+ appsList.addAll(sharedPref.getArrayList("APP_LIST"));
+
+ Log.i("TAG--->", "onAccessibilityEvent: ==>" + sharedPref.getArrayList("APP_LIST"));
+
+ if (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
+ // Get the package name of the currently opened app
+ String packageName = event.getPackageName().toString();
+
+ Log.i("TAG--->", "onAccessibilityEvent: 1==>" + packageName);
+
+ if (sharedPref.checkKey("APP_LIST") &&
+ !packageName.equals(BuildConfig.APPLICATION_ID) &&
+ !packageName.equals("com.android.settings") &&
+ !packageName.equals("com.google.android.googlequicksearchbox")) {
+
+ if (sharedPref.getArrayList("APP_LIST").contains(packageName)) {
+ Intent intent = new Intent(this, BlockApp.class);
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ startActivity(intent);
+ }
+ }
+
+// // Check if the package name matches the blocked app
+// for (String packageNames : appsList) {
+// if (packageNames.equals(packageName)) {
+// // Launch the parent app or show a blocking message
+// Intent intent = new Intent(this, BlockApp.class);
+// intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+// startActivity(intent);
+// }
+// }
+ }
+ }
+
+ @Override
+ public void onInterrupt() {
+ // This method is required but not used in this example
+ }
+
+ @Override
+ protected void onServiceConnected() {
+ super.onServiceConnected();
+
+ sharedPref = new MySharedPref(getApplication());
+ // Set the event types and package names to monitor
+ AccessibilityServiceInfo info = new AccessibilityServiceInfo();
+ info.eventTypes = AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED;
+ info.packageNames = sharedPref.getArrayList("APP_LIST").toArray(new String[0]);
+ info.feedbackType = AccessibilityServiceInfo.FEEDBACK_GENERIC;
+
+ // Set the flags based on the Android version
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
+ info.flags = AccessibilityServiceInfo.FLAG_INCLUDE_NOT_IMPORTANT_VIEWS |
+ AccessibilityServiceInfo.FLAG_REPORT_VIEW_IDS;
+ }
+
+ // Set the service info
+ setServiceInfo(info);
+ }
+
+ /* @Override
+ public void onTaskRemoved(Intent rootIntent) {
+ Intent restartServiceIntent = new Intent(getApplicationContext(), this.getClass());
+ restartServiceIntent.setPackage(getPackageName());
+ startService(restartServiceIntent);
+ super.onTaskRemoved(rootIntent);
+ }*/
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/ssb/simplitend/caregiverdashboard/activities/CaregiverDashActivity.java b/app/src/main/java/com/ssb/simplitend/caregiverdashboard/activities/CaregiverDashActivity.java
index 7f6f9a7..6a2d1ff 100644
--- a/app/src/main/java/com/ssb/simplitend/caregiverdashboard/activities/CaregiverDashActivity.java
+++ b/app/src/main/java/com/ssb/simplitend/caregiverdashboard/activities/CaregiverDashActivity.java
@@ -12,7 +12,6 @@ import androidx.lifecycle.ViewModelProvider;
import com.ssb.simplitend.R;
import com.ssb.simplitend.apputils.CaregiverDataCache;
import com.ssb.simplitend.articles.ArticlesActivity;
-import com.ssb.simplitend.caregiverdashboard.fragments.CaregiverChatsFragment;
import com.ssb.simplitend.caregiverdashboard.fragments.CgDashBoardFragment;
import com.ssb.simplitend.caregiverdashboard.fragments.MyPatientFragment;
import com.ssb.simplitend.caregiverdashboard.mvvm.CaregiverMainViewModel;
@@ -22,6 +21,7 @@ import com.ssb.simplitend.customsviews.MenuItem;
import com.ssb.simplitend.databinding.CaregiverDashboardActivityBinding;
import com.ssb.simplitend.databinding.CaregiverDashboardMenuBinding;
import com.ssb.simplitend.faqs.FAQ_Activity;
+import com.ssb.simplitend.patient_dashboard.chats.ChatFragment;
import com.ssb.simplitend.welcome.welcomecg.mvvm.CareGiverData;
import com.yarolegovich.slidingrootnav.SlidingRootNavBuilder;
import com.yarolegovich.slidingrootnav.callback.DragStateListener;
@@ -56,6 +56,21 @@ public class CaregiverDashActivity extends AppCompatActivity implements
}
+ @Override
+ public void onBackPressed() {
+ Fragment fragment = getSupportFragmentManager().findFragmentByTag("chat");
+ if (fragment != null){
+ if (fragment instanceof ChatFragment){
+ binding.bottomNav.selectMenuItem(MenuItem.DASHBOARD);
+ onBottomNavItemSelected(MenuItem.DASHBOARD);
+ }else{
+ super.onBackPressed();
+ }
+ }else{
+ super.onBackPressed();
+ }
+ }
+
private void initViews() {
// viewmodel
@@ -77,7 +92,7 @@ public class CaregiverDashActivity extends AppCompatActivity implements
binding.bottomNav.setItemSelectListener(this);
// initializing dashboard fragment
- replaceFragment(new CgDashBoardFragment());
+ replaceFragment(new CgDashBoardFragment(), "dashboard");
setLayoutDetails();
@@ -147,9 +162,9 @@ public class CaregiverDashActivity extends AppCompatActivity implements
menuBinding.name.setText(careGiverData.patientDetails.first_name);
}
- private void replaceFragment(Fragment fragment){
+ private void replaceFragment(Fragment fragment, String tag){
getSupportFragmentManager().beginTransaction()
- .replace(R.id.fcv_cg_home, fragment)
+ .replace(R.id.fcv_cg_home, fragment, tag)
.commitAllowingStateLoss();
}
@@ -173,9 +188,12 @@ public class CaregiverDashActivity extends AppCompatActivity implements
@Override
public void onBottomNavItemSelected(MenuItem selectedItem) {
if (selectedItem == MenuItem.DASHBOARD){
- replaceFragment(new CgDashBoardFragment());
+ replaceFragment(new CgDashBoardFragment(), "dashboard");
// setting up toolbar accordingly
+ binding.toolbar.setVisibility(View.VISIBLE);
+ binding.bottomNav.setVisibility(View.VISIBLE);
+
binding.toolbar.setNavigationIcon(AppCompatResources.getDrawable(this, R.drawable.ic_menu));
binding.toolbar.setNavigationIconTint(getResources().getColor(R.color.black));
@@ -190,17 +208,20 @@ public class CaregiverDashActivity extends AppCompatActivity implements
binding.toolbar.setTitle("Welcome " + first_name);
}else if (selectedItem == MenuItem.MY_PATIENT){
- replaceFragment(new MyPatientFragment());
+ replaceFragment(new MyPatientFragment(), "my_patient");
// setting up toolbar accordingly
+ binding.toolbar.setVisibility(View.VISIBLE);
+ binding.bottomNav.setVisibility(View.VISIBLE);
+
binding.toolbar.setTitle(null);
binding.toolbar.setNavigationIcon(AppCompatResources.getDrawable(this, R.drawable.ic_menu));
binding.toolbar.setNavigationIconTint(getResources().getColor(R.color.white));
}else if (selectedItem == MenuItem.CHATS){
- replaceFragment(new CaregiverChatsFragment());
- binding.toolbar.setNavigationIcon(AppCompatResources.getDrawable(this, R.drawable.ic_menu));
- binding.toolbar.setNavigationIconTint(getResources().getColor(R.color.black));
- binding.toolbar.setTitle("Chats");
+ replaceFragment(new ChatFragment(), "chat");
+
+ binding.toolbar.setVisibility(View.GONE);
+ binding.bottomNav.setVisibility(View.GONE);
}
}
}
\ No newline at end of file
diff --git a/app/src/main/java/com/ssb/simplitend/caregiverdashboard/activities/CaregiverProfileActivity.java b/app/src/main/java/com/ssb/simplitend/caregiverdashboard/activities/CaregiverProfileActivity.java
index 0f6372f..12d08d6 100644
--- a/app/src/main/java/com/ssb/simplitend/caregiverdashboard/activities/CaregiverProfileActivity.java
+++ b/app/src/main/java/com/ssb/simplitend/caregiverdashboard/activities/CaregiverProfileActivity.java
@@ -1,11 +1,14 @@
package com.ssb.simplitend.caregiverdashboard.activities;
+import static androidx.biometric.BiometricManager.Authenticators.BIOMETRIC_STRONG;
import static com.ssb.simplitend.caregiverdashboard.activities.EditProfileInfoActivity.IS_CAREGIVER;
import androidx.appcompat.app.AppCompatActivity;
+import androidx.biometric.BiometricManager;
import android.content.Intent;
import android.os.Bundle;
+import android.view.View;
import android.widget.CompoundButton;
import android.widget.Toast;
@@ -70,9 +73,27 @@ public class CaregiverProfileActivity extends AppCompatActivity implements Compo
}
private void initViews() {
+ checkIfBiometricAvailable();
+
binding.biometricCheck.setOnCheckedChangeListener(this);
}
+ private void checkIfBiometricAvailable() {
+
+ BiometricManager biometricManager = BiometricManager.from(this);
+
+ switch (biometricManager.canAuthenticate(BIOMETRIC_STRONG)) {
+ case BiometricManager.BIOMETRIC_ERROR_NO_HARDWARE:
+ case BiometricManager.BIOMETRIC_ERROR_HW_UNAVAILABLE:
+ binding.biometricCheckView.setVisibility(View.GONE);
+ break;
+ case BiometricManager.BIOMETRIC_SUCCESS:
+ case BiometricManager.BIOMETRIC_ERROR_NONE_ENROLLED:
+ binding.biometricCheckView.setVisibility(View.VISIBLE);
+ break;
+ }
+ }
+
private void clickEvents() {
binding.backBtn.setOnClickListener(v -> onBackPressed());
diff --git a/app/src/main/java/com/ssb/simplitend/caregiverdashboard/fragments/CaregiverChatsFragment.java b/app/src/main/java/com/ssb/simplitend/caregiverdashboard/fragments/CaregiverChatsFragment.java
deleted file mode 100644
index f13b067..0000000
--- a/app/src/main/java/com/ssb/simplitend/caregiverdashboard/fragments/CaregiverChatsFragment.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.ssb.simplitend.caregiverdashboard.fragments;
-
-import android.os.Bundle;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import androidx.fragment.app.Fragment;
-
-import com.ssb.simplitend.databinding.CaregiverChatsFragmentBinding;
-
-public class CaregiverChatsFragment extends Fragment {
-
- // view binding
- protected CaregiverChatsFragmentBinding binding;
-
- public CaregiverChatsFragment(){
- // required empty
- }
-
- @Nullable
- @Override
- public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
- binding = CaregiverChatsFragmentBinding.inflate(inflater, container, false);
-
- return binding.getRoot();
- }
-}
diff --git a/app/src/main/java/com/ssb/simplitend/caregiverdashboard/fragments/MyPatientFragment.java b/app/src/main/java/com/ssb/simplitend/caregiverdashboard/fragments/MyPatientFragment.java
index 109def7..75d3795 100644
--- a/app/src/main/java/com/ssb/simplitend/caregiverdashboard/fragments/MyPatientFragment.java
+++ b/app/src/main/java/com/ssb/simplitend/caregiverdashboard/fragments/MyPatientFragment.java
@@ -4,6 +4,7 @@ import static com.ssb.simplitend.caregiverdashboard.activities.PatientProfileSho
import android.content.Intent;
import android.os.Bundle;
+import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -37,6 +38,8 @@ public class MyPatientFragment extends Fragment {
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
binding = MyPatientFragmentBinding.inflate(inflater, container, false);
+ adjustLayout();
+
initViews();
clickEvents();
@@ -44,6 +47,20 @@ public class MyPatientFragment extends Fragment {
return binding.getRoot();
}
+ // adjusts the guideline percentage w.r.t the aspect ratio of the screen
+ private void adjustLayout() {
+ DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
+ int screenWidth = displayMetrics.widthPixels;
+ int screenHeight = displayMetrics.heightPixels;
+
+ // Calculate aspect ratio
+ float aspectRatio = (float) screenHeight / (float) screenWidth;
+
+ if (aspectRatio < 2.03f){
+ binding.guideline.setGuidelinePercent(0.55f);
+ }
+ }
+
private void initViews() {
CaregiverDataCache.getCaregiverData(requireContext(), (careGiverData1 -> {
this.careGiverData = careGiverData1;
diff --git a/app/src/main/java/com/ssb/simplitend/customsviews/HomeBottomNav.java b/app/src/main/java/com/ssb/simplitend/customsviews/HomeBottomNav.java
index f2a6a60..0e9c642 100644
--- a/app/src/main/java/com/ssb/simplitend/customsviews/HomeBottomNav.java
+++ b/app/src/main/java/com/ssb/simplitend/customsviews/HomeBottomNav.java
@@ -83,7 +83,7 @@ public class HomeBottomNav extends FrameLayout {
this.itemSelectListener = itemSelectListener;
}
- private void selectMenuItem(MenuItem menuitem){
+ public void selectMenuItem(MenuItem menuitem){
clearItemSelection(this.selected_item);
diff --git a/app/src/main/java/com/ssb/simplitend/patient_dashboard/chats/ChatFragment.java b/app/src/main/java/com/ssb/simplitend/patient_dashboard/chats/ChatFragment.java
index d70451c..7a929a3 100644
--- a/app/src/main/java/com/ssb/simplitend/patient_dashboard/chats/ChatFragment.java
+++ b/app/src/main/java/com/ssb/simplitend/patient_dashboard/chats/ChatFragment.java
@@ -24,8 +24,6 @@ public class ChatFragment extends Fragment {
// view binding
protected ChatFragmentBinding binding;
- // chat item
- private ChatItem chatItem;
public static final String CHAT_ITEM_KEY = "chat_item_key";
private MessagesListAdapter messageAdapter;
@@ -64,21 +62,7 @@ public class ChatFragment extends Fragment {
private void initViews() {
- Bundle bundle = getArguments();
-
- if (bundle == null) {
- Toast.makeText(requireActivity(), "Something went wrong", Toast.LENGTH_SHORT).show();
- return;
- }
-
- chatItem = (ChatItem) bundle.getSerializable(CHAT_ITEM_KEY);
-
- if (chatItem == null) {
- Toast.makeText(requireActivity(), "Something went wrong", Toast.LENGTH_SHORT).show();
- return;
- }
-
- binding.chatTitle.setText(chatItem.name);
+ binding.chatTitle.setText("Aditya");
MessagesListAdapter.HoldersConfig holdersConfig = new MessagesListAdapter.HoldersConfig();
holdersConfig.setOutcomingLayout(R.layout.sender_msg_viewholder);
@@ -97,7 +81,5 @@ public class ChatFragment extends Fragment {
messageAdapter.addToStart(new Message(new Receiver(), "Good morning mate!"), true);
messageAdapter.addToStart(new Message(new Author(), "Good morning"), true);
messageAdapter.addToStart(new Message(new Receiver(), "Good morning mate!"), true);
-
- messageAdapter.addToStart(new Message(new Receiver(), chatItem.last_message), true);
}
}
\ No newline at end of file
diff --git a/app/src/main/java/com/ssb/simplitend/patient_dashboard/fragments/PatientDashboardFragment.java b/app/src/main/java/com/ssb/simplitend/patient_dashboard/fragments/PatientDashboardFragment.java
index 6e04e79..f5e14f7 100644
--- a/app/src/main/java/com/ssb/simplitend/patient_dashboard/fragments/PatientDashboardFragment.java
+++ b/app/src/main/java/com/ssb/simplitend/patient_dashboard/fragments/PatientDashboardFragment.java
@@ -16,6 +16,7 @@ import androidx.fragment.app.Fragment;
import androidx.navigation.Navigation;
import com.ssb.simplitend.R;
+import com.ssb.simplitend.appblocking.FUAActivity;
import com.ssb.simplitend.apputils.AppUtil;
import com.ssb.simplitend.apputils.PatientDataCache;
import com.ssb.simplitend.databinding.PatientDashboardFragmentBinding;
@@ -124,6 +125,11 @@ public class PatientDashboardFragment extends Fragment {
binding.profile.setOnClickListener(v -> {
Navigation.findNavController(v).navigate(R.id.action_CPDashboardFragment_to_patientProfileInfoFragment);
});
+
+ binding.apps.setOnClickListener(v -> {
+ Intent intent = new Intent(requireActivity(), FUAActivity.class);
+ startActivity(intent);
+ });
}
private void updateTime() {
diff --git a/app/src/main/java/com/ssb/simplitend/patient_dashboard/fragments/PatientProfileInfoFragment.java b/app/src/main/java/com/ssb/simplitend/patient_dashboard/fragments/PatientProfileInfoFragment.java
index b2e8bbe..aa3c35e 100644
--- a/app/src/main/java/com/ssb/simplitend/patient_dashboard/fragments/PatientProfileInfoFragment.java
+++ b/app/src/main/java/com/ssb/simplitend/patient_dashboard/fragments/PatientProfileInfoFragment.java
@@ -18,13 +18,9 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
-import com.bumptech.glide.Glide;
-import com.ssb.simplitend.R;
-import com.ssb.simplitend.apputils.AppUtil;
import com.ssb.simplitend.apputils.PatientDataCache;
import com.ssb.simplitend.caregiverdashboard.activities.EditProfileInfoActivity;
import com.ssb.simplitend.caregiverdashboard.activities.PatientProfileShowerActivity;
-import com.ssb.simplitend.cg_geofencing.CgGeoFencingActivity;
import com.ssb.simplitend.databinding.ActivityPatProfileInfoBinding;
import com.ssb.simplitend.welcome.welcomepatient.mvvm.models.PatientData;
diff --git a/app/src/main/java/com/ssb/simplitend/patientprofile/medreminder/ReminderFragment.java b/app/src/main/java/com/ssb/simplitend/patientprofile/medreminder/ReminderFragment.java
index 9ae4a70..edd72a9 100644
--- a/app/src/main/java/com/ssb/simplitend/patientprofile/medreminder/ReminderFragment.java
+++ b/app/src/main/java/com/ssb/simplitend/patientprofile/medreminder/ReminderFragment.java
@@ -33,7 +33,7 @@ public class ReminderFragment extends Fragment implements RecyclerTouchListener.
ProfileContracts.GetRemindersListCallback, ProfileContracts.ReminderDeleteCallback,
ProfileContracts.AddReminderCallBack,
ReminderAdapter.ReminderCheckClickListener,
- ReminderAdapter.ReminderClickListener{
+ ReminderAdapter.ReminderClickListener {
// view binding
protected RemindersFragmentBinding binding;
@@ -104,34 +104,34 @@ public class ReminderFragment extends Fragment implements RecyclerTouchListener.
// add button
binding.addReminder.setOnClickListener(v ->
- {
+ {
- try {
- Navigation.findNavController(v).navigate(R.id.action_reminderFragment_to_addReminderFragment);
- }catch (Exception e){
- // there may be a IllegalStateException as this same fragment is used from another fragment
- // and not through the nav graph
+ try {
+ Navigation.findNavController(v).navigate(R.id.action_reminderFragment_to_addReminderFragment);
+ } catch (Exception e) {
+ // there may be a IllegalStateException as this same fragment is used from another fragment
+ // and not through the nav graph
- try {
- getParentFragmentManager().beginTransaction()
- .replace(R.id.fcv_profile_shower, AddReminderFragment.class, null)
- .addToBackStack("add_reminder")
- .commitAllowingStateLoss();
- } catch (Exception ex) {
- // user may be out of context
+ try {
+ getParentFragmentManager().beginTransaction()
+ .replace(R.id.fcv_profile_shower, AddReminderFragment.class, null)
+ .addToBackStack("add_reminder")
+ .commitAllowingStateLoss();
+ } catch (Exception ex) {
+ // user may be out of context
+ }
+ }
}
- }
- }
);
binding.done.setOnClickListener(v -> {
- if (getActivity() != null){
+ if (getActivity() != null) {
getActivity().onBackPressed();
}
});
binding.backBtn.setOnClickListener(v -> {
- if (getActivity() != null){
+ if (getActivity() != null) {
getActivity().onBackPressed();
}
});
@@ -426,7 +426,7 @@ public class ReminderFragment extends Fragment implements RecyclerTouchListener.
try {
Navigation.findNavController(binding.getRoot())
.navigate(R.id.action_reminderFragment_to_addReminderFragment, bundle);
- }catch (Exception e){
+ } catch (Exception e) {
// there may be a IllegalStateException as this same fragment is used from another fragment
// and not through the nav graph
@@ -463,37 +463,35 @@ public class ReminderFragment extends Fragment implements RecyclerTouchListener.
@Override
public void onCheck(ReminderResult reminderResult, int position) {
// is user checking only today's check
+ try {
+ int today_date = Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
+ int selected_date = Integer.parseInt(weekDayViewsList.get(reminderViewModel.selected_dow).date.getText().toString());
- if (reminderResult.reminder_marked == null) {
- /*
- now, we don't want to allow checking of routine of other day
- */
- try {
- 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) {
- AppUtil.showAlert(requireContext(),
- "Are you sure?",
- "Do yuo want to check this reminder?\nThis cannot be undone.",
- getString(R.string.yes),
- (dialog, which) -> {
- dialog.dismiss();
-
- updateRoutine(reminderResult, position);
-
- }, getString(R.string.no),
- (dialog, which) -> {
- dialog.dismiss();
- });
- } else {
- Toast.makeText(requireContext(), "Cannot mark future routine.", Toast.LENGTH_SHORT).show();
+ if (today_date == selected_date) {
+ if (reminderResult.reminder_marked != null){
+ // already marked
+ return;
}
- } catch (Exception e) {
- Toast.makeText(requireContext(), "Couldn't be done.", Toast.LENGTH_SHORT).show();
+ AppUtil.showAlert(requireContext(),
+ "Are you sure?",
+ "Do yuo want to check this reminder?\nThis cannot be undone.",
+ getString(R.string.yes),
+ (dialog, which) -> {
+ dialog.dismiss();
+
+ updateRoutine(reminderResult, position);
+
+ }, getString(R.string.no),
+ (dialog, which) -> {
+ dialog.dismiss();
+ });
+ } else {
+ Toast.makeText(requireContext(), "Cannot mark future routine.", Toast.LENGTH_SHORT).show();
}
+ } catch (Exception e) {
+ Toast.makeText(requireContext(), "Couldn't be done.", Toast.LENGTH_SHORT).show();
}
}
diff --git a/app/src/main/java/com/ssb/simplitend/patientprofile/setuproutine/RoutineFragment.java b/app/src/main/java/com/ssb/simplitend/patientprofile/setuproutine/RoutineFragment.java
index e2fc3db..69248f5 100644
--- a/app/src/main/java/com/ssb/simplitend/patientprofile/setuproutine/RoutineFragment.java
+++ b/app/src/main/java/com/ssb/simplitend/patientprofile/setuproutine/RoutineFragment.java
@@ -40,7 +40,7 @@ public class RoutineFragment extends Fragment implements RoutineAdapter.ClickLis
ProfileContracts.AddNUpdateRoutineCallback {
private static final String TAG = "RoutineFragment";
-
+
// view binding
protected RoutineFragmentBinding binding;
@@ -52,7 +52,7 @@ public class RoutineFragment extends Fragment implements RoutineAdapter.ClickLis
private ProgressDialog progressDialog;
- public RoutineFragment(){
+ public RoutineFragment() {
// required empty const.
}
@@ -103,7 +103,7 @@ public class RoutineFragment extends Fragment implements RoutineAdapter.ClickLis
});
binding.backBtn.setOnClickListener(v -> {
- if (getActivity() != null){
+ if (getActivity() != null) {
getActivity().onBackPressed();
}
});
@@ -112,7 +112,7 @@ public class RoutineFragment extends Fragment implements RoutineAdapter.ClickLis
try {
Navigation.findNavController(v).navigate(R.id.action_routineFragment_to_addRoutineFragment);
- }catch (Exception e){
+ } catch (Exception e) {
// there may be a IllegalStateException as this same fragment is used from another fragment
// and not through the nav graph
@@ -128,7 +128,7 @@ public class RoutineFragment extends Fragment implements RoutineAdapter.ClickLis
});
binding.done.setOnClickListener(v -> {
- if (getActivity() != null){
+ if (getActivity() != null) {
getActivity().onBackPressed();
}
});
@@ -201,7 +201,7 @@ public class RoutineFragment extends Fragment implements RoutineAdapter.ClickLis
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);
@@ -213,14 +213,14 @@ public class RoutineFragment extends Fragment implements RoutineAdapter.ClickLis
}
}
- private void setDayOfWeek(int selection){
+ private void setDayOfWeek(int selection) {
// setting selected date in adapter
routineAdapter.setSelected_date(weekDayViewsList.get(selection).mDate);
clearSelection();
- switch (routineViewModel.selected_dow = selection){
+ switch (routineViewModel.selected_dow = selection) {
case 0:
binding.day.setBackgroundResource(R.drawable.seleted_item_primary);
binding.dayT1.setTextColor(getResources().getColor(R.color.white_bg));
@@ -266,8 +266,8 @@ public class RoutineFragment extends Fragment implements RoutineAdapter.ClickLis
}
- private void clearSelection(){
- switch (routineViewModel.selected_dow){
+ private void clearSelection() {
+ switch (routineViewModel.selected_dow) {
case 0:
binding.day.setBackgroundColor(getResources().getColor(R.color.white_bg));
binding.dayT1.setTextColor(getResources().getColor(R.color.black));
@@ -340,13 +340,13 @@ public class RoutineFragment extends Fragment implements RoutineAdapter.ClickLis
public void onRoutinesFetched(List routineList) {
progressDialog.dismiss();
- if (routineList != null && routineList.size() > 0){
+ if (routineList != null && routineList.size() > 0) {
// reminders are present
binding.routineRv.setVisibility(View.VISIBLE);
binding.noData.setVisibility(View.GONE);
routineAdapter.submitList(routineList);
- }else{
+ } else {
binding.routineRv.setVisibility(View.GONE);
binding.noData.setVisibility(View.VISIBLE);
}
@@ -372,7 +372,7 @@ public class RoutineFragment extends Fragment implements RoutineAdapter.ClickLis
AppUtil.showSOSDecision(requireContext(), getString(R.string.delete_med_routine),
getString(R.string.yes), getString(R.string.no),
- v1-> {
+ v1 -> {
// yes click
progressDialog.setTitle("Please wait...");
progressDialog.setMessage("while we delete the routine for you.");
@@ -400,7 +400,7 @@ public class RoutineFragment extends Fragment implements RoutineAdapter.ClickLis
try {
Navigation.findNavController(binding.getRoot()).navigate(R.id.action_routineFragment_to_addRoutineFragment, bundle);
- }catch (Exception e){
+ } catch (Exception e) {
// there may be a IllegalStateException as this same fragment is used from another fragment
// and not through the nav graph
@@ -418,37 +418,38 @@ public class RoutineFragment extends Fragment implements RoutineAdapter.ClickLis
@Override
public void onCheckClick(RoutineDetails routineDetails, int position) {
// is user checking only today's check
-
- if (routineDetails.routine_marked == null){
/*
now, we don't want to allow checking of routine of other day
*/
- try {
- int today_date = Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
- int selected_date = Integer.parseInt(weekDayViewsList.get(routineViewModel.selected_dow).date.getText().toString());
+ try {
+ int today_date = Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
+ int selected_date = Integer.parseInt(weekDayViewsList.get(routineViewModel.selected_dow).date.getText().toString());
- if (today_date == selected_date){
- AppUtil.showAlert(requireContext(),
- "Are you sure?",
- "Do yuo want to check this routine?\nThis cannot be undone.",
- getString(R.string.yes),
- (dialog, which) -> {
- dialog.dismiss();
-
- updateRoutine(routineDetails, position);
-
- }, getString(R.string.no),
- (dialog, which) -> {
- dialog.dismiss();
- });
- }else{
- Toast.makeText(requireContext(), "Cannot mark future routine.", Toast.LENGTH_SHORT).show();
+ if (today_date == selected_date) {
+ if (routineDetails.routine_marked != null){
+ // already marked
+ return;
}
- }catch (Exception e){
- Toast.makeText(requireContext(), "Couldn't be done.", Toast.LENGTH_SHORT).show();
+ AppUtil.showAlert(requireContext(),
+ "Are you sure?",
+ "Do yuo want to check this routine?\nThis cannot be undone.",
+ getString(R.string.yes),
+ (dialog, which) -> {
+ dialog.dismiss();
+
+ updateRoutine(routineDetails, position);
+
+ }, getString(R.string.no),
+ (dialog, which) -> {
+ dialog.dismiss();
+ });
+ } else {
+ Toast.makeText(requireContext(), "Cannot mark future routine.", Toast.LENGTH_SHORT).show();
}
+ } catch (Exception e) {
+ Toast.makeText(requireContext(), "Couldn't be done.", Toast.LENGTH_SHORT).show();
}
}
diff --git a/app/src/main/java/com/ssb/simplitend/welcome/welcomepatient/fragments/register/LocationFragment.java b/app/src/main/java/com/ssb/simplitend/welcome/welcomepatient/fragments/register/LocationFragment.java
index 4776f1e..2e18d0c 100644
--- a/app/src/main/java/com/ssb/simplitend/welcome/welcomepatient/fragments/register/LocationFragment.java
+++ b/app/src/main/java/com/ssb/simplitend/welcome/welcomepatient/fragments/register/LocationFragment.java
@@ -223,10 +223,14 @@ public class LocationFragment extends Fragment implements OnMapReadyCallback,
}
if (patientData.lat != null && patientData.lng != null) {
- double lat = Double.parseDouble(patientData.lat);
- double lng = Double.parseDouble(patientData.lng);
+ try {
+ double lat = Double.parseDouble(patientData.lat);
+ double lng = Double.parseDouble(patientData.lng);
- currentLocation = new LatLng(lat, lng);
+ currentLocation = new LatLng(lat, lng);
+ } catch (NumberFormatException e) {
+ // do nothing
+ }
}
if (patientData.address_line1 != null) {
@@ -389,6 +393,7 @@ public class LocationFragment extends Fragment implements OnMapReadyCallback,
googleMap.setMyLocationEnabled(true);
googleMap.getUiSettings().setMyLocationButtonEnabled(true);
}
+
requestLocations();
}
}
@@ -409,8 +414,6 @@ public class LocationFragment extends Fragment implements OnMapReadyCallback,
googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(default_map_pos));
- addMarker(currentLocation, "Current location");
-
}
@Override
@@ -422,12 +425,13 @@ public class LocationFragment extends Fragment implements OnMapReadyCallback,
googleMap.getUiSettings().setMyLocationButtonEnabled(true);
}
- googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(40.75796541422796, -73.98557368665934), 14));
-
googleMap.setOnMapClickListener(this);
if (currentLocation != null) {
addMarker(currentLocation, "Selected location");
+ googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(currentLocation, 14));
+ }else{
+ googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(40.75796541422796, -73.98557368665934), 14));
}
}
diff --git a/app/src/main/res/drawable/minus.png b/app/src/main/res/drawable/minus.png
new file mode 100644
index 0000000..af0e492
Binary files /dev/null and b/app/src/main/res/drawable/minus.png differ
diff --git a/app/src/main/res/drawable/plus.png b/app/src/main/res/drawable/plus.png
new file mode 100644
index 0000000..f6f0587
Binary files /dev/null and b/app/src/main/res/drawable/plus.png differ
diff --git a/app/src/main/res/drawable/ractangle_corner_10.xml b/app/src/main/res/drawable/ractangle_corner_10.xml
new file mode 100644
index 0000000..2dc183a
--- /dev/null
+++ b/app/src/main/res/drawable/ractangle_corner_10.xml
@@ -0,0 +1,8 @@
+
+
+ -
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/round.xml b/app/src/main/res/drawable/round.xml
new file mode 100644
index 0000000..d2c6336
--- /dev/null
+++ b/app/src/main/res/drawable/round.xml
@@ -0,0 +1,8 @@
+
+
+ -
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_caregiver_profile.xml b/app/src/main/res/layout/activity_caregiver_profile.xml
index bf33928..e949de3 100644
--- a/app/src/main/res/layout/activity_caregiver_profile.xml
+++ b/app/src/main/res/layout/activity_caregiver_profile.xml
@@ -355,7 +355,7 @@
>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/app_list_item.xml b/app/src/main/res/layout/app_list_item.xml
new file mode 100644
index 0000000..3f2d925
--- /dev/null
+++ b/app/src/main/res/layout/app_list_item.xml
@@ -0,0 +1,84 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/caregiver_chats_fragment.xml b/app/src/main/res/layout/caregiver_chats_fragment.xml
deleted file mode 100644
index 5d32718..0000000
--- a/app/src/main/res/layout/caregiver_chats_fragment.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/caregiver_dash_fragment.xml b/app/src/main/res/layout/caregiver_dash_fragment.xml
index d7eb80c..f5e3416 100644
--- a/app/src/main/res/layout/caregiver_dash_fragment.xml
+++ b/app/src/main/res/layout/caregiver_dash_fragment.xml
@@ -3,9 +3,11 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
- xmlns:tools="http://schemas.android.com/tools"
+ android:layout_marginBottom="75dp"
android:background="@color/white">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/my_patient_fragment.xml b/app/src/main/res/layout/my_patient_fragment.xml
index 2f74f6b..da3ce19 100644
--- a/app/src/main/res/layout/my_patient_fragment.xml
+++ b/app/src/main/res/layout/my_patient_fragment.xml
@@ -1,10 +1,13 @@
+
+
-
-
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/patient_dashboard_fragment.xml b/app/src/main/res/layout/patient_dashboard_fragment.xml
index 356fb8c..ecf234b 100644
--- a/app/src/main/res/layout/patient_dashboard_fragment.xml
+++ b/app/src/main/res/layout/patient_dashboard_fragment.xml
@@ -349,6 +349,7 @@
>
@color/black
- @drawable/primary_cursor_drawable
- @drawable/splash_screen
-
-
+
+
// top corner rounded bottom sheet
+
+
-
+
// date picker dialog theme
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index c042681..d1d3a2a 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -17,4 +17,6 @@
#005F9A
#545454
+ #1A000000
+
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index c4419ed..bfefdc3 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -382,4 +382,9 @@
- Miles
+
+ accessibility_service_description
+ ForegroundServiceChannel
+ All apps
+
\ No newline at end of file
diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml
index 0ccaddc..30ced82 100644
--- a/app/src/main/res/values/themes.xml
+++ b/app/src/main/res/values/themes.xml
@@ -14,6 +14,9 @@
- @drawable/primary_cursor_drawable
- @drawable/splash_screen
+
+
+
// top corner rounded bottom sheet
@@ -24,4 +27,14 @@
- @android:color/transparent
+ // date picker dialog theme
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/xml/accessibility_service_config.xml b/app/src/main/res/xml/accessibility_service_config.xml
new file mode 100644
index 0000000..d929113
--- /dev/null
+++ b/app/src/main/res/xml/accessibility_service_config.xml
@@ -0,0 +1,8 @@
+
+
\ No newline at end of file