mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-14 22:12:46 +00:00
rename theme family to style and variant to colors
much more suitable names unfortunately there won't be as many translations, but still it's much better
This commit is contained in:
parent
f8f7444b74
commit
d47386c745
6 changed files with 61 additions and 57 deletions
|
@ -24,8 +24,8 @@ import java.util.Arrays;
|
||||||
public final class KeyboardTheme implements Comparable<KeyboardTheme> {
|
public final class KeyboardTheme implements Comparable<KeyboardTheme> {
|
||||||
|
|
||||||
// old themes
|
// old themes
|
||||||
public static final String THEME_STYLE_MATERIAL = "Material";
|
public static final String STYLE_MATERIAL = "Material";
|
||||||
public static final String THEME_STYLE_HOLO = "Holo";
|
public static final String STYLE_HOLO = "Holo";
|
||||||
|
|
||||||
// new themes using the custom colors
|
// new themes using the custom colors
|
||||||
public static final String THEME_LIGHT = "light";
|
public static final String THEME_LIGHT = "light";
|
||||||
|
@ -35,10 +35,10 @@ public final class KeyboardTheme implements Comparable<KeyboardTheme> {
|
||||||
public static final String THEME_BLACK = "black";
|
public static final String THEME_BLACK = "black";
|
||||||
public static final String THEME_USER = "user";
|
public static final String THEME_USER = "user";
|
||||||
public static final String THEME_USER_NIGHT = "user_night";
|
public static final String THEME_USER_NIGHT = "user_night";
|
||||||
public static final String[] THEME_VARIANTS = new String[] { THEME_LIGHT, THEME_HOLO_WHITE, THEME_DARK, THEME_DARKER, THEME_BLACK, THEME_USER };
|
public static final String[] COLORS = new String[] { THEME_LIGHT, THEME_HOLO_WHITE, THEME_DARK, THEME_DARKER, THEME_BLACK, THEME_USER };
|
||||||
public static final String[] THEME_VARIANTS_DARK = new String[] { THEME_HOLO_WHITE, THEME_DARK, THEME_DARKER, THEME_BLACK, THEME_USER_NIGHT};
|
public static final String[] COLORS_DARK = new String[] { THEME_HOLO_WHITE, THEME_DARK, THEME_DARKER, THEME_BLACK, THEME_USER_NIGHT};
|
||||||
|
|
||||||
public static final String[] THEME_STYLES = { THEME_STYLE_MATERIAL, THEME_STYLE_HOLO };
|
public static final String[] STYLES = { STYLE_MATERIAL, STYLE_HOLO };
|
||||||
|
|
||||||
// These should be aligned with Keyboard.themeId and Keyboard.Case.keyboardTheme
|
// These should be aligned with Keyboard.themeId and Keyboard.Case.keyboardTheme
|
||||||
// attributes' values in attrs.xml.
|
// attributes' values in attrs.xml.
|
||||||
|
@ -114,10 +114,10 @@ public final class KeyboardTheme implements Comparable<KeyboardTheme> {
|
||||||
|
|
||||||
public static KeyboardTheme getKeyboardTheme(final Context context) {
|
public static KeyboardTheme getKeyboardTheme(final Context context) {
|
||||||
final SharedPreferences prefs = DeviceProtectedUtils.getSharedPreferences(context);
|
final SharedPreferences prefs = DeviceProtectedUtils.getSharedPreferences(context);
|
||||||
final String style = prefs.getString(Settings.PREF_THEME_STYLE, THEME_STYLE_MATERIAL);
|
final String style = prefs.getString(Settings.PREF_THEME_STYLE, STYLE_MATERIAL);
|
||||||
final boolean borders = prefs.getBoolean(Settings.PREF_THEME_KEY_BORDERS, false);
|
final boolean borders = prefs.getBoolean(Settings.PREF_THEME_KEY_BORDERS, false);
|
||||||
final int matchingId;
|
final int matchingId;
|
||||||
if (style.equals(THEME_STYLE_HOLO))
|
if (style.equals(STYLE_HOLO))
|
||||||
matchingId = THEME_ID_HOLO_BASE;
|
matchingId = THEME_ID_HOLO_BASE;
|
||||||
else
|
else
|
||||||
matchingId = borders ? THEME_ID_LXX_BASE_BORDER : THEME_ID_LXX_BASE;
|
matchingId = borders ? THEME_ID_LXX_BASE_BORDER : THEME_ID_LXX_BASE;
|
||||||
|
|
|
@ -13,8 +13,8 @@ import android.view.View
|
||||||
import androidx.core.graphics.BlendModeColorFilterCompat
|
import androidx.core.graphics.BlendModeColorFilterCompat
|
||||||
import androidx.core.graphics.BlendModeCompat
|
import androidx.core.graphics.BlendModeCompat
|
||||||
import androidx.core.graphics.drawable.DrawableCompat
|
import androidx.core.graphics.drawable.DrawableCompat
|
||||||
import org.dslul.openboard.inputmethod.keyboard.KeyboardTheme.THEME_STYLE_HOLO
|
import org.dslul.openboard.inputmethod.keyboard.KeyboardTheme.STYLE_HOLO
|
||||||
import org.dslul.openboard.inputmethod.keyboard.KeyboardTheme.THEME_STYLE_MATERIAL
|
import org.dslul.openboard.inputmethod.keyboard.KeyboardTheme.STYLE_MATERIAL
|
||||||
import org.dslul.openboard.inputmethod.keyboard.MainKeyboardView
|
import org.dslul.openboard.inputmethod.keyboard.MainKeyboardView
|
||||||
import org.dslul.openboard.inputmethod.keyboard.MoreKeysKeyboardView
|
import org.dslul.openboard.inputmethod.keyboard.MoreKeysKeyboardView
|
||||||
import org.dslul.openboard.inputmethod.keyboard.clipboard.ClipboardHistoryView
|
import org.dslul.openboard.inputmethod.keyboard.clipboard.ClipboardHistoryView
|
||||||
|
@ -70,7 +70,7 @@ class Colors (
|
||||||
|
|
||||||
init {
|
init {
|
||||||
accentColorFilter = colorFilter(accent)
|
accentColorFilter = colorFilter(accent)
|
||||||
if (themeStyle == THEME_STYLE_HOLO) {
|
if (themeStyle == STYLE_HOLO) {
|
||||||
val darkerBackground = adjustLuminosityAndKeepAlpha(background, -0.2f)
|
val darkerBackground = adjustLuminosityAndKeepAlpha(background, -0.2f)
|
||||||
navBar = darkerBackground
|
navBar = darkerBackground
|
||||||
keyboardBackground = GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, intArrayOf(background, darkerBackground))
|
keyboardBackground = GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, intArrayOf(background, darkerBackground))
|
||||||
|
@ -98,7 +98,7 @@ class Colors (
|
||||||
doubleAdjustedBackground = darken(adjustedBackground)
|
doubleAdjustedBackground = darken(adjustedBackground)
|
||||||
}
|
}
|
||||||
adjustedBackgroundStateList = stateList(doubleAdjustedBackground, adjustedBackground)
|
adjustedBackgroundStateList = stateList(doubleAdjustedBackground, adjustedBackground)
|
||||||
suggestionBackgroundList = if (!hasKeyBorders && themeStyle == THEME_STYLE_MATERIAL)
|
suggestionBackgroundList = if (!hasKeyBorders && themeStyle == STYLE_MATERIAL)
|
||||||
stateList(doubleAdjustedBackground, Color.TRANSPARENT)
|
stateList(doubleAdjustedBackground, Color.TRANSPARENT)
|
||||||
else
|
else
|
||||||
stateList(adjustedBackground, Color.TRANSPARENT)
|
stateList(adjustedBackground, Color.TRANSPARENT)
|
||||||
|
@ -109,12 +109,12 @@ class Colors (
|
||||||
functionalKeyBackgroundFilter = colorFilter(functionalKey)
|
functionalKeyBackgroundFilter = colorFilter(functionalKey)
|
||||||
spaceBarFilter = colorFilter(spaceBar)
|
spaceBarFilter = colorFilter(spaceBar)
|
||||||
backgroundStateList = stateList(brightenOrDarken(background, true), background)
|
backgroundStateList = stateList(brightenOrDarken(background, true), background)
|
||||||
keyStateList = if (themeStyle == THEME_STYLE_HOLO) stateList(keyBackground, keyBackground)
|
keyStateList = if (themeStyle == STYLE_HOLO) stateList(keyBackground, keyBackground)
|
||||||
else stateList(brightenOrDarken(keyBackground, true), keyBackground)
|
else stateList(brightenOrDarken(keyBackground, true), keyBackground)
|
||||||
functionalKeyStateList = stateList(brightenOrDarken(functionalKey, true), functionalKey)
|
functionalKeyStateList = stateList(brightenOrDarken(functionalKey, true), functionalKey)
|
||||||
actionKeyStateList = if (themeStyle == THEME_STYLE_HOLO) functionalKeyStateList
|
actionKeyStateList = if (themeStyle == STYLE_HOLO) functionalKeyStateList
|
||||||
else stateList(brightenOrDarken(accent, true), accent)
|
else stateList(brightenOrDarken(accent, true), accent)
|
||||||
spaceBarStateList = if (themeStyle == THEME_STYLE_HOLO) stateList(spaceBar, spaceBar)
|
spaceBarStateList = if (themeStyle == STYLE_HOLO) stateList(spaceBar, spaceBar)
|
||||||
else stateList(brightenOrDarken(spaceBar, true), spaceBar)
|
else stateList(brightenOrDarken(spaceBar, true), spaceBar)
|
||||||
} else {
|
} else {
|
||||||
// need to set color to background if key borders are disabled, or there will be ugly keys
|
// need to set color to background if key borders are disabled, or there will be ugly keys
|
||||||
|
@ -124,13 +124,13 @@ class Colors (
|
||||||
backgroundStateList = stateList(brightenOrDarken(background, true), background)
|
backgroundStateList = stateList(brightenOrDarken(background, true), background)
|
||||||
keyStateList = stateList(brightenOrDarken(background, true), Color.TRANSPARENT)
|
keyStateList = stateList(brightenOrDarken(background, true), Color.TRANSPARENT)
|
||||||
functionalKeyStateList = keyStateList
|
functionalKeyStateList = keyStateList
|
||||||
actionKeyStateList = if (themeStyle == THEME_STYLE_HOLO) functionalKeyStateList
|
actionKeyStateList = if (themeStyle == STYLE_HOLO) functionalKeyStateList
|
||||||
else stateList(brightenOrDarken(accent, true), accent)
|
else stateList(brightenOrDarken(accent, true), accent)
|
||||||
spaceBarStateList = stateList(brightenOrDarken(spaceBar, true), spaceBar)
|
spaceBarStateList = stateList(brightenOrDarken(spaceBar, true), spaceBar)
|
||||||
}
|
}
|
||||||
keyTextFilter = colorFilter(keyText, BlendModeCompat.SRC_ATOP)
|
keyTextFilter = colorFilter(keyText, BlendModeCompat.SRC_ATOP)
|
||||||
actionKeyIconColorFilter = when {
|
actionKeyIconColorFilter = when {
|
||||||
themeStyle == THEME_STYLE_HOLO -> keyTextFilter
|
themeStyle == STYLE_HOLO -> keyTextFilter
|
||||||
// the white icon may not have enough contrast, and can't be adjusted by the user
|
// the white icon may not have enough contrast, and can't be adjusted by the user
|
||||||
isBrightColor(accent) -> colorFilter(Color.DKGRAY, BlendModeCompat.SRC_ATOP)
|
isBrightColor(accent) -> colorFilter(Color.DKGRAY, BlendModeCompat.SRC_ATOP)
|
||||||
else -> null
|
else -> null
|
||||||
|
@ -146,10 +146,10 @@ class Colors (
|
||||||
BackgroundType.ACTION -> actionKeyStateList
|
BackgroundType.ACTION -> actionKeyStateList
|
||||||
BackgroundType.SPACE -> spaceBarStateList
|
BackgroundType.SPACE -> spaceBarStateList
|
||||||
BackgroundType.ADJUSTED_BACKGROUND -> adjustedBackgroundStateList
|
BackgroundType.ADJUSTED_BACKGROUND -> adjustedBackgroundStateList
|
||||||
BackgroundType.SUGGESTION -> if (!hasKeyBorders && themeStyle == THEME_STYLE_MATERIAL)
|
BackgroundType.SUGGESTION -> if (!hasKeyBorders && themeStyle == STYLE_MATERIAL)
|
||||||
adjustedBackgroundStateList
|
adjustedBackgroundStateList
|
||||||
else backgroundStateList
|
else backgroundStateList
|
||||||
BackgroundType.ACTION_MORE_KEYS -> if (themeStyle == THEME_STYLE_HOLO)
|
BackgroundType.ACTION_MORE_KEYS -> if (themeStyle == STYLE_HOLO)
|
||||||
adjustedBackgroundStateList
|
adjustedBackgroundStateList
|
||||||
else actionKeyStateList
|
else actionKeyStateList
|
||||||
}
|
}
|
||||||
|
@ -172,7 +172,7 @@ class Colors (
|
||||||
else attr.getDrawable(R.styleable.KeyboardView_spacebarNoBorderBackground)
|
else attr.getDrawable(R.styleable.KeyboardView_spacebarNoBorderBackground)
|
||||||
}
|
}
|
||||||
BackgroundType.ACTION -> {
|
BackgroundType.ACTION -> {
|
||||||
if (themeStyle == THEME_STYLE_HOLO && hasKeyBorders) // no borders has a very small pressed drawable otherwise
|
if (themeStyle == STYLE_HOLO && hasKeyBorders) // no borders has a very small pressed drawable otherwise
|
||||||
attr.getDrawable(R.styleable.KeyboardView_functionalKeyBackground)
|
attr.getDrawable(R.styleable.KeyboardView_functionalKeyBackground)
|
||||||
else
|
else
|
||||||
attr.getDrawable(R.styleable.KeyboardView_keyBackground)
|
attr.getDrawable(R.styleable.KeyboardView_keyBackground)
|
||||||
|
|
|
@ -24,9 +24,9 @@ class AppearanceSettingsFragment : SubScreenFragment() {
|
||||||
|
|
||||||
private var needsReload = false
|
private var needsReload = false
|
||||||
|
|
||||||
private val themeFamilyPref: ListPreference by lazy { preferenceScreen.findPreference(Settings.PREF_THEME_STYLE)!! }
|
private val stylePref: ListPreference by lazy { preferenceScreen.findPreference(Settings.PREF_THEME_STYLE)!! }
|
||||||
private val themeVariantPref: ListPreference by lazy { preferenceScreen.findPreference(Settings.PREF_THEME_VARIANT)!! }
|
private val colorsPref: ListPreference by lazy { preferenceScreen.findPreference(Settings.PREF_THEME_COLORS)!! }
|
||||||
private val themeVariantNightPref: ListPreference? by lazy { preferenceScreen.findPreference(Settings.PREF_THEME_VARIANT_NIGHT) }
|
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) }
|
private val dayNightPref: TwoStatePreference? by lazy { preferenceScreen.findPreference(Settings.PREF_THEME_DAY_NIGHT) }
|
||||||
private val userColorsPref: Preference by lazy { preferenceScreen.findPreference("theme_select_colors")!! }
|
private val userColorsPref: Preference by lazy { preferenceScreen.findPreference("theme_select_colors")!! }
|
||||||
private val userColorsPrefNight: Preference? by lazy { preferenceScreen.findPreference("theme_select_colors_night") }
|
private val userColorsPrefNight: Preference? by lazy { preferenceScreen.findPreference("theme_select_colors_night") }
|
||||||
|
@ -38,7 +38,7 @@ class AppearanceSettingsFragment : SubScreenFragment() {
|
||||||
|
|
||||||
removeUnsuitablePreferences()
|
removeUnsuitablePreferences()
|
||||||
setupTheme()
|
setupTheme()
|
||||||
setThemeVariantPrefs(sharedPreferences.getString(Settings.PREF_THEME_STYLE, KeyboardTheme.THEME_STYLE_MATERIAL)!!)
|
setThemeVariantPrefs(sharedPreferences.getString(Settings.PREF_THEME_STYLE, KeyboardTheme.STYLE_MATERIAL)!!)
|
||||||
|
|
||||||
setupKeyboardHeight(Settings.PREF_KEYBOARD_HEIGHT_SCALE, SettingsValues.DEFAULT_SIZE_SCALE)
|
setupKeyboardHeight(Settings.PREF_KEYBOARD_HEIGHT_SCALE, SettingsValues.DEFAULT_SIZE_SCALE)
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ class AppearanceSettingsFragment : SubScreenFragment() {
|
||||||
private fun removeUnsuitablePreferences() {
|
private fun removeUnsuitablePreferences() {
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) {
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) {
|
||||||
removePreference(Settings.PREF_THEME_DAY_NIGHT)
|
removePreference(Settings.PREF_THEME_DAY_NIGHT)
|
||||||
removePreference(Settings.PREF_THEME_VARIANT_NIGHT)
|
removePreference(Settings.PREF_THEME_COLORS_NIGHT)
|
||||||
} else {
|
} else {
|
||||||
// on P there is experimental support for night mode, exposed by some roms like LineageOS
|
// on P there is experimental support for night mode, exposed by some roms like LineageOS
|
||||||
// try to detect this using UI_MODE_NIGHT_UNDEFINED, but actually the system could always report day too?
|
// try to detect this using UI_MODE_NIGHT_UNDEFINED, but actually the system could always report day too?
|
||||||
|
@ -66,7 +66,7 @@ class AppearanceSettingsFragment : SubScreenFragment() {
|
||||||
&& (resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_UNDEFINED
|
&& (resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_UNDEFINED
|
||||||
) {
|
) {
|
||||||
removePreference(Settings.PREF_THEME_DAY_NIGHT)
|
removePreference(Settings.PREF_THEME_DAY_NIGHT)
|
||||||
removePreference(Settings.PREF_THEME_VARIANT_NIGHT)
|
removePreference(Settings.PREF_THEME_COLORS_NIGHT)
|
||||||
removePreference("theme_select_colors_night")
|
removePreference("theme_select_colors_night")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -83,9 +83,9 @@ class AppearanceSettingsFragment : SubScreenFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setThemeVariantPrefs(themeFamily: String) {
|
private fun setThemeVariantPrefs(themeFamily: String) {
|
||||||
themeVariantPref.apply {
|
colorsPref.apply {
|
||||||
entryValues = if (themeFamily == KeyboardTheme.THEME_STYLE_HOLO) KeyboardTheme.THEME_VARIANTS
|
entryValues = if (themeFamily == KeyboardTheme.STYLE_HOLO) KeyboardTheme.COLORS
|
||||||
else KeyboardTheme.THEME_VARIANTS.filterNot { it == KeyboardTheme.THEME_HOLO_WHITE }.toTypedArray()
|
else KeyboardTheme.COLORS.filterNot { it == KeyboardTheme.THEME_HOLO_WHITE }.toTypedArray()
|
||||||
entries = entryValues.map {
|
entries = entryValues.map {
|
||||||
val resId = resources.getIdentifier("theme_name_$it", "string", requireContext().packageName)
|
val resId = resources.getIdentifier("theme_name_$it", "string", requireContext().packageName)
|
||||||
if (resId == 0) it else getString(resId)
|
if (resId == 0) it else getString(resId)
|
||||||
|
@ -100,9 +100,9 @@ class AppearanceSettingsFragment : SubScreenFragment() {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
themeVariantNightPref?.apply {
|
colorsNightPref?.apply {
|
||||||
entryValues = if (themeFamily == KeyboardTheme.THEME_STYLE_HOLO) KeyboardTheme.THEME_VARIANTS_DARK
|
entryValues = if (themeFamily == KeyboardTheme.STYLE_HOLO) KeyboardTheme.COLORS_DARK
|
||||||
else KeyboardTheme.THEME_VARIANTS_DARK.filterNot { it == KeyboardTheme.THEME_HOLO_WHITE }.toTypedArray()
|
else KeyboardTheme.COLORS_DARK.filterNot { it == KeyboardTheme.THEME_HOLO_WHITE }.toTypedArray()
|
||||||
entries = entryValues.map {
|
entries = entryValues.map {
|
||||||
val resId = resources.getIdentifier("theme_name_$it", "string", requireContext().packageName)
|
val resId = resources.getIdentifier("theme_name_$it", "string", requireContext().packageName)
|
||||||
if (resId == 0) it else getString(resId)
|
if (resId == 0) it else getString(resId)
|
||||||
|
@ -120,9 +120,9 @@ class AppearanceSettingsFragment : SubScreenFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupTheme() {
|
private fun setupTheme() {
|
||||||
themeFamilyPref.apply {
|
stylePref.apply {
|
||||||
entries = KeyboardTheme.THEME_STYLES
|
entries = KeyboardTheme.STYLES
|
||||||
entryValues = KeyboardTheme.THEME_STYLES
|
entryValues = KeyboardTheme.STYLES
|
||||||
onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, value ->
|
onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, value ->
|
||||||
summary = entries[entryValues.indexOfFirst { it == value }]
|
summary = entries[entryValues.indexOfFirst { it == value }]
|
||||||
setThemeVariantPrefs(value.toString())
|
setThemeVariantPrefs(value.toString())
|
||||||
|
@ -131,13 +131,13 @@ class AppearanceSettingsFragment : SubScreenFragment() {
|
||||||
summary = entries[entryValues.indexOfFirst { it == value }]
|
summary = entries[entryValues.indexOfFirst { it == value }]
|
||||||
}
|
}
|
||||||
dayNightPref?.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, value ->
|
dayNightPref?.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, value ->
|
||||||
themeVariantNightPref?.isVisible = value as Boolean
|
colorsNightPref?.isVisible = value as Boolean
|
||||||
userColorsPrefNight?.isVisible = value && themeVariantNightPref?.value == KeyboardTheme.THEME_USER_NIGHT
|
userColorsPrefNight?.isVisible = value && colorsNightPref?.value == KeyboardTheme.THEME_USER_NIGHT
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
themeVariantNightPref?.isVisible = dayNightPref?.isChecked == true
|
colorsNightPref?.isVisible = dayNightPref?.isChecked == true
|
||||||
userColorsPref.isVisible = themeVariantPref.value == KeyboardTheme.THEME_USER
|
userColorsPref.isVisible = colorsPref.value == KeyboardTheme.THEME_USER
|
||||||
userColorsPrefNight?.isVisible = dayNightPref?.isChecked == true && themeVariantNightPref?.value == KeyboardTheme.THEME_USER_NIGHT
|
userColorsPrefNight?.isVisible = dayNightPref?.isChecked == true && colorsNightPref?.value == KeyboardTheme.THEME_USER_NIGHT
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupKeyboardHeight(prefKey: String, defaultValue: Float) {
|
private fun setupKeyboardHeight(prefKey: String, defaultValue: Float) {
|
||||||
|
|
|
@ -55,8 +55,8 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
|
||||||
public static final String PREF_SOUND_ON = "sound_on";
|
public static final String PREF_SOUND_ON = "sound_on";
|
||||||
public static final String PREF_POPUP_ON = "popup_on";
|
public static final String PREF_POPUP_ON = "popup_on";
|
||||||
public static final String PREF_THEME_STYLE = "theme_style";
|
public static final String PREF_THEME_STYLE = "theme_style";
|
||||||
public static final String PREF_THEME_VARIANT = "theme_variant";
|
public static final String PREF_THEME_COLORS = "theme_variant";
|
||||||
public static final String PREF_THEME_VARIANT_NIGHT = "theme_variant_night";
|
public static final String PREF_THEME_COLORS_NIGHT = "theme_variant_night";
|
||||||
public static final String PREF_THEME_KEY_BORDERS = "theme_key_borders";
|
public static final String PREF_THEME_KEY_BORDERS = "theme_key_borders";
|
||||||
public static final String PREF_THEME_DAY_NIGHT = "theme_auto_day_night";
|
public static final String PREF_THEME_DAY_NIGHT = "theme_auto_day_night";
|
||||||
public static final String PREF_THEME_USER_COLOR_PREFIX = "theme_color_";
|
public static final String PREF_THEME_USER_COLOR_PREFIX = "theme_color_";
|
||||||
|
@ -473,9 +473,9 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
|
||||||
boolean isNight = ResourceUtils.isNight(context.getResources());
|
boolean isNight = ResourceUtils.isNight(context.getResources());
|
||||||
if (prefs.getBoolean(PREF_FORCE_OPPOSITE_THEME, false)) isNight = !isNight;
|
if (prefs.getBoolean(PREF_FORCE_OPPOSITE_THEME, false)) isNight = !isNight;
|
||||||
final String themeColors = (isNight && prefs.getBoolean(PREF_THEME_DAY_NIGHT, context.getResources().getBoolean(R.bool.day_night_default)))
|
final String themeColors = (isNight && prefs.getBoolean(PREF_THEME_DAY_NIGHT, context.getResources().getBoolean(R.bool.day_night_default)))
|
||||||
? prefs.getString(Settings.PREF_THEME_VARIANT_NIGHT, KeyboardTheme.THEME_DARKER)
|
? prefs.getString(Settings.PREF_THEME_COLORS_NIGHT, KeyboardTheme.THEME_DARKER)
|
||||||
: prefs.getString(Settings.PREF_THEME_VARIANT, KeyboardTheme.THEME_LIGHT);
|
: prefs.getString(Settings.PREF_THEME_COLORS, KeyboardTheme.THEME_LIGHT);
|
||||||
final String themeStyle = prefs.getString(Settings.PREF_THEME_STYLE, KeyboardTheme.THEME_STYLE_MATERIAL);
|
final String themeStyle = prefs.getString(Settings.PREF_THEME_STYLE, KeyboardTheme.STYLE_MATERIAL);
|
||||||
|
|
||||||
return KeyboardTheme.getThemeColors(themeColors, themeStyle, context, prefs);
|
return KeyboardTheme.getThemeColors(themeColors, themeStyle, context, prefs);
|
||||||
}
|
}
|
||||||
|
|
|
@ -556,11 +556,15 @@ New dictionary:
|
||||||
This resource is copied from packages/apps/Settings/res/values/strings.xml -->
|
This resource is copied from packages/apps/Settings/res/values/strings.xml -->
|
||||||
<!-- This resource is corresponding to msgid="5433275485499039199" -->
|
<!-- This resource is corresponding to msgid="5433275485499039199" -->
|
||||||
<string name="user_dict_fast_scroll_alphabet">\u0020ABCDEFGHIJKLMNOPQRSTUVWXYZ</string>
|
<string name="user_dict_fast_scroll_alphabet">\u0020ABCDEFGHIJKLMNOPQRSTUVWXYZ</string>
|
||||||
<!-- Option for choosing theme family [CHAR LIMIT=33] -->
|
<!-- Option for choosing theme style [CHAR LIMIT=33] -->
|
||||||
|
<string name="theme_style">Style</string>
|
||||||
|
<!-- Option for choosing colors [CHAR LIMIT=33] -->
|
||||||
|
<string name="theme_colors">Colors</string>
|
||||||
|
<!-- Option for choosing colors for night mode [CHAR LIMIT=33] -->
|
||||||
|
<string name="theme_colors_night">Colors (night)</string>
|
||||||
|
<!-- TODO: remove the 3 strings below from all files, translation editor could do it but seems completely broken -->
|
||||||
<string name="theme_family">Theme family</string>
|
<string name="theme_family">Theme family</string>
|
||||||
<!-- Option for choosing theme family variant [CHAR LIMIT=33] -->
|
|
||||||
<string name="theme_variant">Theme variant</string>
|
<string name="theme_variant">Theme variant</string>
|
||||||
<!-- Option for choosing theme family variant (night) [CHAR LIMIT=33] -->
|
|
||||||
<string name="theme_variant_night">Theme variant (night)</string>
|
<string name="theme_variant_night">Theme variant (night)</string>
|
||||||
<!-- Option for choosing whether we use a theme that provides borders to keys [CHAR LIMIT=33] -->
|
<!-- Option for choosing whether we use a theme that provides borders to keys [CHAR LIMIT=33] -->
|
||||||
<string name="key_borders">Key borders</string>
|
<string name="key_borders">Key borders</string>
|
||||||
|
@ -585,15 +589,15 @@ New dictionary:
|
||||||
<!-- Theme name for user-defined theme night mode theme -->
|
<!-- Theme name for user-defined theme night mode theme -->
|
||||||
<string name="theme_name_user_night" tools:keep="@string/theme_name_user_night">User-Defined (night)</string>
|
<string name="theme_name_user_night" tools:keep="@string/theme_name_user_night">User-Defined (night)</string>
|
||||||
<!-- Option for selecting custom theme colors -->
|
<!-- Option for selecting custom theme colors -->
|
||||||
<string name="select_user_colors">Adjust theme colors</string>
|
<string name="select_user_colors">Adjust colors</string>
|
||||||
<!-- Option for selecting custom theme colors for night mode only -->
|
<!-- Option for selecting custom theme colors for night mode only -->
|
||||||
<string name="select_user_colors_night">Adjust theme colors (night)</string>
|
<string name="select_user_colors_night">Adjust colors (night)</string>
|
||||||
<!-- Text when determining color automatically -->
|
<!-- Text when determining color automatically -->
|
||||||
<string name="auto_user_color">Choose color automatically</string>
|
<string name="auto_user_color">Choose color automatically</string>
|
||||||
<!-- Hint for text field just to show keyboard (in color settings) -->
|
<!-- Hint for text field just to show keyboard (in color settings) -->
|
||||||
<string name="hint_show_keyboard">Click for preview</string>
|
<string name="hint_show_keyboard">Click for preview</string>
|
||||||
<!-- Description for selection of user-defined colors. -->
|
<!-- Description for selection of user-defined colors. -->
|
||||||
<string name="select_user_colors_summary">Select colors for text and background</string>
|
<string name="select_user_colors_summary">Select colors for text and backgrounds</string>
|
||||||
<!-- Selection: background color. -->
|
<!-- Selection: background color. -->
|
||||||
<string name="select_color_background">Keyboard background</string>
|
<string name="select_color_background">Keyboard background</string>
|
||||||
<!-- Selection: key text color. -->
|
<!-- Selection: key text color. -->
|
||||||
|
|
|
@ -15,16 +15,12 @@
|
||||||
|
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:key="theme_style"
|
android:key="theme_style"
|
||||||
android:title="@string/theme_family"
|
android:title="@string/theme_style"
|
||||||
android:defaultValue="Material"/>
|
android:defaultValue="Material"/>
|
||||||
|
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:key="theme_variant"
|
android:key="theme_variant"
|
||||||
android:title="@string/theme_variant"/>
|
android:title="@string/theme_colors"/>
|
||||||
|
|
||||||
<SwitchPreferenceCompat
|
|
||||||
android:key="theme_key_borders"
|
|
||||||
android:title="@string/key_borders"/>
|
|
||||||
|
|
||||||
<PreferenceScreen
|
<PreferenceScreen
|
||||||
android:fragment="org.dslul.openboard.inputmethod.latin.settings.ColorsSettingsFragment"
|
android:fragment="org.dslul.openboard.inputmethod.latin.settings.ColorsSettingsFragment"
|
||||||
|
@ -32,6 +28,10 @@
|
||||||
android:title="@string/select_user_colors"
|
android:title="@string/select_user_colors"
|
||||||
android:summary="@string/select_user_colors_summary"/>
|
android:summary="@string/select_user_colors_summary"/>
|
||||||
|
|
||||||
|
<SwitchPreferenceCompat
|
||||||
|
android:key="theme_key_borders"
|
||||||
|
android:title="@string/key_borders"/>
|
||||||
|
|
||||||
<SwitchPreferenceCompat
|
<SwitchPreferenceCompat
|
||||||
android:key="theme_auto_day_night"
|
android:key="theme_auto_day_night"
|
||||||
android:title="@string/day_night_mode"
|
android:title="@string/day_night_mode"
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
|
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:key="theme_variant_night"
|
android:key="theme_variant_night"
|
||||||
android:title="@string/theme_variant_night"/>
|
android:title="@string/theme_colors_night"/>
|
||||||
|
|
||||||
<PreferenceScreen
|
<PreferenceScreen
|
||||||
android:fragment="org.dslul.openboard.inputmethod.latin.settings.ColorsNightSettingsFragment"
|
android:fragment="org.dslul.openboard.inputmethod.latin.settings.ColorsNightSettingsFragment"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue