Modern Apps git

← Modern-Apps.git

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

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

Diff

metadata_data/photos/notes/wear/2.png
diff --git a/metadata_data/photos/notes/wear/2.png b/metadata_data/photos/notes/wear/2.pngindex e71c207508..4fb0c392dd 100644Binary files a/metadata_data/photos/notes/wear/2.png and b/metadata_data/photos/notes/wear/2.png differ
notes/src/main/java/com/vayunmathur/notes/sync/WearNotesSync.kt
diff --git a/notes/src/main/java/com/vayunmathur/notes/sync/WearNotesSync.kt b/notes/src/main/java/com/vayunmathur/notes/sync/WearNotesSync.ktindex 2b0c62f2bb..fd081a8955 100644--- a/notes/src/main/java/com/vayunmathur/notes/sync/WearNotesSync.kt+++ b/notes/src/main/java/com/vayunmathur/notes/sync/WearNotesSync.kt@@ -1,6 +1,7 @@ package com.vayunmathur.notes.sync  import android.content.Context+import android.content.Intent import com.vayunmathur.library.log.Log import com.vayunmathur.library.wearlink.WearLinkListener import com.vayunmathur.library.wearlink.WearLinkState@@ -99,6 +100,10 @@ class WearNotesSync private constructor(context: Context) {         }          override fun onMessage(path: String, body: ByteArray) {+            if (path.endsWith("/open-on-phone")) {+                runCatching { appContext.startActivity(Intent(appContext, com.vayunmathur.notes.MainActivity::class.java).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK).putExtra("wear_open_id", body.decodeToString())) }+                return+            }             when (path) {                 WearNotesProtocol.REQUEST_SYNC_PATH -> scope.launch { publishSnapshot() }                 WearNotesProtocol.OP_PATH -> {
notes/src/main/java/com/vayunmathur/notes/ui/WearNoteEditorScreen.kt
diff --git a/notes/src/main/java/com/vayunmathur/notes/ui/WearNoteEditorScreen.kt b/notes/src/main/java/com/vayunmathur/notes/ui/WearNoteEditorScreen.ktindex 5ee5dbdf98..31f08e6900 100644--- a/notes/src/main/java/com/vayunmathur/notes/ui/WearNoteEditorScreen.kt+++ b/notes/src/main/java/com/vayunmathur/notes/ui/WearNoteEditorScreen.kt@@ -107,13 +107,5 @@ internal fun WearNoteEditorContent(                 modifier = Modifier.fillMaxWidth().padding(horizontal = 8.dp),             )         }-        item {-            Chip(-                onClick = onDone,-                label = { Text(stringResource(R.string.wear_back), maxLines = 1) },-                colors = ChipDefaults.secondaryChipColors(),-                modifier = Modifier.fillMaxWidth().padding(horizontal = 8.dp),-            )-        }     } }
notes/src/main/java/com/vayunmathur/notes/ui/WearNoteScreen.kt
diff --git a/notes/src/main/java/com/vayunmathur/notes/ui/WearNoteScreen.kt b/notes/src/main/java/com/vayunmathur/notes/ui/WearNoteScreen.ktindex a2fbf82b48..1c5564fdc2 100644--- a/notes/src/main/java/com/vayunmathur/notes/ui/WearNoteScreen.kt+++ b/notes/src/main/java/com/vayunmathur/notes/ui/WearNoteScreen.kt@@ -1,4 +1,12 @@ package com.vayunmathur.notes.ui+import com.vayunmathur.notes.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@@ -48,6 +56,10 @@ internal fun WearNoteContent( ) {     val listState = rememberScalingLazyListState() +    val context = LocalContext.current++    val scope = rememberCoroutineScope()+     ScalingLazyColumn(state = listState) {         if (note == null) {             item {@@ -105,22 +117,10 @@ internal fun WearNoteContent(                     )                 }             }-            item {-                Chip(-                    onClick = { onDelete(note.syncId) },-                    label = { Text(stringResource(R.string.wear_delete), maxLines = 1) },-                    colors = ChipDefaults.secondaryChipColors(),-                    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),-            )+        wearOpenOnPhoneItem(onClick = { scope.launch { WearLinkBridge.get(context).sendMessage("/notes/open-on-phone", ByteArray(0)) } }, icon = { IconMobileArrowRight(tint = androidx.compose.ui.graphics.Color.White) })+        if (note != null) {+            wearDeleteItem(label = "Delete note", onClick = { onDelete(note.syncId) }, icon = { IconDelete(tint = androidx.compose.ui.graphics.Color.White) })         }     } }