@Override public void onDestroy() { super.onDestroy(); Context context = getApplicationContext(); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); prefs.edit().putInt("missed_readings_start", AlertType.toTime(startHour, startMinute)).apply(); prefs.edit().putInt("missed_readings_end", AlertType.toTime(endHour, endMinute)).apply(); prefs.edit().putString("bg_missed_minutes", bgMissedMinutes.getText().toString()).apply(); prefs.edit().putString("bg_missed_alerts_snooze", bgMissedSnoozeMin.getText().toString()).apply(); prefs.edit().putString("bg_missed_alerts_reraise_sec", bgMissedReraiseSec.getText().toString()).apply(); prefs.edit().putBoolean("bg_missed_alerts", checkboxEnableAlert.isChecked()).apply(); prefs.edit().putBoolean("missed_readings_all_day", checkboxAllDay.isChecked()).apply(); prefs.edit().putBoolean("bg_missed_alerts_enable_alerts_reraise", checkboxEnableReraise.isChecked()).apply(); MissedReadingService.delayedLaunch(); // context.startService(new Intent(context, MissedReadingService.class)); }
@Override public void onDestroy() { super.onDestroy(); Context context = getApplicationContext(); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); prefs.edit().putInt("missed_readings_start", AlertType.toTime(startHour, startMinute)).apply(); prefs.edit().putInt("missed_readings_end", AlertType.toTime(endHour, endMinute)).apply(); prefs.edit().putString("bg_missed_minutes", bgMissedMinutes.getText().toString()).apply(); prefs.edit().putString("bg_missed_alerts_snooze", bgMissedSnoozeMin.getText().toString()).apply(); prefs.edit().putString("bg_missed_alerts_reraise_sec", bgMissedReraiseSec.getText().toString()).apply(); prefs.edit().putBoolean("bg_missed_alerts", checkboxEnableAlert.isChecked()).apply(); prefs.edit().putBoolean("missed_readings_all_day", checkboxAllDay.isChecked()).apply(); prefs.edit().putBoolean("bg_missed_alerts_enable_alerts_reraise", checkboxEnableReraise.isChecked()).apply(); MissedReadingService.delayedLaunch(); // context.startService(new Intent(context, MissedReadingService.class)); }
static public boolean s_in_time_frame(boolean s_all_day, int s_start_time_minutes, int s_end_time_minutes) { if (s_all_day) { //Log.e(TAG, "in_time_frame returning true " ); return true; } // time_now is the number of minutes that have passed from the start of the day. Calendar rightNow = Calendar.getInstance(); int time_now = toTime(rightNow.get(Calendar.HOUR_OF_DAY), rightNow.get(Calendar.MINUTE)); Log.d(TAG, "time_now is " + time_now + " minutes" + " start_time " + s_start_time_minutes + " end_time " + s_end_time_minutes); if(s_start_time_minutes < s_end_time_minutes) { if (time_now >= s_start_time_minutes && time_now <= s_end_time_minutes) { return true; } } else { if (time_now >= s_start_time_minutes || time_now <= s_end_time_minutes) { return true; } } return false; }
static public boolean s_in_time_frame(boolean s_all_day, int s_start_time_minutes, int s_end_time_minutes) { if (s_all_day) { //Log.e(TAG, "in_time_frame returning true " ); return true; } // time_now is the number of minutes that have passed from the start of the day. Calendar rightNow = Calendar.getInstance(); int time_now = toTime(rightNow.get(Calendar.HOUR_OF_DAY), rightNow.get(Calendar.MINUTE)); Log.d(TAG, "time_now is " + time_now + " minutes" + " start_time " + s_start_time_minutes + " end_time " + s_end_time_minutes); if(s_start_time_minutes < s_end_time_minutes) { if (time_now >= s_start_time_minutes && time_now <= s_end_time_minutes) { return true; } } else { if (time_now >= s_start_time_minutes || time_now <= s_end_time_minutes) { return true; } } return false; }
static public boolean s_in_time_frame(boolean s_all_day, int s_start_time_minutes, int s_end_time_minutes) { if (s_all_day) { //Log.e(TAG, "in_time_frame returning true " ); return true; } // time_now is the number of minutes that have passed from the start of the day. Calendar rightNow = Calendar.getInstance(); int time_now = toTime(rightNow.get(Calendar.HOUR_OF_DAY), rightNow.get(Calendar.MINUTE)); Log.d(TAG, "time_now is " + time_now + " minutes" + " start_time " + s_start_time_minutes + " end_time " + s_end_time_minutes); if(s_start_time_minutes < s_end_time_minutes) { if (time_now >= s_start_time_minutes && time_now <= s_end_time_minutes) { return true; } } else { if (time_now >= s_start_time_minutes || time_now <= s_end_time_minutes) { return true; } } return false; }
int timeStart = AlertType.toTime(startHour, startMinute); int timeEnd = AlertType.toTime(endHour, endMinute); if(timeStart == AlertType.toTime(23, 59)) { timeStart++; if(timeEnd == AlertType.toTime(23, 59)) { timeEnd++; if(timeStart == AlertType.toTime(0, 0) && timeEnd == AlertType.toTime(24, 0)) { allDay = true;
int timeStart = AlertType.toTime(startHour, startMinute); int timeEnd = AlertType.toTime(endHour, endMinute); if(timeStart == AlertType.toTime(23, 59)) { timeStart++; if(timeEnd == AlertType.toTime(23, 59)) { timeEnd++; if(timeStart == AlertType.toTime(0, 0) && timeEnd == AlertType.toTime(24, 0)) { allDay = true;
int timeStart = AlertType.toTime(startHour, startMinute); int timeEnd = AlertType.toTime(endHour, endMinute); if(timeStart == AlertType.toTime(23, 59)) { timeStart++; if(timeEnd == AlertType.toTime(23, 59)) { timeEnd++; if(timeStart == AlertType.toTime(0, 0) && timeEnd == AlertType.toTime(24, 0)) { allDay = true;
int timeStart = AlertType.toTime(startHour, startMinute); int timeEnd = AlertType.toTime(endHour, endMinute); if(timeStart == AlertType.toTime(23, 59)) { timeStart++; if(timeEnd == AlertType.toTime(23, 59)) { timeEnd++; if(timeStart == AlertType.toTime(0, 0) && timeEnd == AlertType.toTime(24, 0)) { allDay = true;