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.
refactor: replace AlertDialog with SkinAlertDialog for consistent theming across dialogs
Durganshu Mishra5828c8de3633
diff --git a/app/src/main/java/com/gotcha/LegalConsentDialog.kt b/app/src/main/java/com/gotcha/LegalConsentDialog.ktindex 12f8e01..6939f68 100644--- a/app/src/main/java/com/gotcha/LegalConsentDialog.kt+++ b/app/src/main/java/com/gotcha/LegalConsentDialog.kt@@ -10,7 +10,6 @@ import androidx.compose.foundation.rememberScrollStateimport androidx.compose.foundation.selection.toggleableimport androidx.compose.foundation.shape.RoundedCornerShapeimport androidx.compose.foundation.verticalScroll-import androidx.compose.material3.AlertDialogimport androidx.compose.material3.Checkboximport androidx.compose.material3.HorizontalDividerimport androidx.compose.material3.MaterialTheme@@ -33,7 +32,7 @@ import androidx.compose.ui.semantics.Roleimport androidx.compose.ui.text.font.FontWeightimport androidx.compose.ui.unit.dpimport com.gotcha.ui.renderLegalMarkdown-import com.gotcha.ui.theme.LocalSkin+import com.gotcha.ui.theme.SkinAlertDialog/*** First-launch / re-acceptance gate. Non-dismissable: the only way out is the@@ -72,13 +71,8 @@ fun LegalConsentDialog(val bullets = stringArrayResource(R.array.legal_consent_bullets)val loadingLabel = stringResource(R.string.legal_consent_loading)- AlertDialog(+ SkinAlertDialog(onDismissRequest = { /* non-dismissable until accepted */ },- // Material 3 paints a dialog from `surface`, which every glass skin- // leaves see-through for in-page chrome — so the chat screen reads- // straight through the legal copy. Same colour with the ground already- // behind it, exactly as the long-press menus do. See Skin.menuContainer.- containerColor = LocalSkin.current.menuContainer,title = {Column(verticalArrangement = Arrangement.spacedBy(12.dp)) {Text(diff --git a/app/src/main/java/com/gotcha/ui/AppDrawer.kt b/app/src/main/java/com/gotcha/ui/AppDrawer.ktindex f2ed59b..7848c51 100644--- a/app/src/main/java/com/gotcha/ui/AppDrawer.kt+++ b/app/src/main/java/com/gotcha/ui/AppDrawer.kt@@ -14,7 +14,6 @@ import androidx.compose.material.icons.filled.AutoAwesomeimport androidx.compose.material.icons.filled.Linkimport androidx.compose.material.icons.filled.Settingsimport androidx.compose.material.icons.outlined.Delete-import androidx.compose.material3.AlertDialogimport androidx.compose.material3.Buttonimport androidx.compose.material3.ButtonDefaultsimport androidx.compose.material3.DrawerDefaults@@ -40,6 +39,7 @@ import androidx.compose.ui.unit.dpimport com.gotcha.data.ChatSessionimport com.gotcha.ui.theme.GotchaMonoimport com.gotcha.ui.theme.LocalSkin+import com.gotcha.ui.theme.SkinAlertDialogimport com.gotcha.ui.tour.TourAnchorimport com.gotcha.ui.tour.tourAnchor@@ -190,7 +190,7 @@ fun AppDrawerContent(sessionToDelete?.let { id ->val title = sessions.find { it.id == id }?.title ?: "this chat"- AlertDialog(+ SkinAlertDialog(onDismissRequest = { sessionToDelete = null },title = { Text("Delete Chat?") },text = { Text("Are you sure you want to permanently delete \"$title\"? This action cannot be undone.") },diff --git a/app/src/main/java/com/gotcha/ui/ChatScreen.kt b/app/src/main/java/com/gotcha/ui/ChatScreen.ktindex d7ac921..e227a0a 100644--- a/app/src/main/java/com/gotcha/ui/ChatScreen.kt+++ b/app/src/main/java/com/gotcha/ui/ChatScreen.kt@@ -35,7 +35,6 @@ import androidx.compose.material.icons.filled.Shareimport androidx.compose.material.icons.filled.Stopimport androidx.compose.material.icons.filled.TouchAppimport androidx.compose.material.icons.outlined.Visibility-import androidx.compose.material3.AlertDialogimport androidx.compose.material3.Buttonimport androidx.compose.material3.ButtonDefaultsimport androidx.compose.material3.CircularProgressIndicator@@ -78,6 +77,7 @@ import com.gotcha.agent.ChatUiStateimport com.gotcha.tools.AgentModeimport com.gotcha.ui.theme.GotchaMonoimport com.gotcha.ui.theme.LocalSkin+import com.gotcha.ui.theme.SkinAlertDialogimport com.gotcha.ui.theme.motionSpecimport kotlinx.coroutines.delayimport androidx.compose.foundation.Image as ComposeImage@@ -592,7 +592,7 @@ fun ChatScreen(}state.pendingConfirmation?.let { pending ->- AlertDialog(+ SkinAlertDialog(onDismissRequest = { onConfirm(false) },title = { Text("Allow these actions?") },text = {@@ -613,7 +613,7 @@ fun ChatScreen(if (state.pendingQuestion != null) {val pending = state.pendingQuestion!!var customAnswer by remember { mutableStateOf("") }- AlertDialog(+ SkinAlertDialog(onDismissRequest = { onAnswer(null) },title = { Text(pending.question) },text = {diff --git a/app/src/main/java/com/gotcha/ui/NotificationDetailDialog.kt b/app/src/main/java/com/gotcha/ui/NotificationDetailDialog.ktindex 7d6039c..8e2664a 100644--- a/app/src/main/java/com/gotcha/ui/NotificationDetailDialog.kt+++ b/app/src/main/java/com/gotcha/ui/NotificationDetailDialog.kt@@ -7,7 +7,6 @@ import androidx.compose.foundation.layout.fillMaxWidthimport androidx.compose.foundation.layout.heightInimport androidx.compose.foundation.rememberScrollStateimport androidx.compose.foundation.verticalScroll-import androidx.compose.material3.AlertDialogimport androidx.compose.material3.Buttonimport androidx.compose.material3.MaterialThemeimport androidx.compose.material3.Text@@ -17,6 +16,7 @@ import androidx.compose.ui.Modifierimport androidx.compose.ui.platform.LocalContextimport androidx.compose.ui.unit.dpimport com.gotcha.notifications.NotificationPayload+import com.gotcha.ui.theme.SkinAlertDialog@Composablefun NotificationDetailDialog(@@ -26,7 +26,7 @@ fun NotificationDetailDialog(val context = LocalContext.currentval scrollState = rememberScrollState()- AlertDialog(+ SkinAlertDialog(onDismissRequest = onDismiss,title = {Text(diff --git a/app/src/main/java/com/gotcha/ui/PersonalInfoScreen.kt b/app/src/main/java/com/gotcha/ui/PersonalInfoScreen.ktindex 64a901a..04f5e81 100644--- a/app/src/main/java/com/gotcha/ui/PersonalInfoScreen.kt+++ b/app/src/main/java/com/gotcha/ui/PersonalInfoScreen.kt@@ -1,7 +1,6 @@package com.gotcha.uiimport androidx.compose.foundation.layout.fillMaxWidth-import androidx.compose.material3.AlertDialogimport androidx.compose.material3.Buttonimport androidx.compose.material3.DropdownMenuItemimport androidx.compose.material3.ExperimentalMaterial3Api@@ -26,6 +25,7 @@ import androidx.compose.ui.text.font.FontWeightimport androidx.compose.ui.unit.dpimport com.gotcha.data.Settingsimport com.gotcha.i18n.Language+import com.gotcha.ui.theme.SkinAlertDialogimport com.gotcha.ui.theme.SkinExposedDropdownMenuimport kotlinx.coroutines.launch@@ -213,7 +213,7 @@ fun PersonalInfoScreen(Text(if (testingVoice) "Playing…" else "Test voice")}voiceDataMissing?.let { missingLang ->- AlertDialog(+ SkinAlertDialog(onDismissRequest = { voiceDataMissing = null },title = { Text("Voice data not installed") },text = {diff --git a/app/src/main/java/com/gotcha/ui/SkillsScreen.kt b/app/src/main/java/com/gotcha/ui/SkillsScreen.ktindex 44a6dfa..9f047ae 100644--- a/app/src/main/java/com/gotcha/ui/SkillsScreen.kt+++ b/app/src/main/java/com/gotcha/ui/SkillsScreen.kt@@ -9,7 +9,6 @@ import androidx.compose.foundation.layout.paddingimport androidx.compose.foundation.text.KeyboardOptionsimport androidx.compose.material.icons.Iconsimport androidx.compose.material.icons.outlined.Delete-import androidx.compose.material3.AlertDialogimport androidx.compose.material3.Buttonimport androidx.compose.material3.ButtonDefaultsimport androidx.compose.material3.HorizontalDivider@@ -38,6 +37,7 @@ import androidx.compose.ui.unit.dpimport com.gotcha.agent.skills.Skillimport com.gotcha.agent.skills.SkillRegistryimport com.gotcha.data.Settings+import com.gotcha.ui.theme.SkinAlertDialogimport kotlinx.coroutines.launch/**@@ -289,7 +289,7 @@ fun SkillsScreen(// ---- Delete confirmation dialog ----communitySkillToDelete?.let { pending ->- AlertDialog(+ SkinAlertDialog(onDismissRequest = { communitySkillToDelete = null },title = { Text("Delete community skill?") },text = {diff --git a/app/src/main/java/com/gotcha/ui/theme/Dialog.kt b/app/src/main/java/com/gotcha/ui/theme/Dialog.ktnew file mode 100644index 0000000..846cafc--- /dev/null+++ b/app/src/main/java/com/gotcha/ui/theme/Dialog.kt@@ -0,0 +1,46 @@+package com.gotcha.ui.theme++import androidx.compose.material3.AlertDialog+import androidx.compose.runtime.Composable+import androidx.compose.ui.Modifier+import androidx.compose.ui.graphics.Color++/**+ * Dialogs, in the skin.+ *+ * The same problem [SkinDropdownMenu] exists to solve, one layer up. Material 3+ * paints an alert dialog from the `surface` role, which every glass skin leaves+ * translucent on purpose — that alpha is what makes the in-page panels read as+ * glass over the wallpaper. A dialog is not a panel: it floats over live+ * content, so the same alpha lets the screen underneath read straight through+ * the text, which is unreadable rather than atmospheric. It is worst over a busy+ * screen — the legal gate on top of a chat — but it is wrong everywhere, and a+ * confirmation the user cannot read is a confirmation they cannot give.+ *+ * Hands the dialog the same colour with the ground already behind it. See+ * [Skin.menuContainer], which names menus only because they were the first+ * floating surface to need it.+ *+ * Use this everywhere instead of `AlertDialog`. Parameter order follows the+ * Material 3 original so call sites read the same.+ */+@Composable+fun SkinAlertDialog(+ onDismissRequest: () -> Unit,+ confirmButton: @Composable () -> Unit,+ modifier: Modifier = Modifier,+ dismissButton: (@Composable () -> Unit)? = null,+ title: (@Composable () -> Unit)? = null,+ text: (@Composable () -> Unit)? = null,+ containerColor: Color = LocalSkin.current.menuContainer+) {+ AlertDialog(+ onDismissRequest = onDismissRequest,+ confirmButton = confirmButton,+ modifier = modifier,+ dismissButton = dismissButton,+ title = title,+ text = text,+ containerColor = containerColor+ )+}diff --git a/app/src/main/java/com/gotcha/ui/theme/Skin.kt b/app/src/main/java/com/gotcha/ui/theme/Skin.ktindex df86cfe..6af751d 100644--- a/app/src/main/java/com/gotcha/ui/theme/Skin.kt+++ b/app/src/main/java/com/gotcha/ui/theme/Skin.kt@@ -88,11 +88,15 @@ data class Skin(get() = if (isGlass) ground else scheme.background/**- * What a menu popup paints itself. Material 3 takes that colour from- * `surface`, which every glass skin leaves see-through for the in-page- * chrome — and a see-through popup lets the page read straight through the- * items under it. Same colour, composited onto the ground first: the menu- * looks like the rest of the skin and stops being a window.+ * What anything floating over the app paints itself — menus and dialogs+ * both. Material 3 takes that colour from `surface`, which every glass skin+ * leaves see-through for the in-page chrome — and a see-through popup lets+ * the page read straight through the items under it. Same colour,+ * composited onto the ground first: the popup looks like the rest of the+ * skin and stops being a window.+ *+ * Named for menus because they were the first to need it; see+ * [com.gotcha.ui.theme.SkinAlertDialog] for the other caller.*/val menuContainer: Colorget() = scheme.surface.over(ground)