Update subtitle of Icon Style option in Settings

This commit is contained in:
Patryk Michalik
2022-05-28 21:23:46 +02:00
parent 91d7a96c23
commit 874bbab87f
3 changed files with 21 additions and 2 deletions
+1
View File
@@ -305,4 +305,5 @@
<string name="gesture_swipe_down">Swipe Down</string>
<string name="gesture_home_tap">Home Button Tap</string>
<string name="gesture_back_tap">Back Button Tap</string>
<string name="x_and_y">%s &amp; %s</string>
</resources>
@@ -57,6 +57,24 @@ fun GeneralPreferences() {
val prefs = preferenceManager()
val prefs2 = preferenceManager2()
val iconPacks by LocalPreferenceInteractor.current.iconPacks.collectAsState()
val themedIconsAdapter = prefs.themedIcons.getAdapter()
val drawerThemedIconsAdapter = prefs.drawerThemedIcons.getAdapter()
val currentIconPackName = iconPacks
.find { it.packageName == preferenceManager().iconPackPackage.get() }
?.name
val themedIconsEnabled = ThemedIconsState.getForSettings(
themedIcons = themedIconsAdapter.state.value,
drawerThemedIcons = drawerThemedIconsAdapter.state.value,
) != ThemedIconsState.Off
val iconStyleSubtitle = if (currentIconPackName != null && themedIconsEnabled) {
stringResource(
id = R.string.x_and_y,
currentIconPackName,
stringResource(id = R.string.themed_icon_title),
)
} else currentIconPackName
PreferenceLayout(label = stringResource(id = R.string.general_label)) {
PreferenceGroup {
SwitchPreference(
@@ -67,7 +85,7 @@ fun GeneralPreferences() {
NavigationActionPreference(
label = stringResource(id = R.string.icon_style),
destination = subRoute(name = GeneralRoutes.ICON_PACK),
subtitle = iconPacks.find { it.packageName == preferenceManager().iconPackPackage.get() }?.name,
subtitle = iconStyleSubtitle,
)
IconShapePreference()
val enableFontSelection = prefs2.enableFontSelection.asState().value
@@ -67,7 +67,7 @@ data class IconPackInfo(
val icon: Drawable,
)
private enum class ThemedIconsState(
enum class ThemedIconsState(
@StringRes val labelResourceId: Int,
val themedIcons: Boolean = true,
val drawerThemedIcons: Boolean = false,