mirror of
https://gitee.com/zhangsken/AndroidIDE.git
synced 2026-10-16 07:49:44 +08:00
fix: do not use KeyboardUtils to listen for ime state
This commit is contained in:
@@ -187,6 +187,7 @@ abstract class BaseEditorActivity : EdgeToEdgeIDEActivity(), TabLayout.OnTabSele
|
||||
}
|
||||
}
|
||||
|
||||
private var isImeVisible = false
|
||||
private var contentCardRealHeight: Int? = null
|
||||
private val editorSurfaceContainerBackground by lazy {
|
||||
resolveAttr(R.attr.colorSurfaceDim)
|
||||
@@ -268,10 +269,17 @@ abstract class BaseEditorActivity : EdgeToEdgeIDEActivity(), TabLayout.OnTabSele
|
||||
super.onApplyWindowInsets(insets)
|
||||
val height = contentCardRealHeight ?: return
|
||||
val imeInsets = insets.getInsets(WindowInsetsCompat.Type.ime())
|
||||
|
||||
_binding?.content?.bottomSheet?.setImeVisible(imeInsets.bottom > 0)
|
||||
_binding?.contentCard?.updateLayoutParams<ViewGroup.LayoutParams> {
|
||||
this.height = height - imeInsets.bottom
|
||||
}
|
||||
|
||||
val isImeVisible = imeInsets.bottom > 0
|
||||
if (this.isImeVisible != isImeVisible) {
|
||||
this.isImeVisible = isImeVisible
|
||||
onSoftInputChanged()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onApplySystemBarInsets(insets: Insets) {
|
||||
@@ -333,7 +341,6 @@ abstract class BaseEditorActivity : EdgeToEdgeIDEActivity(), TabLayout.OnTabSele
|
||||
|
||||
setupViews()
|
||||
|
||||
KeyboardUtils.registerSoftInputChangedListener(this) { onSoftInputChanged() }
|
||||
setupContainers()
|
||||
setupDiagnosticInfo()
|
||||
|
||||
|
||||
@@ -303,6 +303,7 @@ constructor(
|
||||
|
||||
fun onSoftInputChanged() {
|
||||
if (context !is Activity) {
|
||||
log.error("Bottom sheet is not attached to an activity!")
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user