parent
e7e89d884b
commit
f96aa0217d
@ -54,16 +54,15 @@ fun FavoritesTagSelector(
|
|||||||
) {
|
) {
|
||||||
val sheetManager = LocalBottomSheetManager.current
|
val sheetManager = LocalBottomSheetManager.current
|
||||||
|
|
||||||
SharedTransitionLayout(
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.padding(
|
|
||||||
top = if (reverse) 8.dp else 4.dp,
|
|
||||||
bottom = if (reverse) 4.dp else 8.dp,
|
|
||||||
end = if (editButton) 8.dp else 0.dp
|
|
||||||
),
|
|
||||||
) {
|
|
||||||
AnimatedContent(
|
AnimatedContent(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(
|
||||||
|
top = if (reverse) 8.dp else 4.dp,
|
||||||
|
bottom = if (reverse) 4.dp else 8.dp,
|
||||||
|
end = if (editButton) 8.dp else 0.dp
|
||||||
|
),
|
||||||
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(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -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,44 +29,36 @@ fun SearchResultGrid(
|
|||||||
highlightedItem: SavableSearchable? = null,
|
highlightedItem: SavableSearchable? = null,
|
||||||
transitionKey: Any? = items
|
transitionKey: Any? = items
|
||||||
) {
|
) {
|
||||||
SharedTransitionLayout(
|
AnimatedContent(
|
||||||
modifier = modifier,
|
items to transitionKey,
|
||||||
) {
|
modifier = modifier
|
||||||
AnimatedContent(
|
.fillMaxWidth()
|
||||||
items to transitionKey,
|
.padding(4.dp),
|
||||||
modifier = Modifier
|
transitionSpec = {
|
||||||
.fillMaxWidth()
|
fadeIn() togetherWith fadeOut()
|
||||||
.padding(4.dp),
|
},
|
||||||
transitionSpec = {
|
contentKey = { it.second }
|
||||||
fadeIn() togetherWith fadeOut()
|
) { (items, _) ->
|
||||||
},
|
Column(
|
||||||
contentKey = { it.second }
|
verticalArrangement = if (reverse) Arrangement.BottomReversed else Arrangement.Top
|
||||||
) { (items, _) ->
|
) {
|
||||||
Column(
|
for (i in 0 until ceil(items.size / columns.toFloat()).toInt()) {
|
||||||
verticalArrangement = if (reverse) Arrangement.BottomReversed else Arrangement.Top
|
Row {
|
||||||
) {
|
for (j in 0 until columns) {
|
||||||
for (i in 0 until ceil(items.size / columns.toFloat()).toInt()) {
|
val item = items.getOrNull(i * columns + j)
|
||||||
Row {
|
if (item != null) {
|
||||||
for (j in 0 until columns) {
|
key(item.key) {
|
||||||
val item = items.getOrNull(i * columns + j)
|
GridItem(
|
||||||
if (item != null) {
|
modifier = Modifier
|
||||||
key(item.key) {
|
.weight(1f)
|
||||||
GridItem(
|
.padding(4.dp),
|
||||||
modifier = Modifier
|
item = item,
|
||||||
.sharedElement(
|
showLabels = showLabels,
|
||||||
rememberSharedContentState(item.key),
|
highlight = item.key == highlightedItem?.key
|
||||||
this@AnimatedContent,
|
)
|
||||||
)
|
|
||||||
.weight(1f)
|
|
||||||
.padding(4.dp),
|
|
||||||
item = item,
|
|
||||||
showLabels = showLabels,
|
|
||||||
highlight = item.key == highlightedItem?.key
|
|
||||||
)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Spacer(modifier = Modifier.weight(1f))
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
Spacer(modifier = Modifier.weight(1f))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user