mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Fix wrong update check for theme
This commit is contained in:
parent
7fbb62fb4c
commit
360c2f4ada
@ -53,9 +53,6 @@ import org.futo.inputmethod.latin.uix.DynamicThemeProvider
|
||||
import org.futo.inputmethod.latin.uix.DynamicThemeProviderOwner
|
||||
import org.futo.inputmethod.latin.uix.EmojiTracker.unuseEmoji
|
||||
import org.futo.inputmethod.latin.uix.EmojiTracker.useEmoji
|
||||
import org.futo.inputmethod.latin.uix.HiddenKeysSetting
|
||||
import org.futo.inputmethod.latin.uix.KeyBordersSetting
|
||||
import org.futo.inputmethod.latin.uix.KeyHintsSetting
|
||||
import org.futo.inputmethod.latin.uix.KeyboardBottomOffsetSetting
|
||||
import org.futo.inputmethod.latin.uix.SUGGESTION_BLACKLIST
|
||||
import org.futo.inputmethod.latin.uix.THEME_KEY
|
||||
|
@ -56,6 +56,10 @@ fun adjustColorBrightnessForContrast(bgColor: Int, fgColor: Int, desiredContrast
|
||||
return ColorUtils.HSLToColor(bgHSL)
|
||||
}
|
||||
|
||||
fun<T> Preferences.get(key: SettingsKey<T>): T {
|
||||
return this[key.key] ?: key.default
|
||||
}
|
||||
|
||||
class BasicThemeProvider(val context: Context, val overrideColorScheme: ColorScheme? = null) :
|
||||
DynamicThemeProvider {
|
||||
override val primaryKeyboardColor: Int
|
||||
@ -133,16 +137,11 @@ class BasicThemeProvider(val context: Context, val overrideColorScheme: ColorSch
|
||||
|
||||
val keyboardHeight: Float
|
||||
|
||||
fun hasUpdated(newPreferences: Preferences): Boolean {
|
||||
return when {
|
||||
newPreferences[HiddenKeysSetting.key] != expertMode -> true
|
||||
newPreferences[KeyBordersSetting.key] != keyBorders -> true
|
||||
newPreferences[KeyHintsSetting.key] != showKeyHints -> true
|
||||
|
||||
newPreferences[KeyboardHeightMultiplierSetting.key] != keyboardHeight -> true
|
||||
|
||||
else -> false
|
||||
}
|
||||
fun hasUpdated(np: Preferences): Boolean {
|
||||
return np.get(HiddenKeysSetting) != expertMode
|
||||
|| np.get(KeyBordersSetting) != keyBorders
|
||||
|| np.get(KeyHintsSetting) != showKeyHints
|
||||
|| np.get(KeyboardHeightMultiplierSetting) != keyboardHeight
|
||||
}
|
||||
|
||||
init {
|
||||
@ -159,8 +158,7 @@ class BasicThemeProvider(val context: Context, val overrideColorScheme: ColorSch
|
||||
expertMode = context.getSettingBlocking(HiddenKeysSetting)
|
||||
keyBorders = context.getSettingBlocking(KeyBordersSetting)
|
||||
showKeyHints = context.getSettingBlocking(KeyHintsSetting)
|
||||
|
||||
keyboardHeight = context.getSettingBlocking(KeyboardHeightMultiplierSetting.key, KeyboardHeightMultiplierSetting.default)
|
||||
keyboardHeight = context.getSettingBlocking(KeyboardHeightMultiplierSetting)
|
||||
|
||||
val primary = colorScheme.primary.toArgb()
|
||||
val secondary = colorScheme.secondary.toArgb()
|
||||
|
Loading…
Reference in New Issue
Block a user