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.

feat: Enhance UI with transparent top bars and new container colors for better visual clarity

Durganshu Mishrafcca00870b4e
diff --git a/app/src/main/java/com/gotcha/ui/AppDrawer.kt b/app/src/main/java/com/gotcha/ui/AppDrawer.kt
index fdbf159..25562f0 100644
--- a/app/src/main/java/com/gotcha/ui/AppDrawer.kt
+++ b/app/src/main/java/com/gotcha/ui/AppDrawer.kt
@@ -16,6 +16,7 @@ import androidx.compose.material.icons.outlined.Delete
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
+import androidx.compose.material3.DrawerDefaults
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
@@ -34,6 +35,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import com.gotcha.data.ChatSession
+import com.gotcha.ui.theme.LocalSkin
@Composable
fun AppDrawerContent(
@@ -49,7 +51,17 @@ fun AppDrawerContent(
) {
var sessionToDelete by remember { mutableStateOf<String?>(null) }
- ModalDrawerSheet(modifier = Modifier.width(300.dp)) {
+ // The drawer covers the app rather than floating in it, so it gets a ground
+ // of its own. Stated explicitly rather than left to DrawerDefaults, because
+ // which surface role the default reads has changed between Material 3
+ // versions and a see-through sidebar is unreadable.
+ val skin = LocalSkin.current
+ val drawerColor = if (skin.isGlass) skin.ground else DrawerDefaults.containerColor
+
+ ModalDrawerSheet(
+ drawerContainerColor = drawerColor,
+ modifier = Modifier.width(300.dp)
+ ) {
Column(modifier = Modifier.fillMaxSize()) {
Text(
"Gotcha",
diff --git a/app/src/main/java/com/gotcha/ui/ChatScreen.kt b/app/src/main/java/com/gotcha/ui/ChatScreen.kt
index cec58fa..cf812ba 100644
--- a/app/src/main/java/com/gotcha/ui/ChatScreen.kt
+++ b/app/src/main/java/com/gotcha/ui/ChatScreen.kt
@@ -49,6 +49,7 @@ import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.material3.TopAppBar
+import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
@@ -130,6 +131,12 @@ fun ChatScreen(
Scaffold(
topBar = {
TopAppBar(
+ // Transparent so the wallpaper carries the bar on a glass skin.
+ // On Deep Space the background underneath is the same colour the
+ // bar would have painted, so this changes nothing there.
+ colors = TopAppBarDefaults.topAppBarColors(
+ containerColor = Color.Transparent
+ ),
title = {
Text(
if (isHome) "Gotcha" else (sessionTitle ?: "Gotcha"),
diff --git a/app/src/main/java/com/gotcha/ui/SettingsCommon.kt b/app/src/main/java/com/gotcha/ui/SettingsCommon.kt
index c91f877..8f7b838 100644
--- a/app/src/main/java/com/gotcha/ui/SettingsCommon.kt
+++ b/app/src/main/java/com/gotcha/ui/SettingsCommon.kt
@@ -24,6 +24,7 @@ import androidx.compose.material3.Switch
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.material3.TopAppBar
+import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.Stable
@@ -33,6 +34,7 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
+import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
@@ -187,6 +189,11 @@ fun SettingsScaffold(
Scaffold(
topBar = {
TopAppBar(
+ // See ChatScreen: glass on a skin that has a wallpaper, and
+ // indistinguishable from the default on one that doesn't.
+ colors = TopAppBarDefaults.topAppBarColors(
+ containerColor = Color.Transparent
+ ),
title = { Text(title) },
navigationIcon = {
TextButton(
diff --git a/app/src/main/java/com/gotcha/ui/theme/Color.kt b/app/src/main/java/com/gotcha/ui/theme/Color.kt
index 7b8dfa7..fd11d56 100644
--- a/app/src/main/java/com/gotcha/ui/theme/Color.kt
+++ b/app/src/main/java/com/gotcha/ui/theme/Color.kt
@@ -94,6 +94,42 @@ val NocturneSalmonContainer = Color(0xFF5C1A2A)
val NocturneMagentaContainer = Color(0xFF3A1140)
val NocturneOnMagentaContainer = Color(0xFFF7D9F2)
+// ---------------------------------------------------------------------------
+// Container roles
+// ---------------------------------------------------------------------------
+// Anything that floats *above* the app rather than sitting in it — the
+// navigation drawer, dialogs, the long-press menu — is opaque, in every skin.
+// Glass is for chrome you look past; a sheet you are reading from needs a
+// ground of its own, or the screen behind it reads straight through the text.
+//
+// Material 3 routes all of those through the surfaceContainer* roles, so
+// setting them opaque here fixes the drawer, dialogs and menus in one move,
+// while `surface` and `surfaceVariant` stay translucent for the in-page chrome.
+
+val AuraContainerLowest = Color(0xFF050506)
+val AuraContainerLow = Color(0xFF0A0A0B)
+val AuraContainer = Color(0xFF141416)
+val AuraContainerHigh = Color(0xFF1B1B1E)
+val AuraContainerHighest = Color(0xFF232326)
+
+val VellumContainerLowest = Color(0xFFFFFFFF)
+val VellumContainerLow = Color(0xFFF7F5F8)
+val VellumContainer = Color(0xFFF1EFF2)
+val VellumContainerHigh = Color(0xFFEBE7ED)
+val VellumContainerHighest = Color(0xFFE4DEE7)
+
+val OrchidContainerLowest = Color(0xFF6A1873)
+val OrchidContainerLow = Color(0xFF741B7D)
+val OrchidContainer = Color(0xFF7E1F88)
+val OrchidContainerHigh = Color(0xFF8A2794)
+val OrchidContainerHighest = Color(0xFF96309F)
+
+val NocturneContainerLowest = Color(0xFF07040A)
+val NocturneContainerLow = Color(0xFF0D0812)
+val NocturneContainer = Color(0xFF171021)
+val NocturneContainerHigh = Color(0xFF201729)
+val NocturneContainerHighest = Color(0xFF2A1F35)
+
/**
* Error red for the pink skins. The stock M3 error would sit a few degrees from
* Aura's rose and Nocturne's salmon, and an error that looks like the send
diff --git a/app/src/main/java/com/gotcha/ui/theme/Skin.kt b/app/src/main/java/com/gotcha/ui/theme/Skin.kt
index 6f8ea39..9574d33 100644
--- a/app/src/main/java/com/gotcha/ui/theme/Skin.kt
+++ b/app/src/main/java/com/gotcha/ui/theme/Skin.kt
@@ -106,14 +106,15 @@ data class Skin(
}
}
-/** Alpha-composites every translucent surface role onto [ground]. */
+/**
+ * Alpha-composites the translucent roles onto [ground]. The surfaceContainer*
+ * roles are already opaque in every skin — see Color.kt — so only the in-page
+ * chrome needs flattening here.
+ */
private fun ColorScheme.flattenOnto(ground: Color): ColorScheme = copy(
background = ground,
surface = surface.over(ground),
surfaceVariant = surfaceVariant.over(ground),
- surfaceContainer = surfaceContainer.over(ground),
- surfaceContainerHigh = surfaceContainerHigh.over(ground),
- surfaceContainerHighest = surfaceContainerHighest.over(ground),
secondaryContainer = secondaryContainer.over(ground)
)
@@ -153,11 +154,11 @@ private val AuraScheme = darkColorScheme(
onSurface = AuraInk,
surfaceVariant = AuraPanelHigh,
onSurfaceVariant = AuraInkDim,
- surfaceContainer = AuraPanel,
- surfaceContainerHigh = AuraPanelHigh,
- surfaceContainerHighest = AuraPanelHigh,
- surfaceContainerLow = AuraGround,
- surfaceContainerLowest = AuraGround,
+ surfaceContainer = AuraContainer,
+ surfaceContainerHigh = AuraContainerHigh,
+ surfaceContainerHighest = AuraContainerHighest,
+ surfaceContainerLow = AuraContainerLow,
+ surfaceContainerLowest = AuraContainerLowest,
outline = AuraOutline,
outlineVariant = AuraOutline,
error = BrandError,
@@ -180,11 +181,11 @@ private val VellumScheme = lightColorScheme(
onSurface = VellumInk,
surfaceVariant = VellumPanelHigh,
onSurfaceVariant = VellumInkDim,
- surfaceContainer = VellumPanel,
- surfaceContainerHigh = VellumPanelHigh,
- surfaceContainerHighest = VellumPanelHigh,
- surfaceContainerLow = VellumGround,
- surfaceContainerLowest = VellumGround,
+ surfaceContainer = VellumContainer,
+ surfaceContainerHigh = VellumContainerHigh,
+ surfaceContainerHighest = VellumContainerHighest,
+ surfaceContainerLow = VellumContainerLow,
+ surfaceContainerLowest = VellumContainerLowest,
outline = VellumOutline,
outlineVariant = VellumOutline
)
@@ -205,11 +206,11 @@ private val OrchidScheme = darkColorScheme(
onSurface = OrchidInk,
surfaceVariant = OrchidPanelHigh,
onSurfaceVariant = OrchidInkDim,
- surfaceContainer = OrchidPanel,
- surfaceContainerHigh = OrchidPanelHigh,
- surfaceContainerHighest = OrchidPanelHigh,
- surfaceContainerLow = OrchidGround,
- surfaceContainerLowest = OrchidGround,
+ surfaceContainer = OrchidContainer,
+ surfaceContainerHigh = OrchidContainerHigh,
+ surfaceContainerHighest = OrchidContainerHighest,
+ surfaceContainerLow = OrchidContainerLow,
+ surfaceContainerLowest = OrchidContainerLowest,
outline = OrchidOutline,
outlineVariant = OrchidOutline,
error = BrandError,
@@ -232,11 +233,11 @@ private val NocturneScheme = darkColorScheme(
onSurface = NocturneInk,
surfaceVariant = NocturnePanelHigh,
onSurfaceVariant = NocturneInkDim,
- surfaceContainer = NocturnePanel,
- surfaceContainerHigh = NocturnePanel,
- surfaceContainerHighest = NocturnePanelHigh,
- surfaceContainerLow = NocturneGround,
- surfaceContainerLowest = NocturneGround,
+ surfaceContainer = NocturneContainer,
+ surfaceContainerHigh = NocturneContainerHigh,
+ surfaceContainerHighest = NocturneContainerHighest,
+ surfaceContainerLow = NocturneContainerLow,
+ surfaceContainerLowest = NocturneContainerLowest,
outline = NocturneOutline,
outlineVariant = NocturneOutline,
error = BrandError,