0
0
mirror of https://github.com/florisboard/florisboard.git synced 2024-09-19 11:32:18 +02:00

Merge pull request #326 from serebit/master

Use haptic feedback by default if available
This commit is contained in:
Patrick Goldinger 2021-02-08 20:46:13 +01:00 committed by GitHub
commit cc9688a2dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -210,6 +210,8 @@ class FlorisBoard : InputMethodService(), ClipboardManager.OnPrimaryClipChangedL
baseContext.setTheme(currentThemeResId)
inputWindowView = layoutInflater.inflate(R.layout.florisboard, null) as InputWindowView
inputWindowView?.isHapticFeedbackEnabled = true
eventListeners.toList().forEach { it?.onCreateInputView() }
return inputWindowView
@ -515,7 +517,12 @@ class FlorisBoard : InputMethodService(), ClipboardManager.OnPrimaryClipChangedL
if (prefs.keyboard.vibrationEnabled) {
var vibrationStrength = prefs.keyboard.vibrationStrength
if (vibrationStrength == -1 && prefs.keyboard.vibrationEnabledSystem) {
vibrationStrength = 36
val hapticsPerformed =
inputWindowView?.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP)
if (hapticsPerformed == false) {
vibrationStrength = 36
}
}
if (vibrationStrength > 0) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {