Modern Apps git

← Modern-Apps.git

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

Commit
c02ac015ea02ee2826dd99cd9130cafa05b03db4
Author
Vayun Mathur <[email protected]>
When
2026-12-05 14:37 UTC (13 hours ago)
Parents
1cedac1
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: :calendar:compileDevKotlin (lint/test in the sweep run).

Diff

calendar/src/main/java/com/vayunmathur/calendar/sync/WearCalendarSync.kt
diff --git a/calendar/src/main/java/com/vayunmathur/calendar/sync/WearCalendarSync.kt b/calendar/src/main/java/com/vayunmathur/calendar/sync/WearCalendarSync.ktindex 273a01f727..62353118ca 100644--- a/calendar/src/main/java/com/vayunmathur/calendar/sync/WearCalendarSync.kt+++ b/calendar/src/main/java/com/vayunmathur/calendar/sync/WearCalendarSync.kt@@ -1,6 +1,7 @@ package com.vayunmathur.calendar.sync  import android.content.Context+import android.content.Intent import com.vayunmathur.calendar.data.Calendar import com.vayunmathur.calendar.data.Event import com.vayunmathur.calendar.data.Instance@@ -92,6 +93,10 @@ class WearCalendarSync private constructor(context: Context) {         }          override fun onMessage(path: String, body: ByteArray) {+            if (path.endsWith("/open-on-phone")) {+                runCatching { appContext.startActivity(Intent(appContext, com.vayunmathur.calendar.MainActivity::class.java).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK).putExtra("wear_open_id", body.decodeToString())) }+                return+            }             if (path != WearCalendarProtocol.REQUEST_SYNC_PATH) return             scope.launch { publishSnapshot() }         }
calendar/src/main/java/com/vayunmathur/calendar/ui/WearEventScreen.kt
diff --git a/calendar/src/main/java/com/vayunmathur/calendar/ui/WearEventScreen.kt b/calendar/src/main/java/com/vayunmathur/calendar/ui/WearEventScreen.ktindex bc2a3341af..f9ebfd6c62 100644--- a/calendar/src/main/java/com/vayunmathur/calendar/ui/WearEventScreen.kt+++ b/calendar/src/main/java/com/vayunmathur/calendar/ui/WearEventScreen.kt@@ -1,4 +1,12 @@ package com.vayunmathur.calendar.ui+import com.vayunmathur.calendar.sync.WearLinkBridge+import com.vayunmathur.library.wearlink.wearOpenOnPhoneItem+import com.vayunmathur.library.ui.IconMobileArrowRight+import androidx.compose.runtime.rememberCoroutineScope+import androidx.compose.ui.platform.LocalContext+import kotlinx.coroutines.launch+import com.vayunmathur.library.ui.IconDelete+import com.vayunmathur.library.wearlink.wearDeleteItem  import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding@@ -47,6 +55,10 @@ internal fun WearEventContent(event: WearCalendarEvent?, onBack: () -> Unit) {     val zone = remember { TimeZone.currentSystemDefault() }     val listState = rememberScalingLazyListState() +    val context = LocalContext.current++    val scope = rememberCoroutineScope()+     ScalingLazyColumn(state = listState) {         if (event == null) {             item {@@ -112,13 +124,6 @@ internal fun WearEventContent(event: WearCalendarEvent?, onBack: () -> Unit) {                 }             }         }-        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("/calendar/open-on-phone", ByteArray(0)) } }, icon = { IconMobileArrowRight(tint = androidx.compose.ui.graphics.Color.White) })     } }
metadata_data/photos/calendar/wear/2.png
diff --git a/metadata_data/photos/calendar/wear/2.png b/metadata_data/photos/calendar/wear/2.pngindex 5c0fc38778..f13ef6fba1 100644Binary files a/metadata_data/photos/calendar/wear/2.png and b/metadata_data/photos/calendar/wear/2.png differ