invert hide app details preference
This commit is contained in:
@@ -23,7 +23,7 @@ import de.mm20.launcher2.ui.component.ProvideIconShape
|
||||
import de.mm20.launcher2.ui.locals.LocalCalendarSystemIds
|
||||
import de.mm20.launcher2.ui.locals.LocalCalendarSystems
|
||||
import de.mm20.launcher2.ui.locals.LocalFavoritesEnabled
|
||||
import de.mm20.launcher2.ui.locals.LocalHideAppDetails
|
||||
import de.mm20.launcher2.ui.locals.LocalShowAppDetails
|
||||
import de.mm20.launcher2.ui.locals.LocalGridSettings
|
||||
import de.mm20.launcher2.ui.locals.LocalMeasurementSystem
|
||||
import de.mm20.launcher2.ui.locals.LocalTimeFormat
|
||||
@@ -60,8 +60,8 @@ fun ProvideSettings(
|
||||
settings.gridSettings.distinctUntilChanged()
|
||||
}.collectAsState(GridSettings())
|
||||
|
||||
val hideAppDetails by remember {
|
||||
searchUiSettings.hideAppDetails.distinctUntilChanged()
|
||||
val showAppDetails by remember {
|
||||
searchUiSettings.showAppDetails.distinctUntilChanged()
|
||||
}.collectAsState(false)
|
||||
|
||||
val timeFormat by remember(context) {
|
||||
@@ -123,7 +123,7 @@ fun ProvideSettings(
|
||||
|
||||
CompositionLocalProvider(
|
||||
LocalFavoritesEnabled provides favoritesEnabled,
|
||||
LocalHideAppDetails provides hideAppDetails,
|
||||
LocalShowAppDetails provides showAppDetails,
|
||||
LocalGridSettings provides gridSettings,
|
||||
LocalTimeFormat provides timeFormat!!,
|
||||
LocalMeasurementSystem provides measurementSystem!!,
|
||||
|
||||
@@ -65,7 +65,7 @@ import de.mm20.launcher2.ui.launcher.search.common.SearchableItemVM
|
||||
import de.mm20.launcher2.ui.launcher.search.listItemViewModel
|
||||
import de.mm20.launcher2.ui.launcher.sheets.LocalBottomSheetManager
|
||||
import de.mm20.launcher2.ui.locals.LocalFavoritesEnabled
|
||||
import de.mm20.launcher2.ui.locals.LocalHideAppDetails
|
||||
import de.mm20.launcher2.ui.locals.LocalShowAppDetails
|
||||
import de.mm20.launcher2.ui.locals.LocalGridSettings
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
@@ -81,7 +81,7 @@ fun AppItem(
|
||||
|
||||
val badge by viewModel.badge.collectAsStateWithLifecycle(null)
|
||||
val icon by viewModel.icon.collectAsStateWithLifecycle()
|
||||
val hideAppDetails = LocalHideAppDetails.current
|
||||
val showAppDetails = LocalShowAppDetails.current
|
||||
|
||||
LaunchedEffect(app) {
|
||||
viewModel.init(app, iconSize.toInt())
|
||||
@@ -124,7 +124,7 @@ fun AppItem(
|
||||
)
|
||||
}
|
||||
|
||||
if (!hideAppDetails) {
|
||||
if (showAppDetails) {
|
||||
app.versionName?.let {
|
||||
Text(
|
||||
text = stringResource(R.string.app_info_version, it),
|
||||
|
||||
@@ -21,7 +21,7 @@ val LocalCardStyle = compositionLocalOf { CardStyle() }
|
||||
|
||||
val LocalFavoritesEnabled = compositionLocalOf { true }
|
||||
|
||||
val LocalHideAppDetails = compositionLocalOf { false }
|
||||
val LocalShowAppDetails = compositionLocalOf { false }
|
||||
|
||||
val LocalGridSettings = compositionLocalOf { GridSettings() }
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ fun AppSearchSettingsScreen() {
|
||||
val viewModel = viewModel<AppSearchSettingsScreenVM>()
|
||||
|
||||
val allApps by viewModel.allApps.collectAsStateWithLifecycle()
|
||||
val hideAppDetails by viewModel.hideAppDetails.collectAsStateWithLifecycle()
|
||||
val showAppDetails by viewModel.showAppDetails.collectAsStateWithLifecycle()
|
||||
val showList by viewModel.showList.collectAsStateWithLifecycle()
|
||||
val showListIcons by viewModel.showListIcons.collectAsStateWithLifecycle()
|
||||
|
||||
@@ -41,9 +41,9 @@ fun AppSearchSettingsScreen() {
|
||||
}
|
||||
)
|
||||
SwitchPreference(
|
||||
title = stringResource(R.string.preference_search_apps_hide_details),
|
||||
summary = stringResource(R.string.preference_search_apps_hide_details_summary),
|
||||
value = hideAppDetails == true,
|
||||
title = stringResource(R.string.preference_search_apps_show_details),
|
||||
summary = stringResource(R.string.preference_search_apps_show_details_summary),
|
||||
value = showAppDetails == true,
|
||||
onValueChanged = {
|
||||
viewModel.setHideAppDetails(it)
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ class AppSearchSettingsScreenVM: ViewModel(), KoinComponent {
|
||||
val allApps = searchUiSettings.allApps
|
||||
.stateIn(viewModelScope, SharingStarted.WhileSubscribed(), null)
|
||||
|
||||
val hideAppDetails = searchUiSettings.hideAppDetails
|
||||
val showAppDetails = searchUiSettings.showAppDetails
|
||||
.stateIn(viewModelScope, SharingStarted.WhileSubscribed(), null)
|
||||
|
||||
fun setAllApps(allApps: Boolean) {
|
||||
@@ -25,7 +25,7 @@ class AppSearchSettingsScreenVM: ViewModel(), KoinComponent {
|
||||
}
|
||||
|
||||
fun setHideAppDetails(hideAppDetails: Boolean) {
|
||||
searchUiSettings.setHideAppDetails(hideAppDetails)
|
||||
searchUiSettings.setShowAppDetails(hideAppDetails)
|
||||
}
|
||||
|
||||
val showList = uiSettings.gridSettings.map { it.showList }
|
||||
|
||||
@@ -628,8 +628,8 @@
|
||||
<string name="preference_search_favorites_summary">Show pinned and frequently used items above app grid</string>
|
||||
<string name="preference_search_apps">Apps</string>
|
||||
<string name="preference_search_apps_summary">Show all apps when the search field is empty</string>
|
||||
<string name="preference_search_apps_hide_details">Hide app details</string>
|
||||
<string name="preference_search_apps_hide_details_summary">When enabled, long-pressing an app item will not show its version and package name</string>
|
||||
<string name="preference_search_apps_show_details">Show app information</string>
|
||||
<string name="preference_search_apps_show_details_summary">Display additional app information, including the version and package name</string>
|
||||
<string name="preference_search_files">Files</string>
|
||||
<string name="preference_search_files_summary">Search local files and cloud files</string>
|
||||
<string name="preference_search_contacts">Contacts</string>
|
||||
|
||||
@@ -72,7 +72,7 @@ data class LauncherSettingsData internal constructor(
|
||||
val favoritesCompactTags: Boolean = false,
|
||||
|
||||
val searchAllApps: Boolean = true,
|
||||
val hideAppDetails: Boolean = false,
|
||||
val appsShowDetails: Boolean = true,
|
||||
|
||||
val fileSearchProviders: Set<String> = setOf("local"),
|
||||
|
||||
|
||||
@@ -70,12 +70,12 @@ class SearchUiSettings internal constructor(
|
||||
}
|
||||
}
|
||||
|
||||
val hideAppDetails
|
||||
get() = launcherDataStore.data.map { it.hideAppDetails }.distinctUntilChanged()
|
||||
val showAppDetails
|
||||
get() = launcherDataStore.data.map { it.appsShowDetails }.distinctUntilChanged()
|
||||
|
||||
fun setHideAppDetails(hideAppDetails: Boolean) {
|
||||
fun setShowAppDetails(showAppDetails: Boolean) {
|
||||
launcherDataStore.update {
|
||||
it.copy(hideAppDetails = hideAppDetails)
|
||||
it.copy(appsShowDetails = showAppDetails)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user