use of com.eveningoutpost.dexdrip.Models.ActiveBgAlert in project xDrip-plus by jamorham.
the class Home method onKeyDown.
@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);
}
Aggregations