mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-06-08 15:47:43 +00:00
better way of force-reloading the keyboard theme
not duplicating an existing mechanism any more and working while keyboard is shown (at least it looks like it)
This commit is contained in:
parent
f0bb541b72
commit
95b6333bf4
19 changed files with 86 additions and 80 deletions
|
@ -79,6 +79,7 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
|
||||||
private int mCurrentUiMode;
|
private int mCurrentUiMode;
|
||||||
private int mCurrentOrientation;
|
private int mCurrentOrientation;
|
||||||
private int mCurrentDpi;
|
private int mCurrentDpi;
|
||||||
|
private boolean mThemeNeedsReload;
|
||||||
|
|
||||||
@SuppressLint("StaticFieldLeak") // this is a keyboard, we want to keep it alive in background
|
@SuppressLint("StaticFieldLeak") // this is a keyboard, we want to keep it alive in background
|
||||||
private static final KeyboardSwitcher sInstance = new KeyboardSwitcher();
|
private static final KeyboardSwitcher sInstance = new KeyboardSwitcher();
|
||||||
|
@ -113,21 +114,29 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// todo: maybe we can remove this after removing old setting?
|
||||||
public void forceUpdateKeyboardTheme(@NonNull Context displayContext) {
|
public void forceUpdateKeyboardTheme(@NonNull Context displayContext) {
|
||||||
Settings settings = Settings.getInstance();
|
Settings settings = Settings.getInstance();
|
||||||
settings.loadSettings(displayContext, settings.getCurrent().mLocale, settings.getCurrent().mInputAttributes);
|
settings.loadSettings(displayContext, settings.getCurrent().mLocale, settings.getCurrent().mInputAttributes);
|
||||||
|
final boolean showing = mLatinIME.isInputViewShown();
|
||||||
|
if (showing)
|
||||||
|
mLatinIME.hideWindow();
|
||||||
mLatinIME.setInputView(onCreateInputView(displayContext, mIsHardwareAcceleratedDrawingEnabled));
|
mLatinIME.setInputView(onCreateInputView(displayContext, mIsHardwareAcceleratedDrawingEnabled));
|
||||||
|
if (showing)
|
||||||
|
mLatinIME.showWindow(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean updateKeyboardThemeAndContextThemeWrapper(final Context context, final KeyboardTheme keyboardTheme) {
|
private boolean updateKeyboardThemeAndContextThemeWrapper(final Context context, final KeyboardTheme keyboardTheme) {
|
||||||
final Resources res = context.getResources();
|
final Resources res = context.getResources();
|
||||||
if (mThemeContext == null
|
if (mThemeNeedsReload
|
||||||
|
|| mThemeContext == null
|
||||||
|| !keyboardTheme.equals(mKeyboardTheme)
|
|| !keyboardTheme.equals(mKeyboardTheme)
|
||||||
|| mCurrentDpi != res.getDisplayMetrics().densityDpi
|
|| mCurrentDpi != res.getDisplayMetrics().densityDpi
|
||||||
|| mCurrentOrientation != res.getConfiguration().orientation
|
|| mCurrentOrientation != res.getConfiguration().orientation
|
||||||
|| (mCurrentUiMode & Configuration.UI_MODE_NIGHT_MASK) != (res.getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK)
|
|| (mCurrentUiMode & Configuration.UI_MODE_NIGHT_MASK) != (res.getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK)
|
||||||
|| !mThemeContext.getResources().equals(res)
|
|| !mThemeContext.getResources().equals(res)
|
||||||
|| Settings.getValues().mColors.haveColorsChanged(context)) {
|
|| Settings.getValues().mColors.haveColorsChanged(context)) {
|
||||||
|
mThemeNeedsReload = false;
|
||||||
mKeyboardTheme = keyboardTheme;
|
mKeyboardTheme = keyboardTheme;
|
||||||
mThemeContext = new ContextThemeWrapper(context, keyboardTheme.mStyleId);
|
mThemeContext = new ContextThemeWrapper(context, keyboardTheme.mStyleId);
|
||||||
mCurrentUiMode = res.getConfiguration().uiMode;
|
mCurrentUiMode = res.getConfiguration().uiMode;
|
||||||
|
@ -719,4 +728,17 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
|
||||||
public String getLocaleAndConfidenceInfo() {
|
public String getLocaleAndConfidenceInfo() {
|
||||||
return mLatinIME.getLocaleAndConfidenceInfo();
|
return mLatinIME.getLocaleAndConfidenceInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Marks the theme as outdated. The theme will be reloaded next time the keyboard is shown.
|
||||||
|
* If the keyboard is currently showing, theme will be reloaded immediately. */
|
||||||
|
public void setThemeNeedsReload() {
|
||||||
|
mThemeNeedsReload = true;
|
||||||
|
if (mLatinIME == null || !mLatinIME.isInputViewShown())
|
||||||
|
return; // will be reloaded right before showing IME
|
||||||
|
|
||||||
|
// Hide and show IME, showing will trigger the reload.
|
||||||
|
// Reloading while IME is shown is glitchy, and hiding / showing is so fast the user shouldn't notice.
|
||||||
|
mLatinIME.hideWindow();
|
||||||
|
mLatinIME.showWindow(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,6 @@ import helium314.keyboard.latin.utils.isBrightColor
|
||||||
import helium314.keyboard.latin.utils.isGoodContrast
|
import helium314.keyboard.latin.utils.isGoodContrast
|
||||||
import helium314.keyboard.latin.utils.prefs
|
import helium314.keyboard.latin.utils.prefs
|
||||||
import helium314.keyboard.settings.SettingsActivity
|
import helium314.keyboard.settings.SettingsActivity
|
||||||
import helium314.keyboard.settings.keyboardNeedsReload
|
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
import kotlinx.serialization.json.Json
|
import kotlinx.serialization.json.Json
|
||||||
import java.util.EnumMap
|
import java.util.EnumMap
|
||||||
|
@ -352,7 +351,7 @@ private constructor(val themeId: Int, @JvmField val mStyleId: Int) {
|
||||||
val key = Settings.PREF_USER_COLORS_PREFIX + themeName
|
val key = Settings.PREF_USER_COLORS_PREFIX + themeName
|
||||||
val value = Json.encodeToString(colors.filter { it.color != null || it.auto == false })
|
val value = Json.encodeToString(colors.filter { it.color != null || it.auto == false })
|
||||||
prefs.edit().putString(key, value).apply()
|
prefs.edit().putString(key, value).apply()
|
||||||
keyboardNeedsReload = true
|
KeyboardSwitcher.getInstance().setThemeNeedsReload()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun readUserColors(prefs: SharedPreferences, themeName: String): List<ColorSetting> {
|
fun readUserColors(prefs: SharedPreferences, themeName: String): List<ColorSetting> {
|
||||||
|
@ -363,7 +362,7 @@ private constructor(val themeId: Int, @JvmField val mStyleId: Int) {
|
||||||
fun writeUserMoreColors(prefs: SharedPreferences, themeName: String, value: Int) {
|
fun writeUserMoreColors(prefs: SharedPreferences, themeName: String, value: Int) {
|
||||||
val key = Settings.PREF_USER_MORE_COLORS_PREFIX + themeName
|
val key = Settings.PREF_USER_MORE_COLORS_PREFIX + themeName
|
||||||
prefs.edit().putInt(key, value).apply()
|
prefs.edit().putInt(key, value).apply()
|
||||||
keyboardNeedsReload = true
|
KeyboardSwitcher.getInstance().setThemeNeedsReload()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun readUserMoreColors(prefs: SharedPreferences, themeName: String): Int {
|
fun readUserMoreColors(prefs: SharedPreferences, themeName: String): Int {
|
||||||
|
@ -374,7 +373,7 @@ private constructor(val themeId: Int, @JvmField val mStyleId: Int) {
|
||||||
fun writeUserAllColors(prefs: SharedPreferences, themeName: String, colorMap: EnumMap<ColorType, Int>) {
|
fun writeUserAllColors(prefs: SharedPreferences, themeName: String, colorMap: EnumMap<ColorType, Int>) {
|
||||||
val key = Settings.PREF_USER_ALL_COLORS_PREFIX + themeName
|
val key = Settings.PREF_USER_ALL_COLORS_PREFIX + themeName
|
||||||
prefs.edit().putString(key, colorMap.map { "${it.key},${it.value}" }.joinToString(";")).apply()
|
prefs.edit().putString(key, colorMap.map { "${it.key},${it.value}" }.joinToString(";")).apply()
|
||||||
keyboardNeedsReload = true
|
KeyboardSwitcher.getInstance().setThemeNeedsReload()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun readUserAllColors(prefs: SharedPreferences, themeName: String): EnumMap<ColorType, Int> {
|
fun readUserAllColors(prefs: SharedPreferences, themeName: String): EnumMap<ColorType, Int> {
|
||||||
|
|
|
@ -89,7 +89,6 @@ import helium314.keyboard.latin.utils.SubtypeLocaleUtils;
|
||||||
import helium314.keyboard.latin.utils.SubtypeSettings;
|
import helium314.keyboard.latin.utils.SubtypeSettings;
|
||||||
import helium314.keyboard.latin.utils.ViewLayoutUtils;
|
import helium314.keyboard.latin.utils.ViewLayoutUtils;
|
||||||
import helium314.keyboard.settings.SettingsActivity;
|
import helium314.keyboard.settings.SettingsActivity;
|
||||||
import helium314.keyboard.settings.SettingsActivityKt;
|
|
||||||
import kotlin.collections.CollectionsKt;
|
import kotlin.collections.CollectionsKt;
|
||||||
|
|
||||||
import java.io.FileDescriptor;
|
import java.io.FileDescriptor;
|
||||||
|
@ -899,8 +898,6 @@ public class LatinIME extends InputMethodService implements
|
||||||
void onStartInputViewInternal(final EditorInfo editorInfo, final boolean restarting) {
|
void onStartInputViewInternal(final EditorInfo editorInfo, final boolean restarting) {
|
||||||
super.onStartInputView(editorInfo, restarting);
|
super.onStartInputView(editorInfo, restarting);
|
||||||
|
|
||||||
reloadIfNecessary();
|
|
||||||
|
|
||||||
mDictionaryFacilitator.onStartInput();
|
mDictionaryFacilitator.onStartInput();
|
||||||
// Switch to the null consumer to handle cases leading to early exit below, for which we
|
// Switch to the null consumer to handle cases leading to early exit below, for which we
|
||||||
// also wouldn't be consuming gesture data.
|
// also wouldn't be consuming gesture data.
|
||||||
|
@ -1975,13 +1972,4 @@ public class LatinIME extends InputMethodService implements
|
||||||
// deallocateMemory always called on hiding, and should not be called when showing
|
// deallocateMemory always called on hiding, and should not be called when showing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void reloadIfNecessary() {
|
|
||||||
// better do the reload when showing the keyboard next time, and not on settings change
|
|
||||||
if (SettingsActivityKt.keyboardNeedsReload) {
|
|
||||||
KeyboardLayoutSet.onKeyboardThemeChanged();
|
|
||||||
mKeyboardSwitcher.forceUpdateKeyboardTheme(mDisplayContext);
|
|
||||||
SettingsActivityKt.keyboardNeedsReload = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,6 @@ import helium314.keyboard.latin.common.encodeBase36
|
||||||
import helium314.keyboard.latin.settings.Settings
|
import helium314.keyboard.latin.settings.Settings
|
||||||
import helium314.keyboard.latin.utils.LayoutType.Companion.folder
|
import helium314.keyboard.latin.utils.LayoutType.Companion.folder
|
||||||
import helium314.keyboard.latin.utils.ScriptUtils.script
|
import helium314.keyboard.latin.utils.ScriptUtils.script
|
||||||
import helium314.keyboard.settings.keyboardNeedsReload
|
|
||||||
import kotlinx.serialization.SerializationException
|
import kotlinx.serialization.SerializationException
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
|
@ -174,7 +173,7 @@ object LayoutUtilsCustom {
|
||||||
getLayoutFile(layoutName, layoutType, context).delete()
|
getLayoutFile(layoutName, layoutType, context).delete()
|
||||||
onLayoutFileChanged()
|
onLayoutFileChanged()
|
||||||
SubtypeSettings.onRenameLayout(layoutType, layoutName, null, context)
|
SubtypeSettings.onRenameLayout(layoutType, layoutName, null, context)
|
||||||
keyboardNeedsReload = true
|
KeyboardSwitcher.getInstance().setThemeNeedsReload()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getDisplayName(layoutName: String) =
|
fun getDisplayName(layoutName: String) =
|
||||||
|
|
|
@ -24,6 +24,7 @@ import androidx.compose.ui.platform.ComposeView
|
||||||
import androidx.core.view.ViewCompat
|
import androidx.core.view.ViewCompat
|
||||||
import androidx.core.view.isGone
|
import androidx.core.view.isGone
|
||||||
import helium314.keyboard.compat.locale
|
import helium314.keyboard.compat.locale
|
||||||
|
import helium314.keyboard.keyboard.KeyboardSwitcher
|
||||||
import helium314.keyboard.latin.BuildConfig
|
import helium314.keyboard.latin.BuildConfig
|
||||||
import helium314.keyboard.latin.InputAttributes
|
import helium314.keyboard.latin.InputAttributes
|
||||||
import helium314.keyboard.latin.R
|
import helium314.keyboard.latin.R
|
||||||
|
@ -173,7 +174,8 @@ class SettingsActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferen
|
||||||
override fun onPause() {
|
override fun onPause() {
|
||||||
super.onPause()
|
super.onPause()
|
||||||
paused = true
|
paused = true
|
||||||
if (forceNight != null || forceTheme != null) keyboardNeedsReload = true
|
if (forceNight != null || forceTheme != null)
|
||||||
|
KeyboardSwitcher.getInstance().setThemeNeedsReload()
|
||||||
forceNight = false
|
forceNight = false
|
||||||
forceTheme = null
|
forceTheme = null
|
||||||
}
|
}
|
||||||
|
@ -186,7 +188,7 @@ class SettingsActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferen
|
||||||
fun setForceTheme(theme: String?, night: Boolean?) {
|
fun setForceTheme(theme: String?, night: Boolean?) {
|
||||||
if (paused) return
|
if (paused) return
|
||||||
if (forceTheme != theme || forceNight != night) {
|
if (forceTheme != theme || forceNight != night) {
|
||||||
keyboardNeedsReload = true
|
KeyboardSwitcher.getInstance().setThemeNeedsReload()
|
||||||
}
|
}
|
||||||
forceTheme = theme
|
forceTheme = theme
|
||||||
forceNight = night
|
forceNight = night
|
||||||
|
@ -240,6 +242,3 @@ class SettingsActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferen
|
||||||
prefChanged.value++
|
prefChanged.value++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@JvmField
|
|
||||||
var keyboardNeedsReload = false
|
|
||||||
|
|
|
@ -38,6 +38,7 @@ import androidx.compose.ui.text.input.TextFieldValue
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import helium314.keyboard.keyboard.ColorSetting
|
import helium314.keyboard.keyboard.ColorSetting
|
||||||
|
import helium314.keyboard.keyboard.KeyboardSwitcher
|
||||||
import helium314.keyboard.keyboard.KeyboardTheme
|
import helium314.keyboard.keyboard.KeyboardTheme
|
||||||
import helium314.keyboard.latin.R
|
import helium314.keyboard.latin.R
|
||||||
import helium314.keyboard.latin.common.ColorType
|
import helium314.keyboard.latin.common.ColorType
|
||||||
|
@ -56,7 +57,6 @@ import helium314.keyboard.settings.SettingsActivity
|
||||||
import helium314.keyboard.settings.SettingsDestination
|
import helium314.keyboard.settings.SettingsDestination
|
||||||
import helium314.keyboard.settings.Theme
|
import helium314.keyboard.settings.Theme
|
||||||
import helium314.keyboard.settings.filePicker
|
import helium314.keyboard.settings.filePicker
|
||||||
import helium314.keyboard.settings.keyboardNeedsReload
|
|
||||||
import helium314.keyboard.settings.previewDark
|
import helium314.keyboard.settings.previewDark
|
||||||
import helium314.keyboard.settings.screens.SaveThoseColors
|
import helium314.keyboard.settings.screens.SaveThoseColors
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
@ -187,7 +187,7 @@ private fun AddColorRow(onDismissRequest: () -> Unit, userColors: Collection<Str
|
||||||
onDismissRequest()
|
onDismissRequest()
|
||||||
prefs.edit().putString(prefKey, textValue.text).apply()
|
prefs.edit().putString(prefKey, textValue.text).apply()
|
||||||
SettingsDestination.navigateTo(targetScreen)
|
SettingsDestination.navigateTo(targetScreen)
|
||||||
keyboardNeedsReload = true
|
KeyboardSwitcher.getInstance().setThemeNeedsReload()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -203,7 +203,7 @@ private fun ColorItemRow(onDismissRequest: () -> Unit, item: String, isSelected:
|
||||||
.clickable {
|
.clickable {
|
||||||
onDismissRequest()
|
onDismissRequest()
|
||||||
prefs.edit().putString(prefKey, item).apply()
|
prefs.edit().putString(prefKey, item).apply()
|
||||||
keyboardNeedsReload = true
|
KeyboardSwitcher.getInstance().setThemeNeedsReload()
|
||||||
}
|
}
|
||||||
.padding(start = 6.dp)
|
.padding(start = 6.dp)
|
||||||
.heightIn(min = 40.dp)
|
.heightIn(min = 40.dp)
|
||||||
|
@ -213,7 +213,7 @@ private fun ColorItemRow(onDismissRequest: () -> Unit, item: String, isSelected:
|
||||||
onClick = {
|
onClick = {
|
||||||
onDismissRequest()
|
onDismissRequest()
|
||||||
prefs.edit().putString(prefKey, item).apply()
|
prefs.edit().putString(prefKey, item).apply()
|
||||||
keyboardNeedsReload = true
|
KeyboardSwitcher.getInstance().setThemeNeedsReload()
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
|
@ -239,7 +239,7 @@ private fun ColorItemRow(onDismissRequest: () -> Unit, item: String, isSelected:
|
||||||
.remove(Settings.PREF_USER_MORE_COLORS_PREFIX + item).apply()
|
.remove(Settings.PREF_USER_MORE_COLORS_PREFIX + item).apply()
|
||||||
if (isSelected)
|
if (isSelected)
|
||||||
prefs.edit().remove(prefKey).apply()
|
prefs.edit().remove(prefKey).apply()
|
||||||
keyboardNeedsReload = true
|
KeyboardSwitcher.getInstance().setThemeNeedsReload()
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ import androidx.compose.ui.platform.LocalDensity
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.input.TextFieldValue
|
import androidx.compose.ui.text.input.TextFieldValue
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
|
import helium314.keyboard.keyboard.KeyboardSwitcher
|
||||||
import helium314.keyboard.latin.R
|
import helium314.keyboard.latin.R
|
||||||
import helium314.keyboard.latin.utils.LayoutType
|
import helium314.keyboard.latin.utils.LayoutType
|
||||||
import helium314.keyboard.latin.utils.LayoutUtilsCustom
|
import helium314.keyboard.latin.utils.LayoutUtilsCustom
|
||||||
|
@ -29,7 +30,6 @@ import helium314.keyboard.settings.CloseIcon
|
||||||
import helium314.keyboard.settings.SettingsActivity
|
import helium314.keyboard.settings.SettingsActivity
|
||||||
import helium314.keyboard.settings.Theme
|
import helium314.keyboard.settings.Theme
|
||||||
import helium314.keyboard.settings.initPreview
|
import helium314.keyboard.settings.initPreview
|
||||||
import helium314.keyboard.settings.keyboardNeedsReload
|
|
||||||
import helium314.keyboard.settings.previewDark
|
import helium314.keyboard.settings.previewDark
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
|
@ -77,7 +77,7 @@ fun LayoutEditDialog(
|
||||||
LayoutUtilsCustom.onLayoutFileChanged()
|
LayoutUtilsCustom.onLayoutFileChanged()
|
||||||
onEdited(newLayoutName)
|
onEdited(newLayoutName)
|
||||||
(ctx.getActivity() as? SettingsActivity)?.prefChanged?.value = 555
|
(ctx.getActivity() as? SettingsActivity)?.prefChanged?.value = 555
|
||||||
keyboardNeedsReload = true
|
KeyboardSwitcher.getInstance().setThemeNeedsReload()
|
||||||
},
|
},
|
||||||
confirmButtonText = stringResource(R.string.save),
|
confirmButtonText = stringResource(R.string.save),
|
||||||
initialText = startContent ?: LayoutUtilsCustom.getLayoutFile(initialLayoutName, layoutType, ctx).readText(),
|
initialText = startContent ?: LayoutUtilsCustom.getLayoutFile(initialLayoutName, layoutType, ctx).readText(),
|
||||||
|
|
|
@ -32,6 +32,7 @@ import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.input.TextFieldValue
|
import androidx.compose.ui.text.input.TextFieldValue
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
|
import helium314.keyboard.keyboard.KeyboardSwitcher
|
||||||
import helium314.keyboard.latin.R
|
import helium314.keyboard.latin.R
|
||||||
import helium314.keyboard.latin.common.Constants.Subtype.ExtraValue
|
import helium314.keyboard.latin.common.Constants.Subtype.ExtraValue
|
||||||
import helium314.keyboard.latin.settings.Defaults.default
|
import helium314.keyboard.latin.settings.Defaults.default
|
||||||
|
@ -49,7 +50,6 @@ import helium314.keyboard.settings.EditButton
|
||||||
import helium314.keyboard.settings.Setting
|
import helium314.keyboard.settings.Setting
|
||||||
import helium314.keyboard.settings.SettingsActivity
|
import helium314.keyboard.settings.SettingsActivity
|
||||||
import helium314.keyboard.settings.Theme
|
import helium314.keyboard.settings.Theme
|
||||||
import helium314.keyboard.settings.keyboardNeedsReload
|
|
||||||
import helium314.keyboard.settings.layoutFilePicker
|
import helium314.keyboard.settings.layoutFilePicker
|
||||||
import helium314.keyboard.settings.layoutIntent
|
import helium314.keyboard.settings.layoutIntent
|
||||||
import helium314.keyboard.settings.previewDark
|
import helium314.keyboard.settings.previewDark
|
||||||
|
@ -167,7 +167,7 @@ private fun LayoutItemRow(
|
||||||
.clickable {
|
.clickable {
|
||||||
onDismissRequest()
|
onDismissRequest()
|
||||||
Settings.writeDefaultLayoutName(layoutName, layoutType, prefs)
|
Settings.writeDefaultLayoutName(layoutName, layoutType, prefs)
|
||||||
keyboardNeedsReload = true
|
KeyboardSwitcher.getInstance().setThemeNeedsReload()
|
||||||
}
|
}
|
||||||
.padding(start = 6.dp)
|
.padding(start = 6.dp)
|
||||||
.heightIn(min = 40.dp)
|
.heightIn(min = 40.dp)
|
||||||
|
@ -177,7 +177,7 @@ private fun LayoutItemRow(
|
||||||
onClick = {
|
onClick = {
|
||||||
onDismissRequest()
|
onDismissRequest()
|
||||||
Settings.writeDefaultLayoutName(layoutName, layoutType, prefs)
|
Settings.writeDefaultLayoutName(layoutName, layoutType, prefs)
|
||||||
keyboardNeedsReload = true
|
KeyboardSwitcher.getInstance().setThemeNeedsReload()
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
|
|
|
@ -19,6 +19,7 @@ import androidx.compose.runtime.saveable.rememberSaveable
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import helium314.keyboard.keyboard.KeyboardSwitcher
|
||||||
import helium314.keyboard.latin.R
|
import helium314.keyboard.latin.R
|
||||||
import helium314.keyboard.latin.common.FileUtils
|
import helium314.keyboard.latin.common.FileUtils
|
||||||
import helium314.keyboard.latin.settings.Defaults
|
import helium314.keyboard.latin.settings.Defaults
|
||||||
|
@ -30,7 +31,6 @@ import helium314.keyboard.settings.Setting
|
||||||
import helium314.keyboard.settings.SettingsActivity
|
import helium314.keyboard.settings.SettingsActivity
|
||||||
import helium314.keyboard.settings.dialogs.ConfirmationDialog
|
import helium314.keyboard.settings.dialogs.ConfirmationDialog
|
||||||
import helium314.keyboard.settings.dialogs.InfoDialog
|
import helium314.keyboard.settings.dialogs.InfoDialog
|
||||||
import helium314.keyboard.settings.keyboardNeedsReload
|
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ fun BackgroundImagePref(setting: Setting, isLandscape: Boolean) {
|
||||||
onNeutral = {
|
onNeutral = {
|
||||||
getFile().delete()
|
getFile().delete()
|
||||||
Settings.clearCachedBackgroundImages()
|
Settings.clearCachedBackgroundImages()
|
||||||
keyboardNeedsReload = true
|
KeyboardSwitcher.getInstance().setThemeNeedsReload()
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -117,7 +117,7 @@ fun BackgroundImagePref(setting: Setting, isLandscape: Boolean) {
|
||||||
private fun setBackgroundImage(ctx: Context, uri: Uri, isNight: Boolean, isLandscape: Boolean): Boolean {
|
private fun setBackgroundImage(ctx: Context, uri: Uri, isNight: Boolean, isLandscape: Boolean): Boolean {
|
||||||
val imageFile = Settings.getCustomBackgroundFile(ctx, isNight, isLandscape)
|
val imageFile = Settings.getCustomBackgroundFile(ctx, isNight, isLandscape)
|
||||||
FileUtils.copyContentUriToNewFile(uri, ctx, imageFile)
|
FileUtils.copyContentUriToNewFile(uri, ctx, imageFile)
|
||||||
keyboardNeedsReload = true
|
KeyboardSwitcher.getInstance().setThemeNeedsReload()
|
||||||
try {
|
try {
|
||||||
BitmapFactory.decodeFile(imageFile.absolutePath)
|
BitmapFactory.decodeFile(imageFile.absolutePath)
|
||||||
} catch (_: Exception) {
|
} catch (_: Exception) {
|
||||||
|
|
|
@ -12,6 +12,7 @@ import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import helium314.keyboard.dictionarypack.DictionaryPackConstants
|
import helium314.keyboard.dictionarypack.DictionaryPackConstants
|
||||||
|
import helium314.keyboard.keyboard.KeyboardSwitcher
|
||||||
import helium314.keyboard.keyboard.internal.keyboard_parser.LAYOUT_NUMBER
|
import helium314.keyboard.keyboard.internal.keyboard_parser.LAYOUT_NUMBER
|
||||||
import helium314.keyboard.keyboard.internal.keyboard_parser.LAYOUT_NUMPAD
|
import helium314.keyboard.keyboard.internal.keyboard_parser.LAYOUT_NUMPAD
|
||||||
import helium314.keyboard.keyboard.internal.keyboard_parser.LAYOUT_NUMPAD_LANDSCAPE
|
import helium314.keyboard.keyboard.internal.keyboard_parser.LAYOUT_NUMPAD_LANDSCAPE
|
||||||
|
@ -39,7 +40,6 @@ import helium314.keyboard.settings.SettingsActivity
|
||||||
import helium314.keyboard.settings.dialogs.ConfirmationDialog
|
import helium314.keyboard.settings.dialogs.ConfirmationDialog
|
||||||
import helium314.keyboard.settings.dialogs.InfoDialog
|
import helium314.keyboard.settings.dialogs.InfoDialog
|
||||||
import helium314.keyboard.settings.filePicker
|
import helium314.keyboard.settings.filePicker
|
||||||
import helium314.keyboard.settings.keyboardNeedsReload
|
|
||||||
import kotlinx.serialization.json.Json
|
import kotlinx.serialization.json.Json
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.FileInputStream
|
import java.io.FileInputStream
|
||||||
|
@ -177,7 +177,7 @@ fun BackupRestorePreference(setting: Setting) {
|
||||||
ctx.getActivity()?.sendBroadcast(newDictBroadcast)
|
ctx.getActivity()?.sendBroadcast(newDictBroadcast)
|
||||||
LayoutUtilsCustom.onLayoutFileChanged()
|
LayoutUtilsCustom.onLayoutFileChanged()
|
||||||
(ctx.getActivity() as? SettingsActivity)?.prefChanged?.value = 210 // for settings reload
|
(ctx.getActivity() as? SettingsActivity)?.prefChanged?.value = 210 // for settings reload
|
||||||
keyboardNeedsReload = true
|
KeyboardSwitcher.getInstance().setThemeNeedsReload()
|
||||||
}
|
}
|
||||||
Preference(name = setting.title, onClick = { showDialog = true })
|
Preference(name = setting.title, onClick = { showDialog = true })
|
||||||
if (showDialog) {
|
if (showDialog) {
|
||||||
|
|
|
@ -10,11 +10,11 @@ import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.remember
|
|
||||||
import androidx.compose.runtime.saveable.rememberSaveable
|
import androidx.compose.runtime.saveable.rememberSaveable
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import helium314.keyboard.keyboard.KeyboardSwitcher
|
||||||
import helium314.keyboard.latin.R
|
import helium314.keyboard.latin.R
|
||||||
import helium314.keyboard.latin.common.FileUtils
|
import helium314.keyboard.latin.common.FileUtils
|
||||||
import helium314.keyboard.latin.settings.Settings
|
import helium314.keyboard.latin.settings.Settings
|
||||||
|
@ -22,7 +22,6 @@ import helium314.keyboard.latin.utils.DeviceProtectedUtils
|
||||||
import helium314.keyboard.settings.Setting
|
import helium314.keyboard.settings.Setting
|
||||||
import helium314.keyboard.settings.dialogs.ConfirmationDialog
|
import helium314.keyboard.settings.dialogs.ConfirmationDialog
|
||||||
import helium314.keyboard.settings.dialogs.InfoDialog
|
import helium314.keyboard.settings.dialogs.InfoDialog
|
||||||
import helium314.keyboard.settings.keyboardNeedsReload
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
@ -41,7 +40,7 @@ fun CustomFontPreference(setting: Setting) {
|
||||||
fontFile.delete()
|
fontFile.delete()
|
||||||
tempFile.renameTo(fontFile)
|
tempFile.renameTo(fontFile)
|
||||||
Settings.clearCachedTypeface()
|
Settings.clearCachedTypeface()
|
||||||
keyboardNeedsReload = true
|
KeyboardSwitcher.getInstance().setThemeNeedsReload()
|
||||||
} catch (_: Exception) {
|
} catch (_: Exception) {
|
||||||
showErrorDialog = true
|
showErrorDialog = true
|
||||||
tempFile.delete()
|
tempFile.delete()
|
||||||
|
@ -66,7 +65,7 @@ fun CustomFontPreference(setting: Setting) {
|
||||||
showDialog = false
|
showDialog = false
|
||||||
fontFile.delete()
|
fontFile.delete()
|
||||||
Settings.clearCachedTypeface()
|
Settings.clearCachedTypeface()
|
||||||
keyboardNeedsReload = true
|
KeyboardSwitcher.getInstance().setThemeNeedsReload()
|
||||||
},
|
},
|
||||||
neutralButtonText = stringResource(R.string.delete),
|
neutralButtonText = stringResource(R.string.delete),
|
||||||
confirmButtonText = stringResource(R.string.load),
|
confirmButtonText = stringResource(R.string.load),
|
||||||
|
|
|
@ -13,6 +13,7 @@ import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import helium314.keyboard.keyboard.KeyboardSwitcher
|
||||||
import helium314.keyboard.keyboard.internal.KeyboardIconsSet
|
import helium314.keyboard.keyboard.internal.KeyboardIconsSet
|
||||||
import helium314.keyboard.latin.R
|
import helium314.keyboard.latin.R
|
||||||
import helium314.keyboard.latin.common.Constants.Separators
|
import helium314.keyboard.latin.common.Constants.Separators
|
||||||
|
@ -20,7 +21,6 @@ import helium314.keyboard.latin.utils.getStringResourceOrName
|
||||||
import helium314.keyboard.latin.utils.prefs
|
import helium314.keyboard.latin.utils.prefs
|
||||||
import helium314.keyboard.settings.Setting
|
import helium314.keyboard.settings.Setting
|
||||||
import helium314.keyboard.settings.dialogs.ReorderDialog
|
import helium314.keyboard.settings.dialogs.ReorderDialog
|
||||||
import helium314.keyboard.settings.keyboardNeedsReload
|
|
||||||
import helium314.keyboard.settings.screens.GetIcon
|
import helium314.keyboard.settings.screens.GetIcon
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
@ -42,7 +42,7 @@ fun ReorderSwitchPreference(setting: Setting, default: String) {
|
||||||
onConfirmed = { reorderedItems ->
|
onConfirmed = { reorderedItems ->
|
||||||
val value = reorderedItems.joinToString(Separators.ENTRY) { it.name + Separators.KV + it.state }
|
val value = reorderedItems.joinToString(Separators.ENTRY) { it.name + Separators.KV + it.state }
|
||||||
prefs.edit().putString(setting.key, value).apply()
|
prefs.edit().putString(setting.key, value).apply()
|
||||||
keyboardNeedsReload = true
|
KeyboardSwitcher.getInstance().setThemeNeedsReload()
|
||||||
},
|
},
|
||||||
onDismissRequest = { showDialog = false },
|
onDismissRequest = { showDialog = false },
|
||||||
onNeutral = { prefs.edit().remove(setting.key).apply() },
|
onNeutral = { prefs.edit().remove(setting.key).apply() },
|
||||||
|
|
|
@ -16,6 +16,7 @@ import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import helium314.keyboard.keyboard.KeyboardActionListener
|
import helium314.keyboard.keyboard.KeyboardActionListener
|
||||||
import helium314.keyboard.keyboard.KeyboardLayoutSet
|
import helium314.keyboard.keyboard.KeyboardLayoutSet
|
||||||
|
import helium314.keyboard.keyboard.KeyboardSwitcher
|
||||||
import helium314.keyboard.keyboard.internal.keyboard_parser.POPUP_KEYS_ALL
|
import helium314.keyboard.keyboard.internal.keyboard_parser.POPUP_KEYS_ALL
|
||||||
import helium314.keyboard.keyboard.internal.keyboard_parser.POPUP_KEYS_MAIN
|
import helium314.keyboard.keyboard.internal.keyboard_parser.POPUP_KEYS_MAIN
|
||||||
import helium314.keyboard.keyboard.internal.keyboard_parser.POPUP_KEYS_MORE
|
import helium314.keyboard.keyboard.internal.keyboard_parser.POPUP_KEYS_MORE
|
||||||
|
@ -42,7 +43,6 @@ import helium314.keyboard.settings.preferences.SliderPreference
|
||||||
import helium314.keyboard.settings.preferences.SwitchPreference
|
import helium314.keyboard.settings.preferences.SwitchPreference
|
||||||
import helium314.keyboard.settings.Theme
|
import helium314.keyboard.settings.Theme
|
||||||
import helium314.keyboard.settings.dialogs.TextInputDialog
|
import helium314.keyboard.settings.dialogs.TextInputDialog
|
||||||
import helium314.keyboard.settings.keyboardNeedsReload
|
|
||||||
import helium314.keyboard.settings.preferences.BackupRestorePreference
|
import helium314.keyboard.settings.preferences.BackupRestorePreference
|
||||||
import helium314.keyboard.settings.preferences.LoadGestureLibPreference
|
import helium314.keyboard.settings.preferences.LoadGestureLibPreference
|
||||||
import helium314.keyboard.settings.previewDark
|
import helium314.keyboard.settings.previewDark
|
||||||
|
@ -221,7 +221,7 @@ fun createAdvancedSettings(context: Context) = listOf(
|
||||||
else -> "version unknown"
|
else -> "version unknown"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onValueChanged = { keyboardNeedsReload = true }
|
onValueChanged = { KeyboardSwitcher.getInstance().setThemeNeedsReload() }
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
Setting(context, Settings.PREF_URL_DETECTION, R.string.url_detection_title, R.string.url_detection_summary) {
|
Setting(context, Settings.PREF_URL_DETECTION, R.string.url_detection_title, R.string.url_detection_summary) {
|
||||||
|
|
|
@ -16,6 +16,7 @@ import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import helium314.keyboard.keyboard.KeyboardSwitcher
|
import helium314.keyboard.keyboard.KeyboardSwitcher
|
||||||
import helium314.keyboard.keyboard.KeyboardTheme
|
import helium314.keyboard.keyboard.KeyboardTheme
|
||||||
|
import helium314.keyboard.keyboard.internal.KeyboardIconsSet
|
||||||
import helium314.keyboard.latin.R
|
import helium314.keyboard.latin.R
|
||||||
import helium314.keyboard.latin.settings.Defaults
|
import helium314.keyboard.latin.settings.Defaults
|
||||||
import helium314.keyboard.latin.settings.Settings
|
import helium314.keyboard.latin.settings.Settings
|
||||||
|
@ -36,7 +37,6 @@ import helium314.keyboard.settings.dialogs.ColorThemePickerDialog
|
||||||
import helium314.keyboard.settings.dialogs.CustomizeIconsDialog
|
import helium314.keyboard.settings.dialogs.CustomizeIconsDialog
|
||||||
import helium314.keyboard.settings.dialogs.TextInputDialog
|
import helium314.keyboard.settings.dialogs.TextInputDialog
|
||||||
import helium314.keyboard.settings.initPreview
|
import helium314.keyboard.settings.initPreview
|
||||||
import helium314.keyboard.settings.keyboardNeedsReload
|
|
||||||
import helium314.keyboard.settings.preferences.BackgroundImagePref
|
import helium314.keyboard.settings.preferences.BackgroundImagePref
|
||||||
import helium314.keyboard.settings.preferences.CustomFontPreference
|
import helium314.keyboard.settings.preferences.CustomFontPreference
|
||||||
import helium314.keyboard.settings.previewDark
|
import helium314.keyboard.settings.previewDark
|
||||||
|
@ -116,7 +116,7 @@ fun createAppearanceSettings(context: Context) = listOf(
|
||||||
setting,
|
setting,
|
||||||
items,
|
items,
|
||||||
Defaults.PREF_ICON_STYLE
|
Defaults.PREF_ICON_STYLE
|
||||||
) { keyboardNeedsReload = true }
|
) { KeyboardSwitcher.getInstance().setThemeNeedsReload() }
|
||||||
},
|
},
|
||||||
Setting(context, Settings.PREF_CUSTOM_ICON_NAMES, R.string.customize_icons) { setting ->
|
Setting(context, Settings.PREF_CUSTOM_ICON_NAMES, R.string.customize_icons) { setting ->
|
||||||
var showDialog by rememberSaveable { mutableStateOf(false) }
|
var showDialog by rememberSaveable { mutableStateOf(false) }
|
||||||
|
@ -125,11 +125,11 @@ fun createAppearanceSettings(context: Context) = listOf(
|
||||||
onClick = { showDialog = true }
|
onClick = { showDialog = true }
|
||||||
)
|
)
|
||||||
if (showDialog) {
|
if (showDialog) {
|
||||||
if (keyboardNeedsReload) {
|
/* if (keyboardNeedsReload) {
|
||||||
KeyboardSwitcher.getInstance().forceUpdateKeyboardTheme(LocalContext.current)
|
KeyboardSwitcher.getInstance().forceUpdateKeyboardTheme(LocalContext.current)
|
||||||
keyboardNeedsReload = false
|
keyboardNeedsReload = false
|
||||||
}
|
}
|
||||||
CustomizeIconsDialog(setting.key) { showDialog = false }
|
*/ CustomizeIconsDialog(setting.key) { showDialog = false }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Setting(context, Settings.PREF_THEME_COLORS, R.string.theme_colors) { setting ->
|
Setting(context, Settings.PREF_THEME_COLORS, R.string.theme_colors) { setting ->
|
||||||
|
@ -173,10 +173,10 @@ fun createAppearanceSettings(context: Context) = listOf(
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
Setting(context, Settings.PREF_THEME_KEY_BORDERS, R.string.key_borders) {
|
Setting(context, Settings.PREF_THEME_KEY_BORDERS, R.string.key_borders) {
|
||||||
SwitchPreference(it, Defaults.PREF_THEME_KEY_BORDERS)
|
SwitchPreference(it, Defaults.PREF_THEME_KEY_BORDERS) { KeyboardSwitcher.getInstance().setThemeNeedsReload() }
|
||||||
},
|
},
|
||||||
Setting(context, Settings.PREF_THEME_DAY_NIGHT, R.string.day_night_mode, R.string.day_night_mode_summary) {
|
Setting(context, Settings.PREF_THEME_DAY_NIGHT, R.string.day_night_mode, R.string.day_night_mode_summary) {
|
||||||
SwitchPreference(it, Defaults.PREF_THEME_DAY_NIGHT) { keyboardNeedsReload = true }
|
SwitchPreference(it, Defaults.PREF_THEME_DAY_NIGHT) { KeyboardSwitcher.getInstance().setThemeNeedsReload() }
|
||||||
},
|
},
|
||||||
Setting(context, Settings.PREF_NAVBAR_COLOR, R.string.theme_navbar, R.string.day_night_mode_summary) {
|
Setting(context, Settings.PREF_NAVBAR_COLOR, R.string.theme_navbar, R.string.day_night_mode_summary) {
|
||||||
SwitchPreference(it, Defaults.PREF_NAVBAR_COLOR)
|
SwitchPreference(it, Defaults.PREF_NAVBAR_COLOR)
|
||||||
|
@ -199,7 +199,7 @@ fun createAppearanceSettings(context: Context) = listOf(
|
||||||
default = Defaults.PREF_SPLIT_SPACER_SCALE,
|
default = Defaults.PREF_SPLIT_SPACER_SCALE,
|
||||||
range = 0.5f..2f,
|
range = 0.5f..2f,
|
||||||
description = { "${(100 * it).toInt()}%" }
|
description = { "${(100 * it).toInt()}%" }
|
||||||
) { keyboardNeedsReload = true }
|
) { KeyboardSwitcher.getInstance().setThemeNeedsReload() }
|
||||||
},
|
},
|
||||||
Setting(context, Settings.PREF_ENABLE_SPLIT_KEYBOARD_LANDSCAPE, R.string.enable_split_keyboard_landscape) {
|
Setting(context, Settings.PREF_ENABLE_SPLIT_KEYBOARD_LANDSCAPE, R.string.enable_split_keyboard_landscape) {
|
||||||
SwitchPreference(it, Defaults.PREF_ENABLE_SPLIT_KEYBOARD_LANDSCAPE) { KeyboardSwitcher.getInstance().reloadKeyboard() }
|
SwitchPreference(it, Defaults.PREF_ENABLE_SPLIT_KEYBOARD_LANDSCAPE) { KeyboardSwitcher.getInstance().reloadKeyboard() }
|
||||||
|
@ -211,10 +211,10 @@ fun createAppearanceSettings(context: Context) = listOf(
|
||||||
default = Defaults.PREF_SPLIT_SPACER_SCALE_LANDSCAPE,
|
default = Defaults.PREF_SPLIT_SPACER_SCALE_LANDSCAPE,
|
||||||
range = 0.5f..2f,
|
range = 0.5f..2f,
|
||||||
description = { "${(100 * it).toInt()}%" }
|
description = { "${(100 * it).toInt()}%" }
|
||||||
) { keyboardNeedsReload = true }
|
) { KeyboardSwitcher.getInstance().setThemeNeedsReload() }
|
||||||
},
|
},
|
||||||
Setting(context, Settings.PREF_NARROW_KEY_GAPS, R.string.prefs_narrow_key_gaps) {
|
Setting(context, Settings.PREF_NARROW_KEY_GAPS, R.string.prefs_narrow_key_gaps) {
|
||||||
SwitchPreference(it, Defaults.PREF_NARROW_KEY_GAPS) { keyboardNeedsReload = true }
|
SwitchPreference(it, Defaults.PREF_NARROW_KEY_GAPS) { KeyboardSwitcher.getInstance().setThemeNeedsReload() }
|
||||||
},
|
},
|
||||||
Setting(context, Settings.PREF_KEYBOARD_HEIGHT_SCALE, R.string.prefs_keyboard_height_scale) { setting ->
|
Setting(context, Settings.PREF_KEYBOARD_HEIGHT_SCALE, R.string.prefs_keyboard_height_scale) { setting ->
|
||||||
SliderPreference(
|
SliderPreference(
|
||||||
|
@ -223,7 +223,7 @@ fun createAppearanceSettings(context: Context) = listOf(
|
||||||
default = Defaults.PREF_KEYBOARD_HEIGHT_SCALE,
|
default = Defaults.PREF_KEYBOARD_HEIGHT_SCALE,
|
||||||
range = 0.5f..1.5f,
|
range = 0.5f..1.5f,
|
||||||
description = { "${(100 * it).toInt()}%" }
|
description = { "${(100 * it).toInt()}%" }
|
||||||
) { keyboardNeedsReload = true }
|
) { KeyboardSwitcher.getInstance().setThemeNeedsReload() }
|
||||||
},
|
},
|
||||||
Setting(context, Settings.PREF_BOTTOM_PADDING_SCALE, R.string.prefs_bottom_padding_scale) { setting ->
|
Setting(context, Settings.PREF_BOTTOM_PADDING_SCALE, R.string.prefs_bottom_padding_scale) { setting ->
|
||||||
SliderPreference(
|
SliderPreference(
|
||||||
|
@ -232,7 +232,7 @@ fun createAppearanceSettings(context: Context) = listOf(
|
||||||
default = Defaults.PREF_BOTTOM_PADDING_SCALE,
|
default = Defaults.PREF_BOTTOM_PADDING_SCALE,
|
||||||
range = 0f..5f,
|
range = 0f..5f,
|
||||||
description = { "${(100 * it).toInt()}%" }
|
description = { "${(100 * it).toInt()}%" }
|
||||||
) { keyboardNeedsReload = true }
|
) { KeyboardSwitcher.getInstance().setThemeNeedsReload() }
|
||||||
},
|
},
|
||||||
Setting(context, Settings.PREF_BOTTOM_PADDING_SCALE_LANDSCAPE, R.string.prefs_bottom_padding_scale_landscape) { setting ->
|
Setting(context, Settings.PREF_BOTTOM_PADDING_SCALE_LANDSCAPE, R.string.prefs_bottom_padding_scale_landscape) { setting ->
|
||||||
SliderPreference(
|
SliderPreference(
|
||||||
|
@ -241,7 +241,7 @@ fun createAppearanceSettings(context: Context) = listOf(
|
||||||
default = Defaults.PREF_BOTTOM_PADDING_SCALE_LANDSCAPE,
|
default = Defaults.PREF_BOTTOM_PADDING_SCALE_LANDSCAPE,
|
||||||
range = 0f..5f,
|
range = 0f..5f,
|
||||||
description = { "${(100 * it).toInt()}%" }
|
description = { "${(100 * it).toInt()}%" }
|
||||||
) { keyboardNeedsReload = true }
|
) { KeyboardSwitcher.getInstance().setThemeNeedsReload() }
|
||||||
},
|
},
|
||||||
Setting(context, Settings.PREF_SIDE_PADDING_SCALE, R.string.prefs_side_padding_scale) { setting ->
|
Setting(context, Settings.PREF_SIDE_PADDING_SCALE, R.string.prefs_side_padding_scale) { setting ->
|
||||||
SliderPreference(
|
SliderPreference(
|
||||||
|
@ -250,7 +250,7 @@ fun createAppearanceSettings(context: Context) = listOf(
|
||||||
default = Defaults.PREF_SIDE_PADDING_SCALE,
|
default = Defaults.PREF_SIDE_PADDING_SCALE,
|
||||||
range = 0f..3f,
|
range = 0f..3f,
|
||||||
description = { "${(100 * it).toInt()}%" }
|
description = { "${(100 * it).toInt()}%" }
|
||||||
) { keyboardNeedsReload = true }
|
) { KeyboardSwitcher.getInstance().setThemeNeedsReload() }
|
||||||
},
|
},
|
||||||
Setting(context, Settings.PREF_SIDE_PADDING_SCALE_LANDSCAPE, R.string.prefs_side_padding_scale_landscape) { setting ->
|
Setting(context, Settings.PREF_SIDE_PADDING_SCALE_LANDSCAPE, R.string.prefs_side_padding_scale_landscape) { setting ->
|
||||||
SliderPreference(
|
SliderPreference(
|
||||||
|
@ -259,7 +259,7 @@ fun createAppearanceSettings(context: Context) = listOf(
|
||||||
default = Defaults.PREF_SIDE_PADDING_SCALE_LANDSCAPE,
|
default = Defaults.PREF_SIDE_PADDING_SCALE_LANDSCAPE,
|
||||||
range = 0f..3f,
|
range = 0f..3f,
|
||||||
description = { "${(100 * it).toInt()}%" }
|
description = { "${(100 * it).toInt()}%" }
|
||||||
) { keyboardNeedsReload = true }
|
) { KeyboardSwitcher.getInstance().setThemeNeedsReload() }
|
||||||
},
|
},
|
||||||
Setting(context, Settings.PREF_SPACE_BAR_TEXT, R.string.prefs_space_bar_text) { setting ->
|
Setting(context, Settings.PREF_SPACE_BAR_TEXT, R.string.prefs_space_bar_text) { setting ->
|
||||||
var showDialog by rememberSaveable { mutableStateOf(false) }
|
var showDialog by rememberSaveable { mutableStateOf(false) }
|
||||||
|
@ -274,7 +274,7 @@ fun createAppearanceSettings(context: Context) = listOf(
|
||||||
onDismissRequest = { showDialog = false },
|
onDismissRequest = { showDialog = false },
|
||||||
onConfirmed = {
|
onConfirmed = {
|
||||||
prefs.edit().putString(setting.key, it).apply()
|
prefs.edit().putString(setting.key, it).apply()
|
||||||
keyboardNeedsReload = true
|
KeyboardSwitcher.getInstance().setThemeNeedsReload()
|
||||||
},
|
},
|
||||||
initialText = prefs.getString(setting.key, Defaults.PREF_SPACE_BAR_TEXT) ?: "",
|
initialText = prefs.getString(setting.key, Defaults.PREF_SPACE_BAR_TEXT) ?: "",
|
||||||
title = { Text(setting.title) },
|
title = { Text(setting.title) },
|
||||||
|
@ -292,7 +292,7 @@ fun createAppearanceSettings(context: Context) = listOf(
|
||||||
default = Defaults.PREF_FONT_SCALE,
|
default = Defaults.PREF_FONT_SCALE,
|
||||||
range = 0.5f..1.5f,
|
range = 0.5f..1.5f,
|
||||||
description = { "${(100 * it).toInt()}%" }
|
description = { "${(100 * it).toInt()}%" }
|
||||||
) { keyboardNeedsReload = true }
|
) { KeyboardSwitcher.getInstance().setThemeNeedsReload() }
|
||||||
},
|
},
|
||||||
Setting(context, Settings.PREF_EMOJI_FONT_SCALE, R.string.prefs_emoji_font_scale) { setting ->
|
Setting(context, Settings.PREF_EMOJI_FONT_SCALE, R.string.prefs_emoji_font_scale) { setting ->
|
||||||
SliderPreference(
|
SliderPreference(
|
||||||
|
@ -301,7 +301,7 @@ fun createAppearanceSettings(context: Context) = listOf(
|
||||||
default = Defaults.PREF_EMOJI_FONT_SCALE,
|
default = Defaults.PREF_EMOJI_FONT_SCALE,
|
||||||
range = 0.5f..1.5f,
|
range = 0.5f..1.5f,
|
||||||
description = { "${(100 * it).toInt()}%" }
|
description = { "${(100 * it).toInt()}%" }
|
||||||
) { keyboardNeedsReload = true }
|
) { KeyboardSwitcher.getInstance().setThemeNeedsReload() }
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
|
import helium314.keyboard.keyboard.KeyboardSwitcher
|
||||||
import helium314.keyboard.latin.BuildConfig
|
import helium314.keyboard.latin.BuildConfig
|
||||||
import helium314.keyboard.latin.DictionaryDumpBroadcastReceiver
|
import helium314.keyboard.latin.DictionaryDumpBroadcastReceiver
|
||||||
import helium314.keyboard.latin.DictionaryFacilitator
|
import helium314.keyboard.latin.DictionaryFacilitator
|
||||||
|
@ -24,7 +25,6 @@ import helium314.keyboard.settings.SearchSettingsScreen
|
||||||
import helium314.keyboard.settings.preferences.SwitchPreference
|
import helium314.keyboard.settings.preferences.SwitchPreference
|
||||||
import helium314.keyboard.settings.Theme
|
import helium314.keyboard.settings.Theme
|
||||||
import helium314.keyboard.settings.initPreview
|
import helium314.keyboard.settings.initPreview
|
||||||
import helium314.keyboard.settings.keyboardNeedsReload
|
|
||||||
import helium314.keyboard.settings.preferences.PreferenceCategory
|
import helium314.keyboard.settings.preferences.PreferenceCategory
|
||||||
import helium314.keyboard.settings.previewDark
|
import helium314.keyboard.settings.previewDark
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ private fun createDebugSettings(context: Context) = listOf(
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Setting(context, DebugSettings.PREF_SHOW_SUGGESTION_INFOS, R.string.prefs_show_suggestion_infos) {
|
Setting(context, DebugSettings.PREF_SHOW_SUGGESTION_INFOS, R.string.prefs_show_suggestion_infos) {
|
||||||
SwitchPreference(it, Defaults.PREF_SHOW_SUGGESTION_INFOS) { keyboardNeedsReload = true }
|
SwitchPreference(it, Defaults.PREF_SHOW_SUGGESTION_INFOS) { KeyboardSwitcher.getInstance().setThemeNeedsReload() }
|
||||||
},
|
},
|
||||||
Setting(context, DebugSettings.PREF_FORCE_NON_DISTINCT_MULTITOUCH, R.string.prefs_force_non_distinct_multitouch) {
|
Setting(context, DebugSettings.PREF_FORCE_NON_DISTINCT_MULTITOUCH, R.string.prefs_force_non_distinct_multitouch) {
|
||||||
SwitchPreference(it, Defaults.PREF_FORCE_NON_DISTINCT_MULTITOUCH) { needsRestart = true }
|
SwitchPreference(it, Defaults.PREF_FORCE_NON_DISTINCT_MULTITOUCH) { needsRestart = true }
|
||||||
|
|
|
@ -8,6 +8,7 @@ import androidx.compose.runtime.collectAsState
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
|
import helium314.keyboard.keyboard.KeyboardSwitcher
|
||||||
import helium314.keyboard.latin.R
|
import helium314.keyboard.latin.R
|
||||||
import helium314.keyboard.latin.settings.Defaults
|
import helium314.keyboard.latin.settings.Defaults
|
||||||
import helium314.keyboard.latin.settings.Settings
|
import helium314.keyboard.latin.settings.Settings
|
||||||
|
@ -22,7 +23,6 @@ import helium314.keyboard.settings.preferences.SliderPreference
|
||||||
import helium314.keyboard.settings.preferences.SwitchPreference
|
import helium314.keyboard.settings.preferences.SwitchPreference
|
||||||
import helium314.keyboard.settings.Theme
|
import helium314.keyboard.settings.Theme
|
||||||
import helium314.keyboard.settings.initPreview
|
import helium314.keyboard.settings.initPreview
|
||||||
import helium314.keyboard.settings.keyboardNeedsReload
|
|
||||||
import helium314.keyboard.settings.previewDark
|
import helium314.keyboard.settings.previewDark
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
@ -81,7 +81,7 @@ fun createGestureTypingSettings(context: Context) = listOf(
|
||||||
val followingSystem = it == default
|
val followingSystem = it == default
|
||||||
// allow the default to be overridden
|
// allow the default to be overridden
|
||||||
ctx.prefs().edit().putBoolean(Settings.PREF_GESTURE_DYNAMIC_PREVIEW_FOLLOW_SYSTEM, followingSystem).apply()
|
ctx.prefs().edit().putBoolean(Settings.PREF_GESTURE_DYNAMIC_PREVIEW_FOLLOW_SYSTEM, followingSystem).apply()
|
||||||
keyboardNeedsReload = true
|
KeyboardSwitcher.getInstance().setThemeNeedsReload()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Setting(context, Settings.PREF_GESTURE_SPACE_AWARE, R.string.gesture_space_aware, R.string.gesture_space_aware_summary) {
|
Setting(context, Settings.PREF_GESTURE_SPACE_AWARE, R.string.gesture_space_aware, R.string.gesture_space_aware_summary) {
|
||||||
|
@ -107,7 +107,7 @@ fun createGestureTypingSettings(context: Context) = listOf(
|
||||||
range = 100f..1900f,
|
range = 100f..1900f,
|
||||||
description = { stringResource(R.string.abbreviation_unit_milliseconds, (it + 100).toString()) },
|
description = { stringResource(R.string.abbreviation_unit_milliseconds, (it + 100).toString()) },
|
||||||
stepSize = 10,
|
stepSize = 10,
|
||||||
) { keyboardNeedsReload = true }
|
) { KeyboardSwitcher.getInstance().setThemeNeedsReload() }
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import helium314.keyboard.keyboard.KeyboardLayoutSet
|
import helium314.keyboard.keyboard.KeyboardLayoutSet
|
||||||
|
import helium314.keyboard.keyboard.KeyboardSwitcher
|
||||||
import helium314.keyboard.latin.AudioAndHapticFeedbackManager
|
import helium314.keyboard.latin.AudioAndHapticFeedbackManager
|
||||||
import helium314.keyboard.latin.R
|
import helium314.keyboard.latin.R
|
||||||
import helium314.keyboard.latin.settings.Defaults
|
import helium314.keyboard.latin.settings.Defaults
|
||||||
|
@ -28,7 +29,6 @@ import helium314.keyboard.settings.preferences.SliderPreference
|
||||||
import helium314.keyboard.settings.preferences.SwitchPreference
|
import helium314.keyboard.settings.preferences.SwitchPreference
|
||||||
import helium314.keyboard.settings.Theme
|
import helium314.keyboard.settings.Theme
|
||||||
import helium314.keyboard.settings.initPreview
|
import helium314.keyboard.settings.initPreview
|
||||||
import helium314.keyboard.settings.keyboardNeedsReload
|
|
||||||
import helium314.keyboard.settings.previewDark
|
import helium314.keyboard.settings.previewDark
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
@ -90,7 +90,7 @@ fun createPreferencesSettings(context: Context) = listOf(
|
||||||
ReorderSwitchPreference(it, Defaults.PREF_POPUP_KEYS_ORDER)
|
ReorderSwitchPreference(it, Defaults.PREF_POPUP_KEYS_ORDER)
|
||||||
},
|
},
|
||||||
Setting(context, Settings.PREF_SHOW_POPUP_HINTS, R.string.show_popup_hints, R.string.show_popup_hints_summary) {
|
Setting(context, Settings.PREF_SHOW_POPUP_HINTS, R.string.show_popup_hints, R.string.show_popup_hints_summary) {
|
||||||
SwitchPreference(it, Defaults.PREF_SHOW_POPUP_HINTS) { keyboardNeedsReload = true }
|
SwitchPreference(it, Defaults.PREF_SHOW_POPUP_HINTS) { KeyboardSwitcher.getInstance().setThemeNeedsReload() }
|
||||||
},
|
},
|
||||||
Setting(context, Settings.PREF_POPUP_ON, R.string.popup_on_keypress) {
|
Setting(context, Settings.PREF_POPUP_ON, R.string.popup_on_keypress) {
|
||||||
SwitchPreference(it, Defaults.PREF_POPUP_ON)
|
SwitchPreference(it, Defaults.PREF_POPUP_ON)
|
||||||
|
@ -110,16 +110,16 @@ fun createPreferencesSettings(context: Context) = listOf(
|
||||||
SwitchPreference(it, Defaults.PREF_ENABLE_CLIPBOARD_HISTORY)
|
SwitchPreference(it, Defaults.PREF_ENABLE_CLIPBOARD_HISTORY)
|
||||||
},
|
},
|
||||||
Setting(context, Settings.PREF_SHOW_NUMBER_ROW, R.string.number_row, R.string.number_row_summary) {
|
Setting(context, Settings.PREF_SHOW_NUMBER_ROW, R.string.number_row, R.string.number_row_summary) {
|
||||||
SwitchPreference(it, Defaults.PREF_SHOW_NUMBER_ROW) { keyboardNeedsReload = true }
|
SwitchPreference(it, Defaults.PREF_SHOW_NUMBER_ROW) { KeyboardSwitcher.getInstance().setThemeNeedsReload() }
|
||||||
},
|
},
|
||||||
Setting(context, Settings.PREF_LOCALIZED_NUMBER_ROW, R.string.localized_number_row, R.string.localized_number_row_summary) {
|
Setting(context, Settings.PREF_LOCALIZED_NUMBER_ROW, R.string.localized_number_row, R.string.localized_number_row_summary) {
|
||||||
SwitchPreference(it, Defaults.PREF_LOCALIZED_NUMBER_ROW) { KeyboardLayoutSet.onSystemLocaleChanged() }
|
SwitchPreference(it, Defaults.PREF_LOCALIZED_NUMBER_ROW) { KeyboardLayoutSet.onSystemLocaleChanged() }
|
||||||
},
|
},
|
||||||
Setting(context, Settings.PREF_SHOW_NUMBER_ROW_HINTS, R.string.number_row_hints) {
|
Setting(context, Settings.PREF_SHOW_NUMBER_ROW_HINTS, R.string.number_row_hints) {
|
||||||
SwitchPreference(it, Defaults.PREF_SHOW_NUMBER_ROW_HINTS) { keyboardNeedsReload = true }
|
SwitchPreference(it, Defaults.PREF_SHOW_NUMBER_ROW_HINTS) { KeyboardSwitcher.getInstance().setThemeNeedsReload() }
|
||||||
},
|
},
|
||||||
Setting(context, Settings.PREF_SHOW_LANGUAGE_SWITCH_KEY, R.string.show_language_switch_key) {
|
Setting(context, Settings.PREF_SHOW_LANGUAGE_SWITCH_KEY, R.string.show_language_switch_key) {
|
||||||
SwitchPreference(it, Defaults.PREF_SHOW_LANGUAGE_SWITCH_KEY) { keyboardNeedsReload = true }
|
SwitchPreference(it, Defaults.PREF_SHOW_LANGUAGE_SWITCH_KEY) { KeyboardSwitcher.getInstance().setThemeNeedsReload() }
|
||||||
},
|
},
|
||||||
Setting(context, Settings.PREF_LANGUAGE_SWITCH_KEY, R.string.language_switch_key_behavior) {
|
Setting(context, Settings.PREF_LANGUAGE_SWITCH_KEY, R.string.language_switch_key_behavior) {
|
||||||
ListPreference(
|
ListPreference(
|
||||||
|
@ -130,7 +130,7 @@ fun createPreferencesSettings(context: Context) = listOf(
|
||||||
stringResource(R.string.language_switch_key_switch_both) to "both"
|
stringResource(R.string.language_switch_key_switch_both) to "both"
|
||||||
),
|
),
|
||||||
Defaults.PREF_LANGUAGE_SWITCH_KEY
|
Defaults.PREF_LANGUAGE_SWITCH_KEY
|
||||||
) { keyboardNeedsReload = true }
|
) { KeyboardSwitcher.getInstance().setThemeNeedsReload() }
|
||||||
},
|
},
|
||||||
Setting(context, Settings.PREF_SHOW_EMOJI_KEY, R.string.show_emoji_key) {
|
Setting(context, Settings.PREF_SHOW_EMOJI_KEY, R.string.show_emoji_key) {
|
||||||
SwitchPreference(it, Defaults.PREF_SHOW_EMOJI_KEY)
|
SwitchPreference(it, Defaults.PREF_SHOW_EMOJI_KEY)
|
||||||
|
@ -138,7 +138,7 @@ fun createPreferencesSettings(context: Context) = listOf(
|
||||||
Setting(context, Settings.PREF_REMOVE_REDUNDANT_POPUPS,
|
Setting(context, Settings.PREF_REMOVE_REDUNDANT_POPUPS,
|
||||||
R.string.remove_redundant_popups, R.string.remove_redundant_popups_summary)
|
R.string.remove_redundant_popups, R.string.remove_redundant_popups_summary)
|
||||||
{
|
{
|
||||||
SwitchPreference(it, Defaults.PREF_REMOVE_REDUNDANT_POPUPS) { keyboardNeedsReload = true }
|
SwitchPreference(it, Defaults.PREF_REMOVE_REDUNDANT_POPUPS) { KeyboardSwitcher.getInstance().setThemeNeedsReload() }
|
||||||
},
|
},
|
||||||
Setting(context, Settings.PREF_CLIPBOARD_HISTORY_RETENTION_TIME, R.string.clipboard_history_retention_time) { setting ->
|
Setting(context, Settings.PREF_CLIPBOARD_HISTORY_RETENTION_TIME, R.string.clipboard_history_retention_time) { setting ->
|
||||||
SliderPreference(
|
SliderPreference(
|
||||||
|
|
|
@ -17,6 +17,7 @@ import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
|
import helium314.keyboard.keyboard.KeyboardSwitcher
|
||||||
import helium314.keyboard.latin.R
|
import helium314.keyboard.latin.R
|
||||||
import helium314.keyboard.latin.permissions.PermissionsUtil
|
import helium314.keyboard.latin.permissions.PermissionsUtil
|
||||||
import helium314.keyboard.latin.settings.Defaults
|
import helium314.keyboard.latin.settings.Defaults
|
||||||
|
@ -36,7 +37,6 @@ import helium314.keyboard.settings.preferences.SwitchPreference
|
||||||
import helium314.keyboard.settings.Theme
|
import helium314.keyboard.settings.Theme
|
||||||
import helium314.keyboard.settings.dialogs.ConfirmationDialog
|
import helium314.keyboard.settings.dialogs.ConfirmationDialog
|
||||||
import helium314.keyboard.settings.initPreview
|
import helium314.keyboard.settings.initPreview
|
||||||
import helium314.keyboard.settings.keyboardNeedsReload
|
|
||||||
import helium314.keyboard.settings.previewDark
|
import helium314.keyboard.settings.previewDark
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
@ -163,7 +163,7 @@ fun createCorrectionSettings(context: Context) = listOf(
|
||||||
Setting(context, Settings.PREF_BIGRAM_PREDICTIONS,
|
Setting(context, Settings.PREF_BIGRAM_PREDICTIONS,
|
||||||
R.string.bigram_prediction, R.string.bigram_prediction_summary
|
R.string.bigram_prediction, R.string.bigram_prediction_summary
|
||||||
) {
|
) {
|
||||||
SwitchPreference(it, Defaults.PREF_BIGRAM_PREDICTIONS) { keyboardNeedsReload = true }
|
SwitchPreference(it, Defaults.PREF_BIGRAM_PREDICTIONS) { KeyboardSwitcher.getInstance().setThemeNeedsReload() }
|
||||||
},
|
},
|
||||||
Setting(context, Settings.PREF_CENTER_SUGGESTION_TEXT_TO_ENTER,
|
Setting(context, Settings.PREF_CENTER_SUGGESTION_TEXT_TO_ENTER,
|
||||||
R.string.center_suggestion_text_to_enter, R.string.center_suggestion_text_to_enter_summary
|
R.string.center_suggestion_text_to_enter, R.string.center_suggestion_text_to_enter_summary
|
||||||
|
|
|
@ -23,6 +23,7 @@ import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.core.graphics.drawable.toBitmap
|
import androidx.core.graphics.drawable.toBitmap
|
||||||
import androidx.core.util.TypedValueCompat
|
import androidx.core.util.TypedValueCompat
|
||||||
|
import helium314.keyboard.keyboard.KeyboardSwitcher
|
||||||
import helium314.keyboard.keyboard.internal.KeyboardIconsSet
|
import helium314.keyboard.keyboard.internal.KeyboardIconsSet
|
||||||
import helium314.keyboard.latin.R
|
import helium314.keyboard.latin.R
|
||||||
import helium314.keyboard.latin.settings.Defaults
|
import helium314.keyboard.latin.settings.Defaults
|
||||||
|
@ -35,7 +36,6 @@ import helium314.keyboard.settings.preferences.SwitchPreference
|
||||||
import helium314.keyboard.settings.Theme
|
import helium314.keyboard.settings.Theme
|
||||||
import helium314.keyboard.settings.dialogs.ToolbarKeysCustomizer
|
import helium314.keyboard.settings.dialogs.ToolbarKeysCustomizer
|
||||||
import helium314.keyboard.settings.initPreview
|
import helium314.keyboard.settings.initPreview
|
||||||
import helium314.keyboard.settings.keyboardNeedsReload
|
|
||||||
import helium314.keyboard.settings.previewDark
|
import helium314.keyboard.settings.previewDark
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
@ -84,7 +84,7 @@ fun createToolbarSettings(context: Context) = listOf(
|
||||||
Setting(context, Settings.PREF_QUICK_PIN_TOOLBAR_KEYS,
|
Setting(context, Settings.PREF_QUICK_PIN_TOOLBAR_KEYS,
|
||||||
R.string.quick_pin_toolbar_keys, R.string.quick_pin_toolbar_keys_summary)
|
R.string.quick_pin_toolbar_keys, R.string.quick_pin_toolbar_keys_summary)
|
||||||
{
|
{
|
||||||
SwitchPreference(it, Defaults.PREF_QUICK_PIN_TOOLBAR_KEYS) { keyboardNeedsReload = true }
|
SwitchPreference(it, Defaults.PREF_QUICK_PIN_TOOLBAR_KEYS) { KeyboardSwitcher.getInstance().setThemeNeedsReload() }
|
||||||
},
|
},
|
||||||
Setting(context, Settings.PREF_AUTO_SHOW_TOOLBAR, R.string.auto_show_toolbar, R.string.auto_show_toolbar_summary)
|
Setting(context, Settings.PREF_AUTO_SHOW_TOOLBAR, R.string.auto_show_toolbar, R.string.auto_show_toolbar_summary)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue