Add preferences to hide filter bar and to configure the default filter
This commit is contained in:
@@ -918,4 +918,9 @@
|
||||
<string name="search_filter_tools">Tools</string>
|
||||
<string name="search_filter_online">Online results</string>
|
||||
<string name="search_filter_apps">Apps</string>
|
||||
<string name="preference_default_filter">Default filter</string>
|
||||
<string name="preference_default_filter_summary">Customize the default filter for searches</string>
|
||||
<string name="preference_filter_bar">Show filter bar</string>
|
||||
<string name="preference_filter_bar_summary">Show quick filters above the keyboard</string>
|
||||
<string name="filter_settings_network_warning">The current filter enables online results by default. Your search queries might unintentionally be sent to external web services. For privacy reasons, this is not recommended.</string>
|
||||
</resources>
|
||||
+17
@@ -1,6 +1,7 @@
|
||||
package de.mm20.launcher2.preferences.search
|
||||
|
||||
import de.mm20.launcher2.preferences.LauncherDataStore
|
||||
import de.mm20.launcher2.search.SearchFilters
|
||||
import kotlinx.coroutines.flow.map
|
||||
|
||||
class SearchFilterSettings internal constructor(
|
||||
@@ -8,4 +9,20 @@ class SearchFilterSettings internal constructor(
|
||||
) {
|
||||
val defaultFilter
|
||||
get() = launcherDataStore.data.map { it.searchFilter }
|
||||
|
||||
fun setDefaultFilter(filter: SearchFilters) {
|
||||
launcherDataStore.update {
|
||||
it.copy(searchFilter = filter)
|
||||
}
|
||||
}
|
||||
|
||||
val filterBar
|
||||
get() = launcherDataStore.data.map { it.searchFilterBar }
|
||||
|
||||
fun setFilterBar(filterBar: Boolean) {
|
||||
launcherDataStore.update {
|
||||
it.copy(searchFilterBar = filterBar)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user