feat: remove haptic feedback setting
Haptic feedback behaviour can already be controlled from Anddroid settings.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user