Modern Apps git

← Modern-Apps.git

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

Commit
34e73a67f7e43276f2ae77d8b0c836635ee4c28e
Author
Vayun Mathur <[email protected]>
When
2026-12-05 14:37 UTC (17 hours ago)
Parents
32b1e88
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: :maps:compileDevKotlin (lint/test in the sweep run).

Diff

maps/src/main/java/com/vayunmathur/maps/platform/WearMapsSync.kt
diff --git a/maps/src/main/java/com/vayunmathur/maps/platform/WearMapsSync.kt b/maps/src/main/java/com/vayunmathur/maps/platform/WearMapsSync.ktindex cdaae85b03..aa37c722c6 100644--- a/maps/src/main/java/com/vayunmathur/maps/platform/WearMapsSync.kt+++ b/maps/src/main/java/com/vayunmathur/maps/platform/WearMapsSync.kt@@ -1,6 +1,7 @@ package com.vayunmathur.maps.platform  import android.content.Context+import android.content.Intent import com.vayunmathur.library.log.Log import com.vayunmathur.library.map.GeoBounds import com.vayunmathur.library.map.GeoPoint@@ -96,6 +97,10 @@ object WearMapsSync {             if (node != null) return             val listener = object : WearLinkListener {                 override fun onMessage(path: String, body: ByteArray) {+            if (path.endsWith("/open-on-phone")) {+                runCatching { appContext.startActivity(Intent(appContext, com.vayunmathur.maps.MainActivity::class.java).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK).putExtra("wear_open_id", body.decodeToString())) }+                return+            }                     if (path == WearMapsProtocol.REQUEST_REGION_PATH) {                         scope.launch { publishRegion(appContext, force = true) }                     }
maps/src/main/java/com/vayunmathur/maps/ui/WearRouteDetailScreen.kt
diff --git a/maps/src/main/java/com/vayunmathur/maps/ui/WearRouteDetailScreen.kt b/maps/src/main/java/com/vayunmathur/maps/ui/WearRouteDetailScreen.ktindex 943b244c62..84b7cae332 100644--- a/maps/src/main/java/com/vayunmathur/maps/ui/WearRouteDetailScreen.kt+++ b/maps/src/main/java/com/vayunmathur/maps/ui/WearRouteDetailScreen.kt@@ -1,4 +1,12 @@ package com.vayunmathur.maps.ui+import com.vayunmathur.maps.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@@ -33,6 +41,10 @@ fun WearRouteDetailScreen( @Composable internal fun WearRouteDetailContent(route: com.vayunmathur.library.wearlink.maps.WearRouteState?, onBack: () -> Unit) {     val listState = rememberScalingLazyListState()+    val context = LocalContext.current++    val scope = rememberCoroutineScope()+     ScalingLazyColumn(state = listState) {         item {             Text(@@ -73,13 +85,6 @@ internal fun WearRouteDetailContent(route: com.vayunmathur.library.wearlink.maps                 )             }         }-        item {-            Chip(-                onClick = onBack,-                label = { Text(stringResource(R.string.wear_back), maxLines = 1) },-                colors = ChipDefaults.primaryChipColors(),-                modifier = Modifier.fillMaxWidth().padding(horizontal = 8.dp),-            )-        }+        wearOpenOnPhoneItem(onClick = { scope.launch { WearLinkBridge.get(context).sendMessage("/maps/open-on-phone", ByteArray(0)) } }, icon = { IconMobileArrowRight(tint = androidx.compose.ui.graphics.Color.White) })     } }
maps/src/main/java/com/vayunmathur/maps/ui/WearSavedScreen.kt
diff --git a/maps/src/main/java/com/vayunmathur/maps/ui/WearSavedScreen.kt b/maps/src/main/java/com/vayunmathur/maps/ui/WearSavedScreen.ktindex 7644b1028b..6f15bdd09d 100644--- a/maps/src/main/java/com/vayunmathur/maps/ui/WearSavedScreen.kt+++ b/maps/src/main/java/com/vayunmathur/maps/ui/WearSavedScreen.kt@@ -1,4 +1,12 @@ package com.vayunmathur.maps.ui+import com.vayunmathur.maps.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@@ -39,6 +47,10 @@ fun WearSavedScreen( @Composable internal fun WearSavedContent(snapshot: com.vayunmathur.library.wearlink.maps.WearMapSnapshot?, position: com.vayunmathur.library.wearlink.maps.WearPosition?, onBack: () -> Unit) {     val listState = rememberScalingLazyListState()+    val context = LocalContext.current++    val scope = rememberCoroutineScope()+     ScalingLazyColumn(state = listState) {         item {             Text(@@ -77,13 +89,6 @@ internal fun WearSavedContent(snapshot: com.vayunmathur.library.wearlink.maps.We                 )             }         }-        item {-            Chip(-                onClick = onBack,-                label = { Text(stringResource(R.string.wear_back), maxLines = 1) },-                colors = ChipDefaults.primaryChipColors(),-                modifier = Modifier.fillMaxWidth().padding(horizontal = 8.dp),-            )-        }+        wearOpenOnPhoneItem(onClick = { scope.launch { WearLinkBridge.get(context).sendMessage("/maps/open-on-phone", ByteArray(0)) } }, icon = { IconMobileArrowRight(tint = androidx.compose.ui.graphics.Color.White) })     } }
metadata_data/photos/maps/wear/3.png
diff --git a/metadata_data/photos/maps/wear/3.png b/metadata_data/photos/maps/wear/3.pngindex 06e1f8996e..1446d795a9 100644Binary files a/metadata_data/photos/maps/wear/3.png and b/metadata_data/photos/maps/wear/3.png differ