vibrate less on bolus

This commit is contained in:
AdrianLxM 2021-01-13 00:23:35 +01:00
parent a3cbb663b9
commit 30689c38aa

View file

@ -115,7 +115,6 @@ public class ListenerService extends WearableListenerService implements GoogleAp
} }
@Override @Override
protected Void doInBackground(Void... params) { protected Void doInBackground(Void... params) {
// Log.d(TAG, logPrefix + "DataRequester: doInBack: " + params); // Log.d(TAG, logPrefix + "DataRequester: doInBack: " + params);
@ -402,7 +401,6 @@ public class ListenerService extends WearableListenerService implements GoogleAp
} }
private void forceGoogleApiConnect() { private void forceGoogleApiConnect() {
if (googleApiClient == null || (!googleApiClient.isConnected() && !googleApiClient.isConnecting())) { if (googleApiClient == null || (!googleApiClient.isConnected() && !googleApiClient.isConnecting())) {
try { try {
@ -607,12 +605,22 @@ public class ListenerService extends WearableListenerService implements GoogleAp
private void showBolusProgress(int progresspercent, String progresstatus) { private void showBolusProgress(int progresspercent, String progresstatus) {
long[] vibratePattern;
boolean vibrate = PreferenceManager
.getDefaultSharedPreferences(this).getBoolean("vibrateOnBolus", true);
if (vibrate) {
vibratePattern = new long[]{0, 50, 1000};
} else {
vibratePattern = new long[]{0, 1, 1000};
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
CharSequence name = "AAPS Bolus Progress"; CharSequence name = "AAPS Bolus Progress";
String description = "Bolus progress and cancel"; String description = "Bolus progress and cancel";
NotificationChannel channel = new NotificationChannel(AAPS_NOTIFY_CHANNEL_ID_BOLUSPROGRESS, name, NotificationManager.IMPORTANCE_HIGH); NotificationChannel channel = new NotificationChannel(AAPS_NOTIFY_CHANNEL_ID_BOLUSPROGRESS, name, NotificationManager.IMPORTANCE_HIGH);
channel.setDescription(description); channel.setDescription(description);
channel.enableVibration(true); channel.enableVibration(true);
channel.setVibrationPattern(vibratePattern);
// Register the channel with the system; you can't change the importance // Register the channel with the system; you can't change the importance
// or other notification behaviors after this // or other notification behaviors after this
@ -624,16 +632,6 @@ public class ListenerService extends WearableListenerService implements GoogleAp
cancelIntent.setAction(ACTION_CANCELBOLUS); cancelIntent.setAction(ACTION_CANCELBOLUS);
PendingIntent cancelPendingIntent = PendingIntent.getService(this, 0, cancelIntent, 0); PendingIntent cancelPendingIntent = PendingIntent.getService(this, 0, cancelIntent, 0);
long[] vibratePattern;
boolean vibreate = PreferenceManager
.getDefaultSharedPreferences(this).getBoolean("vibrateOnBolus", true);
if(vibreate){
vibratePattern = new long[]{0, 50, 1000};
} else {
vibratePattern = new long[]{0, 1, 1000};
}
// TODO: proper channel. Does cancel work?
NotificationCompat.Builder notificationBuilder = NotificationCompat.Builder notificationBuilder =
new NotificationCompat.Builder(this, AAPS_NOTIFY_CHANNEL_ID_BOLUSPROGRESS) new NotificationCompat.Builder(this, AAPS_NOTIFY_CHANNEL_ID_BOLUSPROGRESS)
.setSmallIcon(R.drawable.ic_icon) .setSmallIcon(R.drawable.ic_icon)
@ -675,7 +673,6 @@ public class ListenerService extends WearableListenerService implements GoogleAp
} }
private class DismissThread extends Thread { private class DismissThread extends Thread {
private final int notificationID; private final int notificationID;
private final int seconds; private final int seconds;