Skip to content

Commit da1a892

Browse files
committed
Fix hapticFeedback useVibrator condition
1 parent e2869de commit da1a892

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

app/src/main/java/org/fcitx/fcitx5/android/data/InputFeedbacks.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ package org.fcitx.fcitx5.android.data
66

77
import android.media.AudioManager
88
import android.os.Build
9-
import android.os.Build.VERSION
109
import android.os.VibrationEffect
1110
import android.provider.Settings
1211
import android.view.HapticFeedbackConstants
@@ -71,13 +70,13 @@ object InputFeedbacks {
7170
} else {
7271
duration = buttonPressVibrationMilliseconds.toLong()
7372
amplitude = buttonPressVibrationAmplitude
74-
hfc = if (VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1 && keyUp) {
73+
hfc = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1 && keyUp) {
7574
HapticFeedbackConstants.KEYBOARD_RELEASE
7675
} else {
7776
HapticFeedbackConstants.KEYBOARD_TAP
7877
}
7978
}
80-
val useVibrator = duration != 0L
79+
val useVibrator = duration != 0L || amplitude != 0
8180

8281
if (useVibrator) {
8382
// on Android 13, if system haptic feedback was disabled, `vibrator.vibrate()` won't work

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy