diff options
| author | JosJuice <josjuice@gmail.com> | 2026-06-27 08:43:25 +0200 |
|---|---|---|
| committer | JosJuice <josjuice@gmail.com> | 2026-07-09 21:05:10 +0200 |
| commit | b67188cc442d4b2d38cfb95b83cbeb0525ca257e (patch) | |
| tree | 38b03679d4dc86a44617b298a88124bad10b770d /Source/Android/app | |
| parent | aaeb6e5dc1e0e7377b1f9cc48203051f09282217 (diff) | |
Android: Make vibration length variable
Previously we would vibrate for 100 ms on every vibration, which was
especially annoying if a game was doing a bunch of vibrations that were
supposed to be much shorter than that. Now we tell Android to vibrate
for 10 s, then cancel the vibration as soon as the game turns the
vibration off.
Diffstat (limited to 'Source/Android/app')
| -rw-r--r-- | Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/ControllerInterface.kt | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/ControllerInterface.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/ControllerInterface.kt index b412b6ef9b..bcd47781a0 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/ControllerInterface.kt +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/ControllerInterface.kt @@ -186,7 +186,7 @@ object ControllerInterface { private fun vibrate(vibrator: Vibrator) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { vibrator.vibrate( - VibrationEffect.createOneShot(100, VibrationEffect.DEFAULT_AMPLITUDE), + VibrationEffect.createOneShot(10000, VibrationEffect.DEFAULT_AMPLITUDE), VibrationAttributes.Builder().setUsage(VibrationAttributes.USAGE_MEDIA).build() ) } else { @@ -194,16 +194,22 @@ object ControllerInterface { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { @Suppress("DEPRECATION") vibrator.vibrate( - VibrationEffect.createOneShot(100, VibrationEffect.DEFAULT_AMPLITUDE), + VibrationEffect.createOneShot(10000, VibrationEffect.DEFAULT_AMPLITUDE), attributes ) } else { @Suppress("DEPRECATION") - vibrator.vibrate(100, attributes) + vibrator.vibrate(10000, attributes) } } } + @Keep + @JvmStatic + private fun cancelVibration(vibrator: Vibrator) { + vibrator.cancel() + } + private class InputDeviceListener : InputManager.InputDeviceListener { override external fun onInputDeviceAdded(deviceId: Int) |
