com.eveningoutpost.dexdrip.UtilityModels.AlertPlayer Java Examples
The following examples show how to use
com.eveningoutpost.dexdrip.UtilityModels.AlertPlayer.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StopSensor.java From xDrip-Experimental with GNU General Public License v3.0 | 6 votes |
public void addListenerOnButton() { button = (Button)findViewById(R.id.stop_sensor); button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Sensor.stopSensor(); AlertPlayer.getPlayer().stopAlert(getApplicationContext(), true, false); Toast.makeText(getApplicationContext(), "Sensor stopped", Toast.LENGTH_LONG).show(); //If Sensor is stopped for G5, we need to prevent further BLE scanning. SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); String collection_method = prefs.getString("dex_collection_method", "BluetoothWixel"); if(collection_method.compareTo("DexcomG5") == 0) { Intent serviceIntent = new Intent(getApplicationContext(), G5CollectionService.class); startService(serviceIntent); } Intent intent = new Intent(getApplicationContext(), Home.class); startActivity(intent); finish(); } }); }
Example #2
Source File: Home.java From xDrip with GNU General Public License v3.0 | 6 votes |
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { switch (event.getKeyCode()) { case KeyEvent.KEYCODE_VOLUME_DOWN: case KeyEvent.KEYCODE_VOLUME_UP: case KeyEvent.KEYCODE_VOLUME_MUTE: if (JoH.quietratelimit("button-press", 5)) { if (Pref.getBooleanDefaultFalse("buttons_silence_alert")) { final ActiveBgAlert activeBgAlert = ActiveBgAlert.getOnly(); if (activeBgAlert != null) { AlertPlayer.getPlayer().Snooze(xdrip.getAppContext(), -1); final String msg = "Snoozing alert due to volume button press"; JoH.static_toast_long(msg); UserError.Log.ueh(TAG, msg); } else { if (d) UserError.Log.d(TAG, "no active alert to snooze"); } } else { if (d) UserError.Log.d(TAG, "No action as preference is disabled"); } } break; } if (d) Log.d(TAG, "Keydown event: " + keyCode + " event: " + event.toString()); return super.onKeyDown(keyCode, event); }
Example #3
Source File: Home.java From xDrip-plus with GNU General Public License v3.0 | 6 votes |
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { switch (event.getKeyCode()) { case KeyEvent.KEYCODE_VOLUME_DOWN: case KeyEvent.KEYCODE_VOLUME_UP: case KeyEvent.KEYCODE_VOLUME_MUTE: if (JoH.quietratelimit("button-press", 5)) { if (Pref.getBooleanDefaultFalse("buttons_silence_alert")) { final ActiveBgAlert activeBgAlert = ActiveBgAlert.getOnly(); if (activeBgAlert != null) { AlertPlayer.getPlayer().Snooze(xdrip.getAppContext(), -1); final String msg = "Snoozing alert due to volume button press"; JoH.static_toast_long(msg); UserError.Log.ueh(TAG, msg); } else { if (d) UserError.Log.d(TAG, "no active alert to snooze"); } } else { if (d) UserError.Log.d(TAG, "No action as preference is disabled"); } } break; } if (d) Log.d(TAG, "Keydown event: " + keyCode + " event: " + event.toString()); return super.onKeyDown(keyCode, event); }
Example #4
Source File: StopSensor.java From xDrip with GNU General Public License v3.0 | 6 votes |
public synchronized static void stop() { Sensor.stopSensor(); Inevitable.task("stop-sensor",1000, Sensor::stopSensor); AlertPlayer.getPlayer().stopAlert(xdrip.getAppContext(), true, false); JoH.static_toast_long(gs(R.string.sensor_stopped)); JoH.clearCache(); LibreAlarmReceiver.clearSensorStats(); PluggableCalibration.invalidateAllCaches(); Ob1G5StateMachine.stopSensor(); CollectionServiceStarter.restartCollectionServiceBackground(); Home.staticRefreshBGCharts(); NanoStatus.keepFollowerUpdated(false); }
Example #5
Source File: StopSensor.java From xDrip-plus with GNU General Public License v3.0 | 6 votes |
public synchronized static void stop() { Sensor.stopSensor(); Inevitable.task("stop-sensor",1000, Sensor::stopSensor); AlertPlayer.getPlayer().stopAlert(xdrip.getAppContext(), true, false); JoH.static_toast_long(gs(R.string.sensor_stopped)); JoH.clearCache(); LibreAlarmReceiver.clearSensorStats(); PluggableCalibration.invalidateAllCaches(); Ob1G5StateMachine.stopSensor(); CollectionServiceStarter.restartCollectionServiceBackground(); Home.staticRefreshBGCharts(); NanoStatus.keepFollowerUpdated(false); }
Example #6
Source File: QuickSnooze.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); JoH.static_toast_long(getString(R.string.sending_snooze)); AlertPlayer.getPlayer().Snooze(xdrip.getAppContext(), -1); finish(); }
Example #7
Source File: SnoozeOnNotificationDismissService.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
private void snoozeBgAlert() { AlertType activeBgAlert = ActiveBgAlert.alertTypegetOnly(); int snooze = 30; if(activeBgAlert != null) { if(activeBgAlert.default_snooze != 0) { snooze = activeBgAlert.default_snooze; } else { snooze = SnoozeActivity.getDefaultSnooze(activeBgAlert.above); } } AlertPlayer.getPlayer().Snooze(getApplicationContext(), snooze); }
Example #8
Source File: SnoozeActivity.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
public void addListenerOnButton() { buttonSnooze = (Button)findViewById(R.id.button_snooze); //low alerts disableLowAlerts = (Button)findViewById(R.id.button_disable_low_alerts); clearLowDisabled = (Button)findViewById(R.id.enable_low_alerts); //high alerts disableHighAlerts = (Button)findViewById(R.id.button_disable_high_alerts); clearHighDisabled = (Button)findViewById(R.id.enable_high_alerts); //all alerts disableAlerts = (Button)findViewById(R.id.button_disable_alerts); clearDisabled = (Button)findViewById(R.id.enable_alerts); sendRemoteSnooze = (Button)findViewById(R.id.send_remote_snooze); buttonSnooze.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { int intValue = getTimeFromSnoozeValue(snoozeValue.getValue()); AlertPlayer.getPlayer().Snooze(getApplicationContext(), intValue); Intent intent = new Intent(getApplicationContext(), Home.class); if (ActiveBgAlert.getOnly() != null) { Log.e(TAG, "Snoozed! ActiveBgAlert.getOnly() != null TODO restart Home.class - watchface?"); //KS TODO startActivity(intent); } finish(); } }); showDisableEnableButtons(); setOnClickListenerOnDisableButton(disableAlerts, "alerts_disabled_until"); setOnClickListenerOnDisableButton(disableLowAlerts, "low_alerts_disabled_until"); setOnClickListenerOnDisableButton(disableHighAlerts, "high_alerts_disabled_until"); setOnClickListenerOnClearDisabledButton(clearDisabled, "alerts_disabled_until"); setOnClickListenerOnClearDisabledButton(clearLowDisabled, "low_alerts_disabled_until"); setOnClickListenerOnClearDisabledButton(clearHighDisabled, "high_alerts_disabled_until"); }
Example #9
Source File: AlertType.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
public long getNextAlertTime(Context ctx) { int time = minutes_between; if (time < 1 || AlertPlayer.isAscendingMode(ctx)) { time = 1; } Calendar calendar = Calendar.getInstance(); return calendar.getTimeInMillis() + (time * 60000); }
Example #10
Source File: AlertType.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
public static void testAlert( String name, boolean above, double threshold, boolean all_day, int minutes_between, String mp3_file, int start_time_minutes, int end_time_minutes, boolean override_silent_mode, boolean force_speaker, int snooze, boolean vibrate, Context context) { AlertType at = new AlertType(); at.name = name; at.above = above; at.threshold = threshold; at.all_day = all_day; at.minutes_between = minutes_between; at.uuid = UUID.randomUUID().toString(); at.active = true; at.mp3_file = mp3_file; at.start_time_minutes = start_time_minutes; at.end_time_minutes = end_time_minutes; at.override_silent_mode = override_silent_mode; at.force_speaker = force_speaker; at.default_snooze = snooze; at.vibrate = vibrate; AlertPlayer.getPlayer().startAlert(context, false, at, "TEST", false); }
Example #11
Source File: SnoozeOnNotificationDismissService.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
private void snoozeBgAlert() { AlertType activeBgAlert = ActiveBgAlert.alertTypegetOnly(); int snooze = 30; if(activeBgAlert != null) { if(activeBgAlert.default_snooze != 0) { snooze = activeBgAlert.default_snooze; } else { snooze = SnoozeActivity.getDefaultSnooze(activeBgAlert.above); } } AlertPlayer.getPlayer().Snooze(getApplicationContext(), snooze); }
Example #12
Source File: PebbleWatchSync.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
public static void receiveAppData(int transactionId, PebbleDictionary data) { Log.d(TAG, "receiveAppData: transactionId is " + String.valueOf(transactionId)); AlertPlayer.getPlayer().Snooze(xdrip.getAppContext(), -1); PebbleKit.sendAckToPebble(xdrip.getAppContext(), transactionId); BroadcastSnooze.send(); JoH.static_toast_long("Alarm snoozed by pebble"); }
Example #13
Source File: LeFunService.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
private void shakeDetected() { UserError.Log.d(TAG, "Shake detected"); if (shakeToSnooze()) { AlertPlayer.getPlayer().OpportunisticSnooze(); emptyQueue(); UserError.Log.ueh(TAG, "Alert snoozed by Shake"); } }
Example #14
Source File: LeFunService.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
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"); } }
Example #15
Source File: SnoozeActivity.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
public void addListenerOnButton() { buttonSnooze = (Button)findViewById(R.id.button_snooze); //low alerts disableLowAlerts = (Button)findViewById(R.id.button_disable_low_alerts); clearLowDisabled = (Button)findViewById(R.id.enable_low_alerts); //high alerts disableHighAlerts = (Button)findViewById(R.id.button_disable_high_alerts); clearHighDisabled = (Button)findViewById(R.id.enable_high_alerts); //all alerts disableAlerts = (Button)findViewById(R.id.button_disable_alerts); clearDisabled = (Button)findViewById(R.id.enable_alerts); sendRemoteSnooze = (Button)findViewById(R.id.send_remote_snooze); buttonSnooze.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { int intValue = getTimeFromSnoozeValue(snoozeValue.getValue()); AlertPlayer.getPlayer().Snooze(getApplicationContext(), intValue); Intent intent = new Intent(getApplicationContext(), Home.class); if (ActiveBgAlert.getOnly() != null) { startActivity(intent); } finish(); } }); showDisableEnableButtons(); setOnClickListenerOnDisableButton(disableAlerts, "alerts_disabled_until"); setOnClickListenerOnDisableButton(disableLowAlerts, "low_alerts_disabled_until"); setOnClickListenerOnDisableButton(disableHighAlerts, "high_alerts_disabled_until"); setOnClickListenerOnClearDisabledButton(clearDisabled, "alerts_disabled_until"); setOnClickListenerOnClearDisabledButton(clearLowDisabled, "low_alerts_disabled_until"); setOnClickListenerOnClearDisabledButton(clearHighDisabled, "high_alerts_disabled_until"); }
Example #16
Source File: AlertType.java From xDrip-Experimental with GNU General Public License v3.0 | 5 votes |
public long getNextAlertTime(Context ctx) { int time = minutes_between; if (time < 1 || AlertPlayer.isAscendingMode(ctx)) { time = 1; } Calendar calendar = Calendar.getInstance(); return calendar.getTimeInMillis() + (time * 60000); }
Example #17
Source File: AlertType.java From xDrip-Experimental with GNU General Public License v3.0 | 5 votes |
public static void testAlert( String name, boolean above, double threshold, boolean all_day, int minutes_between, String mp3_file, int start_time_minutes, int end_time_minutes, boolean override_silent_mode, int snooze, boolean vibrate, Context context) { AlertType at = new AlertType(); at.name = name; at.above = above; at.threshold = threshold; at.all_day = all_day; at.minutes_between = minutes_between; at.uuid = UUID.randomUUID().toString(); at.active = true; at.mp3_file = mp3_file; at.start_time_minutes = start_time_minutes; at.end_time_minutes = end_time_minutes; at.override_silent_mode = override_silent_mode; at.default_snooze = snooze; at.vibrate = vibrate; AlertPlayer.getPlayer().startAlert(context, false, at, "TEST"); }
Example #18
Source File: SnoozeOnNotificationDismissService.java From xDrip-Experimental with GNU General Public License v3.0 | 5 votes |
private void snoozeBgAlert() { AlertType activeBgAlert = ActiveBgAlert.alertTypegetOnly(); int snooze = 30; if(activeBgAlert != null) { if(activeBgAlert.default_snooze != 0) { snooze = activeBgAlert.default_snooze; } else { snooze = SnoozeActivity.getDefaultSnooze(activeBgAlert.above); } } AlertPlayer.getPlayer().Snooze(getApplicationContext(), snooze); }
Example #19
Source File: SnoozeActivity.java From xDrip-Experimental with GNU General Public License v3.0 | 5 votes |
public void addListenerOnButton() { buttonSnooze = (Button)findViewById(R.id.button_snooze); //low alerts disableLowAlerts = (Button)findViewById(R.id.button_disable_low_alerts); clearLowDisabled = (Button)findViewById(R.id.enable_low_alerts); //high alerts disableHighAlerts = (Button)findViewById(R.id.button_disable_high_alerts); clearHighDisabled = (Button)findViewById(R.id.enable_high_alerts); //all alerts disableAlerts = (Button)findViewById(R.id.button_disable_alerts); clearDisabled = (Button)findViewById(R.id.enable_alerts); buttonSnooze.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { int intValue = getTimeFromSnoozeValue(snoozeValue.getValue()); AlertPlayer.getPlayer().Snooze(getApplicationContext(), intValue); Intent intent = new Intent(getApplicationContext(), Home.class); if (ActiveBgAlert.getOnly() != null) { startActivity(intent); } finish(); } }); showDisableEnableButtons(); setOnClickListenerOnDisableButton(disableAlerts, "alerts_disabled_until"); setOnClickListenerOnDisableButton(disableLowAlerts, "low_alerts_disabled_until"); setOnClickListenerOnDisableButton(disableHighAlerts, "high_alerts_disabled_until"); setOnClickListenerOnClearDisabledButton(clearDisabled, "alerts_disabled_until"); setOnClickListenerOnClearDisabledButton(clearLowDisabled, "low_alerts_disabled_until"); setOnClickListenerOnClearDisabledButton(clearHighDisabled, "high_alerts_disabled_until"); }
Example #20
Source File: PebbleWatchSync.java From xDrip with GNU General Public License v3.0 | 5 votes |
public static void receiveAppData(int transactionId, PebbleDictionary data) { Log.d(TAG, "receiveAppData: transactionId is " + String.valueOf(transactionId)); AlertPlayer.getPlayer().Snooze(xdrip.getAppContext(), -1); PebbleKit.sendAckToPebble(xdrip.getAppContext(), transactionId); BroadcastSnooze.send(); JoH.static_toast_long("Alarm snoozed by pebble"); }
Example #21
Source File: AlertType.java From xDrip with GNU General Public License v3.0 | 5 votes |
public static void testAlert( String name, boolean above, double threshold, boolean all_day, int minutes_between, String mp3_file, int start_time_minutes, int end_time_minutes, boolean override_silent_mode, int snooze, boolean vibrate, Context context) { AlertType at = new AlertType(); at.name = name; at.above = above; at.threshold = threshold; at.all_day = all_day; at.minutes_between = minutes_between; at.uuid = UUID.randomUUID().toString(); at.active = true; at.mp3_file = mp3_file; at.start_time_minutes = start_time_minutes; at.end_time_minutes = end_time_minutes; at.override_silent_mode = override_silent_mode; at.default_snooze = snooze; at.vibrate = vibrate; AlertPlayer.getPlayer().startAlert(context, false, at, "TEST", false); }
Example #22
Source File: SnoozeOnNotificationDismissService.java From xDrip with GNU General Public License v3.0 | 5 votes |
private void snoozeBgAlert() { AlertType activeBgAlert = ActiveBgAlert.alertTypegetOnly(); int snooze = 30; if(activeBgAlert != null) { if(activeBgAlert.default_snooze != 0) { snooze = activeBgAlert.default_snooze; } else { snooze = SnoozeActivity.getDefaultSnooze(activeBgAlert.above); } } AlertPlayer.getPlayer().Snooze(getApplicationContext(), snooze); }
Example #23
Source File: QuickSnooze.java From xDrip with GNU General Public License v3.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); JoH.static_toast_long(getString(R.string.sending_snooze)); AlertPlayer.getPlayer().Snooze(xdrip.getAppContext(), -1); finish(); }
Example #24
Source File: SnoozeActivity.java From xDrip with GNU General Public License v3.0 | 5 votes |
public void addListenerOnButton() { buttonSnooze = (Button)findViewById(R.id.button_snooze); //low alerts disableLowAlerts = (Button)findViewById(R.id.button_disable_low_alerts); clearLowDisabled = (Button)findViewById(R.id.enable_low_alerts); //high alerts disableHighAlerts = (Button)findViewById(R.id.button_disable_high_alerts); clearHighDisabled = (Button)findViewById(R.id.enable_high_alerts); //all alerts disableAlerts = (Button)findViewById(R.id.button_disable_alerts); clearDisabled = (Button)findViewById(R.id.enable_alerts); sendRemoteSnooze = (Button)findViewById(R.id.send_remote_snooze); buttonSnooze.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { int intValue = getTimeFromSnoozeValue(snoozeValue.getValue()); AlertPlayer.getPlayer().Snooze(getApplicationContext(), intValue); Intent intent = new Intent(getApplicationContext(), Home.class); if (ActiveBgAlert.getOnly() != null) { Log.e(TAG, "Snoozed! ActiveBgAlert.getOnly() != null TODO restart Home.class - watchface?"); //KS TODO startActivity(intent); } finish(); } }); showDisableEnableButtons(); setOnClickListenerOnDisableButton(disableAlerts, "alerts_disabled_until"); setOnClickListenerOnDisableButton(disableLowAlerts, "low_alerts_disabled_until"); setOnClickListenerOnDisableButton(disableHighAlerts, "high_alerts_disabled_until"); setOnClickListenerOnClearDisabledButton(clearDisabled, "alerts_disabled_until"); setOnClickListenerOnClearDisabledButton(clearLowDisabled, "low_alerts_disabled_until"); setOnClickListenerOnClearDisabledButton(clearHighDisabled, "high_alerts_disabled_until"); }
Example #25
Source File: AlertType.java From xDrip with GNU General Public License v3.0 | 5 votes |
public long getNextAlertTime(Context ctx) { int time = minutes_between; if (time < 1 || AlertPlayer.isAscendingMode(ctx)) { time = 1; } Calendar calendar = Calendar.getInstance(); return calendar.getTimeInMillis() + (time * 60000); }
Example #26
Source File: AlertType.java From xDrip with GNU General Public License v3.0 | 5 votes |
public static void testAlert( String name, boolean above, double threshold, boolean all_day, int minutes_between, String mp3_file, int start_time_minutes, int end_time_minutes, boolean override_silent_mode, boolean force_speaker, int snooze, boolean vibrate, Context context) { AlertType at = new AlertType(); at.name = name; at.above = above; at.threshold = threshold; at.all_day = all_day; at.minutes_between = minutes_between; at.uuid = UUID.randomUUID().toString(); at.active = true; at.mp3_file = mp3_file; at.start_time_minutes = start_time_minutes; at.end_time_minutes = end_time_minutes; at.override_silent_mode = override_silent_mode; at.force_speaker = force_speaker; at.default_snooze = snooze; at.vibrate = vibrate; AlertPlayer.getPlayer().startAlert(context, false, at, "TEST", false); }
Example #27
Source File: SnoozeOnNotificationDismissService.java From xDrip with GNU General Public License v3.0 | 5 votes |
private void snoozeBgAlert() { AlertType activeBgAlert = ActiveBgAlert.alertTypegetOnly(); int snooze = 30; if(activeBgAlert != null) { if(activeBgAlert.default_snooze != 0) { snooze = activeBgAlert.default_snooze; } else { snooze = SnoozeActivity.getDefaultSnooze(activeBgAlert.above); } } AlertPlayer.getPlayer().Snooze(getApplicationContext(), snooze); }
Example #28
Source File: AlertType.java From xDrip with GNU General Public License v3.0 | 5 votes |
public long getNextAlertTime(Context ctx) { int time = minutes_between; if (time < 1 || AlertPlayer.isAscendingMode(ctx)) { time = 1; } Calendar calendar = Calendar.getInstance(); return calendar.getTimeInMillis() + (time * 60000); }
Example #29
Source File: LeFunService.java From xDrip with GNU General Public License v3.0 | 5 votes |
private void shakeDetected() { UserError.Log.d(TAG, "Shake detected"); if (shakeToSnooze()) { AlertPlayer.getPlayer().OpportunisticSnooze(); emptyQueue(); UserError.Log.ueh(TAG, "Alert snoozed by Shake"); } }
Example #30
Source File: LeFunService.java From xDrip with GNU General Public License v3.0 | 5 votes |
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"); } }