From f606fd855425eba365c8dcc8463a61c4a77d6539 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Wed, 10 Apr 2013 11:42:16 +0900 Subject: [PATCH] Hide Setup Wizard icon for stock keyboard Bug: 8581647 Change-Id: Id530f1a33a5c919f4a732ec0d545dfbe76e56316 --- java/res/values/setup-wizard.xml | 22 +++++++++++++++++++ .../android/inputmethod/latin/Settings.java | 5 +++++ .../inputmethod/latin/SettingsFragment.java | 8 ++++++- 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 java/res/values/setup-wizard.xml diff --git a/java/res/values/setup-wizard.xml b/java/res/values/setup-wizard.xml new file mode 100644 index 000000000..84647090b --- /dev/null +++ b/java/res/values/setup-wizard.xml @@ -0,0 +1,22 @@ + + + + false + diff --git a/java/src/com/android/inputmethod/latin/Settings.java b/java/src/com/android/inputmethod/latin/Settings.java index ce659bf45..8fbe843cf 100644 --- a/java/src/com/android/inputmethod/latin/Settings.java +++ b/java/src/com/android/inputmethod/latin/Settings.java @@ -272,6 +272,11 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang public static boolean readShowSetupWizardIcon(final SharedPreferences prefs, final Context context) { + final boolean enableSetupWizardByConfig = context.getResources().getBoolean( + R.bool.config_setup_wizard_available); + if (!enableSetupWizardByConfig) { + return false; + } if (!prefs.contains(Settings.PREF_SHOW_SETUP_WIZARD_ICON)) { final ApplicationInfo appInfo = context.getApplicationInfo(); final boolean isApplicationInSystemImage = diff --git a/java/src/com/android/inputmethod/latin/SettingsFragment.java b/java/src/com/android/inputmethod/latin/SettingsFragment.java index 928141c32..5405a5eb7 100644 --- a/java/src/com/android/inputmethod/latin/SettingsFragment.java +++ b/java/src/com/android/inputmethod/latin/SettingsFragment.java @@ -165,6 +165,10 @@ public final class SettingsFragment extends InputMethodSettingsFragment Settings.readKeyPreviewPopupEnabled(prefs, res)); } + if (!res.getBoolean(R.bool.config_setup_wizard_available)) { + removePreference(Settings.PREF_SHOW_SETUP_WIZARD_ICON, advancedSettings); + } + setPreferenceEnabled(Settings.PREF_INCLUDE_OTHER_IMES_IN_LANGUAGE_SWITCH_LIST, Settings.readShowsLanguageSwitchKey(prefs)); @@ -203,7 +207,9 @@ public final class SettingsFragment extends InputMethodSettingsFragment final SharedPreferences prefs = getPreferenceManager().getSharedPreferences(); final CheckBoxPreference showSetupWizardIcon = (CheckBoxPreference)findPreference(Settings.PREF_SHOW_SETUP_WIZARD_ICON); - showSetupWizardIcon.setChecked(Settings.readShowSetupWizardIcon(prefs, getActivity())); + if (showSetupWizardIcon != null) { + showSetupWizardIcon.setChecked(Settings.readShowSetupWizardIcon(prefs, getActivity())); + } updateShowCorrectionSuggestionsSummary(); updateKeyPreviewPopupDelaySummary(); updateCustomInputStylesSummary();