Only update subtype when it changes

This commit is contained in:
Aleksandras Kostarevas 2024-05-16 17:29:49 -05:00
parent be5ed15220
commit 4e2d80fc67

View File

@ -211,12 +211,13 @@ class LatinIME : InputMethodService(), LifecycleOwner, ViewModelStoreOwner, Save
// Called by UixManager when the intention is to subsequently call LegacyKeyboardView with hidden=false
// Maybe this can be changed to LaunchedEffect
fun onKeyboardShown() {
//if(pendingRecreateKeyboard) {
// pendingRecreateKeyboard = false
// recreateKeyboard()
//}
if(pendingRecreateKeyboard) {
pendingRecreateKeyboard = false
recreateKeyboard()
}
}
private var currentSubtype = ""
override fun onCreate() {
super.onCreate()
@ -284,7 +285,10 @@ class LatinIME : InputMethodService(), LifecycleOwner, ViewModelStoreOwner, Save
}
if(activeSubtype != null) {
changeInputMethodSubtype(Subtypes.convertToSubtype(activeSubtype))
if(activeSubtype != currentSubtype) {
currentSubtype = activeSubtype
changeInputMethodSubtype(Subtypes.convertToSubtype(activeSubtype))
}
}
}