@@ -18,7 +18,8 @@ import com.simplemobiletools.keyboard.extensions.safeStorageContext
1818import com.simplemobiletools.keyboard.helpers.*
1919import com.simplemobiletools.keyboard.interfaces.OnKeyboardActionListener
2020import com.simplemobiletools.keyboard.views.MyKeyboardView
21- import kotlinx.android.synthetic.main.keyboard_view_keyboard.view.*
21+ import kotlinx.android.synthetic.main.keyboard_view_keyboard.view.keyboard_holder
22+ import kotlinx.android.synthetic.main.keyboard_view_keyboard.view.keyboard_view
2223
2324// based on https://www.androidauthority.com/lets-build-custom-keyboard-android-832362/
2425class SimpleKeyboardIME : InputMethodService (), OnKeyboardActionListener, SharedPreferences.OnSharedPreferenceChangeListener {
@@ -67,11 +68,11 @@ class SimpleKeyboardIME : InputMethodService(), OnKeyboardActionListener, Shared
6768 keyboard = createNewKeyboard()
6869 keyboardView?.setKeyboard(keyboard!! )
6970 keyboardView?.setEditorInfo(attribute)
70- updateShiftKeyState(null )
71+ updateShiftKeyState()
7172 }
7273
73- private fun updateShiftKeyState (code : Int? ) {
74- if (code == MyKeyboard . KEYCODE_SHIFT ) {
74+ private fun updateShiftKeyState () {
75+ if (keyboard !! .mShiftState == ShiftState . ON_PERMANENT ) {
7576 return
7677 }
7778
@@ -181,10 +182,6 @@ class SimpleKeyboardIME : InputMethodService(), OnKeyboardActionListener, Shared
181182 }
182183 }
183184 }
184-
185- if (keyboard!! .mShiftState != ShiftState .ON_PERMANENT ) {
186- updateShiftKeyState(code)
187- }
188185 }
189186
190187 override fun onActionUp () {
@@ -258,6 +255,7 @@ class SimpleKeyboardIME : InputMethodService(), OnKeyboardActionListener, Shared
258255 if (newSelStart == newSelEnd) {
259256 keyboardView?.closeClipboardManager()
260257 }
258+ updateShiftKeyState()
261259 }
262260
263261 private fun moveCursor (moveRight : Boolean ) {
0 commit comments