mirror of
https://github.com/florisboard/florisboard.git
synced 2024-09-19 19:42:20 +02:00
Merge pull request #326 from serebit/master
Use haptic feedback by default if available
This commit is contained in:
commit
cc9688a2dd
@ -210,6 +210,8 @@ class FlorisBoard : InputMethodService(), ClipboardManager.OnPrimaryClipChangedL
|
|||||||
baseContext.setTheme(currentThemeResId)
|
baseContext.setTheme(currentThemeResId)
|
||||||
|
|
||||||
inputWindowView = layoutInflater.inflate(R.layout.florisboard, null) as InputWindowView
|
inputWindowView = layoutInflater.inflate(R.layout.florisboard, null) as InputWindowView
|
||||||
|
inputWindowView?.isHapticFeedbackEnabled = true
|
||||||
|
|
||||||
eventListeners.toList().forEach { it?.onCreateInputView() }
|
eventListeners.toList().forEach { it?.onCreateInputView() }
|
||||||
|
|
||||||
return inputWindowView
|
return inputWindowView
|
||||||
@ -515,8 +517,13 @@ class FlorisBoard : InputMethodService(), ClipboardManager.OnPrimaryClipChangedL
|
|||||||
if (prefs.keyboard.vibrationEnabled) {
|
if (prefs.keyboard.vibrationEnabled) {
|
||||||
var vibrationStrength = prefs.keyboard.vibrationStrength
|
var vibrationStrength = prefs.keyboard.vibrationStrength
|
||||||
if (vibrationStrength == -1 && prefs.keyboard.vibrationEnabledSystem) {
|
if (vibrationStrength == -1 && prefs.keyboard.vibrationEnabledSystem) {
|
||||||
|
val hapticsPerformed =
|
||||||
|
inputWindowView?.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP)
|
||||||
|
|
||||||
|
if (hapticsPerformed == false) {
|
||||||
vibrationStrength = 36
|
vibrationStrength = 36
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (vibrationStrength > 0) {
|
if (vibrationStrength > 0) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
vibrator?.vibrate(
|
vibrator?.vibrate(
|
||||||
|
Loading…
Reference in New Issue
Block a user