Merge pull request #194 from Merkost/capitalizing_refactoring

Fixed some wrong capitalizing scenarios
This commit is contained in:
Tibor Kaputa 2023-06-16 15:32:09 +02:00 committed by GitHub
commit 5e50feea90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 8 deletions

View File

@ -18,7 +18,8 @@ import com.simplemobiletools.keyboard.extensions.safeStorageContext
import com.simplemobiletools.keyboard.helpers.*
import com.simplemobiletools.keyboard.interfaces.OnKeyboardActionListener
import com.simplemobiletools.keyboard.views.MyKeyboardView
import kotlinx.android.synthetic.main.keyboard_view_keyboard.view.*
import kotlinx.android.synthetic.main.keyboard_view_keyboard.view.keyboard_holder
import kotlinx.android.synthetic.main.keyboard_view_keyboard.view.keyboard_view
// based on https://www.androidauthority.com/lets-build-custom-keyboard-android-832362/
class SimpleKeyboardIME : InputMethodService(), OnKeyboardActionListener, SharedPreferences.OnSharedPreferenceChangeListener {
@ -67,11 +68,11 @@ class SimpleKeyboardIME : InputMethodService(), OnKeyboardActionListener, Shared
keyboard = createNewKeyboard()
keyboardView?.setKeyboard(keyboard!!)
keyboardView?.setEditorInfo(attribute)
updateShiftKeyState(null)
updateShiftKeyState()
}
private fun updateShiftKeyState(code: Int?) {
if (code == MyKeyboard.KEYCODE_SHIFT) {
private fun updateShiftKeyState() {
if (keyboard!!.mShiftState == ShiftState.ON_PERMANENT) {
return
}
@ -181,10 +182,6 @@ class SimpleKeyboardIME : InputMethodService(), OnKeyboardActionListener, Shared
}
}
}
if (keyboard!!.mShiftState != ShiftState.ON_PERMANENT) {
updateShiftKeyState(code)
}
}
override fun onActionUp() {
@ -258,6 +255,7 @@ class SimpleKeyboardIME : InputMethodService(), OnKeyboardActionListener, Shared
if (newSelStart == newSelEnd) {
keyboardView?.closeClipboardManager()
}
updateShiftKeyState()
}
private fun moveCursor(moveRight: Boolean) {