Modern Apps git

← Modern-Apps.git

clock: fix watch design (no Back buttons, centered filled actions)

Commit
7c2709698522e9970f6bcb78affb13cb5604554b
Author
Vayun Mathur <[email protected]>
When
2026-12-05 14:37 UTC (13 hours ago)
Parents
c6bf91a
Remove bottom text Back chips from watch screens (system back
now pops the shared WearBackStack), add a centered filled
Open on phone button with the mobile-arrow-right icon on
detail/summary screens, and convert existing watch deletes to
a red filled Delete button below it where a real watch delete
path already exists (notes: Delete note via store op, todo:
Delete task via its confirm route). Open on phone sends the
/<app>/open-on-phone conduit message; the phone sync opens the
app main activity with the entity id extra. List/nav chips and
toggles keep their component types; no Outlined/TextButton
remains on watch screens.

Verified: :clock:compileDevKotlin (lint/test in the sweep run).

Diff

clock/src/main/java/com/vayunmathur/clock/sync/WearClockSync.kt
diff --git a/clock/src/main/java/com/vayunmathur/clock/sync/WearClockSync.kt b/clock/src/main/java/com/vayunmathur/clock/sync/WearClockSync.ktindex 3fe1049d1a..145a5721f9 100644--- a/clock/src/main/java/com/vayunmathur/clock/sync/WearClockSync.kt+++ b/clock/src/main/java/com/vayunmathur/clock/sync/WearClockSync.kt@@ -1,6 +1,7 @@ package com.vayunmathur.clock.sync  import android.content.Context+import android.content.Intent import com.vayunmathur.clock.data.ClockRepository import com.vayunmathur.library.wearlink.clock.WearClockAlarm import com.vayunmathur.library.wearlink.clock.WearClockProtocol@@ -93,6 +94,10 @@ class WearClockSync private constructor(context: Context) {         }          override fun onMessage(path: String, body: ByteArray) {+            if (path.endsWith("/open-on-phone")) {+                runCatching { appContext.startActivity(Intent(appContext, com.vayunmathur.clock.MainActivity::class.java).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK).putExtra("wear_open_id", body.decodeToString())) }+                return+            }             if (path != WearClockProtocol.REQUEST_SYNC_PATH) return             scope.launch { publishSnapshot() }         }
clock/src/main/java/com/vayunmathur/clock/ui/WearAlarmDetailScreen.kt
diff --git a/clock/src/main/java/com/vayunmathur/clock/ui/WearAlarmDetailScreen.kt b/clock/src/main/java/com/vayunmathur/clock/ui/WearAlarmDetailScreen.ktindex 7dbe8a694f..c7346670ba 100644--- a/clock/src/main/java/com/vayunmathur/clock/ui/WearAlarmDetailScreen.kt+++ b/clock/src/main/java/com/vayunmathur/clock/ui/WearAlarmDetailScreen.kt@@ -1,4 +1,10 @@ package com.vayunmathur.clock.ui+import com.vayunmathur.library.wearlink.wearOpenOnPhoneItem+import com.vayunmathur.library.ui.IconMobileArrowRight+import androidx.compose.runtime.rememberCoroutineScope+import kotlinx.coroutines.launch+import com.vayunmathur.library.ui.IconDelete+import com.vayunmathur.library.wearlink.wearDeleteItem  import android.content.Intent import android.net.Uri@@ -36,6 +42,7 @@ import kotlin.time.Instant fun WearAlarmDetailScreen(store: WearClockStore, alarmId: Long, onBack: () -> Unit) {     val persisted by store.state.collectAsState()     val context = LocalContext.current+    val scope = rememberCoroutineScope()     val alarm = persisted.snapshot.alarms.firstOrNull { it.alarmId == alarmId }     val nowMillis = System.currentTimeMillis()     val state = alarm?.let {@@ -138,14 +145,7 @@ fun WearAlarmDetailScreen(store: WearClockStore, alarmId: Long, onBack: () -> Un                 }             }         }-        item {-            Chip(-                onClick = onBack,-                label = { Text(stringResource(R.string.wear_back), maxLines = 1) },-                colors = ChipDefaults.secondaryChipColors(),-                modifier = Modifier.fillMaxWidth().padding(horizontal = 8.dp),-            )-        }+        wearOpenOnPhoneItem(onClick = { scope.launch { WearLinkBridge.get(context).sendMessage("/clock/open-on-phone", ByteArray(0)) } }, icon = { IconMobileArrowRight(tint = androidx.compose.ui.graphics.Color.White) })     } } 
clock/src/main/java/com/vayunmathur/clock/ui/WearAlarmsScreen.kt
diff --git a/clock/src/main/java/com/vayunmathur/clock/ui/WearAlarmsScreen.kt b/clock/src/main/java/com/vayunmathur/clock/ui/WearAlarmsScreen.ktindex 604250f7d0..39c5621758 100644--- a/clock/src/main/java/com/vayunmathur/clock/ui/WearAlarmsScreen.kt+++ b/clock/src/main/java/com/vayunmathur/clock/ui/WearAlarmsScreen.kt@@ -82,14 +82,6 @@ internal fun WearAlarmsContent(                 WearAlarmChip(alarm, state) { onOpenAlarm(alarm.alarmId) }             }         }-        item {-            Chip(-                onClick = onBack,-                label = { Text(stringResource(R.string.wear_back), maxLines = 1) },-                colors = ChipDefaults.secondaryChipColors(),-                modifier = Modifier.fillMaxWidth().padding(horizontal = 8.dp),-            )-        }     } } 
clock/src/main/java/com/vayunmathur/clock/ui/WearStopwatchScreen.kt
diff --git a/clock/src/main/java/com/vayunmathur/clock/ui/WearStopwatchScreen.kt b/clock/src/main/java/com/vayunmathur/clock/ui/WearStopwatchScreen.ktindex d1071645a5..7dbef92504 100644--- a/clock/src/main/java/com/vayunmathur/clock/ui/WearStopwatchScreen.kt+++ b/clock/src/main/java/com/vayunmathur/clock/ui/WearStopwatchScreen.kt@@ -110,13 +110,5 @@ fun WearStopwatchScreen(store: WearClockStore, onBack: () -> Unit) {                 modifier = Modifier.fillMaxWidth().padding(horizontal = 12.dp, vertical = 2.dp),             )         }-        item {-            Chip(-                onClick = onBack,-                label = { Text(stringResource(R.string.wear_back), maxLines = 1) },-                colors = ChipDefaults.secondaryChipColors(),-                modifier = Modifier.fillMaxWidth().padding(horizontal = 8.dp),-            )-        }     } }
clock/src/main/java/com/vayunmathur/clock/ui/WearTimersScreen.kt
diff --git a/clock/src/main/java/com/vayunmathur/clock/ui/WearTimersScreen.kt b/clock/src/main/java/com/vayunmathur/clock/ui/WearTimersScreen.ktindex 33a17e267f..2ff2363038 100644--- a/clock/src/main/java/com/vayunmathur/clock/ui/WearTimersScreen.kt+++ b/clock/src/main/java/com/vayunmathur/clock/ui/WearTimersScreen.kt@@ -129,14 +129,6 @@ fun WearTimersScreen(store: WearClockStore, onBack: () -> Unit) {                 modifier = Modifier.fillMaxWidth().padding(horizontal = 8.dp),             )         }-        item {-            Chip(-                onClick = onBack,-                label = { Text(stringResource(R.string.wear_back), maxLines = 1) },-                colors = ChipDefaults.secondaryChipColors(),-                modifier = Modifier.fillMaxWidth().padding(horizontal = 8.dp),-            )-        }     } } 
clock/src/main/java/com/vayunmathur/clock/ui/WearWorldClockScreen.kt
diff --git a/clock/src/main/java/com/vayunmathur/clock/ui/WearWorldClockScreen.kt b/clock/src/main/java/com/vayunmathur/clock/ui/WearWorldClockScreen.ktindex aa29d9ae87..2067dbe447 100644--- a/clock/src/main/java/com/vayunmathur/clock/ui/WearWorldClockScreen.kt+++ b/clock/src/main/java/com/vayunmathur/clock/ui/WearWorldClockScreen.kt@@ -62,14 +62,6 @@ fun WearWorldClockScreen(store: WearClockStore, onBack: () -> Unit) {                 WearWorldClockRow(clock, nowMillis)             }         }-        item {-            Chip(-                onClick = onBack,-                label = { Text(stringResource(R.string.wear_back), maxLines = 1) },-                colors = ChipDefaults.secondaryChipColors(),-                modifier = Modifier.fillMaxWidth().padding(horizontal = 8.dp),-            )-        }     } }