fix #10, close clipboard manager automatically in some cases
This commit is contained in:
parent
f384351858
commit
19c61cfbaf
|
@ -199,6 +199,13 @@ class SimpleKeyboardIME : InputMethodService(), MyKeyboardView.OnKeyboardActionL
|
||||||
currentInputConnection?.commitText(text, 0)
|
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) {
|
private fun moveCursor(moveRight: Boolean) {
|
||||||
val extractedText = currentInputConnection?.getExtractedText(ExtractedTextRequest(), 0) ?: return
|
val extractedText = currentInputConnection?.getExtractedText(ExtractedTextRequest(), 0) ?: return
|
||||||
var newCursorPosition = extractedText.selectionStart
|
var newCursorPosition = extractedText.selectionStart
|
||||||
|
|
|
@ -1293,7 +1293,7 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun closeClipboardManager() {
|
fun closeClipboardManager() {
|
||||||
mClipboardManagerHolder?.clipboard_manager_holder?.beGone()
|
mClipboardManagerHolder?.clipboard_manager_holder?.beGone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue