Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions change-logs/1.28.0/changesets/activity-phone-compact.md
Original file line number Diff line number Diff line change
@@ -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 にそろえました。
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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,
Expand All @@ -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,
)

/**
Expand All @@ -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)
}
}

Expand Down Expand Up @@ -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 {
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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),
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading