mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-14 14:02:44 +00:00
make sure holo white is not selectable without holo style
This commit is contained in:
parent
22878578a7
commit
2d38cf0805
5 changed files with 23 additions and 10 deletions
|
@ -136,7 +136,7 @@ fun SwitchPreference(
|
||||||
val ctx = LocalContext.current
|
val ctx = LocalContext.current
|
||||||
val prefs = ctx.prefs()
|
val prefs = ctx.prefs()
|
||||||
val b = (ctx.getActivity() as? SettingsActivity2)?.prefChanged?.collectAsState()
|
val b = (ctx.getActivity() as? SettingsActivity2)?.prefChanged?.collectAsState()
|
||||||
if (b?.value ?: 0 < 0)
|
if ((b?.value ?: 0) < 0)
|
||||||
Log.v("irrelevant", "stupid way to trigger recomposition on preference change")
|
Log.v("irrelevant", "stupid way to trigger recomposition on preference change")
|
||||||
var value = prefs.getBoolean(pref, default)
|
var value = prefs.getBoolean(pref, default)
|
||||||
fun switched(newValue: Boolean) {
|
fun switched(newValue: Boolean) {
|
||||||
|
@ -194,7 +194,7 @@ fun <T: Number> SliderPreference(
|
||||||
val ctx = LocalContext.current
|
val ctx = LocalContext.current
|
||||||
val prefs = ctx.prefs()
|
val prefs = ctx.prefs()
|
||||||
val b = (ctx.getActivity() as? SettingsActivity2)?.prefChanged?.collectAsState()
|
val b = (ctx.getActivity() as? SettingsActivity2)?.prefChanged?.collectAsState()
|
||||||
if (b?.value ?: 0 < 0)
|
if ((b?.value ?: 0) < 0)
|
||||||
Log.v("irrelevant", "stupid way to trigger recomposition on preference change")
|
Log.v("irrelevant", "stupid way to trigger recomposition on preference change")
|
||||||
val initialValue = if (default is Int || default is Float)
|
val initialValue = if (default is Int || default is Float)
|
||||||
getPrefOfType(prefs, pref, default)
|
getPrefOfType(prefs, pref, default)
|
||||||
|
|
|
@ -16,9 +16,6 @@ import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
// todo (roughly in order)
|
// todo (roughly in order)
|
||||||
// make all prefs actually work
|
// make all prefs actually work
|
||||||
// appearance
|
// appearance
|
||||||
// holo white selectable for non-holo style if we had selected holo theme before
|
|
||||||
// the list just stays the old one after changing the setting
|
|
||||||
// also, even if selected it should not be used...
|
|
||||||
// click on bg image does nothing when already set (but works after reload)
|
// click on bg image does nothing when already set (but works after reload)
|
||||||
// split spacer scale setting does not reload?
|
// split spacer scale setting does not reload?
|
||||||
// narrow key gaps setting is not changing properly?
|
// narrow key gaps setting is not changing properly?
|
||||||
|
@ -29,6 +26,7 @@ import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
// try moving the recomposition of pref change somewhere else, so it's not duplicated everywhere
|
// try moving the recomposition of pref change somewhere else, so it's not duplicated everywhere
|
||||||
// make the pref lists more compact (compare with old settings)
|
// make the pref lists more compact (compare with old settings)
|
||||||
// try making text size similar to old state (also in dialogs)
|
// try making text size similar to old state (also in dialogs)
|
||||||
|
// more similar dialog style args (for all dialogs, or for none)
|
||||||
// check whether dialogs have the same colors, i think currently it's a bit inconsistent
|
// check whether dialogs have the same colors, i think currently it's a bit inconsistent
|
||||||
// see all the properties for each alertDialog -> any way to set it in a single place?
|
// see all the properties for each alertDialog -> any way to set it in a single place?
|
||||||
// title too huge for bg image and text on spacebar dialogs, also maybe somewhere else -> where to set in one place?
|
// title too huge for bg image and text on spacebar dialogs, also maybe somewhere else -> where to set in one place?
|
||||||
|
|
|
@ -60,7 +60,7 @@ fun AppearanceScreen(
|
||||||
val ctx = LocalContext.current
|
val ctx = LocalContext.current
|
||||||
val prefs = ctx.prefs()
|
val prefs = ctx.prefs()
|
||||||
val b = (LocalContext.current.getActivity() as? SettingsActivity2)?.prefChanged?.collectAsState()
|
val b = (LocalContext.current.getActivity() as? SettingsActivity2)?.prefChanged?.collectAsState()
|
||||||
if (b?.value ?: 0 < 0)
|
if ((b?.value ?: 0) < 0)
|
||||||
Log.v("irrelevant", "stupid way to trigger recomposition on preference change")
|
Log.v("irrelevant", "stupid way to trigger recomposition on preference change")
|
||||||
val dayNightMode = Build.VERSION.SDK_INT >= Build.VERSION_CODES.P && Settings.readDayNightPref(prefs, ctx.resources)
|
val dayNightMode = Build.VERSION.SDK_INT >= Build.VERSION_CODES.P && Settings.readDayNightPref(prefs, ctx.resources)
|
||||||
val lightTheme = prefs.getString(Settings.PREF_THEME_COLORS, KeyboardTheme.THEME_LIGHT)
|
val lightTheme = prefs.getString(Settings.PREF_THEME_COLORS, KeyboardTheme.THEME_LIGHT)
|
||||||
|
@ -102,6 +102,7 @@ fun AppearanceScreen(
|
||||||
fun createAppearancePrefs(context: Context) = listOf(
|
fun createAppearancePrefs(context: Context) = listOf(
|
||||||
PrefDef(context, Settings.PREF_THEME_STYLE, R.string.theme_style) { def ->
|
PrefDef(context, Settings.PREF_THEME_STYLE, R.string.theme_style) { def ->
|
||||||
val ctx = LocalContext.current
|
val ctx = LocalContext.current
|
||||||
|
val prefs = ctx.prefs()
|
||||||
val items = KeyboardTheme.STYLES.map {
|
val items = KeyboardTheme.STYLES.map {
|
||||||
it.getStringResourceOrName("style_name_", ctx) to it
|
it.getStringResourceOrName("style_name_", ctx) to it
|
||||||
}
|
}
|
||||||
|
@ -109,7 +110,15 @@ fun createAppearancePrefs(context: Context) = listOf(
|
||||||
def,
|
def,
|
||||||
items,
|
items,
|
||||||
KeyboardTheme.STYLE_MATERIAL
|
KeyboardTheme.STYLE_MATERIAL
|
||||||
)
|
) {
|
||||||
|
if (it != KeyboardTheme.STYLE_HOLO) {
|
||||||
|
// todo: use defaults once they exist
|
||||||
|
if (prefs.getString(Settings.PREF_THEME_COLORS, "") == KeyboardTheme.THEME_HOLO_WHITE)
|
||||||
|
prefs.edit().putString(Settings.PREF_THEME_COLORS, KeyboardTheme.THEME_LIGHT).apply()
|
||||||
|
if (prefs.getString(Settings.PREF_THEME_COLORS_NIGHT, "") == KeyboardTheme.THEME_HOLO_WHITE)
|
||||||
|
prefs.edit().putString(Settings.PREF_THEME_COLORS_NIGHT, KeyboardTheme.THEME_DARK).apply()
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
PrefDef(context, Settings.PREF_ICON_STYLE, R.string.icon_style) { def ->
|
PrefDef(context, Settings.PREF_ICON_STYLE, R.string.icon_style) { def ->
|
||||||
val ctx = LocalContext.current
|
val ctx = LocalContext.current
|
||||||
|
@ -138,6 +147,9 @@ fun createAppearancePrefs(context: Context) = listOf(
|
||||||
},
|
},
|
||||||
PrefDef(context, Settings.PREF_THEME_COLORS, R.string.theme_colors) { def ->
|
PrefDef(context, Settings.PREF_THEME_COLORS, R.string.theme_colors) { def ->
|
||||||
val ctx = LocalContext.current
|
val ctx = LocalContext.current
|
||||||
|
val b = (ctx.getActivity() as? SettingsActivity2)?.prefChanged?.collectAsState()
|
||||||
|
if ((b?.value ?: 0) < 0)
|
||||||
|
Log.v("irrelevant", "stupid way to trigger recomposition on preference change")
|
||||||
val currentStyle = ctx.prefs().getString(Settings.PREF_THEME_STYLE, KeyboardTheme.STYLE_MATERIAL)
|
val currentStyle = ctx.prefs().getString(Settings.PREF_THEME_STYLE, KeyboardTheme.STYLE_MATERIAL)
|
||||||
val items = KeyboardTheme.COLORS.mapNotNull {
|
val items = KeyboardTheme.COLORS.mapNotNull {
|
||||||
if (it == KeyboardTheme.THEME_HOLO_WHITE && currentStyle != KeyboardTheme.STYLE_HOLO)
|
if (it == KeyboardTheme.THEME_HOLO_WHITE && currentStyle != KeyboardTheme.STYLE_HOLO)
|
||||||
|
@ -152,8 +164,11 @@ fun createAppearancePrefs(context: Context) = listOf(
|
||||||
},
|
},
|
||||||
PrefDef(context, Settings.PREF_THEME_COLORS_NIGHT, R.string.theme_colors_night) { def ->
|
PrefDef(context, Settings.PREF_THEME_COLORS_NIGHT, R.string.theme_colors_night) { def ->
|
||||||
val ctx = LocalContext.current
|
val ctx = LocalContext.current
|
||||||
|
val b = (ctx.getActivity() as? SettingsActivity2)?.prefChanged?.collectAsState()
|
||||||
|
if ((b?.value ?: 0) < 0)
|
||||||
|
Log.v("irrelevant", "stupid way to trigger recomposition on preference change")
|
||||||
val currentStyle = ctx.prefs().getString(Settings.PREF_THEME_STYLE, KeyboardTheme.STYLE_MATERIAL)
|
val currentStyle = ctx.prefs().getString(Settings.PREF_THEME_STYLE, KeyboardTheme.STYLE_MATERIAL)
|
||||||
val items = KeyboardTheme.COLORS.mapNotNull {
|
val items = KeyboardTheme.COLORS_DARK.mapNotNull {
|
||||||
if (it == KeyboardTheme.THEME_HOLO_WHITE && currentStyle == KeyboardTheme.STYLE_HOLO)
|
if (it == KeyboardTheme.THEME_HOLO_WHITE && currentStyle == KeyboardTheme.STYLE_HOLO)
|
||||||
return@mapNotNull null
|
return@mapNotNull null
|
||||||
it.getStringResourceOrName("theme_name_", ctx) to it
|
it.getStringResourceOrName("theme_name_", ctx) to it
|
||||||
|
|
|
@ -28,7 +28,7 @@ fun GestureTypingScreen(
|
||||||
) {
|
) {
|
||||||
val prefs = LocalContext.current.prefs()
|
val prefs = LocalContext.current.prefs()
|
||||||
val b = (LocalContext.current.getActivity() as? SettingsActivity2)?.prefChanged?.collectAsState()
|
val b = (LocalContext.current.getActivity() as? SettingsActivity2)?.prefChanged?.collectAsState()
|
||||||
if (b?.value ?: 0 < 0)
|
if ((b?.value ?: 0) < 0)
|
||||||
Log.v("irrelevant", "stupid way to trigger recomposition on preference change")
|
Log.v("irrelevant", "stupid way to trigger recomposition on preference change")
|
||||||
val gestureEnabled = prefs.getBoolean(Settings.PREF_GESTURE_INPUT, true)
|
val gestureEnabled = prefs.getBoolean(Settings.PREF_GESTURE_INPUT, true)
|
||||||
val gestureTrailEnabled = prefs.getBoolean(Settings.PREF_GESTURE_PREVIEW_TRAIL, true)
|
val gestureTrailEnabled = prefs.getBoolean(Settings.PREF_GESTURE_PREVIEW_TRAIL, true)
|
||||||
|
|
|
@ -49,7 +49,7 @@ fun TextCorrectionScreen(
|
||||||
) {
|
) {
|
||||||
val prefs = LocalContext.current.prefs()
|
val prefs = LocalContext.current.prefs()
|
||||||
val b = (LocalContext.current.getActivity() as? SettingsActivity2)?.prefChanged?.collectAsState()
|
val b = (LocalContext.current.getActivity() as? SettingsActivity2)?.prefChanged?.collectAsState()
|
||||||
if (b?.value ?: 0 < 0)
|
if ((b?.value ?: 0) < 0)
|
||||||
Log.v("irrelevant", "stupid way to trigger recomposition on preference change")
|
Log.v("irrelevant", "stupid way to trigger recomposition on preference change")
|
||||||
val autocorrectEnabled = prefs.getBoolean(Settings.PREF_AUTO_CORRECTION, true)
|
val autocorrectEnabled = prefs.getBoolean(Settings.PREF_AUTO_CORRECTION, true)
|
||||||
val personalizedSuggestionsEnabled = prefs.getBoolean(Settings.PREF_KEY_USE_PERSONALIZED_DICTS, true)
|
val personalizedSuggestionsEnabled = prefs.getBoolean(Settings.PREF_KEY_USE_PERSONALIZED_DICTS, true)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue