Modern Apps git

← Modern-Apps.git

securemail: compact chip fields, inset-safe compose

Commit
0ba75dc35168790fad1d241263eaf09534aecc1d
Author
vayun-mathur <[email protected]>
When
2026-10-24 19:37 UTC (1 month ago)
Parents
2466e4c

Diff

securemail/src/main/java/com/vayunmathur/securemail/ui/ComposeScreen.kt
diff --git a/securemail/src/main/java/com/vayunmathur/securemail/ui/ComposeScreen.kt b/securemail/src/main/java/com/vayunmathur/securemail/ui/ComposeScreen.ktindex bef9c0b94f..1470f6e403 100644--- a/securemail/src/main/java/com/vayunmathur/securemail/ui/ComposeScreen.kt+++ b/securemail/src/main/java/com/vayunmathur/securemail/ui/ComposeScreen.kt@@ -10,7 +10,9 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.imePadding import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.systemBarsPadding import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardOptions@@ -87,7 +89,13 @@ fun ComposeScreen(         }     }     val allRecipients = draftTo + draftCc + draftBcc-    DesktopMaxWidthContainer(Modifier.fillMaxSize()) {+    // No top app bar by design; systemBarsPadding keeps the form clear of+    // the status bar / camera cutout, imePadding keeps Send above the keyboard.+    DesktopMaxWidthContainer(+        Modifier.fillMaxSize()+            .systemBarsPadding()+            .imePadding(),+    ) {         Column(             modifier = Modifier                 .fillMaxWidth()
securemail/src/main/java/com/vayunmathur/securemail/ui/RecipientChipField.kt
diff --git a/securemail/src/main/java/com/vayunmathur/securemail/ui/RecipientChipField.kt b/securemail/src/main/java/com/vayunmathur/securemail/ui/RecipientChipField.ktindex 5a999217f9..a60668f5eb 100644--- a/securemail/src/main/java/com/vayunmathur/securemail/ui/RecipientChipField.kt+++ b/securemail/src/main/java/com/vayunmathur/securemail/ui/RecipientChipField.kt@@ -1,12 +1,8 @@ package com.vayunmathur.securemail.ui  import androidx.compose.foundation.layout.Arrangement-import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.FlowRow-import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth-import androidx.compose.foundation.layout.padding-import androidx.compose.foundation.layout.size import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.runtime.Composable@@ -14,26 +10,23 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue-import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.unit.dp-import com.vayunmathur.library.ui.Card import com.vayunmathur.library.ui.IconAdd import com.vayunmathur.library.ui.IconButton import com.vayunmathur.library.ui.IconRemoveCircle import com.vayunmathur.library.ui.InputChip-import com.vayunmathur.library.ui.MaterialTheme import com.vayunmathur.library.ui.OutlinedTextField import com.vayunmathur.library.ui.Text  /**- * Recipient chip field (shared by To/Cc/Bcc): type an address + Enter (Done)- * to add it as a chip; tap a chip's โœ• to remove; `+` opens the contacts- * picker. Invalid addresses surface [onInvalid] (messenger) instead of- * adding. Mirrors the `MultiCategoryPicker` chip rendering- * (`InputChip + IconRemoveCircle`) with an editable field.+ * Recipient field (shared by To/Cc/Bcc): chips above a single-line input.+ * Type an address + Enter (Done) to add it as a chip; tap a chip's โœ• to+ * remove; the trailing `+` opens the contacts picker. Invalid addresses+ * surface [onInvalid] (messenger) instead of adding. No card wrapper โ€” the+ * field label is the destination (To/Cc/Bcc) and the hint stays put.  */ @Composable fun RecipientChipField(@@ -54,47 +47,34 @@ fun RecipientChipField(             onInvalid()         }     }-    Card(modifier = Modifier.fillMaxWidth()) {-        Column(-            modifier = Modifier.padding(12.dp).fillMaxWidth(),+    if (recipients.isNotEmpty()) {+        FlowRow(+            modifier = Modifier.fillMaxWidth(),+            horizontalArrangement = Arrangement.spacedBy(8.dp),             verticalArrangement = Arrangement.spacedBy(8.dp),         ) {-            Text(label, style = MaterialTheme.typography.labelMedium)-            if (recipients.isNotEmpty()) {-                FlowRow(-                    modifier = Modifier.fillMaxWidth(),-                    horizontalArrangement = Arrangement.spacedBy(8.dp),-                    verticalArrangement = Arrangement.spacedBy(8.dp),-                ) {-                    recipients.forEach { address ->-                        InputChip(-                            selected = false,-                            onClick = { onRemove(address) },-                            label = { Text(address) },-                            trailingIcon = { IconRemoveCircle(Modifier.size(18.dp)) },-                        )-                    }-                }-            }-            Row(-                modifier = Modifier.fillMaxWidth(),-                horizontalArrangement = Arrangement.spacedBy(8.dp),-                verticalAlignment = Alignment.CenterVertically,-            ) {-                OutlinedTextField(-                    value = text,-                    onValueChange = { text = it },-                    label = { Text("Type address, Enter to add") },-                    modifier = Modifier.weight(1f),-                    singleLine = true,-                    keyboardOptions = KeyboardOptions(-                        keyboardType = KeyboardType.Email,-                        imeAction = ImeAction.Done,-                    ),-                    keyboardActions = KeyboardActions(onDone = { submit() }),+            recipients.forEach { address ->+                InputChip(+                    selected = false,+                    onClick = { onRemove(address) },+                    label = { Text(address) },+                    trailingIcon = { IconRemoveCircle() },                 )-                IconButton(onClick = onPickContact) { IconAdd() }             }         }     }+    OutlinedTextField(+        value = text,+        onValueChange = { text = it },+        label = { Text(label) },+        placeholder = { Text("Type address, Enter to add") },+        modifier = Modifier.fillMaxWidth(),+        singleLine = true,+        keyboardOptions = KeyboardOptions(+            keyboardType = KeyboardType.Email,+            imeAction = ImeAction.Done,+        ),+        keyboardActions = KeyboardActions(onDone = { submit() }),+        trailingIcon = { IconButton(onClick = onPickContact) { IconAdd() } },+    ) }