Remove shared element transitions from favorites section

Close #913
This commit is contained in:
MM20 2024-07-03 21:34:07 +02:00
parent e7e89d884b
commit f96aa0217d
No known key found for this signature in database
GPG Key ID: 0B61A8F2DEAFA389
2 changed files with 42 additions and 85 deletions

View File

@ -54,7 +54,8 @@ fun FavoritesTagSelector(
) { ) {
val sheetManager = LocalBottomSheetManager.current val sheetManager = LocalBottomSheetManager.current
SharedTransitionLayout(
AnimatedContent(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.padding( .padding(
@ -62,8 +63,6 @@ fun FavoritesTagSelector(
bottom = if (reverse) 4.dp else 8.dp, bottom = if (reverse) 4.dp else 8.dp,
end = if (editButton) 8.dp else 0.dp end = if (editButton) 8.dp else 0.dp
), ),
) {
AnimatedContent(
targetState = expanded, targetState = expanded,
) { ) {
if (!it) { if (!it) {
@ -80,11 +79,7 @@ fun FavoritesTagSelector(
) { ) {
FilterChip( FilterChip(
modifier = Modifier modifier = Modifier
.padding(start = 16.dp) .padding(start = 16.dp),
.sharedBounds(
rememberSharedContentState("favorites"),
this@AnimatedContent
),
selected = selectedTag == null, selected = selectedTag == null,
onClick = { onSelectTag(null) }, onClick = { onSelectTag(null) },
leadingIcon = { leadingIcon = {
@ -99,11 +94,7 @@ fun FavoritesTagSelector(
for (tag in tags) { for (tag in tags) {
TagChip( TagChip(
modifier = Modifier modifier = Modifier
.padding(start = 8.dp) .padding(start = 8.dp),
.sharedBounds(
rememberSharedContentState("tag-${tag.tag}"),
this@AnimatedContent
),
tag = tag, tag = tag,
selected = selectedTag == tag.tag, selected = selectedTag == tag.tag,
onClick = { onClick = {
@ -121,10 +112,6 @@ fun FavoritesTagSelector(
} }
IconButton( IconButton(
modifier = Modifier modifier = Modifier
.sharedElement(
rememberSharedContentState("expandButton"),
this@AnimatedContent
)
.rotate(rot), .rotate(rot),
onClick = { onExpand(true) }) { onClick = { onExpand(true) }) {
Icon(Icons.Rounded.ExpandMore, null) Icon(Icons.Rounded.ExpandMore, null)
@ -135,10 +122,6 @@ fun FavoritesTagSelector(
if (editButton) { if (editButton) {
SmallFloatingActionButton( SmallFloatingActionButton(
modifier = Modifier.sharedBounds(
rememberSharedContentState("editButton"),
this@AnimatedContent
),
elevation = FloatingActionButtonDefaults.bottomAppBarFabElevation(), elevation = FloatingActionButtonDefaults.bottomAppBarFabElevation(),
onClick = { sheetManager.showEditFavoritesSheet() } onClick = { sheetManager.showEditFavoritesSheet() }
) { ) {
@ -160,11 +143,7 @@ fun FavoritesTagSelector(
) { ) {
FilterChip( FilterChip(
modifier = Modifier modifier = Modifier
.padding(end = 8.dp) .padding(end = 8.dp),
.sharedBounds(
rememberSharedContentState("favorites"),
this@AnimatedContent
),
selected = selectedTag == null, selected = selectedTag == null,
onClick = { onSelectTag(null) }, onClick = { onSelectTag(null) },
leadingIcon = { leadingIcon = {
@ -179,11 +158,7 @@ fun FavoritesTagSelector(
for (tag in tags) { for (tag in tags) {
TagChip( TagChip(
modifier = Modifier modifier = Modifier
.padding(end = 8.dp) .padding(end = 8.dp),
.sharedBounds(
rememberSharedContentState("tag-${tag.tag}"),
this@AnimatedContent
),
tag = tag, tag = tag,
selected = selectedTag == tag.tag, selected = selectedTag == tag.tag,
onClick = { onClick = {
@ -206,10 +181,6 @@ fun FavoritesTagSelector(
} }
IconButton( IconButton(
modifier = Modifier modifier = Modifier
.sharedElement(
rememberSharedContentState("expandButton"),
this@AnimatedContent
)
.rotate(rot), .rotate(rot),
onClick = { onExpand(false) } onClick = { onExpand(false) }
) { ) {
@ -218,10 +189,6 @@ fun FavoritesTagSelector(
if (editButton) { if (editButton) {
SmallFloatingActionButton( SmallFloatingActionButton(
modifier = Modifier.sharedBounds(
rememberSharedContentState("editButton"),
this@AnimatedContent
),
elevation = FloatingActionButtonDefaults.bottomAppBarFabElevation(), elevation = FloatingActionButtonDefaults.bottomAppBarFabElevation(),
onClick = { sheetManager.showEditFavoritesSheet() } onClick = { sheetManager.showEditFavoritesSheet() }
) { ) {
@ -236,4 +203,4 @@ fun FavoritesTagSelector(
} }
} }
} }
}

View File

@ -1,8 +1,6 @@
package de.mm20.launcher2.ui.launcher.search.common.grid package de.mm20.launcher2.ui.launcher.search.common.grid
import androidx.compose.animation.AnimatedContent import androidx.compose.animation.AnimatedContent
import androidx.compose.animation.SharedTransitionLayout
import androidx.compose.animation.SharedTransitionScope
import androidx.compose.animation.fadeIn import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut import androidx.compose.animation.fadeOut
import androidx.compose.animation.togetherWith import androidx.compose.animation.togetherWith
@ -31,12 +29,9 @@ fun SearchResultGrid(
highlightedItem: SavableSearchable? = null, highlightedItem: SavableSearchable? = null,
transitionKey: Any? = items transitionKey: Any? = items
) { ) {
SharedTransitionLayout(
modifier = modifier,
) {
AnimatedContent( AnimatedContent(
items to transitionKey, items to transitionKey,
modifier = Modifier modifier = modifier
.fillMaxWidth() .fillMaxWidth()
.padding(4.dp), .padding(4.dp),
transitionSpec = { transitionSpec = {
@ -55,10 +50,6 @@ fun SearchResultGrid(
key(item.key) { key(item.key) {
GridItem( GridItem(
modifier = Modifier modifier = Modifier
.sharedElement(
rememberSharedContentState(item.key),
this@AnimatedContent,
)
.weight(1f) .weight(1f)
.padding(4.dp), .padding(4.dp),
item = item, item = item,
@ -74,5 +65,4 @@ fun SearchResultGrid(
} }
} }
} }
}
} }