Animate collapse/expand change
This commit is contained in:
parent
bab276f7e3
commit
bf3d7207de
1 changed files with 23 additions and 20 deletions
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
package io.element.android.features.messages.impl.timeline
|
package io.element.android.features.messages.impl.timeline
|
||||||
|
|
||||||
|
import androidx.compose.animation.animateContentSize
|
||||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
|
|
@ -173,29 +174,31 @@ fun TimelineItemRow(
|
||||||
onExpandGroupClick(timelineItem)
|
onExpandGroupClick(timelineItem)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (timelineItem.expanded) {
|
Column(modifier = Modifier.animateContentSize()) {
|
||||||
Column {
|
GroupHeaderView(
|
||||||
timelineItem.events.forEach { subGroupEvent ->
|
text = pluralStringResource(
|
||||||
TimelineItemRow(
|
id = R.plurals.room_timeline_state_changes,
|
||||||
timelineItem = subGroupEvent,
|
count = timelineItem.events.size,
|
||||||
highlightedItem = highlightedItem,
|
timelineItem.events.size
|
||||||
onClick = onClick,
|
),
|
||||||
onLongClick = onLongClick,
|
isExpanded = timelineItem.expanded,
|
||||||
onExpandGroupClick = {}
|
isHighlighted = !timelineItem.expanded && timelineItem.events.any { it.identifier() == highlightedItem },
|
||||||
)
|
onClick = ::onExpandGroupClick,
|
||||||
|
)
|
||||||
|
if (timelineItem.expanded) {
|
||||||
|
Column {
|
||||||
|
timelineItem.events.forEach { subGroupEvent ->
|
||||||
|
TimelineItemRow(
|
||||||
|
timelineItem = subGroupEvent,
|
||||||
|
highlightedItem = highlightedItem,
|
||||||
|
onClick = onClick,
|
||||||
|
onLongClick = onLongClick,
|
||||||
|
onExpandGroupClick = {}
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GroupHeaderView(
|
|
||||||
text = pluralStringResource(
|
|
||||||
id = R.plurals.room_timeline_state_changes,
|
|
||||||
count = timelineItem.events.size,
|
|
||||||
timelineItem.events.size
|
|
||||||
),
|
|
||||||
isExpanded = timelineItem.expanded,
|
|
||||||
isHighlighted = !timelineItem.expanded && timelineItem.events.any { it.identifier() == highlightedItem },
|
|
||||||
onClick = ::onExpandGroupClick,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue