From 87841886d4bf6c4a60d48774333dba6609c97f1f Mon Sep 17 00:00:00 2001 From: Leonid Plyushch Date: Sat, 23 Nov 2019 19:49:07 +0200 Subject: [PATCH] extra keys: improve handling of DnD mode Do not disturb mode is now handled only for SDKs pre-28. Extra keys will not vibrate only when total silence mode is used. --- app/src/main/java/com/termux/app/ExtraKeysView.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/termux/app/ExtraKeysView.java b/app/src/main/java/com/termux/app/ExtraKeysView.java index 1af2830a..e2f76dc3 100644 --- a/app/src/main/java/com/termux/app/ExtraKeysView.java +++ b/app/src/main/java/com/termux/app/ExtraKeysView.java @@ -354,9 +354,13 @@ public final class ExtraKeysView extends GridLayout { if (Settings.System.getInt(getContext().getContentResolver(), Settings.System.HAPTIC_FEEDBACK_ENABLED, 0) != 0) { - // Depending on DnD settings, value can be >1 but 0 means "disabled". - if (Settings.Global.getInt(getContext().getContentResolver(), "zen_mode", 0) < 1) { + if (Build.VERSION.SDK_INT >= 28) { finalButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + } else { + // Perform haptic feedback only if no total silence mode enabled. + if (Settings.Global.getInt(getContext().getContentResolver(), "zen_mode", 0) != 2) { + finalButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + } } }