mirror of
https://github.com/SimpleMobileTools/Simple-Keyboard.git
synced 2025-06-05 21:49:26 +02:00
insert the clipboard content on click
This commit is contained in:
@ -198,6 +198,10 @@ class SimpleKeyboardIME : InputMethodService(), MyKeyboardView.OnKeyboardActionL
|
|||||||
moveCursor(true)
|
moveCursor(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onText(text: String) {
|
||||||
|
currentInputConnection?.commitText(text, 0)
|
||||||
|
}
|
||||||
|
|
||||||
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
|
||||||
|
@ -62,6 +62,12 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
|
|||||||
* Called when the user long presses Space and moves to the right
|
* Called when the user long presses Space and moves to the right
|
||||||
*/
|
*/
|
||||||
fun moveCursorRight()
|
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
|
private var mKeyboard: MyKeyboard? = null
|
||||||
@ -415,7 +421,7 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
|
|||||||
background = rippleBg
|
background = rippleBg
|
||||||
setTextColor(mTextColor)
|
setTextColor(mTextColor)
|
||||||
setOnClickListener {
|
setOnClickListener {
|
||||||
|
mOnKeyboardActionListener!!.onText(clipboardContent.toString())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -828,6 +834,10 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
|
|||||||
override fun moveCursorRight() {
|
override fun moveCursorRight() {
|
||||||
mOnKeyboardActionListener!!.moveCursorRight()
|
mOnKeyboardActionListener!!.moveCursorRight()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onText(text: String) {
|
||||||
|
mOnKeyboardActionListener!!.onText(text)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val keyboard = if (popupKey.popupCharacters != null) {
|
val keyboard = if (popupKey.popupCharacters != null) {
|
||||||
|
Reference in New Issue
Block a user