mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-03 16:10:00 +00:00
Add preview for focusedEvent.
This commit is contained in:
+2
@@ -106,6 +106,8 @@ fun aMessagesState(
|
|||||||
voiceMessageComposerState: VoiceMessageComposerState = aVoiceMessageComposerState(),
|
voiceMessageComposerState: VoiceMessageComposerState = aVoiceMessageComposerState(),
|
||||||
timelineState: TimelineState = aTimelineState(
|
timelineState: TimelineState = aTimelineState(
|
||||||
timelineItems = aTimelineItemList(aTimelineItemTextContent()),
|
timelineItems = aTimelineItemList(aTimelineItemTextContent()),
|
||||||
|
// Render a focused event for an event with sender information displayed
|
||||||
|
focusedEventIndex = 2,
|
||||||
),
|
),
|
||||||
retrySendMenuState: RetrySendMenuState = aRetrySendMenuState(),
|
retrySendMenuState: RetrySendMenuState = aRetrySendMenuState(),
|
||||||
readReceiptBottomSheetState: ReadReceiptBottomSheetState = aReadReceiptBottomSheetState(),
|
readReceiptBottomSheetState: ReadReceiptBottomSheetState = aReadReceiptBottomSheetState(),
|
||||||
|
|||||||
+2
-1
@@ -49,6 +49,7 @@ fun aTimelineState(
|
|||||||
timelineItems: ImmutableList<TimelineItem> = persistentListOf(),
|
timelineItems: ImmutableList<TimelineItem> = persistentListOf(),
|
||||||
renderReadReceipts: Boolean = false,
|
renderReadReceipts: Boolean = false,
|
||||||
timelineRoomInfo: TimelineRoomInfo = aTimelineRoomInfo(),
|
timelineRoomInfo: TimelineRoomInfo = aTimelineRoomInfo(),
|
||||||
|
focusedEventIndex: Int = -1,
|
||||||
eventSink: (TimelineEvents) -> Unit = {},
|
eventSink: (TimelineEvents) -> Unit = {},
|
||||||
) = TimelineState(
|
) = TimelineState(
|
||||||
timelineItems = timelineItems,
|
timelineItems = timelineItems,
|
||||||
@@ -56,7 +57,7 @@ fun aTimelineState(
|
|||||||
renderReadReceipts = renderReadReceipts,
|
renderReadReceipts = renderReadReceipts,
|
||||||
newEventState = NewEventState.None,
|
newEventState = NewEventState.None,
|
||||||
isLive = true,
|
isLive = true,
|
||||||
focusedEventId = null,
|
focusedEventId = timelineItems.filterIsInstance<TimelineItem.Event>().getOrNull(focusedEventIndex)?.eventId,
|
||||||
focusRequestState = FocusRequestState.None,
|
focusRequestState = FocusRequestState.None,
|
||||||
eventSink = eventSink,
|
eventSink = eventSink,
|
||||||
)
|
)
|
||||||
|
|||||||
+4
-1
@@ -312,7 +312,10 @@ internal fun TimelineViewPreview(
|
|||||||
LocalTimelineItemPresenterFactories provides aFakeTimelineItemPresenterFactories(),
|
LocalTimelineItemPresenterFactories provides aFakeTimelineItemPresenterFactories(),
|
||||||
) {
|
) {
|
||||||
TimelineView(
|
TimelineView(
|
||||||
state = aTimelineState(timelineItems),
|
state = aTimelineState(
|
||||||
|
timelineItems = timelineItems,
|
||||||
|
focusedEventIndex = 0,
|
||||||
|
),
|
||||||
typingNotificationState = aTypingNotificationState(),
|
typingNotificationState = aTypingNotificationState(),
|
||||||
onUserDataClicked = {},
|
onUserDataClicked = {},
|
||||||
onLinkClicked = {},
|
onLinkClicked = {},
|
||||||
|
|||||||
+3
-2
@@ -160,12 +160,13 @@ private fun TimelineItemGroupedEventsRowContent(
|
|||||||
@PreviewsDayNight
|
@PreviewsDayNight
|
||||||
@Composable
|
@Composable
|
||||||
internal fun TimelineItemGroupedEventsRowContentExpandedPreview() = ElementPreview {
|
internal fun TimelineItemGroupedEventsRowContentExpandedPreview() = ElementPreview {
|
||||||
|
val events = aGroupedEvents(withReadReceipts = true)
|
||||||
TimelineItemGroupedEventsRowContent(
|
TimelineItemGroupedEventsRowContent(
|
||||||
isExpanded = true,
|
isExpanded = true,
|
||||||
onExpandGroupClick = {},
|
onExpandGroupClick = {},
|
||||||
timelineItem = aGroupedEvents(withReadReceipts = true),
|
timelineItem = events,
|
||||||
timelineRoomInfo = aTimelineRoomInfo(),
|
timelineRoomInfo = aTimelineRoomInfo(),
|
||||||
focusedEventId = null,
|
focusedEventId = events.events.first().eventId,
|
||||||
renderReadReceipts = true,
|
renderReadReceipts = true,
|
||||||
isLastOutgoingMessage = false,
|
isLastOutgoingMessage = false,
|
||||||
onClick = {},
|
onClick = {},
|
||||||
|
|||||||
Reference in New Issue
Block a user