Skip to content

Commit 7aa6598

Browse files
ENOA-ANSUL-EDENlzlv312
authored andcommitted
fix: use actual keycode instead of index for key sound feedback
Co-Authored-By: iSilen <[email protected]>
1 parent 0ee6693 commit 7aa6598

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

app/src/main/java/com/osfans/trime/ime/keyboard/KeyboardGestureFrame.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ open class KeyboardGestureFrame(context: Context) : FrameLayout(context) {
256256
onKeyActionListener?.invoke(keyIndex, KeyBehavior.CLICK)
257257
launchRepeatClickJob(pointerId, state)
258258
} else {
259+
if (hasPopupKeys(keyIndex)) onKeyStateListener?.invoke(keyIndex, KeyBehavior.LONG_CLICK, true, true, false)
259260
if (onKeyActionListener?.invoke(keyIndex, KeyBehavior.LONG_CLICK) == true) {
260261
deactivateKeyFeedback(keyIndex, KeyBehavior.LONG_CLICK)
261262
activePointers.delete(pointerId)

app/src/main/java/com/osfans/trime/ime/keyboard/KeyboardView.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ class KeyboardView(
114114

115115
onKeyActionListener = { keyIndex, behavior ->
116116
if (behavior == KeyBehavior.LONG_CLICK && hasPopupKeys(keyIndex)) {
117-
keyboardActionListener?.onPress(keyIndex, false)
118117
val popupKeys = mKeys.get(keyIndex).popup
119118
val bounds = getKeyBounds(keyIndex)
120119
popupActionListener.onPopupAction(
@@ -163,7 +162,7 @@ class KeyboardView(
163162

164163
onKeyStateListener = { keyIndex, behavior, isVisible, isPressed, isRepeating ->
165164
val key = mKeys.getOrNull(keyIndex)
166-
if (isPressed || (isRepeating && vibrateOnKeyRepeat)) keyboardActionListener?.onPress(keyIndex, !isRepeating)
165+
if (isPressed || (isRepeating && vibrateOnKeyRepeat)) keyboardActionListener?.onPress(key?.getCode(behavior) ?: 0, !isRepeating)
167166
if (!isRepeating) {
168167
if (isVisible) {
169168
key?.onPressed()
@@ -173,7 +172,7 @@ class KeyboardView(
173172
key?.onReleased()
174173
invalidateKey(key)
175174
hidePopup(keyIndex)
176-
if (behavior == KeyBehavior.LONG_CLICK || vibrateOnKeyRelease) keyboardActionListener?.onPress(keyIndex, false)
175+
if (behavior == KeyBehavior.LONG_CLICK || vibrateOnKeyRelease) keyboardActionListener?.onPress(key?.getCode(behavior) ?: 0, false)
177176
}
178177
}
179178
}

0 commit comments

Comments
 (0)