Give InputMode the package name as extra variable.

This commit is contained in:
Nehemiah of Zebulun 2023-10-10 11:37:32 -04:00
parent fcb15459d0
commit add9d0d020
3 changed files with 11 additions and 1 deletions

View File

@ -6,7 +6,6 @@ import android.inputmethodservice.InputMethodService
import android.media.AudioManager
import android.media.MediaRecorder
import android.net.Uri
import android.opengl.ETC1.getHeight
import android.os.Bundle
import android.provider.Settings
import android.text.InputType
@ -780,6 +779,10 @@ class WKT9: InputMethodService(), SpellCheckerSession.SpellCheckerSessionListene
}
}
attribute?.packageName?.let {
inputMode?.packageName(it)
}
updateInputStatus()
}

View File

@ -12,6 +12,7 @@ open class BaseInputMode: InputMode {
protected var newKey = true
protected var keyIndex = 0
protected var lastKey: Key? = null
protected var packageName: String? = null
protected open val keyCommandResolver: KeyCommandResolver = KeyCommandResolver.getBasic()
@ -43,6 +44,10 @@ open class BaseInputMode: InputMode {
return KeyEventResult()
}
override fun packageName(packageName: String) {
this.packageName = packageName
}
override fun restart() {
Log.d(tag, "Restart should be handled by individual input modes")
}

View File

@ -17,5 +17,7 @@ interface InputMode {
fun afterKeyLongDown(key: Key, keyDownMS: Long, composing: Boolean): KeyEventResult
fun packageName(packageName: String)
fun restart()
}