Skip to content

Commit 9441101

Browse files
committed
Fix custom list expand animations
1 parent 662a75f commit 9441101

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreen.kt

+22-4
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ fun SelectLocation(
197197
)
198198
}
199199

200+
@OptIn(ExperimentalFoundationApi::class)
200201
@Suppress("LongMethod")
201202
@Composable
202203
fun SelectLocationScreen(
@@ -331,7 +332,14 @@ fun SelectLocationScreen(
331332
BottomSheetState.ShowEditCustomListBottomSheet(customList)
332333
}
333334
)
334-
item { Spacer(modifier = Modifier.height(Dimens.mediumPadding)) }
335+
item {
336+
Spacer(
337+
modifier =
338+
Modifier.height(Dimens.mediumPadding)
339+
.animateItemPlacement()
340+
.animateContentSize()
341+
)
342+
}
335343
}
336344
if (state.countries.isNotEmpty()) {
337345
relayList(
@@ -377,7 +385,10 @@ private fun LazyListScope.customLists(
377385
ThreeDotCell(
378386
text = stringResource(R.string.custom_lists),
379387
onClickDots = onShowCustomListBottomSheet,
380-
modifier = Modifier.testTag(SELECT_LOCATION_CUSTOM_LIST_HEADER_TEST_TAG)
388+
modifier =
389+
Modifier.testTag(SELECT_LOCATION_CUSTOM_LIST_HEADER_TEST_TAG)
390+
.animateItemPlacement()
391+
.animateContentSize()
381392
)
382393
}
383394
if (customLists.isNotEmpty()) {
@@ -400,11 +411,17 @@ private fun LazyListScope.customLists(
400411
)
401412
}
402413
item {
403-
SwitchComposeSubtitleCell(text = stringResource(R.string.to_add_locations_to_a_list))
414+
SwitchComposeSubtitleCell(
415+
text = stringResource(R.string.to_add_locations_to_a_list),
416+
modifier = Modifier.animateItemPlacement().animateContentSize()
417+
)
404418
}
405419
} else {
406420
item(contentType = ContentType.EMPTY_TEXT) {
407-
SwitchComposeSubtitleCell(text = stringResource(R.string.to_create_a_custom_list))
421+
SwitchComposeSubtitleCell(
422+
text = stringResource(R.string.to_create_a_custom_list),
423+
modifier = Modifier.animateItemPlacement().animateContentSize()
424+
)
408425
}
409426
}
410427
}
@@ -421,6 +438,7 @@ private fun LazyListScope.relayList(
421438
) {
422439
HeaderCell(
423440
text = stringResource(R.string.all_locations),
441+
modifier = Modifier.animateItemPlacement().animateContentSize()
424442
)
425443
}
426444
items(

0 commit comments

Comments
 (0)