fix: add missed disableVibration

This commit is contained in:
xtaodada 2022-12-04 14:29:30 +08:00
parent e5b75028a2
commit 889f7b0aa6
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659
2 changed files with 6 additions and 4 deletions

View File

@ -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);
}
}
}

View File

@ -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)
}