mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-06-04 05:40:17 +00:00
allow independent selection of icon style and theme style
This commit is contained in:
parent
aed5704582
commit
48b0bb1cbf
5 changed files with 24 additions and 2 deletions
|
@ -33,6 +33,7 @@ class AppearanceSettingsFragment : SubScreenFragment() {
|
|||
private var needsReload = false
|
||||
|
||||
private val stylePref: ListPreference by lazy { preferenceScreen.findPreference(Settings.PREF_THEME_STYLE)!! }
|
||||
private val iconStylePref: ListPreference by lazy { preferenceScreen.findPreference(Settings.PREF_ICON_STYLE)!! }
|
||||
private val colorsPref: ListPreference by lazy { preferenceScreen.findPreference(Settings.PREF_THEME_COLORS)!! }
|
||||
private val colorsNightPref: ListPreference? by lazy { preferenceScreen.findPreference(Settings.PREF_THEME_COLORS_NIGHT) }
|
||||
private val dayNightPref: TwoStatePreference? by lazy { preferenceScreen.findPreference(Settings.PREF_THEME_DAY_NIGHT) }
|
||||
|
@ -155,6 +156,18 @@ class AppearanceSettingsFragment : SubScreenFragment() {
|
|||
}
|
||||
summary = entries[entryValues.indexOfFirst { it == value }]
|
||||
}
|
||||
iconStylePref.apply {
|
||||
entryValues = KeyboardTheme.STYLES
|
||||
entries = entryValues.getNamesFromResourcesIfAvailable("style_name_")
|
||||
if (value !in entryValues)
|
||||
value = entryValues.first().toString()
|
||||
|
||||
onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, value ->
|
||||
summary = entries[entryValues.indexOfFirst { it == value }]
|
||||
true
|
||||
}
|
||||
summary = entries[entryValues.indexOfFirst { it == value }]
|
||||
}
|
||||
dayNightPref?.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, value ->
|
||||
val yesThisIsBoolean = value as Boolean // apparently kotlin smartcast got less smart with 2.0.0
|
||||
colorsNightPref?.isVisible = yesThisIsBoolean
|
||||
|
|
|
@ -60,6 +60,7 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
|
|||
|
||||
// theme-related stuff
|
||||
public static final String PREF_THEME_STYLE = "theme_style";
|
||||
public static final String PREF_ICON_STYLE = "icon_style";
|
||||
public static final String PREF_THEME_COLORS = "theme_colors";
|
||||
public static final String PREF_THEME_COLORS_NIGHT = "theme_colors_night";
|
||||
public static final String PREF_THEME_KEY_BORDERS = "theme_key_borders";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue