diff --git a/app/src/main/java/com/app/simplitend/patient_dashboard/foodreminders/FoodScheduler.java b/app/src/main/java/com/app/simplitend/patient_dashboard/foodreminders/FoodScheduler.java index 92c2f74..1d72e73 100644 --- a/app/src/main/java/com/app/simplitend/patient_dashboard/foodreminders/FoodScheduler.java +++ b/app/src/main/java/com/app/simplitend/patient_dashboard/foodreminders/FoodScheduler.java @@ -44,9 +44,9 @@ public abstract class FoodScheduler { private final static Meal breakFastMeal, lunchMeal, dinnerMeal; static { - breakFastMeal = new Meal(FOOD_TIME.BREAK_FAST, 16, 0); - lunchMeal = new Meal(FOOD_TIME.LUNCH, 18, 0); - dinnerMeal = new Meal(FOOD_TIME.DINNER, 21, 0); + breakFastMeal = new Meal(FOOD_TIME.BREAK_FAST, 9, 0); + lunchMeal = new Meal(FOOD_TIME.LUNCH, 13, 0); + dinnerMeal = new Meal(FOOD_TIME.DINNER, 20, 0); } public static void scheduleFoodReminders(Context context) { diff --git a/app/src/main/java/com/app/simplitend/patient_dashboard/fragments/PatientDashboardFragment.java b/app/src/main/java/com/app/simplitend/patient_dashboard/fragments/PatientDashboardFragment.java index 060f6f4..edb5e07 100644 --- a/app/src/main/java/com/app/simplitend/patient_dashboard/fragments/PatientDashboardFragment.java +++ b/app/src/main/java/com/app/simplitend/patient_dashboard/fragments/PatientDashboardFragment.java @@ -223,6 +223,11 @@ public class PatientDashboardFragment extends Fragment implements ProfileContrac OneSignal.getNotifications().addForegroundLifecycleListener(this); + Activity activity = getActivity(); + if (activity != null) { + activity.registerReceiver(timeTickReceiver, new IntentFilter(Intent.ACTION_TIME_TICK)); + } + return binding.getRoot(); } @@ -231,6 +236,11 @@ public class PatientDashboardFragment extends Fragment implements ProfileContrac super.onDestroyView(); requireContext().unregisterReceiver(notification_receiver); OneSignal.getNotifications().removeForegroundLifecycleListener(this); + + Activity activity = getActivity(); + if (activity != null) { + activity.unregisterReceiver(timeTickReceiver); + } } private void setDetails() { @@ -260,10 +270,6 @@ public class PatientDashboardFragment extends Fragment implements ProfileContrac super.onResume(); updateTime(); updateNotificationsCount(); - Activity activity = getActivity(); - if (activity != null) { - activity.registerReceiver(timeTickReceiver, new IntentFilter(Intent.ACTION_TIME_TICK)); - } } private void updateNotificationsCount() { @@ -285,15 +291,6 @@ public class PatientDashboardFragment extends Fragment implements ProfileContrac } } - @Override - public void onPause() { - super.onPause(); - Activity activity = getActivity(); - if (activity != null) { - activity.unregisterReceiver(timeTickReceiver); - } - } - private void clickEvents() { binding.refreshBtn.setOnClickListener(v -> { showLoadingProgress(true);