Change toggle to show search bar instead
This commit is contained in:
1 parent
5e2b41744f
commit
660a5cd5cf
3 files changed
+27
-12
No files matched your search
@@ -167,5 +167,5 @@
|
||||
<string name="colors">Colors</string>
|
||||
<string name="dynamic">Dynamic</string>
|
||||
<string name="all_apps_search_market_message">Search for More Apps</string>
|
||||
<string name="hide_app_search_bar">Hide search bar</string>
|
||||
<string name="show_app_search_bar">Show Search Bar</string>
|
||||
</resources>
|
||||
@@ -130,3 +130,8 @@ fun <T> customPreferenceAdapter(value: T, onValueChange: (T) -> Unit): Preferenc
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
operator fun PreferenceAdapter<Boolean>.not(): PreferenceAdapter<Boolean> {
|
||||
return rememberTransformAdapter(adapter = this, transformGet = { !it }, transformSet = { !it })
|
||||
}
|
||||
@@ -22,6 +22,7 @@ import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.navigation.NavGraphBuilder
|
||||
import app.lawnchair.preferences.getAdapter
|
||||
import app.lawnchair.preferences.not
|
||||
import app.lawnchair.preferences.preferenceManager
|
||||
import app.lawnchair.ui.preferences.components.*
|
||||
import com.android.launcher3.R
|
||||
@@ -59,19 +60,28 @@ fun AppDrawerPreferences() {
|
||||
SuggestionsPreference()
|
||||
}
|
||||
PreferenceGroup(heading = stringResource(id = R.string.pref_category_search)) {
|
||||
val showSearchBar = !prefs.hideAppSearchBar.getAdapter()
|
||||
SwitchPreference(
|
||||
label = stringResource(id = R.string.hide_app_search_bar),
|
||||
adapter = prefs.hideAppSearchBar.getAdapter()
|
||||
)
|
||||
SwitchPreference(
|
||||
adapter = prefs.searchAutoShowKeyboard.getAdapter(),
|
||||
label = stringResource(id = R.string.pref_search_auto_show_keyboard),
|
||||
)
|
||||
SwitchPreference(
|
||||
adapter = prefs.useFuzzySearch.getAdapter(),
|
||||
label = stringResource(id = R.string.fuzzy_search_title),
|
||||
description = stringResource(id = R.string.fuzzy_search_desc)
|
||||
label = stringResource(id = R.string.show_app_search_bar),
|
||||
adapter = showSearchBar
|
||||
)
|
||||
AnimatedVisibility(
|
||||
visible = showSearchBar.state.value,
|
||||
enter = expandVertically() + fadeIn(),
|
||||
exit = shrinkVertically() + fadeOut()
|
||||
) {
|
||||
DividerColumn {
|
||||
SwitchPreference(
|
||||
adapter = prefs.searchAutoShowKeyboard.getAdapter(),
|
||||
label = stringResource(id = R.string.pref_search_auto_show_keyboard),
|
||||
)
|
||||
SwitchPreference(
|
||||
adapter = prefs.useFuzzySearch.getAdapter(),
|
||||
label = stringResource(id = R.string.fuzzy_search_title),
|
||||
description = stringResource(id = R.string.fuzzy_search_desc)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
PreferenceGroup(heading = stringResource(id = R.string.grid)) {
|
||||
SliderPreference(
|
||||
|
||||
Reference in new issue
Block a user