Merge pull request #196 from Merkost/capitalizing_refactoring

Sentences capitalization cursor improvements
This commit is contained in:
Tibor Kaputa 2023-06-18 08:52:35 +02:00 committed by GitHub
commit b89cc04f04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -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

View File

@ -49,6 +49,7 @@
<com.simplemobiletools.commons.views.MyEditText
android:id="@+id/text_edittext"
android:inputType="textCapSentences"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/activity_margin"