Skip to content

Commit d4d1e91

Browse files
authored
Merge pull request #5003 from element-hq/feature/bma/homeScreenIteration
Home screen iteration
2 parents f4891c2 + dfd5343 commit d4d1e91

File tree

42 files changed

+145
-118
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+145
-118
lines changed

features/home/impl/src/main/kotlin/io/element/android/features/home/impl/HomeView.kt

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ package io.element.android.features.home.impl
1212
import androidx.activity.compose.BackHandler
1313
import androidx.compose.foundation.background
1414
import androidx.compose.foundation.layout.Box
15+
import androidx.compose.foundation.layout.PaddingValues
1516
import androidx.compose.foundation.layout.calculateEndPadding
1617
import androidx.compose.foundation.layout.calculateStartPadding
1718
import androidx.compose.foundation.layout.consumeWindowInsets
@@ -181,6 +182,15 @@ private fun HomeScaffold(
181182
displayFilters = roomListState.displayFilters && state.currentHomeNavigationBarItem == HomeNavigationBarItem.Chats,
182183
filtersState = roomListState.filtersState,
183184
canReportBug = state.canReportBug,
185+
modifier = if (state.isSpaceFeatureEnabled) {
186+
Modifier.hazeEffect(
187+
state = hazeState,
188+
style = HazeMaterials.thick(),
189+
)
190+
} else {
191+
Modifier
192+
.background(ElementTheme.colors.bgCanvasDefault)
193+
}
184194
)
185195
},
186196
bottomBar = {
@@ -190,7 +200,7 @@ private fun HomeScaffold(
190200
modifier = Modifier
191201
.hazeEffect(
192202
state = hazeState,
193-
style = HazeMaterials.regular(),
203+
style = HazeMaterials.thick(),
194204
)
195205
) {
196206
HomeNavigationBarItem.entries.forEach { item ->
@@ -227,15 +237,18 @@ private fun HomeScaffold(
227237
onConfirmRecoveryKeyClick = onConfirmRecoveryKeyClick,
228238
onRoomClick = ::onRoomClick,
229239
onCreateRoomClick = onCreateRoomClick,
230-
// FAB height is 56dp, bottom padding is 16dp, we add 8dp as extra margin -> 56+16+8 = 80,
231-
// and include provided bottom padding
232-
contentBottomPadding = 80.dp + padding.calculateBottomPadding(),
240+
contentPadding = PaddingValues(
241+
// FAB height is 56dp, bottom padding is 16dp, we add 8dp as extra margin -> 56+16+8 = 80,
242+
// and include provided bottom padding
243+
bottom = 80.dp + padding.calculateBottomPadding(),
244+
top = padding.calculateTopPadding()
245+
),
233246
modifier = Modifier
234247
.padding(
235-
top = padding.calculateTopPadding(),
236-
bottom = 0.dp,
237-
start = padding.calculateStartPadding(LocalLayoutDirection.current),
238-
end = padding.calculateEndPadding(LocalLayoutDirection.current),
248+
PaddingValues(
249+
start = padding.calculateStartPadding(LocalLayoutDirection.current),
250+
end = padding.calculateEndPadding(LocalLayoutDirection.current),
251+
)
239252
)
240253
.consumeWindowInsets(padding)
241254
.hazeSource(state = hazeState)

features/home/impl/src/main/kotlin/io/element/android/features/home/impl/components/RoomListContentView.kt

Lines changed: 45 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import androidx.compose.ui.Modifier
3131
import androidx.compose.ui.res.stringResource
3232
import androidx.compose.ui.text.style.TextAlign
3333
import androidx.compose.ui.tooling.preview.PreviewParameter
34-
import androidx.compose.ui.unit.Dp
3534
import androidx.compose.ui.unit.dp
3635
import io.element.android.compound.theme.ElementTheme
3736
import io.element.android.compound.tokens.generated.CompoundIcons
@@ -67,44 +66,53 @@ fun RoomListContentView(
6766
onConfirmRecoveryKeyClick: () -> Unit,
6867
onRoomClick: (RoomListRoomSummary) -> Unit,
6968
onCreateRoomClick: () -> Unit,
70-
contentBottomPadding: Dp,
69+
contentPadding: PaddingValues,
7170
modifier: Modifier = Modifier,
7271
) {
73-
Box(modifier = modifier) {
74-
when (contentState) {
75-
is RoomListContentState.Skeleton -> {
76-
SkeletonView(
77-
count = contentState.count,
78-
)
79-
}
80-
is RoomListContentState.Empty -> {
81-
EmptyView(
82-
state = contentState,
83-
eventSink = eventSink,
84-
onSetUpRecoveryClick = onSetUpRecoveryClick,
85-
onConfirmRecoveryKeyClick = onConfirmRecoveryKeyClick,
86-
onCreateRoomClick = onCreateRoomClick,
87-
)
88-
}
89-
is RoomListContentState.Rooms -> {
90-
RoomsView(
91-
state = contentState,
92-
hideInvitesAvatars = hideInvitesAvatars,
93-
filtersState = filtersState,
94-
eventSink = eventSink,
95-
onSetUpRecoveryClick = onSetUpRecoveryClick,
96-
onConfirmRecoveryKeyClick = onConfirmRecoveryKeyClick,
97-
onRoomClick = onRoomClick,
98-
contentBottomPadding = contentBottomPadding,
99-
)
100-
}
72+
when (contentState) {
73+
is RoomListContentState.Skeleton -> {
74+
SkeletonView(
75+
modifier = modifier,
76+
count = contentState.count,
77+
contentPadding = contentPadding,
78+
)
79+
}
80+
is RoomListContentState.Empty -> {
81+
EmptyView(
82+
modifier = modifier.padding(contentPadding),
83+
state = contentState,
84+
eventSink = eventSink,
85+
onSetUpRecoveryClick = onSetUpRecoveryClick,
86+
onConfirmRecoveryKeyClick = onConfirmRecoveryKeyClick,
87+
onCreateRoomClick = onCreateRoomClick,
88+
)
89+
}
90+
is RoomListContentState.Rooms -> {
91+
RoomsView(
92+
modifier = modifier,
93+
state = contentState,
94+
hideInvitesAvatars = hideInvitesAvatars,
95+
filtersState = filtersState,
96+
eventSink = eventSink,
97+
onSetUpRecoveryClick = onSetUpRecoveryClick,
98+
onConfirmRecoveryKeyClick = onConfirmRecoveryKeyClick,
99+
onRoomClick = onRoomClick,
100+
contentPadding = contentPadding,
101+
)
101102
}
102103
}
103104
}
104105

105106
@Composable
106-
private fun SkeletonView(count: Int, modifier: Modifier = Modifier) {
107-
LazyColumn(modifier = modifier) {
107+
private fun SkeletonView(
108+
count: Int,
109+
contentPadding: PaddingValues,
110+
modifier: Modifier = Modifier,
111+
) {
112+
LazyColumn(
113+
modifier = modifier,
114+
contentPadding = contentPadding,
115+
) {
108116
repeat(count) { index ->
109117
item {
110118
RoomSummaryPlaceholderRow()
@@ -167,7 +175,7 @@ private fun RoomsView(
167175
onSetUpRecoveryClick: () -> Unit,
168176
onConfirmRecoveryKeyClick: () -> Unit,
169177
onRoomClick: (RoomListRoomSummary) -> Unit,
170-
contentBottomPadding: Dp,
178+
contentPadding: PaddingValues,
171179
modifier: Modifier = Modifier,
172180
) {
173181
if (state.summaries.isEmpty() && filtersState.hasAnyFilterSelected) {
@@ -183,7 +191,7 @@ private fun RoomsView(
183191
onSetUpRecoveryClick = onSetUpRecoveryClick,
184192
onConfirmRecoveryKeyClick = onConfirmRecoveryKeyClick,
185193
onRoomClick = onRoomClick,
186-
contentBottomPadding = contentBottomPadding,
194+
contentPadding = contentPadding,
187195
modifier = modifier.fillMaxSize(),
188196
)
189197
}
@@ -197,7 +205,7 @@ private fun RoomsViewList(
197205
onSetUpRecoveryClick: () -> Unit,
198206
onConfirmRecoveryKeyClick: () -> Unit,
199207
onRoomClick: (RoomListRoomSummary) -> Unit,
200-
contentBottomPadding: Dp,
208+
contentPadding: PaddingValues,
201209
modifier: Modifier = Modifier,
202210
) {
203211
val lazyListState = rememberLazyListState()
@@ -216,7 +224,7 @@ private fun RoomsViewList(
216224
LazyColumn(
217225
state = lazyListState,
218226
modifier = modifier,
219-
contentPadding = PaddingValues(bottom = contentBottomPadding)
227+
contentPadding = contentPadding,
220228
) {
221229
when (state.securityBannerState) {
222230
SecurityBannerState.SetUpRecovery -> {
@@ -329,6 +337,6 @@ internal fun RoomListContentViewPreview(@PreviewParameter(RoomListContentStatePr
329337
onConfirmRecoveryKeyClick = {},
330338
onRoomClick = {},
331339
onCreateRoomClick = {},
332-
contentBottomPadding = 0.dp,
340+
contentPadding = PaddingValues(0.dp),
333341
)
334342
}

features/home/impl/src/main/kotlin/io/element/android/features/home/impl/roomlist/RoomListStateProvider.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ open class RoomListStateProvider : PreviewParameterProvider<RoomListState> {
4242
aRoomListState(searchState = aRoomListSearchState(isSearchActive = true, query = "Test")),
4343
aRoomListState(contentState = aRoomsContentState(securityBannerState = SecurityBannerState.SetUpRecovery)),
4444
aRoomListState(contentState = aRoomsContentState(batteryOptimizationState = aBatteryOptimizationState(shouldDisplayBanner = true))),
45+
aRoomListState(contentState = anEmptyContentState(securityBannerState = SecurityBannerState.RecoveryKeyConfirmation)),
4546
)
4647
}
4748

libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/modifiers/Gradient.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ fun Modifier.backgroundVerticalGradient(
3737
brush = Brush.verticalGradient(
3838
colorStops = subtleColorStops(isEnterpriseBuild),
3939
),
40-
alpha = 0.75f,
4140
)
4241
}
4342

Loading
Loading
Loading
Loading
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading

0 commit comments

Comments
 (0)