mirror of
https://github.com/SimpleMobileTools/Simple-Keyboard.git
synced 2025-01-31 10:24:45 +01:00
insert the clipboard content on click
This commit is contained in:
parent
7c2d370459
commit
90d4215372
@ -198,6 +198,10 @@ class SimpleKeyboardIME : InputMethodService(), MyKeyboardView.OnKeyboardActionL
|
||||
moveCursor(true)
|
||||
}
|
||||
|
||||
override fun onText(text: String) {
|
||||
currentInputConnection?.commitText(text, 0)
|
||||
}
|
||||
|
||||
private fun moveCursor(moveRight: Boolean) {
|
||||
val extractedText = currentInputConnection?.getExtractedText(ExtractedTextRequest(), 0) ?: return
|
||||
var newCursorPosition = extractedText.selectionStart
|
||||
|
@ -62,6 +62,12 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
|
||||
* Called when the user long presses Space and moves to the right
|
||||
*/
|
||||
fun moveCursorRight()
|
||||
|
||||
/**
|
||||
* Sends a sequence of characters to the listener.
|
||||
* @param text the string to be displayed.
|
||||
*/
|
||||
fun onText(text: String)
|
||||
}
|
||||
|
||||
private var mKeyboard: MyKeyboard? = null
|
||||
@ -415,7 +421,7 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
|
||||
background = rippleBg
|
||||
setTextColor(mTextColor)
|
||||
setOnClickListener {
|
||||
|
||||
mOnKeyboardActionListener!!.onText(clipboardContent.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -828,6 +834,10 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
|
||||
override fun moveCursorRight() {
|
||||
mOnKeyboardActionListener!!.moveCursorRight()
|
||||
}
|
||||
|
||||
override fun onText(text: String) {
|
||||
mOnKeyboardActionListener!!.onText(text)
|
||||
}
|
||||
}
|
||||
|
||||
val keyboard = if (popupKey.popupCharacters != null) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user