Bring back tag expand / collapse shared element transition
Surely the bug that crashes the launcher has been fixed by now :clueless:
This commit is contained in:
parent
5dd387fe32
commit
cd803974de
@ -2,6 +2,7 @@ package de.mm20.launcher2.ui.common
|
|||||||
|
|
||||||
import androidx.compose.animation.AnimatedContent
|
import androidx.compose.animation.AnimatedContent
|
||||||
import androidx.compose.animation.EnterExitState
|
import androidx.compose.animation.EnterExitState
|
||||||
|
import androidx.compose.animation.SharedTransitionScope
|
||||||
import androidx.compose.animation.core.animateFloat
|
import androidx.compose.animation.core.animateFloat
|
||||||
import androidx.compose.foundation.ScrollState
|
import androidx.compose.foundation.ScrollState
|
||||||
import androidx.compose.foundation.horizontalScroll
|
import androidx.compose.foundation.horizontalScroll
|
||||||
@ -53,8 +54,9 @@ fun FavoritesTagSelector(
|
|||||||
) {
|
) {
|
||||||
val sheetManager = LocalBottomSheetManager.current
|
val sheetManager = LocalBottomSheetManager.current
|
||||||
|
|
||||||
|
SharedTransitionScope {
|
||||||
AnimatedContent(
|
AnimatedContent(
|
||||||
modifier = Modifier
|
modifier = it
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(
|
.padding(
|
||||||
top = if (reverse) 8.dp else 4.dp,
|
top = if (reverse) 8.dp else 4.dp,
|
||||||
@ -77,7 +79,11 @@ 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 = {
|
||||||
@ -92,7 +98,11 @@ 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 = {
|
||||||
@ -113,7 +123,11 @@ fun FavoritesTagSelector(
|
|||||||
}
|
}
|
||||||
IconButton(
|
IconButton(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.rotate(rot),
|
.rotate(rot)
|
||||||
|
.sharedBounds(
|
||||||
|
rememberSharedContentState("expand"),
|
||||||
|
this@AnimatedContent
|
||||||
|
),
|
||||||
onClick = { onExpand(true) }) {
|
onClick = { onExpand(true) }) {
|
||||||
Icon(Icons.Rounded.ExpandMore, null)
|
Icon(Icons.Rounded.ExpandMore, null)
|
||||||
}
|
}
|
||||||
@ -123,6 +137,11 @@ fun FavoritesTagSelector(
|
|||||||
|
|
||||||
if (editButton) {
|
if (editButton) {
|
||||||
SmallFloatingActionButton(
|
SmallFloatingActionButton(
|
||||||
|
modifier = Modifier
|
||||||
|
.sharedBounds(
|
||||||
|
rememberSharedContentState("edit"),
|
||||||
|
this@AnimatedContent
|
||||||
|
),
|
||||||
elevation = FloatingActionButtonDefaults.bottomAppBarFabElevation(),
|
elevation = FloatingActionButtonDefaults.bottomAppBarFabElevation(),
|
||||||
onClick = { sheetManager.showEditFavoritesSheet() }
|
onClick = { sheetManager.showEditFavoritesSheet() }
|
||||||
) {
|
) {
|
||||||
@ -144,7 +163,8 @@ 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 = {
|
||||||
@ -159,7 +179,8 @@ 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 = {
|
||||||
@ -185,7 +206,8 @@ fun FavoritesTagSelector(
|
|||||||
}
|
}
|
||||||
IconButton(
|
IconButton(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.rotate(rot),
|
.rotate(rot)
|
||||||
|
.sharedBounds(rememberSharedContentState("expand"), this@AnimatedContent),
|
||||||
onClick = { onExpand(false) }
|
onClick = { onExpand(false) }
|
||||||
) {
|
) {
|
||||||
Icon(Icons.Rounded.ExpandLess, null)
|
Icon(Icons.Rounded.ExpandLess, null)
|
||||||
@ -193,6 +215,8 @@ fun FavoritesTagSelector(
|
|||||||
|
|
||||||
if (editButton) {
|
if (editButton) {
|
||||||
SmallFloatingActionButton(
|
SmallFloatingActionButton(
|
||||||
|
modifier = Modifier
|
||||||
|
.sharedBounds(rememberSharedContentState("edit"), this@AnimatedContent),
|
||||||
elevation = FloatingActionButtonDefaults.bottomAppBarFabElevation(),
|
elevation = FloatingActionButtonDefaults.bottomAppBarFabElevation(),
|
||||||
onClick = { sheetManager.showEditFavoritesSheet() }
|
onClick = { sheetManager.showEditFavoritesSheet() }
|
||||||
) {
|
) {
|
||||||
@ -207,4 +231,5 @@ fun FavoritesTagSelector(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user