fix: the Android keyboard opens on the first tap after the system dismissed it (#665)

This commit is contained in:
Kirk authored and GitHub committed 2026-10-13 14:17:31 -04:00
1 parent 6de6ec821c
commit fc9d4d0646
2 files changed
+61 -1

No files matched your search

@@ -2,10 +2,12 @@ package com.droiddeck.launcher.input
import android.app.Activity
import android.content.Context
import android.os.Build
import android.text.InputType
import android.view.KeyCharacterMap
import android.view.KeyEvent
import android.view.View
import android.view.WindowInsets
import android.view.inputmethod.BaseInputConnection
import android.view.inputmethod.EditorInfo
import android.view.inputmethod.InputConnection
@@ -53,7 +55,10 @@ class KeyboardHost(
return KeyConnection()
}
fun toggle() = if (shown) hide() else show()
fun toggle() = if (shown && imeVisible()) hide() else show()
private fun imeVisible() = Build.VERSION.SDK_INT < Build.VERSION_CODES.R ||
rootWindowInsets?.isVisible(WindowInsets.Type.ime()) != false
fun show() {
shown = true