fix #10, close clipboard manager automatically in some cases

This commit is contained in:
tibbi 2022-02-04 12:07:23 +01:00
parent f384351858
commit 19c61cfbaf
2 changed files with 8 additions and 1 deletions

View File

@ -199,6 +199,13 @@ class SimpleKeyboardIME : InputMethodService(), MyKeyboardView.OnKeyboardActionL
currentInputConnection?.commitText(text, 0)
}
override fun onUpdateSelection(oldSelStart: Int, oldSelEnd: Int, newSelStart: Int, newSelEnd: Int, candidatesStart: Int, candidatesEnd: Int) {
super.onUpdateSelection(oldSelStart, oldSelEnd, newSelStart, newSelEnd, candidatesStart, candidatesEnd)
if (newSelStart == newSelEnd) {
keyboardView?.closeClipboardManager()
}
}
private fun moveCursor(moveRight: Boolean) {
val extractedText = currentInputConnection?.getExtractedText(ExtractedTextRequest(), 0) ?: return
var newCursorPosition = extractedText.selectionStart

View File

@ -1293,7 +1293,7 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
return true
}
private fun closeClipboardManager() {
fun closeClipboardManager() {
mClipboardManagerHolder?.clipboard_manager_holder?.beGone()
}