public void snooze(int minutes) { next_alert_at = new Date().getTime() + minutes * 60000; is_snoozed = true; Log.ueh("Snoozed Alert","Snoozed until: "+JoH.dateTimeText(next_alert_at)); save(); }
public void snooze(int minutes) { next_alert_at = new Date().getTime() + minutes * 60000; is_snoozed = true; Log.ueh("Snoozed Alert","Snoozed until: "+JoH.dateTimeText(next_alert_at)); save(); }
@Override public void run() { Log.d(TAG, "delayed alert firing"); final Intent notificationIntent = new Intent(xdrip.getAppContext(), Reminders.class).putExtra("reminder_id", reminder.getId().toString()); final Intent notificationDeleteIntent = new Intent(xdrip.getAppContext(), Reminders.class).putExtra("snooze_id", reminder.getId()).putExtra("snooze", "true"); final PendingIntent deleteIntent = PendingIntent.getActivity(xdrip.getAppContext(), NOTIFICATION_ID + 1, notificationDeleteIntent, 0); final PendingIntent pendingIntent = PendingIntent.getActivity(xdrip.getAppContext(), NOTIFICATION_ID, notificationIntent, 0); JoH.showNotification(reminder.getTitle(), xdrip.getAppContext().getString(R.string.reminder_due) + " " + JoH.hourMinuteString(reminder.next_due), pendingIntent, NOTIFICATION_ID, NotificationChannels.REMINDER_CHANNEL, true, true, deleteIntent, JoH.isOngoingCall() ? null : (reminder.sound_uri != null) ? Uri.parse(reminder.sound_uri) : Uri.parse(JoH.getResourceURI(R.raw.reminder_default_notification)), null); // JoH.showNotification(reminder.getTitle(), "Reminder due " + JoH.hourMinuteString(reminder.next_due), pendingIntent, NOTIFICATION_ID, true, true, deleteIntent, JoH.isOngoingCall() ? null : (reminder.sound_uri != null) ? Uri.parse(reminder.sound_uri) : Uri.parse(JoH.getResourceURI(R.raw.reminder_default_notification))); UserError.Log.ueh("Reminder Alert", reminder.getTitle() + " due: " + JoH.dateTimeText(reminder.next_due) + ((reminder.snoozed_till > reminder.next_due) ? " snoozed till: " + JoH.dateTimeText(reminder.snoozed_till) : "")); reminder.notified(); } }, 10000);
@Override public void run() { Log.d(TAG, "delayed alert firing"); final Intent notificationIntent = new Intent(xdrip.getAppContext(), Reminders.class).putExtra("reminder_id", reminder.getId().toString()); final Intent notificationDeleteIntent = new Intent(xdrip.getAppContext(), Reminders.class).putExtra("snooze_id", reminder.getId()).putExtra("snooze", "true"); final PendingIntent deleteIntent = PendingIntent.getActivity(xdrip.getAppContext(), NOTIFICATION_ID + 1, notificationDeleteIntent, 0); final PendingIntent pendingIntent = PendingIntent.getActivity(xdrip.getAppContext(), NOTIFICATION_ID, notificationIntent, 0); JoH.showNotification(reminder.getTitle(), xdrip.getAppContext().getString(R.string.reminder_due) + " " + JoH.hourMinuteString(reminder.next_due), pendingIntent, NOTIFICATION_ID, NotificationChannels.REMINDER_CHANNEL, true, true, deleteIntent, JoH.isOngoingCall() ? null : (reminder.sound_uri != null) ? Uri.parse(reminder.sound_uri) : Uri.parse(JoH.getResourceURI(R.raw.reminder_default_notification)), null); // JoH.showNotification(reminder.getTitle(), "Reminder due " + JoH.hourMinuteString(reminder.next_due), pendingIntent, NOTIFICATION_ID, true, true, deleteIntent, JoH.isOngoingCall() ? null : (reminder.sound_uri != null) ? Uri.parse(reminder.sound_uri) : Uri.parse(JoH.getResourceURI(R.raw.reminder_default_notification))); UserError.Log.ueh("Reminder Alert", reminder.getTitle() + " due: " + JoH.dateTimeText(reminder.next_due) + ((reminder.snoozed_till > reminder.next_due) ? " snoozed till: " + JoH.dateTimeText(reminder.snoozed_till) : "")); reminder.notified(); } }, 10000);
public static void set_vehicle_mode(boolean value) { setInternalPrefsString(PREFS_MOTION_VEHICLE_MODE, value ? "true" : "false"); if (value) { setInternalPrefsLong(VEHICLE_MODE_SINCE, JoH.tsl()); } else { final long duration = get_vehicle_mode_minutes(); setInternalPrefsLong(VEHICLE_MODE_SINCE, -1); if (duration > 0) { UserError.Log.ueh(TAG, "Exiting vehicle mode after: " + duration + " minutes"); } } VehicleMode.sendBroadcast(); }
public static void runPackageInstaller(final byte[] buffer) { if (buffer == null) return; try { UserError.Log.ueh(TAG, "Running demigod package installer with payload size: " + buffer.length); installPackage(xdrip.getAppContext(), buffer, BuildConfig.APPLICATION_ID); } catch (Exception e) { UserError.Log.e(TAG, e.toString()); } }
public void snooze(int minutes) { next_alert_at = new Date().getTime() + minutes * 60000; is_snoozed = true; Log.ueh("Snoozed Alert","Snoozed until: "+JoH.dateTimeText(next_alert_at)); save(); }
private static void processDevice(final String mac, final boolean connected) { if (VehicleMode.isEnabled() && VehicleMode.viaCarAudio() && SelectAudioDevice.getAudioMac().equals(mac)) { VehicleMode.setVehicleModeActive(connected); UserError.Log.ueh(TAG, "Vehicle mode: " + (connected ? "Enabled" : "Disabled")); if (connected) { Inevitable.task("xdrip-vehicle-mode", NOISE_DELAY, HeadsetStateReceiver::audioNotification); } Home.staticRefreshBGChartsOnIdle(); } }
public static synchronized void invalidateAllForSensor() { final List<Calibration> cals = allForSensorLimited(9999999); if (cals != null) { for (Calibration cal : cals) { cal.invalidate(); } } JoH.clearCache(); String msg = "Deleted all calibrations for sensor"; Log.ueh(TAG, msg); JoH.static_toast_long(msg); }
private void findPhone() { UserError.Log.d(TAG, "Find phone function triggered"); if (!AlertPlayer.getPlayer().OpportunisticSnooze()) { JoH.showNotification("Find Phone", "Activated from Lefun band", null, 5, true, true, false); } else { emptyQueue(); UserError.Log.ueh(TAG, "Alert snoozed by Find feature"); } }
private void shakeDetected() { UserError.Log.d(TAG, "Shake detected"); if (shakeToSnooze()) { AlertPlayer.getPlayer().OpportunisticSnooze(); emptyQueue(); UserError.Log.ueh(TAG, "Alert snoozed by Shake"); } }
public static synchronized void invalidateAllForSensor() { final List<Calibration> cals = allForSensorLimited(9999999); if (cals != null) { for (Calibration cal : cals) { cal.invalidate(); } } String msg = "Deleted all calibrations for sensor"; Log.ueh(TAG, msg); JoH.static_toast_long(msg); }
public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); if ((JoH.tsl() - when) < 120000) { sendRealSnoozeToRemote(); UserError.Log.ueh(TAG, "Sent snooze to remote after confirmation"); } else { JoH.static_toast_long("Took too long to confirm! Ignoring!"); UserError.Log.ueh(TAG, "Ignored snooze confirmation as took > 2 minutes to confirm!"); } } });
public static void sendSnoozeToRemote() { if ((Home.get_master() || Home.get_follower()) && (Pref.getBooleanDefaultFalse("send_snooze_to_remote")) && (JoH.pratelimit("gcm-sra-maybe", 5))) { if (Pref.getBooleanDefaultFalse("confirm_snooze_to_remote")) { Home.startHomeWithExtra(xdrip.getAppContext(), Home.HOME_FULL_WAKEUP, "1"); Home.startHomeWithExtra(xdrip.getAppContext(), Home.SNOOZE_CONFIRM_DIALOG, ""); } else { sendRealSnoozeToRemote(); UserError.Log.ueh(TAG, "Sent snooze to remote"); } } }
public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); if ((JoH.tsl() - when) < 120000) { sendRealSnoozeToRemote(); UserError.Log.ueh(TAG, "Sent snooze to remote after confirmation"); } else { JoH.static_toast_long("Took too long to confirm! Ignoring!"); UserError.Log.ueh(TAG, "Ignored snooze confirmation as took > 2 minutes to confirm!"); } } });
public static void sendSnoozeToRemote() { if ((Home.get_master() || Home.get_follower()) && (Pref.getBooleanDefaultFalse("send_snooze_to_remote")) && (JoH.pratelimit("gcm-sra-maybe", 5))) { if (Pref.getBooleanDefaultFalse("confirm_snooze_to_remote")) { Home.startHomeWithExtra(xdrip.getAppContext(), Home.HOME_FULL_WAKEUP, "1"); Home.startHomeWithExtra(xdrip.getAppContext(), Home.SNOOZE_CONFIRM_DIALOG, ""); } else { sendRealSnoozeToRemote(); UserError.Log.ueh(TAG, "Sent snooze to remote"); } } }
private void shakeDetected() { UserError.Log.d(TAG, "Shake detected"); if (shakeToSnooze()) { AlertPlayer.getPlayer().OpportunisticSnooze(); emptyQueue(); UserError.Log.ueh(TAG, "Alert snoozed by Shake"); } }
private void findPhone() { UserError.Log.d(TAG, "Find phone function triggered"); if (!AlertPlayer.getPlayer().OpportunisticSnooze()) { JoH.showNotification("Find Phone", "Activated from Lefun band", null, 5, true, true, false); } else { emptyQueue(); UserError.Log.ueh(TAG, "Alert snoozed by Find feature"); } }
public static synchronized void invalidateAllForSensor() { final List<Calibration> cals = allForSensorLimited(9999999); if (cals != null) { for (Calibration cal : cals) { cal.invalidate(); } } JoH.clearCache(); String msg = "Deleted all calibrations for sensor"; Log.ueh(TAG, msg); JoH.static_toast_long(msg); }
private static void processDevice(final String mac, final boolean connected) { if (VehicleMode.isEnabled() && VehicleMode.viaCarAudio() && SelectAudioDevice.getAudioMac().equals(mac)) { VehicleMode.setVehicleModeActive(connected); UserError.Log.ueh(TAG, "Vehicle mode: " + (connected ? "Enabled" : "Disabled")); if (connected) { Inevitable.task("xdrip-vehicle-mode", NOISE_DELAY, HeadsetStateReceiver::audioNotification); } Home.staticRefreshBGChartsOnIdle(); } }