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