Add an debug option to use spacebar switcher
Change-Id: Icc483f097696a1c5a2a7ab037afce19c9cfe837f
This commit is contained in:
parent
1b9eecb521
commit
c5a2b51924
4 changed files with 24 additions and 3 deletions
|
@ -55,6 +55,8 @@
|
|||
<string name="prefs_suggestion_visibility_show_name">Always show</string>
|
||||
<string name="prefs_suggestion_visibility_show_only_portrait_name">Show on portrait mode</string>
|
||||
<string name="prefs_suggestion_visibility_hide_name">Always hide</string>
|
||||
<!-- Option to enable spacebar language switcher [CHAR LIMIT=20]-->
|
||||
<string name="prefs_use_spacebar_language_switch">Use the spacebar language switcher</string>
|
||||
|
||||
<!-- Option to show/hide the settings key -->
|
||||
<string name="prefs_settings_key">Show settings key</string>
|
||||
|
|
|
@ -35,6 +35,13 @@
|
|||
android:defaultValue="@string/config_default_keyboard_theme_id"
|
||||
/>
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="use_spacebar_language_switch"
|
||||
android:title="@string/prefs_use_spacebar_language_switch"
|
||||
android:persistent="true"
|
||||
android:defaultValue="false"
|
||||
/>
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="debug_mode"
|
||||
android:title="@string/prefs_debug_mode"
|
||||
|
|
|
@ -33,6 +33,7 @@ public class DebugSettings extends PreferenceActivity
|
|||
|
||||
private boolean mServiceNeedsRestart = false;
|
||||
private CheckBoxPreference mDebugMode;
|
||||
private CheckBoxPreference mUseSpacebarLanguageSwitch;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle icicle) {
|
||||
|
@ -60,6 +61,13 @@ public class DebugSettings extends PreferenceActivity
|
|||
updateDebugMode();
|
||||
mServiceNeedsRestart = true;
|
||||
}
|
||||
} else if (key.equals(SubtypeSwitcher.USE_SPACEBAR_LANGUAGE_SWITCH_KEY)) {
|
||||
if (mUseSpacebarLanguageSwitch != null) {
|
||||
mUseSpacebarLanguageSwitch.setChecked(
|
||||
prefs.getBoolean(SubtypeSwitcher.USE_SPACEBAR_LANGUAGE_SWITCH_KEY,
|
||||
getResources().getBoolean(
|
||||
R.bool.config_use_spacebar_language_switcher)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -52,6 +52,8 @@ public class SubtypeSwitcher {
|
|||
private static final String VOICE_MODE = "voice";
|
||||
private static final String SUBTYPE_EXTRAVALUE_REQUIRE_NETWORK_CONNECTIVITY =
|
||||
"requireNetworkConnectivity";
|
||||
public static final String USE_SPACEBAR_LANGUAGE_SWITCH_KEY = "use_spacebar_language_switch";
|
||||
|
||||
private final TextUtils.SimpleStringSplitter mLocaleSplitter =
|
||||
new TextUtils.SimpleStringSplitter(LOCALE_SEPARATER);
|
||||
|
||||
|
@ -61,6 +63,7 @@ public class SubtypeSwitcher {
|
|||
private /* final */ Resources mResources;
|
||||
private /* final */ ConnectivityManager mConnectivityManager;
|
||||
private /* final */ boolean mConfigUseSpacebarLanguageSwitcher;
|
||||
private /* final */ SharedPreferences mPrefs;
|
||||
private final ArrayList<InputMethodSubtypeCompatWrapper>
|
||||
mEnabledKeyboardSubtypesOfCurrentInputMethod =
|
||||
new ArrayList<InputMethodSubtypeCompatWrapper>();
|
||||
|
@ -112,10 +115,8 @@ public class SubtypeSwitcher {
|
|||
mInputLocaleStr = null;
|
||||
mCurrentSubtype = null;
|
||||
mAllEnabledSubtypesOfCurrentInputMethod = null;
|
||||
// TODO: Voice input should be created here
|
||||
mVoiceInputWrapper = null;
|
||||
mConfigUseSpacebarLanguageSwitcher = service.getResources().getBoolean(
|
||||
R.bool.config_use_spacebar_language_switcher);
|
||||
mPrefs = prefs;
|
||||
|
||||
final NetworkInfo info = mConnectivityManager.getActiveNetworkInfo();
|
||||
mIsNetworkConnected = (info != null && info.isConnected());
|
||||
|
@ -133,6 +134,9 @@ public class SubtypeSwitcher {
|
|||
// Update parameters which are changed outside LatinIME. This parameters affect UI so they
|
||||
// should be updated every time onStartInputview.
|
||||
public void updateParametersOnStartInputView() {
|
||||
mConfigUseSpacebarLanguageSwitcher = mPrefs.getBoolean(USE_SPACEBAR_LANGUAGE_SWITCH_KEY,
|
||||
mService.getResources().getBoolean(
|
||||
R.bool.config_use_spacebar_language_switcher));
|
||||
updateEnabledSubtypes();
|
||||
updateShortcutIME();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue