email: expand composer attachment sections as they fill
- Commit
c65cfc030006f08768802ef735290391d6acf5c8- Author
- Vayun Mathur <[email protected]>
- When
- 2026-12-05 16:25 UTC (11 hours ago)
- Parents
a31eb29
The inline-image thumbnail row and the attachment rows mounted in a cut when the first image/attachment was added. Both now open through ExpandVisibility in the composer column. The size summary and its over-25MB warning stay instant, as before. Wrap abrupt conditional content in the shared library.ui motion helpers so it expands/fades/pops in instead of popping in cut, and closes up cleanly when it goes away. No raw androidx.compose. animation is used at the call site, per the fatal DirectCompose Animation lint; durations and easing come from the helpers' MaterialTheme motion-scheme defaults. Verified in this worktree with lint, lintVitalRelease and testDevUnitTest for the module (details in the session report; any pre-existing failure was reproduced on the pristine base).
Diff
email/src/main/java/com/vayunmathur/email/ui/ComposerAttachments.kt
diff --git a/email/src/main/java/com/vayunmathur/email/ui/ComposerAttachments.kt b/email/src/main/java/com/vayunmathur/email/ui/ComposerAttachments.ktindex e5a121d0a8..3aeb571cff 100644--- a/email/src/main/java/com/vayunmathur/email/ui/ComposerAttachments.kt+++ b/email/src/main/java/com/vayunmathur/email/ui/ComposerAttachments.kt@@ -20,6 +20,7 @@ import androidx.compose.ui.unit.dp import com.vayunmathur.email.R import com.vayunmathur.email.ui.composer.EmailHtmlEditorController import com.vayunmathur.library.ui.Card+import com.vayunmathur.library.ui.ExpandVisibility import com.vayunmathur.library.ui.IconAttachment import com.vayunmathur.library.ui.IconButton import com.vayunmathur.library.ui.IconClose@@ -40,7 +41,7 @@ fun ComposerAttachmentSection( onRemoveAttachment: (Uri) -> Unit, ) { // Inline images thumbnail row (text-based to avoid heavy deps; WYSIWYG preview already in editor)- if (bodyController.inlineImages.isNotEmpty()) {+ ExpandVisibility(visible = bodyController.inlineImages.isNotEmpty()) { val inlineTotal = bodyController.inlineImages.sumOf { uriSize(context, it.localUri) } Text(stringResource(R.string.inline_images, bodyController.inlineImages.size, android.text.format.Formatter.formatShortFileSize(context, inlineTotal)), style = MaterialTheme.typography.labelSmall) androidx.compose.foundation.lazy.LazyRow(@@ -76,7 +77,7 @@ fun ComposerAttachmentSection( } } - if (attachments.isNotEmpty()) {+ ExpandVisibility(visible = attachments.isNotEmpty()) { attachments.forEach { uri -> val attachmentLabel = remember(uri) { "${uriName(context, uri)} · " + android.text.format.Formatter.formatShortFileSize(context, uriSize(context, uri))