From 7b0745c5f1eaf492d12e52d56ea741ef8fb9a8f4 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 12 Aug 2026 10:38:54 +0200 Subject: [PATCH] Fix layout issues. --- .../space/impl/addroom/AddRoomToSpaceView.kt | 51 ++++++++++++++----- .../roomselect/impl/RoomSelectView.kt | 18 ++++++- 2 files changed, 53 insertions(+), 16 deletions(-) diff --git a/features/space/impl/src/main/kotlin/io/element/android/features/space/impl/addroom/AddRoomToSpaceView.kt b/features/space/impl/src/main/kotlin/io/element/android/features/space/impl/addroom/AddRoomToSpaceView.kt index eb485f11b5..2f75072d0a 100644 --- a/features/space/impl/src/main/kotlin/io/element/android/features/space/impl/addroom/AddRoomToSpaceView.kt +++ b/features/space/impl/src/main/kotlin/io/element/android/features/space/impl/addroom/AddRoomToSpaceView.kt @@ -12,10 +12,15 @@ import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.WindowInsets +import androidx.compose.foundation.layout.WindowInsetsSides +import androidx.compose.foundation.layout.asPaddingValues import androidx.compose.foundation.layout.consumeWindowInsets import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.only import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.safeDrawing import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.LazyRow import androidx.compose.foundation.lazy.items @@ -112,7 +117,13 @@ fun AddRoomToSpaceView( .consumeWindowInsets(paddingValues) ) { SearchBar( - modifier = Modifier.fillMaxWidth(), + modifier = Modifier + .fillMaxWidth() + .padding( + WindowInsets.safeDrawing + .only(WindowInsetsSides.Horizontal) + .asPaddingValues() + ), placeHolderTitle = stringResource(CommonStrings.action_search), queryState = state.searchQuery, active = state.isSearchActive, @@ -147,23 +158,35 @@ fun AddRoomToSpaceView( } if (!state.isSearchActive) { - Spacer(modifier = Modifier.height(16.dp)) - Text( - text = stringResource(R.string.screen_space_add_rooms_room_access_description), - color = ElementTheme.colors.textSecondary, - style = ElementTheme.typography.fontBodySmRegular, - modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp) - ) - if (state.selectedRooms.isNotEmpty()) { - SelectedRoomsRow( - selectedRooms = state.selectedRooms, - onRemoveRoom = ::onRoomToggled, - modifier = Modifier.padding(vertical = 16.dp) + Column( + modifier = Modifier + .fillMaxWidth() + .padding( + WindowInsets.safeDrawing + .only(WindowInsetsSides.Horizontal) + .asPaddingValues() + ) + ) { + Spacer(modifier = Modifier.height(16.dp)) + Text( + text = stringResource(R.string.screen_space_add_rooms_room_access_description), + color = ElementTheme.colors.textSecondary, + style = ElementTheme.typography.fontBodySmRegular, + modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp) ) + if (state.selectedRooms.isNotEmpty()) { + SelectedRoomsRow( + selectedRooms = state.selectedRooms, + onRemoveRoom = ::onRoomToggled, + modifier = Modifier.padding(vertical = 16.dp) + ) + } } if (state.suggestions.isNotEmpty()) { - LazyColumn { + LazyColumn( + contentPadding = lazyColumnContentPadding, + ) { item { ListSectionHeader( title = stringResource(id = CommonStrings.common_suggestions), diff --git a/libraries/roomselect/impl/src/main/kotlin/io/element/android/libraries/roomselect/impl/RoomSelectView.kt b/libraries/roomselect/impl/src/main/kotlin/io/element/android/libraries/roomselect/impl/RoomSelectView.kt index e16cce6fd9..357d86dd5a 100644 --- a/libraries/roomselect/impl/src/main/kotlin/io/element/android/libraries/roomselect/impl/RoomSelectView.kt +++ b/libraries/roomselect/impl/src/main/kotlin/io/element/android/libraries/roomselect/impl/RoomSelectView.kt @@ -15,11 +15,16 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.WindowInsets +import androidx.compose.foundation.layout.WindowInsetsSides +import androidx.compose.foundation.layout.asPaddingValues import androidx.compose.foundation.layout.consumeWindowInsets import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.heightIn +import androidx.compose.foundation.layout.only import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.safeDrawing import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.LazyRow import androidx.compose.foundation.lazy.items @@ -144,7 +149,13 @@ fun RoomSelectView( .consumeWindowInsets(paddingValues) ) { SearchBar( - modifier = Modifier.fillMaxWidth(), + modifier = Modifier + .fillMaxWidth() + .padding( + WindowInsets.safeDrawing + .only(WindowInsetsSides.Horizontal) + .asPaddingValues() + ), placeHolderTitle = stringResource(CommonStrings.action_search), queryState = state.searchQuery, active = state.isSearchActive, @@ -184,7 +195,10 @@ fun RoomSelectView( showVerticalSpace = true, ) if (state.resultState is SearchBarResultState.Results) { - LazyColumn(state = lazyListState) { + LazyColumn( + state = lazyListState, + contentPadding = lazyColumnContentPadding, + ) { items(state.resultState.results, key = { it.roomId.value }) { roomSummary -> Column { RoomSummaryView(