Skip to content

Commit 59de752

Browse files
Fixed issue with caching for mini keyboard views: Getting 'miniKeyboardView' from 'mMiniKeyboardCache' and not from the previously shown layout. Fix #251.
+ removed mMiniKeyboard!!.mOnKeyboardActionListener is not needed in MyKeyboardView.onLongPress() func. Originally defined in SimpleKeyboardIME class.
1 parent 7f2b90c commit 59de752

File tree

1 file changed

+3
-32
lines changed

1 file changed

+3
-32
lines changed

app/src/main/kotlin/com/simplemobiletools/keyboard/views/MyKeyboardView.kt

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,37 +1012,6 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
10121012
mMiniKeyboard = miniKeyboardView
10131013
}
10141014

1015-
mMiniKeyboard!!.mOnKeyboardActionListener = object : OnKeyboardActionListener {
1016-
override fun onKey(code: Int) {
1017-
mOnKeyboardActionListener!!.onKey(code)
1018-
dismissPopupKeyboard()
1019-
}
1020-
1021-
override fun onPress(primaryCode: Int) {
1022-
mOnKeyboardActionListener!!.onPress(primaryCode)
1023-
}
1024-
1025-
override fun onActionUp() {
1026-
mOnKeyboardActionListener!!.onActionUp()
1027-
}
1028-
1029-
override fun moveCursorLeft() {
1030-
mOnKeyboardActionListener!!.moveCursorLeft()
1031-
}
1032-
1033-
override fun moveCursorRight() {
1034-
mOnKeyboardActionListener!!.moveCursorRight()
1035-
}
1036-
1037-
override fun onText(text: String) {
1038-
mOnKeyboardActionListener!!.onText(text)
1039-
}
1040-
1041-
override fun reloadKeyboard() {
1042-
mOnKeyboardActionListener!!.reloadKeyboard()
1043-
}
1044-
}
1045-
10461015
val keyboard = if (popupKey.popupCharacters != null) {
10471016
MyKeyboard(context, popupKeyboardId, popupKey.popupCharacters!!, popupKey.width)
10481017
} else {
@@ -1056,7 +1025,9 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
10561025
)
10571026
mMiniKeyboardCache[popupKey] = mMiniKeyboardContainer
10581027
} else {
1059-
mMiniKeyboard = keyboardPopupBinding!!.miniKeyboardView
1028+
//Using 'miniKeyboardView' from cache
1029+
mMiniKeyboard = mMiniKeyboardCache[popupKey]?.let(KeyboardPopupKeyboardBinding::bind)?.miniKeyboardView
1030+
?: keyboardPopupBinding!!.miniKeyboardView
10601031
}
10611032

10621033
getLocationInWindow(mCoordinates)

0 commit comments

Comments
 (0)