Skip to content

Commit

Permalink
Respect SC layout setting for search
Browse files Browse the repository at this point in the history
Change-Id: I311c3cb593f2241cd897cd3aff37cfe6e324f491
  • Loading branch information
SpiritCroc committed Oct 3, 2024
1 parent 6254e6d commit 929f529
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,9 @@ import io.element.android.libraries.designsystem.theme.roomListRoomMessageDate
import io.element.android.libraries.designsystem.theme.roomListRoomName
import io.element.android.libraries.designsystem.theme.unreadIndicator
import io.element.android.libraries.ui.strings.CommonStrings
import timber.log.Timber

internal val scRowMinHeight = 84.dp

internal fun scRoomSummaryRowSupports(room: RoomListRoomSummary) = room.displayType == RoomSummaryDisplayType.ROOM

@Composable
internal fun ScRoomSummaryRow(
room: RoomListRoomSummary,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.lazy.itemsIndexed
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.TextFieldDefaults
Expand All @@ -37,10 +38,13 @@ import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.unit.dp
import chat.schildi.lib.preferences.ScPrefs
import chat.schildi.lib.preferences.value
import io.element.android.compound.tokens.generated.CompoundIcons
import io.element.android.features.roomlist.impl.R
import io.element.android.features.roomlist.impl.RoomListEvents
import io.element.android.features.roomlist.impl.components.RoomSummaryRow
import io.element.android.features.roomlist.impl.components.ScRoomSummaryRow
import io.element.android.features.roomlist.impl.contentType
import io.element.android.features.roomlist.impl.model.RoomListRoomSummary
import io.element.android.libraries.designsystem.components.button.BackButton
Expand Down Expand Up @@ -186,10 +190,19 @@ private fun RoomListSearchContent(
LazyColumn(
modifier = Modifier.weight(1f),
) {
items(
itemsIndexed(
items = state.results,
contentType = { room -> room.contentType() },
) { room ->
contentType = { _, room -> room.contentType() },
) { index, room ->
if (ScPrefs.SC_OVERVIEW_LAYOUT.value()) {
ScRoomSummaryRow(
room = room,
onClick = ::onRoomClick,
eventSink = eventSink,
isLastIndex = index == state.results.lastIndex,
)
return@itemsIndexed
}
RoomSummaryRow(
room = room,
onClick = ::onRoomClick,
Expand Down

0 comments on commit 929f529

Please sign in to comment.