diff options
author | 2011-01-19 03:13:44 -0800 | |
---|---|---|
committer | 2011-01-19 03:13:44 -0800 | |
commit | 16dc76af4d73838fd5a5148a91a0a47fe2c56906 (patch) | |
tree | 8297442ab04fed9c40f2014acea1e519d45fc682 /java | |
parent | aa4e054dd69ffe597f9e06aa0d6eeb2c30585184 (diff) | |
parent | 89764ad4ac5415fb9753c38671b1fa18b9cdd390 (diff) | |
download | latinime-16dc76af4d73838fd5a5148a91a0a47fe2c56906.tar.gz latinime-16dc76af4d73838fd5a5148a91a0a47fe2c56906.tar.xz latinime-16dc76af4d73838fd5a5148a91a0a47fe2c56906.zip |
am 89764ad4: Simplify text correction settings in latin IME.
* commit '89764ad4ac5415fb9753c38671b1fa18b9cdd390':
Simplify text correction settings in latin IME.
Diffstat (limited to 'java')
-rw-r--r-- | java/res/values-xlarge/config.xml | 2 | ||||
-rw-r--r-- | java/res/values/config.xml | 6 | ||||
-rw-r--r-- | java/res/xml/prefs.xml | 20 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIME.java | 23 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/latin/Settings.java | 26 |
5 files changed, 61 insertions, 16 deletions
diff --git a/java/res/values-xlarge/config.xml b/java/res/values-xlarge/config.xml index d6864608d..004b39b92 100644 --- a/java/res/values-xlarge/config.xml +++ b/java/res/values-xlarge/config.xml @@ -24,6 +24,8 @@ <bool name="config_enable_show_voice_key_option">false</bool> <bool name="config_enable_show_popup_on_keypress_option">false</bool> <bool name="config_enable_show_recorrection_option">false</bool> + <bool name="config_enable_quick_fixes_option">false</bool> + <bool name="config_enable_bigram_suggestions_option">false</bool> <bool name="config_candidate_highlight_font_color_enabled">false</bool> <bool name="config_swipe_down_dismiss_keyboard_enabled">false</bool> <bool name="config_sliding_key_input_enabled">false</bool> diff --git a/java/res/values/config.xml b/java/res/values/config.xml index a523635ca..6a1b27a05 100644 --- a/java/res/values/config.xml +++ b/java/res/values/config.xml @@ -27,12 +27,18 @@ <bool name="config_enable_show_voice_key_option">true</bool> <bool name="config_enable_show_popup_on_keypress_option">true</bool> <bool name="config_enable_show_recorrection_option">true</bool> + <bool name="config_enable_quick_fixes_option">true</bool> + <bool name="config_enable_bigram_suggestions_option">true</bool> + <bool name="config_enable_usability_study_mode_option">false</bool> <bool name="config_candidate_highlight_font_color_enabled">true</bool> <bool name="config_swipe_down_dismiss_keyboard_enabled">true</bool> <bool name="config_sliding_key_input_enabled">true</bool> <bool name="config_digit_popup_characters_enabled">true</bool> <!-- Whether or not Popup on key press is enabled by default --> <bool name="config_default_popup_preview">true</bool> + <!-- Default values for whether quick fixes and bigram suggestions are activated --> + <bool name="config_default_quick_fixes">true</bool> + <bool name="config_default_bigram_suggestions">true</bool> <bool name="config_use_spacebar_language_switcher">true</bool> <!-- The language is never displayed if == 0, always displayed if < 0 --> <integer name="config_delay_before_fadeout_language_on_spacebar">-1</integer> diff --git a/java/res/xml/prefs.xml b/java/res/xml/prefs.xml index 02918858b..9ea801ef7 100644 --- a/java/res/xml/prefs.xml +++ b/java/res/xml/prefs.xml @@ -94,16 +94,6 @@ /> <ListPreference - android:key="show_suggestions_setting" - android:summary="@string/prefs_show_suggestions_summary" - android:title="@string/prefs_show_suggestions" - android:persistent="true" - android:entryValues="@array/prefs_suggestion_visibility_values" - android:entries="@array/prefs_suggestion_visibilities" - android:defaultValue="@string/prefs_suggestion_visibility_default_value" - /> - - <ListPreference android:key="auto_correction_threshold" android:title="@string/auto_correction" android:summary="@string/auto_correction_summary" @@ -113,6 +103,16 @@ android:defaultValue="@string/auto_correction_threshold_mode_index_modest" /> + <ListPreference + android:key="show_suggestions_setting" + android:summary="@string/prefs_show_suggestions_summary" + android:title="@string/prefs_show_suggestions" + android:persistent="true" + android:entryValues="@array/prefs_suggestion_visibility_values" + android:entries="@array/prefs_suggestion_visibilities" + android:defaultValue="@string/prefs_suggestion_visibility_default_value" + /> + <CheckBoxPreference android:key="bigram_suggestion" android:title="@string/bigram_suggestion" diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index fff09fa97..4e1c56cba 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -412,7 +412,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen mSuggest.close(); } final SharedPreferences prefs = mPrefs; - mQuickFixes = prefs.getBoolean(Settings.PREF_QUICK_FIXES, true); + mQuickFixes = isQuickFixesEnabled(prefs); final Resources res = mResources; int mainDicResId = getMainDictionaryResourceId(res); @@ -2077,7 +2077,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen mPopupOn = prefs.getBoolean(Settings.PREF_POPUP_ON, mResources.getBoolean(R.bool.config_default_popup_preview)); mAutoCap = prefs.getBoolean(Settings.PREF_AUTO_CAP, true); - mQuickFixes = prefs.getBoolean(Settings.PREF_QUICK_FIXES, true); + mQuickFixes = isQuickFixesEnabled(prefs); mAutoCorrectEnabled = isAutoCorrectEnabled(prefs); mBigramSuggestionEnabled = mAutoCorrectEnabled && isBigramSuggestionEnabled(prefs); @@ -2126,6 +2126,16 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen mSuggest.setAutoCorrectionThreshold(autoCorrectionThreshold); } + private boolean isQuickFixesEnabled(SharedPreferences sp) { + final boolean showQuickFixesOption = mResources.getBoolean( + R.bool.config_enable_quick_fixes_option); + if (!showQuickFixesOption) { + return isAutoCorrectEnabled(sp); + } + return sp.getBoolean(Settings.PREF_QUICK_FIXES, mResources.getBoolean( + R.bool.config_default_quick_fixes)); + } + private boolean isAutoCorrectEnabled(SharedPreferences sp) { final String currentAutoCorrectionSetting = sp.getString( Settings.PREF_AUTO_CORRECTION_THRESHOLD, @@ -2136,8 +2146,13 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen } private boolean isBigramSuggestionEnabled(SharedPreferences sp) { - // TODO: Define default value instead of 'true'. - return sp.getBoolean(Settings.PREF_BIGRAM_SUGGESTIONS, true); + final boolean showBigramSuggestionsOption = mResources.getBoolean( + R.bool.config_enable_bigram_suggestions_option); + if (!showBigramSuggestionsOption) { + return isAutoCorrectEnabled(sp); + } + return sp.getBoolean(Settings.PREF_BIGRAM_SUGGESTIONS, mResources.getBoolean( + R.bool.config_default_bigram_suggestions)); } private void initSuggestPuncList() { diff --git a/java/src/com/android/inputmethod/latin/Settings.java b/java/src/com/android/inputmethod/latin/Settings.java index 1b802d4ab..653dbeaba 100644 --- a/java/src/com/android/inputmethod/latin/Settings.java +++ b/java/src/com/android/inputmethod/latin/Settings.java @@ -1,6 +1,6 @@ /* * Copyright (C) 2008 The Android Open Source Project - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at @@ -66,6 +66,8 @@ public class Settings extends PreferenceActivity public static final String PREF_AUTO_CORRECTION_THRESHOLD = "auto_correction_threshold"; public static final String PREF_BIGRAM_SUGGESTIONS = "bigram_suggestion"; + public static final String PREF_USABILITY_STUDY_MODE = "usability_study_mode"; + // Dialog ids private static final int VOICE_INPUT_CONFIRM_DIALOG = 0; @@ -113,7 +115,9 @@ public class Settings extends PreferenceActivity ensureConsistencyOfAutoCorrectionSettings(); final PreferenceGroup generalSettings = - (PreferenceGroup) findPreference(PREF_GENERAL_SETTINGS_KEY); + (PreferenceGroup) findPreference(PREF_GENERAL_SETTINGS_KEY); + final PreferenceGroup textCorrectionGroup = + (PreferenceGroup) findPreference(PREF_PREDICTION_SETTINGS_KEY); final boolean showSettingsKeyOption = getResources().getBoolean( R.bool.config_enable_show_settings_key_option); @@ -149,6 +153,24 @@ public class Settings extends PreferenceActivity if (!showRecorrectionOption) { generalSettings.removePreference(findPreference(PREF_RECORRECTION_ENABLED)); } + + final boolean showQuickFixesOption = getResources().getBoolean( + R.bool.config_enable_quick_fixes_option); + if (!showQuickFixesOption) { + textCorrectionGroup.removePreference(findPreference(PREF_QUICK_FIXES)); + } + + final boolean showBigramSuggestionsOption = getResources().getBoolean( + R.bool.config_enable_bigram_suggestions_option); + if (!showBigramSuggestionsOption) { + textCorrectionGroup.removePreference(findPreference(PREF_BIGRAM_SUGGESTIONS)); + } + + final boolean showUsabilityModeStudyOption = getResources().getBoolean( + R.bool.config_enable_usability_study_mode_option); + if (!showUsabilityModeStudyOption) { + getPreferenceScreen().removePreference(findPreference(PREF_USABILITY_STUDY_MODE)); + } } @Override |