feat: remove haptic feedback setting

Haptic feedback behaviour can already be controlled from Anddroid
settings.
This commit is contained in:
FineFindus
2024-05-25 11:31:58 +02:00
parent 5d3afc1b0e
commit e0a793e176
3 changed files with 20 additions and 31 deletions

View File

@@ -475,24 +475,23 @@ public class FooterStatusDisplayItem extends StatusDisplayItem{
}
private static void vibrateForAction(View view, boolean isPositive) {
if (!GlobalUserPreferences.hapticFeedback) return;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
view.performHapticFeedback(isPositive ? HapticFeedbackConstants.CONFIRM : HapticFeedbackConstants.REJECT);
} else {
Vibrator vibrator = view.getContext().getSystemService(Vibrator.class);
return;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
vibrator.vibrate(VibrationEffect.createPredefined(isPositive ? VibrationEffect.EFFECT_CLICK : VibrationEffect.EFFECT_DOUBLE_CLICK));
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
VibrationEffect effect = isPositive
? VibrationEffect.createOneShot(75L, 128)
: VibrationEffect.createWaveform(new long[]{0L, 75L, 75L, 75L}, new int[]{0, 128, 0, 128}, -1);
vibrator.vibrate(effect);
} else {
if (isPositive) vibrator.vibrate(75L);
else vibrator.vibrate(new long[]{0L, 75L, 75L, 75L}, -1);
}
Vibrator vibrator = view.getContext().getSystemService(Vibrator.class);
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.Q) {
vibrator.vibrate(VibrationEffect.createPredefined(isPositive ? VibrationEffect.EFFECT_CLICK : VibrationEffect.EFFECT_DOUBLE_CLICK));
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
VibrationEffect effect = isPositive
? VibrationEffect.createOneShot(75L, 128)
: VibrationEffect.createWaveform(new long[]{0L, 75L, 75L, 75L}, new int[]{0, 128, 0, 128}, -1);
vibrator.vibrate(effect);
} else {
if (isPositive) vibrator.vibrate(75L);
else vibrator.vibrate(new long[]{0L, 75L, 75L, 75L}, -1);
}
}
}