This commit is contained in:
ADITYA
2024-03-24 23:24:07 +05:30
parent 26f2f6ccc2
commit e2f0cf4cb9
2 changed files with 13 additions and 16 deletions

View File

@@ -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) {

View File

@@ -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);