Skip to content
Snippets Groups Projects
Commit 6bcbc38a authored by Aleksandras Kostarevas's avatar Aleksandras Kostarevas
Browse files

Fix touch typing mode

parent 88ecbf11
No related branches found
No related tags found
No related merge requests found
...@@ -15,7 +15,6 @@ import androidx.compose.ui.unit.Dp ...@@ -15,7 +15,6 @@ import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.datastore.preferences.core.Preferences import androidx.datastore.preferences.core.Preferences
import androidx.datastore.preferences.core.booleanPreferencesKey import androidx.datastore.preferences.core.booleanPreferencesKey
import androidx.datastore.preferences.core.floatPreferencesKey
import org.futo.inputmethod.keyboard.internal.KeyboardIconsSet import org.futo.inputmethod.keyboard.internal.KeyboardIconsSet
import org.futo.inputmethod.latin.R import org.futo.inputmethod.latin.R
import org.futo.inputmethod.latin.uix.actions.AllActions import org.futo.inputmethod.latin.uix.actions.AllActions
...@@ -23,7 +22,7 @@ import org.futo.inputmethod.latin.uix.actions.AllActionsMap ...@@ -23,7 +22,7 @@ import org.futo.inputmethod.latin.uix.actions.AllActionsMap
import org.futo.inputmethod.v2keyboard.KeyVisualStyle import org.futo.inputmethod.v2keyboard.KeyVisualStyle
val KeyBordersSetting = SettingsKey(booleanPreferencesKey("keyBorders"), true) val KeyBordersSetting = SettingsKey(booleanPreferencesKey("keyBorders"), true)
val HiddenKeysSetting = SettingsKey(booleanPreferencesKey("hiddenKeys"), false) val HiddenKeysSetting = SettingsKey(booleanPreferencesKey("hiddenKeys1"), false)
val KeyHintsSetting = SettingsKey(booleanPreferencesKey("keyHints"), false) val KeyHintsSetting = SettingsKey(booleanPreferencesKey("keyHints"), false)
fun<T> Preferences.get(key: SettingsKey<T>): T { fun<T> Preferences.get(key: SettingsKey<T>): T {
...@@ -279,25 +278,35 @@ class BasicThemeProvider(val context: Context, val colorScheme: KeyboardColorSch ...@@ -279,25 +278,35 @@ class BasicThemeProvider(val context: Context, val colorScheme: KeyboardColorSch
} }
keyStyles = mapOf( keyStyles = mapOf(
KeyVisualStyle.Action to VisualStyleDescriptor( KeyVisualStyle.Action to if(expertMode) {
backgroundDrawable = coloredRoundedRectangle(colorScheme.primary.toArgb(), dp(128.dp)), VisualStyleDescriptor(
foregroundColor = colorScheme.onPrimary.toArgb(), backgroundDrawable = coloredRoundedRectangle(colorScheme.outline.copy(alpha = 0.1f).toArgb(), dp(128.dp)),
foregroundColor = colorScheme.onSurface.copy(alpha = 0.6f).toArgb(),
backgroundDrawablePressed = coloredRoundedRectangle(colorScheme.secondaryContainer.toArgb(), dp(128.dp)), backgroundDrawablePressed = coloredRoundedRectangle(colorScheme.outline.copy(alpha = 0.6f).toArgb(), dp(128.dp)),
foregroundColorPressed = colorScheme.onSecondaryContainer.toArgb() foregroundColorPressed = colorScheme.onSurface.toArgb()
), )
} else {
VisualStyleDescriptor(
backgroundDrawable = coloredRoundedRectangle(colorScheme.primary.toArgb(), dp(128.dp)),
foregroundColor = colorScheme.onPrimary.toArgb(),
backgroundDrawablePressed = coloredRoundedRectangle(colorScheme.secondaryContainer.toArgb(), dp(128.dp)),
foregroundColorPressed = colorScheme.onSecondaryContainer.toArgb()
)
},
KeyVisualStyle.Normal to if(keyBorders) { KeyVisualStyle.Normal to if(keyBorders) {
makeVisualStyle( makeVisualStyle(
keyColor, keyColor,
onKeyColor, if(expertMode) transparent else onKeyColor,
highlight, highlight,
keyCornerRadius keyCornerRadius
) )
} else { } else {
makeVisualStyle( makeVisualStyle(
transparent, transparent,
onBackground, if(expertMode) transparent else onKeyColor,
highlight, highlight,
keyCornerRadius keyCornerRadius
) )
...@@ -314,14 +323,14 @@ class BasicThemeProvider(val context: Context, val colorScheme: KeyboardColorSch ...@@ -314,14 +323,14 @@ class BasicThemeProvider(val context: Context, val colorScheme: KeyboardColorSch
KeyVisualStyle.Functional to if(keyBorders) { KeyVisualStyle.Functional to if(keyBorders) {
makeVisualStyle( makeVisualStyle(
functionalKeyColor, functionalKeyColor,
onKeyColor, if(expertMode) Color(onKeyColor).copy(alpha = 0.2f).toArgb() else onKeyColor,
highlight, highlight,
keyCornerRadius keyCornerRadius
) )
} else { } else {
makeVisualStyle( makeVisualStyle(
transparent, transparent,
onBackground, if(expertMode) Color(onKeyColor).copy(alpha = 0.2f).toArgb() else onKeyColor,
highlight, highlight,
keyCornerRadius keyCornerRadius
) )
...@@ -330,14 +339,14 @@ class BasicThemeProvider(val context: Context, val colorScheme: KeyboardColorSch ...@@ -330,14 +339,14 @@ class BasicThemeProvider(val context: Context, val colorScheme: KeyboardColorSch
KeyVisualStyle.StickyOff to if(keyBorders) { KeyVisualStyle.StickyOff to if(keyBorders) {
makeVisualStyle( makeVisualStyle(
keyColor, keyColor,
onKeyColor, if(expertMode) Color(onKeyColor).copy(alpha = 0.2f).toArgb() else onKeyColor,
highlight, highlight,
keyCornerRadius keyCornerRadius
) )
} else { } else {
makeVisualStyle( makeVisualStyle(
transparent, transparent,
onBackground, if(expertMode) Color(onKeyColor).copy(alpha = 0.2f).toArgb() else onKeyColor,
highlight, highlight,
keyCornerRadius keyCornerRadius
) )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment