diff --git a/change-logs/1.28.0/changesets/activity-phone-compact.md b/change-logs/1.28.0/changesets/activity-phone-compact.md new file mode 100644 index 0000000000..be6df51aad --- /dev/null +++ b/change-logs/1.28.0/changesets/activity-phone-compact.md @@ -0,0 +1,21 @@ +--- +type: improved +area: activity +platforms: + - android + - ios +pull_request: 5123 +rollout: full +--- + +## zh-CN + +手机上的“动态”列表改成和网页一样的紧凑行:行间不再有分隔线,间距更紧,仍保留两行预览;顶部筛选条和列表左右边距统一为 20。 + +## en + +On phones, the Activity list now uses the same compact rows as the web: no dividers between rows and tighter spacing, still with a two-line preview. The filter bar and the rows share a 20pt side margin. + +## ja + +スマートフォンの「アクティビティ」一覧を Web と同じコンパクトな行にしました。行の区切り線をなくして間隔を詰め、2 行のプレビューはそのままです。上部のフィルターバーと一覧の左右の余白は 20 にそろえました。 diff --git a/compose/shared/src/androidUnitTest/kotlin/build/raft/app/ActivityConversationRowsScreenshotTest.kt b/compose/shared/src/androidUnitTest/kotlin/build/raft/app/ActivityConversationRowsScreenshotTest.kt index f2a2cb59c5..638bcbd9de 100644 --- a/compose/shared/src/androidUnitTest/kotlin/build/raft/app/ActivityConversationRowsScreenshotTest.kt +++ b/compose/shared/src/androidUnitTest/kotlin/build/raft/app/ActivityConversationRowsScreenshotTest.kt @@ -9,7 +9,9 @@ import androidx.activity.compose.setContent import androidx.compose.foundation.background import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll +import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.runtime.Composable @@ -323,7 +325,12 @@ private fun ActivityRowsVisualContent(appearance: RaftAppAppearance, groupedByDa ) RaftTheme(appearance = if (appearance == RaftAppAppearance.Dark) RaftAppearance.Dark else RaftAppearance.Light) { // Scrollable like the real LazyColumn: a row past the viewport keeps its own height. - Column(Modifier.fillMaxSize().background(RaftTheme.colors.layerCanvas).verticalScroll(rememberScrollState())) { + val layout = activityRowLayout + // As SharedActivityList lays them out: 8dp above the first row, rows 2dp apart. + Column( + Modifier.fillMaxSize().background(RaftTheme.colors.layerCanvas).verticalScroll(rememberScrollState()).padding(top = layout.listTop), + verticalArrangement = Arrangement.spacedBy(layout.rowGap), + ) { val entries = if (groupedByDay) { activityConversationListEntries(shownRows, timeContext) @@ -332,7 +339,7 @@ private fun ActivityRowsVisualContent(appearance: RaftAppAppearance, groupedByDa } entries.forEach { entry -> if (entry is ActivityConversationListEntry.DayHeading) { - ActivityDayHeading(entry.label, first = entry.first, background = RaftTheme.colors.layerCanvas) + ActivityDayHeading(entry.label, first = entry.first, background = RaftTheme.colors.layerCanvas, horizontalPadding = layout.contentEdge) return@forEach } val item = (entry as ActivityConversationListEntry.Row).item @@ -452,7 +459,12 @@ private fun ActivityRowsSwipeVisualContent(appearance: RaftAppAppearance, pose: } RaftTheme(appearance = if (appearance == RaftAppAppearance.Dark) RaftAppearance.Dark else RaftAppearance.Light) { // Scrollable like the real LazyColumn: a row past the viewport keeps its own height. - Column(Modifier.fillMaxSize().background(RaftTheme.colors.layerCanvas).verticalScroll(rememberScrollState())) { + val layout = activityRowLayout + // As SharedActivityList lays them out: 8dp above the first row, rows 2dp apart. + Column( + Modifier.fillMaxSize().background(RaftTheme.colors.layerCanvas).verticalScroll(rememberScrollState()).padding(top = layout.listTop), + verticalArrangement = Arrangement.spacedBy(layout.rowGap), + ) { rows.forEachIndexed { index, (item, rowState) -> val (open, slide) = rowState ActivityConversationListRow( @@ -521,7 +533,12 @@ private fun ActivityRowsHoverVisualContent(appearance: RaftAppAppearance) { ) val context = ActivityConversationListContext(channelSymbolsByChannelId = mapOf("launch-week" to "#", "release" to "#")) RaftTheme(appearance = if (appearance == RaftAppAppearance.Dark) RaftAppearance.Dark else RaftAppearance.Light) { - Column(Modifier.fillMaxSize().background(RaftTheme.colors.layerCanvas).verticalScroll(rememberScrollState())) { + val layout = activityRowLayout + // As SharedActivityList lays them out: 8dp above the first row, rows 2dp apart. + Column( + Modifier.fillMaxSize().background(RaftTheme.colors.layerCanvas).verticalScroll(rememberScrollState()).padding(top = layout.listTop), + verticalArrangement = Arrangement.spacedBy(layout.rowGap), + ) { rows.forEachIndexed { index, (item, hovered) -> ActivityConversationListRow( item = item, diff --git a/compose/shared/src/androidUnitTest/kotlin/build/raft/app/ActivityWideRowsScreenshotTest.kt b/compose/shared/src/androidUnitTest/kotlin/build/raft/app/ActivityWideRowsScreenshotTest.kt index 79325a189c..2d3345fb68 100644 --- a/compose/shared/src/androidUnitTest/kotlin/build/raft/app/ActivityWideRowsScreenshotTest.kt +++ b/compose/shared/src/androidUnitTest/kotlin/build/raft/app/ActivityWideRowsScreenshotTest.kt @@ -44,7 +44,7 @@ import org.robolectric.annotation.GraphicsMode * selected (the open conversation), so its shape shows. * - `screens.activity.wide.rows.touch` / `.dark`: by touch, content 20dp from the column's edge, rows at least 56dp; * - `screens.activity.wide.rows.fine`: a mouse or trackpad, content 16dp in, the third row hovered. - * The phone keeps its own rows (two reserved excerpt lines, hairlines): [ActivityConversationRowsScreenshotTest]. + * The phone takes the same cell with two reserved excerpt lines: [ActivityConversationRowsScreenshotTest]. * Verify / record as [RaftRobolectricScreenshot]. */ @RunWith(RobolectricTestRunner::class) diff --git a/compose/shared/src/androidUnitTest/screenshots/activity.app-bot.dm-rows.dark.png b/compose/shared/src/androidUnitTest/screenshots/activity.app-bot.dm-rows.dark.png index 145187acfd..9bb8c441f3 100644 Binary files a/compose/shared/src/androidUnitTest/screenshots/activity.app-bot.dm-rows.dark.png and b/compose/shared/src/androidUnitTest/screenshots/activity.app-bot.dm-rows.dark.png differ diff --git a/compose/shared/src/androidUnitTest/screenshots/activity.app-bot.dm-rows.png b/compose/shared/src/androidUnitTest/screenshots/activity.app-bot.dm-rows.png index e511385df0..28392a0438 100644 Binary files a/compose/shared/src/androidUnitTest/screenshots/activity.app-bot.dm-rows.png and b/compose/shared/src/androidUnitTest/screenshots/activity.app-bot.dm-rows.png differ diff --git a/compose/shared/src/androidUnitTest/screenshots/hover.activity-row.dark.png b/compose/shared/src/androidUnitTest/screenshots/hover.activity-row.dark.png index 7681d36166..102821b0d7 100644 Binary files a/compose/shared/src/androidUnitTest/screenshots/hover.activity-row.dark.png and b/compose/shared/src/androidUnitTest/screenshots/hover.activity-row.dark.png differ diff --git a/compose/shared/src/androidUnitTest/screenshots/hover.activity-row.png b/compose/shared/src/androidUnitTest/screenshots/hover.activity-row.png index d5ee70f0a8..4998d1d123 100644 Binary files a/compose/shared/src/androidUnitTest/screenshots/hover.activity-row.png and b/compose/shared/src/androidUnitTest/screenshots/hover.activity-row.png differ diff --git a/compose/shared/src/androidUnitTest/screenshots/screens.activity.filter.chip.dark.png b/compose/shared/src/androidUnitTest/screenshots/screens.activity.filter.chip.dark.png index fa32fbc9dc..76b1c7b885 100644 Binary files a/compose/shared/src/androidUnitTest/screenshots/screens.activity.filter.chip.dark.png and b/compose/shared/src/androidUnitTest/screenshots/screens.activity.filter.chip.dark.png differ diff --git a/compose/shared/src/androidUnitTest/screenshots/screens.activity.filter.chip.png b/compose/shared/src/androidUnitTest/screenshots/screens.activity.filter.chip.png index 90081a5360..17909fa9c0 100644 Binary files a/compose/shared/src/androidUnitTest/screenshots/screens.activity.filter.chip.png and b/compose/shared/src/androidUnitTest/screenshots/screens.activity.filter.chip.png differ diff --git a/compose/shared/src/androidUnitTest/screenshots/screens.activity.filter.menu.dark.png b/compose/shared/src/androidUnitTest/screenshots/screens.activity.filter.menu.dark.png index cb6a926175..1ce906cf9f 100644 Binary files a/compose/shared/src/androidUnitTest/screenshots/screens.activity.filter.menu.dark.png and b/compose/shared/src/androidUnitTest/screenshots/screens.activity.filter.menu.dark.png differ diff --git a/compose/shared/src/androidUnitTest/screenshots/screens.activity.filter.menu.png b/compose/shared/src/androidUnitTest/screenshots/screens.activity.filter.menu.png index b8633868f7..164ff9c417 100644 Binary files a/compose/shared/src/androidUnitTest/screenshots/screens.activity.filter.menu.png and b/compose/shared/src/androidUnitTest/screenshots/screens.activity.filter.menu.png differ diff --git a/compose/shared/src/androidUnitTest/screenshots/screens.activity.filter.none.dark.png b/compose/shared/src/androidUnitTest/screenshots/screens.activity.filter.none.dark.png index 77e309b1fd..4a22be3cc0 100644 Binary files a/compose/shared/src/androidUnitTest/screenshots/screens.activity.filter.none.dark.png and b/compose/shared/src/androidUnitTest/screenshots/screens.activity.filter.none.dark.png differ diff --git a/compose/shared/src/androidUnitTest/screenshots/screens.activity.filter.none.png b/compose/shared/src/androidUnitTest/screenshots/screens.activity.filter.none.png index c1d832bf15..8d81b88437 100644 Binary files a/compose/shared/src/androidUnitTest/screenshots/screens.activity.filter.none.png and b/compose/shared/src/androidUnitTest/screenshots/screens.activity.filter.none.png differ diff --git a/compose/shared/src/androidUnitTest/screenshots/screens.activity.object-rows.dark.png b/compose/shared/src/androidUnitTest/screenshots/screens.activity.object-rows.dark.png index 288e8f4169..d10dea03d4 100644 Binary files a/compose/shared/src/androidUnitTest/screenshots/screens.activity.object-rows.dark.png and b/compose/shared/src/androidUnitTest/screenshots/screens.activity.object-rows.dark.png differ diff --git a/compose/shared/src/androidUnitTest/screenshots/screens.activity.object-rows.png b/compose/shared/src/androidUnitTest/screenshots/screens.activity.object-rows.png index f9b851975f..0d921d198c 100644 Binary files a/compose/shared/src/androidUnitTest/screenshots/screens.activity.object-rows.png and b/compose/shared/src/androidUnitTest/screenshots/screens.activity.object-rows.png differ diff --git a/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.dark.png b/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.dark.png index 0cf03a5203..a767d858ec 100644 Binary files a/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.dark.png and b/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.dark.png differ diff --git a/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.day-groups.png b/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.day-groups.png index 0635201d11..878dff718c 100644 Binary files a/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.day-groups.png and b/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.day-groups.png differ diff --git a/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.hover-done.dark.png b/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.hover-done.dark.png index 134d9694d9..fee1967363 100644 Binary files a/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.hover-done.dark.png and b/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.hover-done.dark.png differ diff --git a/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.hover-done.png b/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.hover-done.png index 82c11ed4e9..cdf48ea1f1 100644 Binary files a/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.hover-done.png and b/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.hover-done.png differ diff --git a/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.marked-unread.dark.png b/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.marked-unread.dark.png index 64b8a39ab1..c760cef8b1 100644 Binary files a/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.marked-unread.dark.png and b/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.marked-unread.dark.png differ diff --git a/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.marked-unread.png b/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.marked-unread.png index 0c3fc43ec6..df4cee9418 100644 Binary files a/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.marked-unread.png and b/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.marked-unread.png differ diff --git a/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.png b/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.png index 8045cebb8d..daf26c3c3c 100644 Binary files a/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.png and b/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.png differ diff --git a/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.swipe-full-done.png b/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.swipe-full-done.png index 7154dd9537..a63af5db12 100644 Binary files a/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.swipe-full-done.png and b/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.swipe-full-done.png differ diff --git a/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.swipe-open.dark.png b/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.swipe-open.dark.png index ef6cfed0e0..9cc8ac406a 100644 Binary files a/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.swipe-open.dark.png and b/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.swipe-open.dark.png differ diff --git a/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.swipe-open.png b/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.swipe-open.png index 0561e3600b..c7fad2f5ec 100644 Binary files a/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.swipe-open.png and b/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.swipe-open.png differ diff --git a/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.swipe-read-open.dark.png b/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.swipe-read-open.dark.png index 1972eefac2..b433c93b89 100644 Binary files a/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.swipe-read-open.dark.png and b/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.swipe-read-open.dark.png differ diff --git a/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.swipe-read-open.png b/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.swipe-read-open.png index d0be6c8ad6..2b0d69cddf 100644 Binary files a/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.swipe-read-open.png and b/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.swipe-read-open.png differ diff --git a/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.swipe-sliding.png b/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.swipe-sliding.png index b20977ce6d..b9e3b47832 100644 Binary files a/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.swipe-sliding.png and b/compose/shared/src/androidUnitTest/screenshots/screens.activity.rows.swipe-sliding.png differ diff --git a/compose/shared/src/androidUnitTest/screenshots/screens.activity.task-rows.dark.png b/compose/shared/src/androidUnitTest/screenshots/screens.activity.task-rows.dark.png index 12efa3d038..a4bfe9ec2a 100644 Binary files a/compose/shared/src/androidUnitTest/screenshots/screens.activity.task-rows.dark.png and b/compose/shared/src/androidUnitTest/screenshots/screens.activity.task-rows.dark.png differ diff --git a/compose/shared/src/androidUnitTest/screenshots/screens.activity.task-rows.png b/compose/shared/src/androidUnitTest/screenshots/screens.activity.task-rows.png index 8e3847f79e..f5cc2ac2bf 100644 Binary files a/compose/shared/src/androidUnitTest/screenshots/screens.activity.task-rows.png and b/compose/shared/src/androidUnitTest/screenshots/screens.activity.task-rows.png differ diff --git a/compose/shared/src/commonMain/kotlin/build/raft/app/activity/ActivityConversationList.kt b/compose/shared/src/commonMain/kotlin/build/raft/app/activity/ActivityConversationList.kt index cba96716bb..1496460781 100644 --- a/compose/shared/src/commonMain/kotlin/build/raft/app/activity/ActivityConversationList.kt +++ b/compose/shared/src/commonMain/kotlin/build/raft/app/activity/ActivityConversationList.kt @@ -859,12 +859,12 @@ private val ConversationDividerStart = 64.dp private val ConversationSenderAvatar = 19.dp /** - * How an Activity row is laid out. A phone keeps its own row (artin #3653: two reserved excerpt lines, - * hairlines between rows, full-bleed fills). The wide layout takes the web's row (ThreadsInbox + * How an Activity row is laid out: the web's row at every width (ThreadsInbox * `RaftInboxItem density="compact"`, a list cell; raft-design patterns/lists.md and - * components/inbox-item.md): the title line and one excerpt line, the state drawn on one rounded - * shape inset [shapeInset] from both sides of the column, the content [contentPadX] inside that - * shape, [padY] above and below it, rows [rowGap] apart and no line between them. + * components/inbox-item.md): the state drawn on one rounded shape inset [shapeInset] from both sides + * of the column, the content [contentPadX] inside that shape, [padY] above and below it, rows + * [rowGap] apart and no line between them. A phone keeps its two reserved excerpt lines (artin + * #3653; artin 2026-11-20: the compact spacing, the two-line preview kept); the wide layout shows one. */ @Immutable internal data class ActivityRowLayout( @@ -878,7 +878,7 @@ internal data class ActivityRowLayout( val minHeight: Dp, /** The excerpt's lines, each reserved. */ val previewLines: Int, - /** A hairline between two adjacent rows. */ + /** A hairline between two adjacent rows (none in the web's list cells: lists.md "lists have no dividers"). */ val dividers: Boolean, /** Between two rows (the list's `gap-0.5`). */ val rowGap: Dp, @@ -893,17 +893,23 @@ internal data class ActivityRowLayout( get() = if (shapeInset > 0.dp) RoundedCornerShape(RaftRadius.Control) else RectangleShape companion object { - /** The phone's row, unchanged: 16dp edges, 12dp above and below, two excerpt lines, hairlines. */ - val Phone = + /** + * The phone's row: the web's compact list cell with two excerpt lines. The shape 8dp in, the + * content 12dp inside it (20dp from the screen's edge); by touch 8dp above and below and at + * least 56dp tall (`pointer-coarse:min-h-14 pointer-coarse:py-2`); under a mouse or trackpad in + * a narrow window 12dp above and below with no minimum (`py-3`, `md:pointer-fine` only from + * 768); rows 2dp apart with no line between them. + */ + fun phone(pointerInput: RaftPointerInput): ActivityRowLayout = ActivityRowLayout( - shapeInset = 0.dp, - contentPadX = 16.dp, - padY = 12.dp, - minHeight = 0.dp, + shapeInset = 8.dp, + contentPadX = 12.dp, + padY = if (pointerInput == RaftPointerInput.Fine) 12.dp else 8.dp, + minHeight = if (pointerInput == RaftPointerInput.Fine) 0.dp else 56.dp, previewLines = ActivityConversationPreviewMaxLines, - dividers = true, - rowGap = 0.dp, - listTop = 4.dp, + dividers = false, + rowGap = 2.dp, + listTop = 8.dp, ) /** @@ -924,7 +930,7 @@ internal data class ActivityRowLayout( ) fun of(scale: RaftScale, pointerInput: RaftPointerInput): ActivityRowLayout = - if (scale == RaftScale.Wide) wide(pointerInput) else Phone + if (scale == RaftScale.Wide) wide(pointerInput) else phone(pointerInput) } } @@ -1055,7 +1061,7 @@ internal fun ActivityConversationListRow( modifier = Modifier .fillMaxWidth() - // The wide layout's list cell: its state shape sits in from both sides of the column. + // The list cell: its state shape sits in from both sides of the column. .padding(horizontal = layout.shapeInset) .then( when { @@ -1079,7 +1085,7 @@ internal fun ActivityConversationListRow( Modifier } ) - // The washes above run edge to edge; the row's content (and its actions) + // The washes above span the shape; the row's content (and its actions) // stays out of the horizontal safe area. .raftSafeAreaHorizontalPadding(), contentAlignment = Alignment.CenterStart, @@ -1230,7 +1236,7 @@ internal fun ActivityConversationListRow( } if (showHoverDone && onHoverDone != null) { // web: an outline icon-md Button with Lucide Check, tooltip "Mark as Done", at the end of - // the trailing column (the content's 16dp end inset), centred on the compact row. Outside + // the trailing column (the content's end inset), centred on the compact row. Outside // the row's gesture area, so a click marks the row done without opening it. RaftIconButton( onClick = onHoverDone, diff --git a/compose/shared/src/commonMain/kotlin/build/raft/app/home/SharedInboxPanel.kt b/compose/shared/src/commonMain/kotlin/build/raft/app/home/SharedInboxPanel.kt index 648dd954e9..3655c622e3 100644 --- a/compose/shared/src/commonMain/kotlin/build/raft/app/home/SharedInboxPanel.kt +++ b/compose/shared/src/commonMain/kotlin/build/raft/app/home/SharedInboxPanel.kt @@ -1334,12 +1334,13 @@ internal fun activityFilterBarHeight(scale: RaftScale, pointerInput: RaftPointer } /** - * The Activity column's margin, where its head, its toolbar and its rows start (raft-design - * lists.md, One edge; raft-ui `listColumnMargin`): 16 on a phone (unchanged); on the wide layout - * 20 with a finger and 16 under a mouse or trackpad. + * The Activity column's margin, where its toolbar and its rows start (raft-design lists.md, One + * edge; raft-ui `listColumnMargin`: `[--column-margin:20px] md:pointer-fine:[--column-margin: + * var(--page-inset)]`): 20 on a phone, with a finger or a mouse, and on the wide layout with a + * finger; 16 only on the wide layout under a mouse or trackpad. */ internal fun activityColumnMargin(scale: RaftScale, pointerInput: RaftPointerInput): Dp = - if (scale == RaftScale.Wide && pointerInput == RaftPointerInput.Touch) 20.dp else 16.dp + if (scale == RaftScale.Wide && pointerInput == RaftPointerInput.Fine) 16.dp else 20.dp /** web `@max-[30rem]` on the toolbar's content box: the row less its [edge] on both sides. */ internal fun activityMarkAllReadIconOnly(toolbarWidth: Dp, edge: Dp = 16.dp): Boolean = toolbarWidth - edge * 2 < 480.dp @@ -2185,8 +2186,8 @@ internal fun SharedActivityList( Modifier .fillMaxSize() .raftHoldsHorizontalDragsWhileScrolling(listScrolling) - // web inbox scroller `py-1`; on a phone rows sit edge to edge, split by their own - // hairline; on the wide layout (the list's own `py-1 gap-0.5`) 2dp apart, no line. + // web inbox scroller `py-1` and the list's own `py-1 gap-0.5`: 8dp above the first + // row, rows 2dp apart with no line between them, on a phone as on the wide layout. .padding(top = rowLayout.listTop), verticalArrangement = Arrangement.spacedBy(rowLayout.rowGap), ) { diff --git a/compose/shared/src/commonTest/kotlin/build/raft/app/ActivityFilterBarHeightTest.kt b/compose/shared/src/commonTest/kotlin/build/raft/app/ActivityFilterBarHeightTest.kt index 92fb6763ab..396c93c478 100644 --- a/compose/shared/src/commonTest/kotlin/build/raft/app/ActivityFilterBarHeightTest.kt +++ b/compose/shared/src/commonTest/kotlin/build/raft/app/ActivityFilterBarHeightTest.kt @@ -23,9 +23,10 @@ class ActivityFilterBarHeightTest { @Test fun columnMarginIsTheRowsEdge() { - // raft-design lists.md, One edge: 20 from the column's edge on a touch screen from 768, 16 with a - // mouse; the phone keeps its 16 here. - assertEquals(16.dp, activityColumnMargin(RaftScale.Compact, RaftPointerInput.Touch)) + // raft-ui listColumnMargin: 20 everywhere, 16 only from 768 under a mouse or trackpad. The + // phone's toolbar sits on the rows' 20 line, with a finger or a mouse. + assertEquals(20.dp, activityColumnMargin(RaftScale.Compact, RaftPointerInput.Touch)) + assertEquals(20.dp, activityColumnMargin(RaftScale.Compact, RaftPointerInput.Fine)) assertEquals(20.dp, activityColumnMargin(RaftScale.Wide, RaftPointerInput.Touch)) assertEquals(16.dp, activityColumnMargin(RaftScale.Wide, RaftPointerInput.Fine)) } diff --git a/compose/shared/src/commonTest/kotlin/build/raft/app/ActivityRowLayoutTest.kt b/compose/shared/src/commonTest/kotlin/build/raft/app/ActivityRowLayoutTest.kt index e34cea3849..f30ee931ec 100644 --- a/compose/shared/src/commonTest/kotlin/build/raft/app/ActivityRowLayoutTest.kt +++ b/compose/shared/src/commonTest/kotlin/build/raft/app/ActivityRowLayoutTest.kt @@ -6,24 +6,36 @@ import build.raft.designsystem.theme.RaftScale import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertFalse -import kotlin.test.assertTrue class ActivityRowLayoutTest { @Test - fun phoneKeepsItsRowWhateverTheInput() { - // artin #3653: two reserved excerpt lines; 16dp edges, 12dp above and below, hairlines, full-bleed fills. - for (input in RaftPointerInput.entries) { - val layout = ActivityRowLayout.of(RaftScale.Compact, input) - assertEquals(ActivityRowLayout.Phone, layout) - assertEquals(0.dp, layout.shapeInset) - assertEquals(16.dp, layout.contentEdge) - assertEquals(12.dp, layout.padY) - assertEquals(0.dp, layout.minHeight) - assertEquals(2, layout.previewLines) - assertTrue(layout.dividers) - assertEquals(0.dp, layout.rowGap) - assertEquals(4.dp, layout.listTop) - } + fun phoneTouchIsTheWebCompactCellWithTwoExcerptLines() { + // raft-design lists.md / inbox-item.md density="compact" by touch: the shape 8px in, content 12px + // inside it (20px from the screen's edge), 8px above and below with a 56px minimum, rows 2px + // apart, no dividers; the phone keeps its two reserved excerpt lines (artin #3653, 2026-11-20). + val layout = ActivityRowLayout.of(RaftScale.Compact, RaftPointerInput.Touch) + assertEquals(8.dp, layout.shapeInset) + assertEquals(12.dp, layout.contentPadX) + assertEquals(20.dp, layout.contentEdge) + assertEquals(8.dp, layout.padY) + assertEquals(56.dp, layout.minHeight) + assertEquals(2, layout.previewLines) + assertFalse(layout.dividers) + assertEquals(2.dp, layout.rowGap) + assertEquals(8.dp, layout.listTop) + } + + @Test + fun phoneFineKeepsTheNarrowMouseBlockPadding() { + // With a mouse in a window narrower than 768px: py-3 and no touch minimum; the inline padding + // only narrows from md, so the content stays 20px in. + val layout = ActivityRowLayout.of(RaftScale.Compact, RaftPointerInput.Fine) + assertEquals(20.dp, layout.contentEdge) + assertEquals(12.dp, layout.padY) + assertEquals(0.dp, layout.minHeight) + assertEquals(2, layout.previewLines) + assertFalse(layout.dividers) + assertEquals(2.dp, layout.rowGap) } @Test