Skip to content
This repository was archived by the owner on Oct 18, 2024. It is now read-only.

Commit 3b43ef4

Browse files
committed
fix: do not use KeyboardUtils to listen for ime state
1 parent cfc0aed commit 3b43ef4

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

app/src/main/java/com/itsaky/androidide/activities/editor/BaseEditorActivity.kt

+8-1
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ abstract class BaseEditorActivity : EdgeToEdgeIDEActivity(), TabLayout.OnTabSele
187187
}
188188
}
189189

190+
private var isImeVisible = false
190191
private var contentCardRealHeight: Int? = null
191192
private val editorSurfaceContainerBackground by lazy {
192193
resolveAttr(R.attr.colorSurfaceDim)
@@ -268,10 +269,17 @@ abstract class BaseEditorActivity : EdgeToEdgeIDEActivity(), TabLayout.OnTabSele
268269
super.onApplyWindowInsets(insets)
269270
val height = contentCardRealHeight ?: return
270271
val imeInsets = insets.getInsets(WindowInsetsCompat.Type.ime())
272+
271273
_binding?.content?.bottomSheet?.setImeVisible(imeInsets.bottom > 0)
272274
_binding?.contentCard?.updateLayoutParams<ViewGroup.LayoutParams> {
273275
this.height = height - imeInsets.bottom
274276
}
277+
278+
val isImeVisible = imeInsets.bottom > 0
279+
if (this.isImeVisible != isImeVisible) {
280+
this.isImeVisible = isImeVisible
281+
onSoftInputChanged()
282+
}
275283
}
276284

277285
override fun onApplySystemBarInsets(insets: Insets) {
@@ -333,7 +341,6 @@ abstract class BaseEditorActivity : EdgeToEdgeIDEActivity(), TabLayout.OnTabSele
333341

334342
setupViews()
335343

336-
KeyboardUtils.registerSoftInputChangedListener(this) { onSoftInputChanged() }
337344
setupContainers()
338345
setupDiagnosticInfo()
339346

app/src/main/java/com/itsaky/androidide/ui/EditorBottomSheet.kt

+1
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ constructor(
303303

304304
fun onSoftInputChanged() {
305305
if (context !is Activity) {
306+
log.error("Bottom sheet is not attached to an activity!")
306307
return
307308
}
308309

0 commit comments

Comments
 (0)