Modern Apps git

← Modern-Apps.git

keyboard: make system IME hide-keyboard chevron follow light/dark theme for contrast

Commit
0c1ebc0574a780c463dc6027985ddb6e2e65fd41
Author
Vayun Mathur <[email protected]>
When
2026-08-08 17:39 UTC (4 months ago)
Parents
0f3a446

Diff

keyboard/src/main/java/com/vayunmathur/keyboard/ime/KeyboardService.kt
diff --git a/keyboard/src/main/java/com/vayunmathur/keyboard/ime/KeyboardService.kt b/keyboard/src/main/java/com/vayunmathur/keyboard/ime/KeyboardService.ktindex 4ae98dda2a..1b30587e6f 100644--- a/keyboard/src/main/java/com/vayunmathur/keyboard/ime/KeyboardService.kt+++ b/keyboard/src/main/java/com/vayunmathur/keyboard/ime/KeyboardService.kt@@ -17,9 +17,12 @@ import android.view.inputmethod.InputConnection import android.view.inputmethod.InputMethodManager import android.view.inputmethod.InputMethodSubtype import android.view.inputmethod.InputMethodSubtype.InputMethodSubtypeBuilder+import androidx.compose.foundation.isSystemInDarkTheme+import androidx.compose.runtime.LaunchedEffect import androidx.compose.ui.platform.ComposeView import androidx.compose.ui.platform.ViewCompositionStrategy import androidx.core.content.FileProvider+import androidx.core.view.WindowInsetsControllerCompat import androidx.core.view.inputmethod.EditorInfoCompat import androidx.core.view.inputmethod.InputConnectionCompat import androidx.core.view.inputmethod.InputContentInfoCompat@@ -281,6 +284,17 @@ class KeyboardService : InputMethodService(),                 insets             }             setContent {+                // The framework draws the "hide keyboard" chevron in the navigation bar of the IME+                // window, not inside our Compose tree. Its icon color is the nav-bar icon appearance,+                // which defaults to light (white) icons. In a light theme that renders nearly invisible,+                // so track the theme: light theme -> dark nav-bar icons, dark theme -> light icons.+                val isDark = isSystemInDarkTheme()+                LaunchedEffect(isDark) {+                    window?.window?.let { imeWindow ->+                        WindowInsetsControllerCompat(imeWindow, imeWindow.decorView)+                            .isAppearanceLightNavigationBars = !isDark+                    }+                }                 DynamicTheme {                     KeyboardScreen(kbState, this@KeyboardService)                 }