From c786583ce86002000e2b4cfdcde970eb826a6124 Mon Sep 17 00:00:00 2001 From: Michael <13953785+Laserlicht@users.noreply.github.com> Date: Sat, 8 Jul 2023 18:16:54 +0200 Subject: [PATCH] Android Tick Effect --- .../vcmi-app/src/main/java/eu/vcmi/vcmi/NativeMethods.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/android/vcmi-app/src/main/java/eu/vcmi/vcmi/NativeMethods.java b/android/vcmi-app/src/main/java/eu/vcmi/vcmi/NativeMethods.java index 3ed602e20..8470e2d16 100644 --- a/android/vcmi-app/src/main/java/eu/vcmi/vcmi/NativeMethods.java +++ b/android/vcmi-app/src/main/java/eu/vcmi/vcmi/NativeMethods.java @@ -145,12 +145,11 @@ public class NativeMethods @SuppressWarnings(Const.JNI_METHOD_SUPPRESS) public static void hapticFeedback() { - int duration_ms = 30; final Context ctx = SDL.getContext(); if (Build.VERSION.SDK_INT >= 26) { - ((Vibrator) ctx.getSystemService(ctx.VIBRATOR_SERVICE)).vibrate(VibrationEffect.createOneShot(duration_ms, 5)); + ((Vibrator) ctx.getSystemService(ctx.VIBRATOR_SERVICE)).vibrate(VibrationEffect.createPredefined(VibrationEffect.EFFECT_TICK)); } else { - ((Vibrator) ctx.getSystemService(ctx.VIBRATOR_SERVICE)).vibrate(duration_ms); + ((Vibrator) ctx.getSystemService(ctx.VIBRATOR_SERVICE)).vibrate(30); } }