mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Recreate keyboard whenever action window is exited
This commit is contained in:
parent
226fea5d46
commit
106de18b3b
@ -299,18 +299,21 @@ class LatinIME : InputMethodService(), LifecycleOwner, ViewModelStoreOwner, Save
|
|||||||
return drawableProvider!!
|
return drawableProvider!!
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateDrawableProvider(colorScheme: ColorScheme) {
|
private fun recreateKeyboard() {
|
||||||
activeColorScheme = colorScheme
|
|
||||||
|
|
||||||
// ... update drawableProvider with params
|
|
||||||
drawableProvider = BasicThemeProvider(this, overrideColorScheme = colorScheme)
|
|
||||||
|
|
||||||
// ... force change keyboard view
|
|
||||||
legacyInputView = latinIMELegacy.onCreateInputView()
|
legacyInputView = latinIMELegacy.onCreateInputView()
|
||||||
latinIMELegacy.loadKeyboard()
|
latinIMELegacy.loadKeyboard()
|
||||||
setContent()
|
}
|
||||||
|
|
||||||
|
private fun updateDrawableProvider(colorScheme: ColorScheme) {
|
||||||
|
activeColorScheme = colorScheme
|
||||||
|
drawableProvider = BasicThemeProvider(this, overrideColorScheme = colorScheme)
|
||||||
|
|
||||||
|
// recreate the keyboard if not in action window, if we are in action window then
|
||||||
|
// it'll be recreated when we exit
|
||||||
|
if(currWindowAction != null) recreateKeyboard()
|
||||||
|
|
||||||
window.window?.navigationBarColor = drawableProvider!!.primaryKeyboardColor
|
window.window?.navigationBarColor = drawableProvider!!.primaryKeyboardColor
|
||||||
|
setContent()
|
||||||
}
|
}
|
||||||
|
|
||||||
private val latinIMELegacy = LatinIMELegacy(
|
private val latinIMELegacy = LatinIMELegacy(
|
||||||
@ -406,8 +409,7 @@ class LatinIME : InputMethodService(), LifecycleOwner, ViewModelStoreOwner, Save
|
|||||||
private var currWindowAction: Action? = null
|
private var currWindowAction: Action? = null
|
||||||
private fun onActionActivated(action: Action) {
|
private fun onActionActivated(action: Action) {
|
||||||
if(action.windowImpl != null) {
|
if(action.windowImpl != null) {
|
||||||
currWindowAction = action
|
enterActionWindowView(action)
|
||||||
setContent()
|
|
||||||
} else if(action.simplePressImpl != null) {
|
} else if(action.simplePressImpl != null) {
|
||||||
action.simplePressImpl.invoke(this)
|
action.simplePressImpl.invoke(this)
|
||||||
} else {
|
} else {
|
||||||
@ -444,16 +446,27 @@ class LatinIME : InputMethodService(), LifecycleOwner, ViewModelStoreOwner, Save
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun enterActionWindowView(action: Action) {
|
||||||
|
assert(action.windowImpl != null)
|
||||||
|
currWindowAction = action
|
||||||
|
|
||||||
|
setContent()
|
||||||
|
}
|
||||||
|
|
||||||
private fun returnBackToMainKeyboardViewFromAction() {
|
private fun returnBackToMainKeyboardViewFromAction() {
|
||||||
assert(currWindowAction != null)
|
assert(currWindowAction != null)
|
||||||
currWindowAction = null
|
currWindowAction = null
|
||||||
|
|
||||||
|
// Keyboard acts buggy in many ways after being detached from window then attached again,
|
||||||
|
// so let's recreate it
|
||||||
|
recreateKeyboard()
|
||||||
|
|
||||||
setContent()
|
setContent()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun ActionViewWithHeader(action: Action) {
|
private fun ActionViewWithHeader(action: Action) {
|
||||||
val windowImpl = action.windowImpl!!
|
val windowImpl = action.windowImpl!!
|
||||||
println("The height is $inputViewHeight, which in DP is ${ with(LocalDensity.current) { inputViewHeight.toDp() }}")
|
|
||||||
Column {
|
Column {
|
||||||
Surface(modifier = Modifier
|
Surface(modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
|
Loading…
Reference in New Issue
Block a user