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
protected Void doInBackground(Void... params) {
// Log.d(TAG, logPrefix + "DataRequester: doInBack: " + params);
@ -402,7 +401,6 @@ public class ListenerService extends WearableListenerService implements GoogleAp
}
private void forceGoogleApiConnect() {
if (googleApiClient == null || (!googleApiClient.isConnected() && !googleApiClient.isConnecting())) {
try {
@ -607,12 +605,22 @@ public class ListenerService extends WearableListenerService implements GoogleAp
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) {
CharSequence name = "AAPS Bolus Progress";
String description = "Bolus progress and cancel";
NotificationChannel channel = new NotificationChannel(AAPS_NOTIFY_CHANNEL_ID_BOLUSPROGRESS, name, NotificationManager.IMPORTANCE_HIGH);
channel.setDescription(description);
channel.enableVibration(true);
channel.setVibrationPattern(vibratePattern);
// Register the channel with the system; you can't change the importance
// or other notification behaviors after this
@ -624,16 +632,6 @@ public class ListenerService extends WearableListenerService implements GoogleAp
cancelIntent.setAction(ACTION_CANCELBOLUS);
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 =
new NotificationCompat.Builder(this, AAPS_NOTIFY_CHANNEL_ID_BOLUSPROGRESS)
.setSmallIcon(R.drawable.ic_icon)
@ -675,7 +673,6 @@ public class ListenerService extends WearableListenerService implements GoogleAp
}
private class DismissThread extends Thread {
private final int notificationID;
private final int seconds;