mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
Optimize lazy column
This commit is contained in:
committed by
Benoit Marty
parent
e1798deba2
commit
e31131ee69
+8
-1
@@ -122,7 +122,11 @@ fun RoomListContent(
|
||||
.nestedScroll(nestedScrollConnection),
|
||||
state = lazyListState,
|
||||
) {
|
||||
items(roomSummaries) { room ->
|
||||
items(
|
||||
items = roomSummaries,
|
||||
contentType = { room -> room.contentType() },
|
||||
key = { room -> room.key() },
|
||||
) { room ->
|
||||
RoomSummaryRow(room = room, onClick = ::onRoomClicked)
|
||||
}
|
||||
}
|
||||
@@ -134,6 +138,9 @@ fun RoomListContent(
|
||||
}
|
||||
}
|
||||
|
||||
private fun RoomListRoomSummary.key() = id
|
||||
private fun RoomListRoomSummary.contentType() = isPlaceholder
|
||||
|
||||
private fun LazyListState.isScrolled(): Boolean {
|
||||
return firstVisibleItemIndex > 0 || firstVisibleItemScrollOffset > 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user