Merge pull request #460 from prabhy619/issue455

#455 Disabling long pressing space for keyboard change
This commit is contained in:
Daniele Laudani 2022-01-16 20:37:55 +01:00 committed by GitHub
commit 9bb92981f2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 1 deletions

View file

@ -1082,7 +1082,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element,
return;
}
final int code = key.getCode();
if (code == Constants.CODE_SPACE || code == Constants.CODE_LANGUAGE_SWITCH) {
if (code == Constants.CODE_SPACE&&Settings.getInstance().getCurrent().mSpaceForLangChange || code == Constants.CODE_LANGUAGE_SWITCH) {
// Long pressing the space key invokes IME switcher dialog.
if (sListener.onCustomRequest(Constants.CUSTOM_CODE_SHOW_INPUT_METHOD_PICKER)) {
cancelKeyTracking();

View file

@ -111,6 +111,8 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
public static final String PREF_SHOW_HINTS = "pref_show_hints";
public static final String PREF_SPACE_TO_CHANGE_LANG = "prefs_long_press_keyboard_to_change_lang";
// This preference key is deprecated. Use {@link #PREF_SHOW_LANGUAGE_SWITCH_KEY} instead.
// This is being used only for the backward compatibility.
private static final String PREF_SUPPRESS_LANGUAGE_SWITCH_KEY =

View file

@ -71,6 +71,7 @@ public class SettingsValues {
public final boolean mIncludesOtherImesInLanguageSwitchList;
public final boolean mShowsNumberRow;
public final boolean mShowsHints;
public final boolean mSpaceForLangChange;
public final boolean mShowsLanguageSwitchKey;
public final boolean mShowsEmojiKey;
public final boolean mShowsClipboardKey;
@ -148,6 +149,7 @@ public class SettingsValues {
mIncludesOtherImesInLanguageSwitchList = !Settings.ENABLE_SHOW_LANGUAGE_SWITCH_KEY_SETTINGS || prefs.getBoolean(Settings.PREF_INCLUDE_OTHER_IMES_IN_LANGUAGE_SWITCH_LIST, false) /* forcibly */;
mShowsNumberRow = prefs.getBoolean(Settings.PREF_SHOW_NUMBER_ROW, false);
mShowsHints = prefs.getBoolean(Settings.PREF_SHOW_HINTS, true);
mSpaceForLangChange = prefs.getBoolean(Settings.PREF_SPACE_TO_CHANGE_LANG, true);
mShowsLanguageSwitchKey = prefs.getBoolean(Settings.PREF_SHOW_LANGUAGE_SWITCH_KEY, false);
mShowsEmojiKey = prefs.getBoolean(Settings.PREF_SHOW_EMOJI_KEY, false);
mShowsClipboardKey = prefs.getBoolean(Settings.PREF_SHOW_CLIPBOARD_KEY, false);

View file

@ -217,6 +217,9 @@
<!-- Description of the settings to show hints -->
<string name="show_hints_summary">Show long-press hints</string>
<!-- Title of the settings to disable long press space to change language -->
<string name="prefs_long_press_keyboard_to_change_lang">Long press to change lang</string>
<!-- Title of the settings to enable keyboard resizing -->
<string name="prefs_resize_keyboard">Enable keyboard resizing</string>
<!-- Title of the settings for setting keyboard height -->

View file

@ -34,6 +34,11 @@
android:summary="@string/show_hints_summary"
android:defaultValue="true"
android:persistent="true" />
<CheckBoxPreference
android:key="prefs_long_press_keyboard_to_change_lang"
android:title="@string/prefs_long_press_keyboard_to_change_lang"
android:persistent="true"
android:defaultValue="true" />
<CheckBoxPreference
android:key="pref_show_language_switch_key"
android:title="@string/show_language_switch_key"