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.
feat: Simplify appearance settings by removing transparency and frost options for a cleaner UI
Durganshu Mishraab15ec5338dd
diff --git a/app/src/debug/java/com/gotcha/debug/TestHooksReceiver.kt b/app/src/debug/java/com/gotcha/debug/TestHooksReceiver.ktindex f22e265..189c1cb 100644--- a/app/src/debug/java/com/gotcha/debug/TestHooksReceiver.kt+++ b/app/src/debug/java/com/gotcha/debug/TestHooksReceiver.kt@@ -42,20 +42,10 @@ class TestHooksReceiver : BroadcastReceiver() {val repository = SettingsRepository(context)val current = repository.load()val updated = current.copy(- skinId = intent.getStringExtra(EXTRA_SKIN) ?: current.skinId,- reduceTransparency = intent.getBooleanExtra(- EXTRA_REDUCE_TRANSPARENCY,- current.reduceTransparency- ),- frostPercent = intent.getIntExtra(EXTRA_FROST, current.frostPercent)+ skinId = intent.getStringExtra(EXTRA_SKIN) ?: current.skinId)repository.save(updated)- Log.i(- TAG,- "appearance: skin=${updated.skinId} " +- "reduceTransparency=${updated.reduceTransparency} " +- "frost=${updated.frostPercent}"- )+ Log.i(TAG, "appearance: skin=${updated.skinId}")}private fun seedSettings(context: Context, intent: Intent) {@@ -85,8 +75,6 @@ class TestHooksReceiver : BroadcastReceiver() {const val ACTION_SEED_SETTINGS = "com.gotcha.debug.SEED_SETTINGS"const val ACTION_SET_APPEARANCE = "com.gotcha.debug.SET_APPEARANCE"const val EXTRA_SKIN = "skin"- const val EXTRA_REDUCE_TRANSPARENCY = "reduce_transparency"- const val EXTRA_FROST = "frost"const val EXTRA_BASE_URL = "base_url"const val EXTRA_API_KEY = "api_key"const val EXTRA_MODEL = "model"diff --git a/app/src/main/java/com/gotcha/MainActivity.kt b/app/src/main/java/com/gotcha/MainActivity.ktindex 5c50fc4..c66310d 100644--- a/app/src/main/java/com/gotcha/MainActivity.kt+++ b/app/src/main/java/com/gotcha/MainActivity.kt@@ -75,12 +75,8 @@ class MainActivity : ComponentActivity() {/** Appearance, applied immediately when changed in Settings ▸ Appearance. */private var appearance by mutableStateOf(Appearance())- /** The three settings that decide what the app looks like, and nothing else. */- private data class Appearance(- val skinId: String = Skins.DEFAULT_ID,- val reduceTransparency: Boolean = false,- val frostPercent: Int = 100- )+ /** The one setting that decides what the app looks like. */+ private data class Appearance(val skinId: String = Skins.DEFAULT_ID)/*** Repaints the window behind Compose in the current skin's ground. themes.xml@@ -93,11 +89,7 @@ class MainActivity : ComponentActivity() {window.setBackgroundDrawable(ColorDrawable(skin.launchGround.toArgb()))}- private fun Settings.appearance() = Appearance(- skinId = skinId,- reduceTransparency = reduceTransparency,- frostPercent = frostPercent- )+ private fun Settings.appearance() = Appearance(skinId = skinId)/** MediaProjection consent result — stores intent for screenshot capture. */private val mediaProjectionLauncher =@@ -192,11 +184,7 @@ class MainActivity : ComponentActivity() {applyLaunchBackground()setContent {- GotchaTheme(- skinId = appearance.skinId,- reduceTransparency = appearance.reduceTransparency,- frostPercent = appearance.frostPercent- ) {+ GotchaTheme(skinId = appearance.skinId) {Surface(modifier = Modifier.fillMaxSize(),color = MaterialTheme.colorScheme.backgrounddiff --git a/app/src/main/java/com/gotcha/data/SettingsRepository.kt b/app/src/main/java/com/gotcha/data/SettingsRepository.ktindex bb7ff23..ba153f5 100644--- a/app/src/main/java/com/gotcha/data/SettingsRepository.kt+++ b/app/src/main/java/com/gotcha/data/SettingsRepository.kt@@ -60,17 +60,6 @@ data class Settings(* value it no longer knows.*/val skinId: String = "deepspace",- /**- * Solid panels, no wallpaper. Android has no system-level "reduce- * transparency", so this is the only way for someone to ask for one.- */- val reduceTransparency: Boolean = false,- /**- * How much of the skin's own frost to apply, as a percentage. 100 is what- * the skin was designed with; 0 leaves the wallpaper sharp behind the glass.- * Only bites where the device can blur live — see GlassTier.- */- val frostPercent: Int = 100,val disabledSkills: Set<String> = emptySet(),/*** Ids of connectors the user switched off. Credentials survive (re-enabling@@ -278,8 +267,6 @@ class SettingsRepository(context: Context) {notifyChimeEnabled = prefs.getBoolean(KEY_NOTIFY_CHIME, false),assistiveBallEnabled = prefs.getBoolean(KEY_ASSISTIVE_BALL, false),skinId = resolvedSkinId(),- reduceTransparency = prefs.getBoolean(KEY_REDUCE_TRANSPARENCY, false),- frostPercent = prefs.getInt(KEY_FROST_PERCENT, 100),disabledSkills = stringSet(KEY_DISABLED_SKILLS),disabledConnectors = stringSet(KEY_DISABLED_CONNECTORS),proactiveEnabled = prefs.getBoolean(KEY_PROACTIVE_ENABLED, true),@@ -330,8 +317,6 @@ class SettingsRepository(context: Context) {.putBoolean(KEY_NOTIFY_CHIME, settings.notifyChimeEnabled).putBoolean(KEY_ASSISTIVE_BALL, settings.assistiveBallEnabled).putString(KEY_SKIN_ID, settings.skinId)- .putBoolean(KEY_REDUCE_TRANSPARENCY, settings.reduceTransparency)- .putInt(KEY_FROST_PERCENT, settings.frostPercent).putStringSet(KEY_DISABLED_SKILLS, settings.disabledSkills).putStringSet(KEY_DISABLED_CONNECTORS, settings.disabledConnectors).putBoolean(KEY_PROACTIVE_ENABLED, settings.proactiveEnabled)@@ -403,8 +388,6 @@ class SettingsRepository(context: Context) {const val KEY_LEGACY_THEME_MODE = "theme_mode"const val SKIN_DEEP_SPACE_DARK = "deepspace"const val SKIN_DEEP_SPACE_LIGHT = "deepspace_light"- const val KEY_REDUCE_TRANSPARENCY = "reduce_transparency"- const val KEY_FROST_PERCENT = "frost_percent"const val KEY_DISABLED_SKILLS = "disabled_skills"const val KEY_DISABLED_CONNECTORS = "disabled_connectors"const val KEY_PROACTIVE_ENABLED = "proactive_enabled"diff --git a/app/src/main/java/com/gotcha/ui/AppearanceScreen.kt b/app/src/main/java/com/gotcha/ui/AppearanceScreen.ktindex 0b12a66..b2426fd 100644--- a/app/src/main/java/com/gotcha/ui/AppearanceScreen.kt+++ b/app/src/main/java/com/gotcha/ui/AppearanceScreen.kt@@ -17,11 +17,9 @@ import androidx.compose.foundation.shape.RoundedCornerShapeimport androidx.compose.material3.ExperimentalMaterial3Apiimport androidx.compose.material3.HorizontalDividerimport androidx.compose.material3.MaterialTheme-import androidx.compose.material3.Sliderimport androidx.compose.material3.Textimport androidx.compose.runtime.Composableimport androidx.compose.runtime.getValue-import androidx.compose.runtime.mutableIntStateOfimport androidx.compose.runtime.mutableStateOfimport androidx.compose.runtime.rememberimport androidx.compose.runtime.setValue@@ -35,15 +33,13 @@ import androidx.compose.ui.unit.dpimport com.gotcha.data.Settingsimport com.gotcha.ui.theme.Brightnessimport com.gotcha.ui.theme.GlassTier-import com.gotcha.ui.theme.GotchaMonoimport com.gotcha.ui.theme.LocalGlassTierimport com.gotcha.ui.theme.Skinimport com.gotcha.ui.theme.SkinMiniatureimport com.gotcha.ui.theme.Skins-import kotlin.math.roundToInt/**- * The Appearance page: light or dark, which skin, and how much glass.+ * The Appearance page: which skin, and nothing else.** Every control here applies the moment it is touched — a theme you have to* save is a theme you cannot judge.@@ -63,8 +59,6 @@ fun AppearanceScreen() {val initial = remember { load() }var skinId by remember { mutableStateOf(initial.skinId) }- var reduceTransparency by remember { mutableStateOf(initial.reduceTransparency) }- var frostPercent by remember { mutableIntStateOf(initial.frostPercent) }val overlay = rememberSettingsOverlayState()val tier = LocalGlassTier.current@@ -100,40 +94,8 @@ fun AppearanceScreen(HorizontalDivider(thickness = 1.dp)- if (selected.isGlass && !reduceTransparency) {- Text(- "Frost",- style = MaterialTheme.typography.bodyLarge- )- Slider(- value = frostPercent.toFloat(),- onValueChange = { frostPercent = it.roundToInt() },- // Persist on release rather than per pixel: the preview follows the- // thumb, but a hundred writes per drag is a hundred writes.- onValueChangeFinished = { apply { s -> s.copy(frostPercent = frostPercent) } },- valueRange = 0f..100f,- modifier = Modifier.testTag("appearance_frost")- )- Text(- "$frostPercent% of ${selected.label}'s frost",- style = MaterialTheme.typography.bodySmall,- fontFamily = GotchaMono,- color = MaterialTheme.colorScheme.onSurfaceVariant- )- }-- SettingsToggleRow(- label = "Reduce transparency",- checked = reduceTransparency,- onCheckedChange = {- reduceTransparency = it- apply { s -> s.copy(reduceTransparency = it) }- },- isLarge = true,- switchTestTag = "appearance_reduce_transparency"- )Text(- text = tierExplanation(tier, reduceTransparency),+ text = tierExplanation(tier),style = MaterialTheme.typography.bodySmall,color = MaterialTheme.colorScheme.onSurfaceVariant)@@ -141,11 +103,10 @@ fun AppearanceScreen(}/** Says what this device is actually doing, rather than what the theme wishes it did. */-private fun tierExplanation(tier: GlassTier, reduceTransparency: Boolean): String = when {- tier == GlassTier.SOLID -> "Battery saver is on, so the theme is drawn flat until it's off."- reduceTransparency -> "Panels are solid. The theme keeps its colour and texture."- tier == GlassTier.LIVE -> "Panels blur what's behind them."- else -> "Live blur isn't available on this device, so panels use a fixed frost."+private fun tierExplanation(tier: GlassTier): String = when (tier) {+ GlassTier.SOLID -> "Battery saver is on, so the theme is drawn flat until it's off."+ GlassTier.LIVE -> "Panels blur what's behind them."+ GlassTier.STATIC -> "Live blur isn't available on this device, so panels use a fixed frost."}private const val TILES_PER_ROW = 2diff --git a/app/src/main/java/com/gotcha/ui/SettingsCommon.kt b/app/src/main/java/com/gotcha/ui/SettingsCommon.ktindex 8f7b838..aea0a74 100644--- a/app/src/main/java/com/gotcha/ui/SettingsCommon.kt+++ b/app/src/main/java/com/gotcha/ui/SettingsCommon.kt@@ -58,7 +58,7 @@ import kotlinx.coroutines.delayenum class SettingsPage(val title: String, val summary: String, val testTag: String) {APPEARANCE("Appearance",- "Theme, light and dark, transparency",+ "How the app looks","settings_appearance_row"),PERSONAL_INFO(diff --git a/app/src/main/java/com/gotcha/ui/theme/Backdrop.kt b/app/src/main/java/com/gotcha/ui/theme/Backdrop.ktindex 69f9dde..5dd3944 100644--- a/app/src/main/java/com/gotcha/ui/theme/Backdrop.kt+++ b/app/src/main/java/com/gotcha/ui/theme/Backdrop.kt@@ -77,11 +77,7 @@ fun SkinMiniature(skin: Skin, modifier: Modifier = Modifier) {// Shown as it will actually render on this device and at these settings. A// preview that keeps its wallpaper while the app has dropped it is a picker// promising something the app then does not do.- val shown = when (LocalGlassTier.current) {- GlassTier.SOLID -> skin.opaque()- GlassTier.OPAQUE -> skin.opaquePanels()- GlassTier.LIVE, GlassTier.STATIC -> skin- }+ val shown = if (LocalGlassTier.current == GlassTier.SOLID) skin.opaque() else skinBox(modifier.background(shown.ground)) {Wallpaper(shown, live = false)if (shown.grain > 0f) Grain(shown.grain)diff --git a/app/src/main/java/com/gotcha/ui/theme/GlassTier.kt b/app/src/main/java/com/gotcha/ui/theme/GlassTier.ktindex 06537ee..796316a 100644--- a/app/src/main/java/com/gotcha/ui/theme/GlassTier.kt+++ b/app/src/main/java/com/gotcha/ui/theme/GlassTier.kt@@ -37,14 +37,6 @@ enum class GlassTier {*/STATIC,- /**- * Opaque panels, wallpaper kept. What "reduce transparency" should mean: the- * request is about seeing *through* chrome, not about the theme's colour and- * texture, and taking the wallpaper too makes the setting feel like it broke- * the app rather than adjusted it.- */- OPAQUE,-/** Nothing at all: opaque panels and no wallpaper. The cheapest we render. */SOLID}@@ -57,11 +49,9 @@ val LocalGlassTier = staticCompositionLocalOf { GlassTier.STATIC }* is running — battery saver, and the system-wide blur toggle in developer* options — so both are observed rather than sampled once at startup.*- * [reduceTransparency] is our own setting. Android has no system-level one (that- * is an iOS feature), so if we do not offer it, nobody has it.*/@Composable-fun rememberGlassTier(reduceTransparency: Boolean): GlassTier {+fun rememberGlassTier(): GlassTier {val context = LocalContext.currentval powerManager = remember(context) {context.getSystemService(Context.POWER_SERVICE) as PowerManager@@ -94,10 +84,7 @@ fun rememberGlassTier(reduceTransparency: Boolean): GlassTier {}return when {- // Battery saver is a cost signal, so it drops everything. Reduce- // transparency is a legibility signal, so it only drops the see-through.powerSaving -> GlassTier.SOLID- reduceTransparency -> GlassTier.OPAQUEblurAvailable && !lowRam -> GlassTier.LIVEelse -> GlassTier.STATIC}diff --git a/app/src/main/java/com/gotcha/ui/theme/Skin.kt b/app/src/main/java/com/gotcha/ui/theme/Skin.ktindex 721b6bf..bf23aee 100644--- a/app/src/main/java/com/gotcha/ui/theme/Skin.kt+++ b/app/src/main/java/com/gotcha/ui/theme/Skin.kt@@ -79,34 +79,6 @@ data class Skin(val launchGround: Colorget() = if (isGlass) ground else scheme.background- /**- * The same skin with its frost dialled to [percent] of what it was designed- * with. The scrim scales with it: they are two halves of one effect, and- * leaving the veil at full strength over a sharp wallpaper reads as haze- * rather than as a choice.- */- fun withFrost(percent: Int): Skin {- if (percent >= 100 || !isGlass) return this- val factor = percent.coerceIn(0, 100) / 100f- return copy(frost = frost * factor, scrim = scrim * factor)- }-- /**- * Solid panels over the skin's own wallpaper. The ground keeps its tint,- * grain and vignette — those were never transparency — while everything you- * read from stops being see-through.- */- fun opaquePanels(): Skin {- if (!isGlass) return this- // `background` stays transparent on purpose. Scaffold paints its- // container from that role, so giving it a colour here would lay an- // opaque sheet straight over the wallpaper this function exists to keep.- return copy(- frost = 0.dp,- scheme = scheme.flattenOnto(ground, keepBackgroundTransparent = true)- )- }-/*** The same skin with the glass taken out: panels composited down onto their* own ground, no wallpaper, no grain. The palette and the layout are@@ -129,15 +101,11 @@ data class Skin(* roles are already opaque in every skin — see Color.kt — so only the in-page* chrome needs flattening here.*- * [keepBackgroundTransparent] is the difference between "no glass" and "no- * wallpaper": Scaffold paints its container from the `background` role, so- * colouring it hides anything drawn behind the app.+ * `background` takes the ground: Scaffold paints its container from that role,+ * and at this tier there is no wallpaper left behind the app for it to hide.*/-private fun ColorScheme.flattenOnto(- ground: Color,- keepBackgroundTransparent: Boolean = false-): ColorScheme = copy(- background = if (keepBackgroundTransparent) background else ground,+private fun ColorScheme.flattenOnto(ground: Color): ColorScheme = copy(+ background = ground,surface = surface.over(ground),surfaceVariant = surfaceVariant.over(ground),secondaryContainer = secondaryContainer.over(ground)@@ -326,7 +294,7 @@ object Skins {val Orchid = Skin(id = "orchid",label = "Orchid",- tagline = "Tinted. Violet ground, coral actions, heavy grain.",+ tagline = "Tinted. Violet ground, coral actions, fine grain.",brightness = Brightness.DARK,backdrop = Backdrop.FLAT,ground = OrchidGround,diff --git a/app/src/main/java/com/gotcha/ui/theme/Theme.kt b/app/src/main/java/com/gotcha/ui/theme/Theme.ktindex 3444d31..8b85f76 100644--- a/app/src/main/java/com/gotcha/ui/theme/Theme.kt+++ b/app/src/main/java/com/gotcha/ui/theme/Theme.kt@@ -42,25 +42,16 @@ internal val LightColorScheme = lightColorScheme(* @param skinId which entry of [Skins] the user picked. A skin is the whole* theme: there is no light/dark switch on top of it, because a skin that has* to work in both is two designs sharing a name. Deep Space ships as two.- * @param frostPercent scales the skin's frost and scrim, 0-100.- * @param reduceTransparency our own accessibility switch - Android has no- * system-level equivalent, so this is the only way to ask for solid panels.*/@Composablefun GotchaTheme(skinId: String = Skins.DEFAULT_ID,- frostPercent: Int = 100,- reduceTransparency: Boolean = false,content: @Composable () -> Unit) {- val tier = rememberGlassTier(reduceTransparency)- val picked = Skins.byId(skinId).withFrost(frostPercent)+ val tier = rememberGlassTier()+ val picked = Skins.byId(skinId)// The tier decides what the skin is made of, not whether the user gets it.- val skin = when (tier) {- GlassTier.SOLID -> picked.opaque()- GlassTier.OPAQUE -> picked.opaquePanels()- GlassTier.LIVE, GlassTier.STATIC -> picked- }+ val skin = if (tier == GlassTier.SOLID) picked.opaque() else pickedSystemBars(skin)