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.DynamicThemeProviderOwner
|
||||||
import org.futo.inputmethod.latin.uix.EmojiTracker.unuseEmoji
|
import org.futo.inputmethod.latin.uix.EmojiTracker.unuseEmoji
|
||||||
import org.futo.inputmethod.latin.uix.EmojiTracker.useEmoji
|
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.KeyboardBottomOffsetSetting
|
||||||
import org.futo.inputmethod.latin.uix.SUGGESTION_BLACKLIST
|
import org.futo.inputmethod.latin.uix.SUGGESTION_BLACKLIST
|
||||||
import org.futo.inputmethod.latin.uix.THEME_KEY
|
import org.futo.inputmethod.latin.uix.THEME_KEY
|
||||||
|
@ -56,6 +56,10 @@ fun adjustColorBrightnessForContrast(bgColor: Int, fgColor: Int, desiredContrast
|
|||||||
return ColorUtils.HSLToColor(bgHSL)
|
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) :
|
class BasicThemeProvider(val context: Context, val overrideColorScheme: ColorScheme? = null) :
|
||||||
DynamicThemeProvider {
|
DynamicThemeProvider {
|
||||||
override val primaryKeyboardColor: Int
|
override val primaryKeyboardColor: Int
|
||||||
@ -133,16 +137,11 @@ class BasicThemeProvider(val context: Context, val overrideColorScheme: ColorSch
|
|||||||
|
|
||||||
val keyboardHeight: Float
|
val keyboardHeight: Float
|
||||||
|
|
||||||
fun hasUpdated(newPreferences: Preferences): Boolean {
|
fun hasUpdated(np: Preferences): Boolean {
|
||||||
return when {
|
return np.get(HiddenKeysSetting) != expertMode
|
||||||
newPreferences[HiddenKeysSetting.key] != expertMode -> true
|
|| np.get(KeyBordersSetting) != keyBorders
|
||||||
newPreferences[KeyBordersSetting.key] != keyBorders -> true
|
|| np.get(KeyHintsSetting) != showKeyHints
|
||||||
newPreferences[KeyHintsSetting.key] != showKeyHints -> true
|
|| np.get(KeyboardHeightMultiplierSetting) != keyboardHeight
|
||||||
|
|
||||||
newPreferences[KeyboardHeightMultiplierSetting.key] != keyboardHeight -> true
|
|
||||||
|
|
||||||
else -> false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
@ -159,8 +158,7 @@ class BasicThemeProvider(val context: Context, val overrideColorScheme: ColorSch
|
|||||||
expertMode = context.getSettingBlocking(HiddenKeysSetting)
|
expertMode = context.getSettingBlocking(HiddenKeysSetting)
|
||||||
keyBorders = context.getSettingBlocking(KeyBordersSetting)
|
keyBorders = context.getSettingBlocking(KeyBordersSetting)
|
||||||
showKeyHints = context.getSettingBlocking(KeyHintsSetting)
|
showKeyHints = context.getSettingBlocking(KeyHintsSetting)
|
||||||
|
keyboardHeight = context.getSettingBlocking(KeyboardHeightMultiplierSetting)
|
||||||
keyboardHeight = context.getSettingBlocking(KeyboardHeightMultiplierSetting.key, KeyboardHeightMultiplierSetting.default)
|
|
||||||
|
|
||||||
val primary = colorScheme.primary.toArgb()
|
val primary = colorScheme.primary.toArgb()
|
||||||
val secondary = colorScheme.secondary.toArgb()
|
val secondary = colorScheme.secondary.toArgb()
|
||||||
|
Loading…
Reference in New Issue
Block a user