mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-03 06:01:40 +00:00
Animate collapse/expand change
This commit is contained in:
committed by
Benoit Marty
parent
4b9a01d753
commit
31ec3267db
+23
-20
@@ -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,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user