From cca92c784af124eba0c1e2d734449578d2a755fc Mon Sep 17 00:00:00 2001 From: merkost Date: Sat, 17 Jun 2023 09:32:33 +1000 Subject: [PATCH 1/2] Fixed capitalization scenario when cursor is moved --- .../keyboard/services/SimpleKeyboardIME.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/keyboard/services/SimpleKeyboardIME.kt b/app/src/main/kotlin/com/simplemobiletools/keyboard/services/SimpleKeyboardIME.kt index 0669a11..750f9ba 100644 --- a/app/src/main/kotlin/com/simplemobiletools/keyboard/services/SimpleKeyboardIME.kt +++ b/app/src/main/kotlin/com/simplemobiletools/keyboard/services/SimpleKeyboardIME.kt @@ -6,6 +6,7 @@ import android.text.InputType.* import android.text.TextUtils import android.view.KeyEvent import android.view.View +import android.view.inputmethod.CursorAnchorInfo import android.view.inputmethod.EditorInfo import android.view.inputmethod.EditorInfo.IME_ACTION_NONE import android.view.inputmethod.EditorInfo.IME_FLAG_NO_ENTER_ACTION @@ -72,7 +73,7 @@ class SimpleKeyboardIME : InputMethodService(), OnKeyboardActionListener, Shared } private fun updateShiftKeyState() { - if (keyboard!!.mShiftState == ShiftState.ON_PERMANENT) { + if (keyboard?.mShiftState == ShiftState.ON_PERMANENT) { return } @@ -258,6 +259,11 @@ class SimpleKeyboardIME : InputMethodService(), OnKeyboardActionListener, Shared updateShiftKeyState() } + override fun onUpdateCursorAnchorInfo(cursorAnchorInfo: CursorAnchorInfo?) { + super.onUpdateCursorAnchorInfo(cursorAnchorInfo) + updateShiftKeyState() + } + private fun moveCursor(moveRight: Boolean) { val extractedText = currentInputConnection?.getExtractedText(ExtractedTextRequest(), 0) ?: return var newCursorPosition = extractedText.selectionStart From 9c57944b2988b84d7481b91a86ba830a66d2883b Mon Sep 17 00:00:00 2001 From: merkost Date: Sun, 18 Jun 2023 13:09:08 +1000 Subject: [PATCH 2/2] Added sentences capitalization to the first editText --- app/src/main/res/layout/activity_main.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 4a1cf2c..95a29fc 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -49,6 +49,7 @@