mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-20 08:50:25 +00:00
properly apply user defined theme immediately
This commit is contained in:
parent
72dac6a9ea
commit
d2f414811f
4 changed files with 20 additions and 5 deletions
|
@ -52,11 +52,12 @@ Plan / to do:
|
|||
* ~theming, https://github.com/openboard-team/openboard/issues/124~
|
||||
* ~fix emoji view not themed properly~
|
||||
* ~fix ABC buttons in emoji and clipboard view have wrong text color~
|
||||
* ~allow adjusting colors without requiring manual reload of keyboard~
|
||||
* ~fix issues in _more suggestions_ view, https://github.com/Helium314/openboard/issues/9#issuecomment-1626932543~ (not 100% fixed, but should not be noticeable)
|
||||
* fix buttons on long-press action key not themed
|
||||
* allow adjusting colors without requiring manual reload of keyboard
|
||||
* fix issues in _more suggestions_ view, https://github.com/Helium314/openboard/issues/9#issuecomment-1626932543
|
||||
* fix icons on long-press comma key not themed
|
||||
* ~delete suggestions, https://github.com/openboard-team/openboard/issues/106~
|
||||
* make functionality more discoverable, e.g. add a button to the _more suggestions_ menu
|
||||
* make functionality more discoverable, e.g. add a button to the _more suggestions_ menu, or replace long-press menu and show more suggestions by scrolling suggestion strip
|
||||
* ~gesture typing, https://github.com/openboard-team/openboard/issues/3~
|
||||
* ~license issues, require using an external library~
|
||||
* ~move/copy _use contacts_ setting from well hidden spell checker settings to _text correction_ settings~
|
||||
|
|
|
@ -100,6 +100,10 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
|
|||
}
|
||||
}
|
||||
|
||||
public void forceUpdateKeyboardTheme() {
|
||||
mLatinIME.setInputView(onCreateInputView(mIsHardwareAcceleratedDrawingEnabled));
|
||||
}
|
||||
|
||||
private boolean updateKeyboardThemeAndContextThemeWrapper(final Context context,
|
||||
final KeyboardTheme keyboardTheme) {
|
||||
final boolean nightModeChanged = (mCurrentUiMode & Configuration.UI_MODE_NIGHT_MASK)
|
||||
|
|
|
@ -21,6 +21,7 @@ import android.os.Bundle
|
|||
import android.preference.ListPreference
|
||||
import android.preference.Preference
|
||||
import android.preference.TwoStatePreference
|
||||
import org.dslul.openboard.inputmethod.keyboard.KeyboardSwitcher
|
||||
import org.dslul.openboard.inputmethod.keyboard.KeyboardTheme
|
||||
import org.dslul.openboard.inputmethod.latin.R
|
||||
import org.dslul.openboard.inputmethod.latin.common.Constants
|
||||
|
@ -33,6 +34,7 @@ import java.util.*
|
|||
class AppearanceSettingsFragment : SubScreenFragment(), Preference.OnPreferenceChangeListener {
|
||||
|
||||
private var selectedThemeId = 0
|
||||
private var needsReload = false
|
||||
|
||||
private lateinit var themeFamilyPref: ListPreference
|
||||
private lateinit var themeVariantPref: ListPreference
|
||||
|
@ -71,6 +73,13 @@ class AppearanceSettingsFragment : SubScreenFragment(), Preference.OnPreferenceC
|
|||
findPreference(Settings.PREF_CUSTOM_INPUT_STYLES))
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
if (needsReload)
|
||||
KeyboardSwitcher.getInstance().forceUpdateKeyboardTheme()
|
||||
needsReload = false
|
||||
}
|
||||
|
||||
override fun onPreferenceChange(preference: Preference, value: Any?): Boolean {
|
||||
(preference as? ListPreference)?.apply {
|
||||
summary = entries[entryValues.indexOfFirst { it == value }]
|
||||
|
@ -185,7 +194,7 @@ class AppearanceSettingsFragment : SubScreenFragment(), Preference.OnPreferenceC
|
|||
3 -> Settings.PREF_THEME_USER_COLOR_ACCENT
|
||||
else -> Settings.PREF_THEME_USER_COLOR_KEYS
|
||||
}
|
||||
val d = ColorPickerDialog(activity, items[i], sharedPreferences, pref)
|
||||
val d = ColorPickerDialog(activity, items[i], sharedPreferences, pref) { needsReload = true}
|
||||
d.show()
|
||||
}
|
||||
.show()
|
||||
|
|
|
@ -30,7 +30,7 @@ import android.widget.TextView;
|
|||
import org.dslul.openboard.inputmethod.latin.R;
|
||||
|
||||
public class ColorPickerDialog extends AlertDialog implements SeekBar.OnSeekBarChangeListener {
|
||||
protected ColorPickerDialog(Context context, String title, SharedPreferences prefs, String colorPref) {
|
||||
protected ColorPickerDialog(Context context, String title, SharedPreferences prefs, String colorPref, Runnable onChanged) {
|
||||
super(context);
|
||||
setTitle(title);
|
||||
View view = getLayoutInflater().inflate(R.layout.color_dialog, null);
|
||||
|
@ -80,6 +80,7 @@ public class ColorPickerDialog extends AlertDialog implements SeekBar.OnSeekBarC
|
|||
mSeekBarGreen.getProgress(),
|
||||
mSeekBarBlue.getProgress());
|
||||
prefs.edit().putInt(colorPref, value).apply();
|
||||
onChanged.run();
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue