mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-24 00:26:22 +00:00
separate language switch key behavior from key enablement
This commit is contained in:
parent
4dc0e98321
commit
a1d32b84fd
6 changed files with 19 additions and 6 deletions
|
@ -88,6 +88,10 @@ fun checkVersionUpgrade(context: Context) {
|
||||||
.distinctBy { it.split(",").first() }
|
.distinctBy { it.split(",").first() }
|
||||||
.joinToString(";")
|
.joinToString(";")
|
||||||
prefs.edit { putString(Settings.PREF_PINNED_TOOLBAR_KEYS, newPinnedKeysPref) }
|
prefs.edit { putString(Settings.PREF_PINNED_TOOLBAR_KEYS, newPinnedKeysPref) }
|
||||||
|
|
||||||
|
// enable language switch key if it was enabled previously
|
||||||
|
if (prefs.contains(Settings.PREF_LANGUAGE_SWITCH_KEY) && prefs.getString(Settings.PREF_LANGUAGE_SWITCH_KEY, "") != "off")
|
||||||
|
prefs.edit { putBoolean(Settings.PREF_SHOW_LANGUAGE_SWITCH_KEY, true) }
|
||||||
}
|
}
|
||||||
upgradeToolbarPrefs(prefs)
|
upgradeToolbarPrefs(prefs)
|
||||||
onCustomLayoutFileListChanged() // just to be sure
|
onCustomLayoutFileListChanged() // just to be sure
|
||||||
|
|
|
@ -92,6 +92,7 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
|
||||||
public static final String PREF_KEY_USE_PERSONALIZED_DICTS = "use_personalized_dicts";
|
public static final String PREF_KEY_USE_PERSONALIZED_DICTS = "use_personalized_dicts";
|
||||||
public static final String PREF_KEY_USE_DOUBLE_SPACE_PERIOD = "use_double_space_period";
|
public static final String PREF_KEY_USE_DOUBLE_SPACE_PERIOD = "use_double_space_period";
|
||||||
public static final String PREF_BLOCK_POTENTIALLY_OFFENSIVE = "block_potentially_offensive";
|
public static final String PREF_BLOCK_POTENTIALLY_OFFENSIVE = "block_potentially_offensive";
|
||||||
|
public static final String PREF_SHOW_LANGUAGE_SWITCH_KEY = "show_language_switch_key";
|
||||||
public static final String PREF_LANGUAGE_SWITCH_KEY = "language_switch_key";
|
public static final String PREF_LANGUAGE_SWITCH_KEY = "language_switch_key";
|
||||||
public static final String PREF_SHOW_EMOJI_KEY = "show_emoji_key";
|
public static final String PREF_SHOW_EMOJI_KEY = "show_emoji_key";
|
||||||
public static final String PREF_VARIABLE_TOOLBAR_DIRECTION = "var_toolbar_direction";
|
public static final String PREF_VARIABLE_TOOLBAR_DIRECTION = "var_toolbar_direction";
|
||||||
|
|
|
@ -65,6 +65,7 @@ public class SettingsValues {
|
||||||
public final boolean mShowsVoiceInputKey;
|
public final boolean mShowsVoiceInputKey;
|
||||||
public final boolean mLanguageSwitchKeyToOtherImes;
|
public final boolean mLanguageSwitchKeyToOtherImes;
|
||||||
public final boolean mLanguageSwitchKeyToOtherSubtypes;
|
public final boolean mLanguageSwitchKeyToOtherSubtypes;
|
||||||
|
private final boolean mShowsLanguageSwitchKey;
|
||||||
public final boolean mShowsNumberRow;
|
public final boolean mShowsNumberRow;
|
||||||
public final boolean mLocalizedNumberRow;
|
public final boolean mLocalizedNumberRow;
|
||||||
public final boolean mShowsHints;
|
public final boolean mShowsHints;
|
||||||
|
@ -150,9 +151,10 @@ public class SettingsValues {
|
||||||
mSlidingKeyInputPreviewEnabled = prefs.getBoolean(
|
mSlidingKeyInputPreviewEnabled = prefs.getBoolean(
|
||||||
DebugSettings.PREF_SLIDING_KEY_INPUT_PREVIEW, true);
|
DebugSettings.PREF_SLIDING_KEY_INPUT_PREVIEW, true);
|
||||||
mShowsVoiceInputKey = mInputAttributes.mShouldShowVoiceInputKey;
|
mShowsVoiceInputKey = mInputAttributes.mShouldShowVoiceInputKey;
|
||||||
final String languagePref = prefs.getString(Settings.PREF_LANGUAGE_SWITCH_KEY, "off");
|
final String languagePref = prefs.getString(Settings.PREF_LANGUAGE_SWITCH_KEY, "internal");
|
||||||
mLanguageSwitchKeyToOtherImes = languagePref.equals("input_method") || languagePref.equals("both");
|
mLanguageSwitchKeyToOtherImes = languagePref.equals("input_method") || languagePref.equals("both");
|
||||||
mLanguageSwitchKeyToOtherSubtypes = languagePref.equals("internal") || languagePref.equals("both");
|
mLanguageSwitchKeyToOtherSubtypes = languagePref.equals("internal") || languagePref.equals("both");
|
||||||
|
mShowsLanguageSwitchKey = prefs.getBoolean(Settings.PREF_SHOW_LANGUAGE_SWITCH_KEY, false); // only relevant for default functional key layout
|
||||||
mShowsNumberRow = prefs.getBoolean(Settings.PREF_SHOW_NUMBER_ROW, false);
|
mShowsNumberRow = prefs.getBoolean(Settings.PREF_SHOW_NUMBER_ROW, false);
|
||||||
mLocalizedNumberRow = prefs.getBoolean(Settings.PREF_LOCALIZED_NUMBER_ROW, true);
|
mLocalizedNumberRow = prefs.getBoolean(Settings.PREF_LOCALIZED_NUMBER_ROW, true);
|
||||||
mShowsHints = prefs.getBoolean(Settings.PREF_SHOW_HINTS, true);
|
mShowsHints = prefs.getBoolean(Settings.PREF_SHOW_HINTS, true);
|
||||||
|
@ -287,7 +289,7 @@ public class SettingsValues {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLanguageSwitchKeyEnabled() {
|
public boolean isLanguageSwitchKeyEnabled() {
|
||||||
if (!mLanguageSwitchKeyToOtherImes && !mLanguageSwitchKeyToOtherSubtypes) {
|
if (!mShowsLanguageSwitchKey) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final RichInputMethodManager imm = RichInputMethodManager.getInstance();
|
final RichInputMethodManager imm = RichInputMethodManager.getInstance();
|
||||||
|
|
|
@ -88,13 +88,11 @@
|
||||||
<!-- default value for auto-day/night setting -->
|
<!-- default value for auto-day/night setting -->
|
||||||
<bool name="day_night_default">false</bool>
|
<bool name="day_night_default">false</bool>
|
||||||
<string-array name="language_switch_key_values">
|
<string-array name="language_switch_key_values">
|
||||||
<item>off</item>
|
|
||||||
<item>internal</item>
|
<item>internal</item>
|
||||||
<item>input_method</item>
|
<item>input_method</item>
|
||||||
<item>both</item>
|
<item>both</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
<string-array name="language_switch_key_entries">
|
<string-array name="language_switch_key_entries">
|
||||||
<item>@string/auto_correction_threshold_mode_off</item> <!-- maybe use a separate string -->
|
|
||||||
<item>@string/switch_language</item>
|
<item>@string/switch_language</item>
|
||||||
<item>@string/language_switch_key_switch_input_method</item>
|
<item>@string/language_switch_key_switch_input_method</item>
|
||||||
<item>@string/language_switch_key_switch_both</item>
|
<item>@string/language_switch_key_switch_both</item>
|
||||||
|
|
|
@ -58,6 +58,8 @@
|
||||||
<string name="language_switch_key_switch_both">Switch both</string>
|
<string name="language_switch_key_switch_both">Switch both</string>
|
||||||
<!-- Option to show language switch key [CHAR LIMIT=30] -->
|
<!-- Option to show language switch key [CHAR LIMIT=30] -->
|
||||||
<string name="show_language_switch_key">Language switch key</string>
|
<string name="show_language_switch_key">Language switch key</string>
|
||||||
|
<!-- Option for setting whether language switch key should switch internal layouts only, or also to other keyboards -->
|
||||||
|
<string name="language_switch_key_behavior">Language switch key behavior</string>
|
||||||
<!-- Option to show shortcut key to emoji palettes -->
|
<!-- Option to show shortcut key to emoji palettes -->
|
||||||
<string name="show_emoji_key">Emoji key</string>
|
<string name="show_emoji_key">Emoji key</string>
|
||||||
<!-- Units abbreviation for the duration (milliseconds) [CHAR LIMIT=10] -->
|
<!-- Units abbreviation for the duration (milliseconds) [CHAR LIMIT=10] -->
|
||||||
|
|
|
@ -79,12 +79,18 @@
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:persistent="true" />
|
android:persistent="true" />
|
||||||
|
|
||||||
|
<SwitchPreference
|
||||||
|
android:key="show_language_switch_key"
|
||||||
|
android:title="@string/show_language_switch_key"
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:persistent="true" />
|
||||||
|
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:key="language_switch_key"
|
android:key="language_switch_key"
|
||||||
android:title="@string/show_language_switch_key"
|
android:title="@string/language_switch_key_behavior"
|
||||||
android:entries="@array/language_switch_key_entries"
|
android:entries="@array/language_switch_key_entries"
|
||||||
android:entryValues="@array/language_switch_key_values"
|
android:entryValues="@array/language_switch_key_values"
|
||||||
android:defaultValue="off"
|
android:defaultValue="internal"
|
||||||
android:summary="%s"
|
android:summary="%s"
|
||||||
android:persistent="true"
|
android:persistent="true"
|
||||||
latin:singleLineTitle="false" />
|
latin:singleLineTitle="false" />
|
||||||
|
|
Loading…
Add table
Reference in a new issue