home pc
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user