diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/BotWebViewVibrationEffect.java b/TMessagesProj/src/main/java/org/telegram/messenger/BotWebViewVibrationEffect.java index d689cbac4..eeb219fbd 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/BotWebViewVibrationEffect.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/BotWebViewVibrationEffect.java @@ -5,6 +5,8 @@ import android.os.VibrationEffect; import androidx.annotation.RequiresApi; +import tw.nekomimi.nekogram.utils.VibrateUtil; + public enum BotWebViewVibrationEffect { IMPACT_LIGHT(new long[] {7}, new int[] {65}, new long[] {60}), IMPACT_MEDIUM(new long[] {7}, new int[] {145}, new long[] {70}), @@ -43,9 +45,9 @@ public enum BotWebViewVibrationEffect { public void vibrate() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - AndroidUtilities.getVibrator().vibrate(getVibrationEffectForOreo()); + VibrateUtil.vibrate(200L, getVibrationEffectForOreo()); } else { - AndroidUtilities.getVibrator().vibrate(fallbackTimings, -1); + VibrateUtil.vibrate(fallbackTimings, -1); } } } diff --git a/TMessagesProj/src/main/java/tw/nekomimi/nekogram/utils/VibrateUtil.kt b/TMessagesProj/src/main/java/tw/nekomimi/nekogram/utils/VibrateUtil.kt index 873ee3d6e..c74b4e9b8 100644 --- a/TMessagesProj/src/main/java/tw/nekomimi/nekogram/utils/VibrateUtil.kt +++ b/TMessagesProj/src/main/java/tw/nekomimi/nekogram/utils/VibrateUtil.kt @@ -54,8 +54,8 @@ object VibrateUtil { } @JvmStatic - fun disableHapticFeedback(view: View) { - view.isHapticFeedbackEnabled = false + fun disableHapticFeedback(view: View?) { + view?.isHapticFeedbackEnabled = false (view as? ViewGroup)?.children?.forEach(::disableHapticFeedback) }