Bring back hidden items button
This commit is contained in:
parent
a29475b485
commit
5734fc791c
@ -16,6 +16,7 @@ import androidx.compose.foundation.layout.windowInsetsPadding
|
||||
import androidx.compose.foundation.text.KeyboardActionScope
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.rounded.FilterAlt
|
||||
import androidx.compose.material.icons.rounded.VisibilityOff
|
||||
import androidx.compose.material3.Badge
|
||||
import androidx.compose.material3.FilledIconButton
|
||||
import androidx.compose.material3.Icon
|
||||
@ -40,6 +41,7 @@ import de.mm20.launcher2.ui.component.SearchBar
|
||||
import de.mm20.launcher2.ui.component.SearchBarLevel
|
||||
import de.mm20.launcher2.ui.launcher.search.SearchVM
|
||||
import de.mm20.launcher2.ui.launcher.search.filters.KeyboardFilterBar
|
||||
import de.mm20.launcher2.ui.launcher.sheets.LocalBottomSheetManager
|
||||
|
||||
@Composable
|
||||
fun LauncherSearchBar(
|
||||
@ -61,6 +63,10 @@ fun LauncherSearchBar(
|
||||
val focusRequester = remember { FocusRequester() }
|
||||
|
||||
val searchVM: SearchVM = viewModel()
|
||||
val hiddenItemsButtonEnabled by searchVM.hiddenResultsButton.collectAsState(false)
|
||||
val hiddenItems by searchVM.hiddenResults
|
||||
|
||||
val sheetManager = LocalBottomSheetManager.current
|
||||
|
||||
LaunchedEffect(focused) {
|
||||
if (focused) focusRequester.requestFocus()
|
||||
@ -84,6 +90,18 @@ fun LauncherSearchBar(
|
||||
reverse = bottomSearchBar,
|
||||
darkColors = darkColors,
|
||||
menu = {
|
||||
AnimatedVisibility(
|
||||
hiddenItemsButtonEnabled && isSearchOpen && hiddenItems.isNotEmpty(),
|
||||
enter = scaleIn(tween(100)),
|
||||
exit = scaleOut(tween(100))
|
||||
) {
|
||||
FilledIconButton(
|
||||
onClick = { sheetManager.showHiddenItemsSheet() },
|
||||
colors = if (sheetManager.hiddenItemsSheetShown.value) IconButtonDefaults.filledTonalIconButtonColors() else IconButtonDefaults.iconButtonColors()
|
||||
) {
|
||||
Icon(imageVector = Icons.Rounded.VisibilityOff, contentDescription = null)
|
||||
}
|
||||
}
|
||||
AnimatedVisibility(
|
||||
isSearchOpen,
|
||||
enter = scaleIn(tween(100)),
|
||||
|
||||
@ -91,7 +91,7 @@ data class LauncherSettingsData internal constructor(
|
||||
|
||||
val rankingWeightFactor: WeightFactor = WeightFactor.Default,
|
||||
|
||||
val hiddenItemsShowButton: Boolean = true,
|
||||
val hiddenItemsShowButton: Boolean = false,
|
||||
|
||||
val iconsShape: IconShape = IconShape.PlatformDefault,
|
||||
val iconsAdaptify: Boolean = false,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user