From 9441101e93708c10f333318631d3bd9ddd55c381 Mon Sep 17 00:00:00 2001 From: Jonatan Rhodin Date: Wed, 3 Apr 2024 09:02:36 +0200 Subject: [PATCH] Fix custom list expand animations --- .../compose/screen/SelectLocationScreen.kt | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreen.kt index a7e802e89ce8..9144903f6393 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreen.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreen.kt @@ -197,6 +197,7 @@ fun SelectLocation( ) } +@OptIn(ExperimentalFoundationApi::class) @Suppress("LongMethod") @Composable fun SelectLocationScreen( @@ -331,7 +332,14 @@ fun SelectLocationScreen( BottomSheetState.ShowEditCustomListBottomSheet(customList) } ) - item { Spacer(modifier = Modifier.height(Dimens.mediumPadding)) } + item { + Spacer( + modifier = + Modifier.height(Dimens.mediumPadding) + .animateItemPlacement() + .animateContentSize() + ) + } } if (state.countries.isNotEmpty()) { relayList( @@ -377,7 +385,10 @@ private fun LazyListScope.customLists( ThreeDotCell( text = stringResource(R.string.custom_lists), onClickDots = onShowCustomListBottomSheet, - modifier = Modifier.testTag(SELECT_LOCATION_CUSTOM_LIST_HEADER_TEST_TAG) + modifier = + Modifier.testTag(SELECT_LOCATION_CUSTOM_LIST_HEADER_TEST_TAG) + .animateItemPlacement() + .animateContentSize() ) } if (customLists.isNotEmpty()) { @@ -400,11 +411,17 @@ private fun LazyListScope.customLists( ) } item { - SwitchComposeSubtitleCell(text = stringResource(R.string.to_add_locations_to_a_list)) + SwitchComposeSubtitleCell( + text = stringResource(R.string.to_add_locations_to_a_list), + modifier = Modifier.animateItemPlacement().animateContentSize() + ) } } else { item(contentType = ContentType.EMPTY_TEXT) { - SwitchComposeSubtitleCell(text = stringResource(R.string.to_create_a_custom_list)) + SwitchComposeSubtitleCell( + text = stringResource(R.string.to_create_a_custom_list), + modifier = Modifier.animateItemPlacement().animateContentSize() + ) } } } @@ -421,6 +438,7 @@ private fun LazyListScope.relayList( ) { HeaderCell( text = stringResource(R.string.all_locations), + modifier = Modifier.animateItemPlacement().animateContentSize() ) } items(