Skip to content

Your phone, on your command. Gotcha is world's first fully on-device AI copilot for Android that turns natural language into real device actions — safely.

fix: opt out of force dark to fix unreadable light mode on Android 10

Durganshu Mishra1f5541c5a34f
diff --git a/app/src/main/java/com/gotcha/MainActivity.kt b/app/src/main/java/com/gotcha/MainActivity.kt
index 835ea13..a441f12 100644
--- a/app/src/main/java/com/gotcha/MainActivity.kt
+++ b/app/src/main/java/com/gotcha/MainActivity.kt
@@ -90,6 +90,11 @@ class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
lifecycleOwner = this
+ // Some OEM skins (e.g. MIUI) force-dark light-themed apps even when the
+ // theme opts out; disabling on the decorView covers those cases too.
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
+ window.decorView.isForceDarkAllowed = false
+ }
settingsRepository = SettingsRepository(this)
openChatRequested = intent?.getBooleanExtra(EXTRA_OPEN_CHAT, false) == true
diff --git a/app/src/main/res/values-v29/themes.xml b/app/src/main/res/values-v29/themes.xml
new file mode 100644
index 0000000..5a1f5d8
--- /dev/null
+++ b/app/src/main/res/values-v29/themes.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <!-- Compose renders its own dark theme; force dark (Android 10 / MIUI
+ auto-inversion of light-themed apps) half-inverts Compose UIs,
+ leaving white text on light surfaces. Opt out explicitly. -->
+ <style name="Theme.Gotcha" parent="android:Theme.Material.Light.NoActionBar">
+ <item name="android:forceDarkAllowed">false</item>
+ </style>
+</resources>