mirror of
https://github.com/termux/termux-app
synced 2024-06-13 12:56:41 +00:00
extra keys: follow DnD mode and haptic feedback Android settings
Do not vibrate when: * Do not disturb mode is on. * Haptic feedback is disabled in Android settings.
This commit is contained in:
parent
d5f9cf85c9
commit
a3673d1af5
|
@ -2,6 +2,7 @@ package com.termux.app;
|
|||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.provider.Settings;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import java.util.concurrent.Executors;
|
||||
|
@ -350,7 +351,15 @@ public final class ExtraKeysView extends GridLayout {
|
|||
|
||||
final Button finalButton = button;
|
||||
button.setOnClickListener(v -> {
|
||||
finalButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
|
||||
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) {
|
||||
finalButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
|
||||
}
|
||||
}
|
||||
|
||||
View root = getRootView();
|
||||
if(Arrays.asList("CTRL", "ALT", "FN").contains(buttonText)) {
|
||||
ToggleButton self = (ToggleButton) finalButton;
|
||||
|
|
Loading…
Reference in New Issue
Block a user