Remove search result order preference
This commit is contained in:
parent
774777f79c
commit
77a68f8361
@ -5,6 +5,7 @@ import androidx.compose.animation.AnimatedVisibility
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.automirrored.rounded.Sort
|
||||
import androidx.compose.material.icons.rounded.AppShortcut
|
||||
import androidx.compose.material.icons.rounded.ArrowOutward
|
||||
import androidx.compose.material.icons.rounded.Calculate
|
||||
@ -37,7 +38,6 @@ import androidx.lifecycle.compose.LocalLifecycleOwner
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import androidx.lifecycle.repeatOnLifecycle
|
||||
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||
import de.mm20.launcher2.preferences.SearchResultOrder
|
||||
import de.mm20.launcher2.ui.R
|
||||
import de.mm20.launcher2.ui.component.BottomSheetDialog
|
||||
import de.mm20.launcher2.ui.component.MissingPermissionBanner
|
||||
@ -296,22 +296,6 @@ fun SearchSettingsScreen() {
|
||||
}
|
||||
item {
|
||||
PreferenceCategory {
|
||||
val searchResultOrdering by viewModel.searchResultOrdering.collectAsStateWithLifecycle(
|
||||
null
|
||||
)
|
||||
ListPreference(
|
||||
title = stringResource(R.string.preference_search_result_ordering),
|
||||
items = listOf(
|
||||
stringResource(R.string.preference_search_result_ordering_alphabetic) to SearchResultOrder.Alphabetical,
|
||||
stringResource(R.string.preference_search_result_ordering_weighted) to SearchResultOrder.Weighted
|
||||
),
|
||||
value = searchResultOrdering,
|
||||
onValueChanged = {
|
||||
if (it != null) viewModel.setSearchResultOrdering(it)
|
||||
},
|
||||
icon = Icons.Rounded.Sort
|
||||
)
|
||||
|
||||
val reverseSearchResults by viewModel.reverseSearchResults.collectAsStateWithLifecycle(
|
||||
null
|
||||
)
|
||||
@ -325,6 +309,7 @@ fun SearchSettingsScreen() {
|
||||
onValueChanged = {
|
||||
if (it != null) viewModel.setReverseSearchResults(it)
|
||||
},
|
||||
icon = Icons.AutoMirrored.Rounded.Sort
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,15 +1,10 @@
|
||||
package de.mm20.launcher2.ui.settings.search
|
||||
|
||||
import android.content.Context
|
||||
import android.content.pm.LauncherApps
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.core.content.getSystemService
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import de.mm20.launcher2.permissions.PermissionGroup
|
||||
import de.mm20.launcher2.permissions.PermissionsManager
|
||||
import de.mm20.launcher2.preferences.SearchResultOrder
|
||||
import de.mm20.launcher2.preferences.search.CalculatorSearchSettings
|
||||
import de.mm20.launcher2.preferences.search.CalendarSearchSettings
|
||||
import de.mm20.launcher2.preferences.search.ContactSearchSettings
|
||||
@ -111,14 +106,6 @@ class SearchSettingsScreenVM : ViewModel(), KoinComponent {
|
||||
shortcutSearchSettings.setEnabled(appShortcuts)
|
||||
}
|
||||
|
||||
val searchResultOrdering = searchUiSettings.resultOrder
|
||||
.stateIn(viewModelScope, SharingStarted.WhileSubscribed(), null)
|
||||
|
||||
fun setSearchResultOrdering(searchResultOrdering: SearchResultOrder) {
|
||||
searchUiSettings.setResultOrder(searchResultOrdering)
|
||||
}
|
||||
|
||||
|
||||
val reverseSearchResults = searchUiSettings.reversedResults
|
||||
.stateIn(viewModelScope, SharingStarted.WhileSubscribed(), null)
|
||||
|
||||
|
||||
@ -89,7 +89,6 @@ data class LauncherSettingsData internal constructor(
|
||||
val searchBarFixed: Boolean = false,
|
||||
|
||||
val searchResultsReversed: Boolean = false,
|
||||
val searchResultOrder: SearchResultOrder = SearchResultOrder.Weighted,
|
||||
val separateWorkProfile: Boolean = true,
|
||||
|
||||
val rankingWeightFactor: WeightFactor = WeightFactor.Default,
|
||||
@ -374,12 +373,6 @@ sealed interface GestureAction {
|
||||
data class Launch(val key: String?) : GestureAction
|
||||
}
|
||||
|
||||
@Serializable
|
||||
enum class SearchResultOrder {
|
||||
Weighted,
|
||||
Alphabetical,
|
||||
LaunchCount,
|
||||
}
|
||||
|
||||
@Serializable
|
||||
enum class WeightFactor {
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package de.mm20.launcher2.preferences.ui
|
||||
|
||||
import de.mm20.launcher2.preferences.LauncherDataStore
|
||||
import de.mm20.launcher2.preferences.SearchResultOrder
|
||||
import kotlinx.coroutines.flow.distinctUntilChanged
|
||||
import kotlinx.coroutines.flow.map
|
||||
|
||||
@ -35,15 +34,6 @@ class SearchUiSettings internal constructor(
|
||||
}
|
||||
}
|
||||
|
||||
val resultOrder
|
||||
get() = launcherDataStore.data.map { it.searchResultOrder }.distinctUntilChanged()
|
||||
|
||||
fun setResultOrder(resultOrder: SearchResultOrder) {
|
||||
launcherDataStore.update {
|
||||
it.copy(searchResultOrder = resultOrder)
|
||||
}
|
||||
}
|
||||
|
||||
val openKeyboard
|
||||
get() = launcherDataStore.data.map { it.searchBarKeyboard }.distinctUntilChanged()
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user