diff --git a/java/res/values/donottranslate-altchars.xml b/java/res/values/donottranslate-altchars.xml index 41c498ee3..de4250edf 100644 --- a/java/res/values/donottranslate-altchars.xml +++ b/java/res/values/donottranslate-altchars.xml @@ -43,4 +43,14 @@ + + ".com" + + ".net" + + ".org" + + ".gov" + + ".edu" diff --git a/java/res/values/donottranslate.xml b/java/res/values/donottranslate.xml index 453e188ff..cfca4d624 100644 --- a/java/res/values/donottranslate.xml +++ b/java/res/values/donottranslate.xml @@ -27,31 +27,93 @@ - 0 + 0 - 1 + 1 - 2 + 2 + + + @string/settings_key_mode_auto + @string/settings_key_mode_always_show + @string/settings_key_mode_always_hide + + + + @string/settings_key_mode_auto_name + @string/settings_key_mode_always_show_name + @string/settings_key_mode_always_hide_name + - 0 + 0 - 1 + 1 - 2 + 2 - 0 + 0 + + + @string/prefs_suggestion_visibility_show_value + @string/prefs_suggestion_visibility_show_only_portrait_value + @string/prefs_suggestion_visibility_hide_value + + + @string/prefs_suggestion_visibility_show_name + @string/prefs_suggestion_visibility_show_only_portrait_name + @string/prefs_suggestion_visibility_hide_name + + + 0 + 1 + 2 + + @string/auto_correction_threshold_mode_value_off + @string/auto_correction_threshold_mode_value_modest + @string/auto_correction_threshold_mode_value_aggeressive + + + @string/auto_correction_threshold_mode_off + @string/auto_correction_threshold_mode_modest + @string/auto_correction_threshold_mode_aggeressive + + + 0 + 1 + 2 + + @string/voice_mode_main + @string/voice_mode_symbols + @string/voice_mode_off + + + + @string/voice_input_modes_main_keyboard + @string/voice_input_modes_symbols_keyboard + @string/voice_input_modes_off + + + + @string/voice_input_modes_summary_main_keyboard + @string/voice_input_modes_summary_symbols_keyboard + @string/voice_input_modes_summary_off + + + + Android keyboard Debug settings + Debug Mode - Basic - Basic (High Contrast) - Stone (bold) - Stone (normal) - Gingerbread - Honeycomb + Basic + Basic (High Contrast) + Stone (bold) + Stone (normal) + Gingerbread + Honeycomb - + @string/layout_basic @string/layout_high_contrast @string/layout_stone_normal @@ -59,7 +121,7 @@ @string/layout_gingerbread @string/layout_honeycomb - + 0 1 2 diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml index da315df80..c244ad214 100644 --- a/java/res/values/strings.xml +++ b/java/res/values/strings.xml @@ -34,182 +34,54 @@ Popup on keypress - - Correct typing errors - - - Enable input error correction - - - Landscape input errors - - - Enable input error correction - - - Word suggestions - - - Automatically correct the previous word - - - Word suggestions Word suggestion settings - - Enable auto completion while typing - - - Auto completion - - - Increase text field size - - Hide word suggestions in landscape view Auto-capitalization - - Capitalize the start of a sentence - - Auto-punctuate - - - + Quick fixes Corrects commonly typed mistakes - + Show suggestions Display suggested words while typing - - - @string/prefs_suggestion_visibility_show_value - @string/prefs_suggestion_visibility_show_only_portrait_value - @string/prefs_suggestion_visibility_hide_value - Always show Show on portrait mode Always hide - - @string/prefs_suggestion_visibility_show_name - @string/prefs_suggestion_visibility_show_only_portrait_name - @string/prefs_suggestion_visibility_hide_name - Show settings key - - - @string/settings_key_mode_auto - @string/settings_key_mode_always_show - @string/settings_key_mode_always_hide - Automatic Always show Always hide - - - @string/settings_key_mode_auto_name - @string/settings_key_mode_always_show_name - @string/settings_key_mode_always_hide_name - - - - Auto-complete - - Spacebar and punctuation automatically insert highlighted word - 0 - 1 - 2 - - @string/auto_completion_threshold_mode_value_off - @string/auto_completion_threshold_mode_value_modest - @string/auto_completion_threshold_mode_value_aggeressive - - - Off + + + Auto correction + + Spacebar and punctuation automatically insert highlighted word + + Off - Modest + Modest - Aggressive - - @string/auto_completion_threshold_mode_off - @string/auto_completion_threshold_mode_modest - @string/auto_completion_threshold_mode_aggeressive - + Aggressive Bigram Suggestions Use previous word to improve suggestion - - - None - Basic - Advanced - - - - 0 - - 1 - - 2 - - - @string/prediction_none - @string/prediction_basic - @string/prediction_full - - %s : Saved - - Hold a key down to see accents (ø, ö, etc.) - - Press the back key \u21B6 to close the keyboard at any point - - Access numbers and symbols - - Press and hold the left-most word to add it to the dictionary - - - - Touch this hint to continue » - - - Touch here to close this hint and start typing! - - - The keyboard opens any time you touch a text field - - - Touch & hold a key to view accents\n(ø, ö, ô, ó, and so on) - - - - Switch to numbers and symbols by touching this key - - - Go back to letters by touching this key again - - - Touch & hold this key to change keyboard settings, like auto complete - - - Try it! - - Go @@ -308,62 +180,14 @@ Voice input - - - On main keyboard - On symbols keyboard - Off - - - - 0 - - 1 - - 2 - - - @string/voice_mode_main - @string/voice_mode_symbols - @string/voice_mode_off - - - - - Mic on main keyboard - Mic on symbols keyboard - Voice input is disabled - - - - Auto submit after voice - - - Automatically press enter when searching or going to the next field. - - - - Open the keyboard\n\nTouch any text field. - - - Close the keyboard\n\nPress the Back key. - - - Touch \u0026 hold a key for options\n\nAccess punctuation and accents. - - - Keyboard settings\n\nTouch \u0026 hold the \?123\ key. - - - ".com" - - ".net" - - ".org" - - ".gov" - - ".edu" + + On main keyboard + On symbols keyboard + Off + + Mic on main keyboard + Mic on symbols keyboard + Voice input is disabled Select input method @@ -391,8 +215,6 @@ Keyboard Theme - keyboard - voice Czech Keyboard Danish Keyboard German Keyboard @@ -428,9 +250,6 @@ Chinese (China) Voice Chinese (Taiwan) Voice - - Android keyboard Debug settings - Debug Mode Usability Study Mode diff --git a/java/res/xml-xlarge/kbd_key_styles.xml b/java/res/xml-xlarge/kbd_key_styles.xml index 8a1f6ffc6..9ff3340b8 100644 --- a/java/res/xml-xlarge/kbd_key_styles.xml +++ b/java/res/xml-xlarge/kbd_key_styles.xml @@ -153,9 +153,9 @@ latin:isSticky="true" /> diff --git a/java/res/xml/prefs.xml b/java/res/xml/prefs.xml index 85612b049..1bc33950d 100644 --- a/java/res/xml/prefs.xml +++ b/java/res/xml/prefs.xml @@ -102,13 +102,13 @@ /> = 0 - && index < mCompletions.length) { - CompletionInfo ci = mCompletions[index]; + if (mApplicationSpecifiedCompletionOn && mApplicationSpecifiedCompletions != null + && index >= 0 && index < mApplicationSpecifiedCompletions.length) { + CompletionInfo ci = mApplicationSpecifiedCompletions[index]; if (ic != null) { ic.commitCompletion(ci); } @@ -1650,7 +1654,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen break; } } - // If we didn't find a match, at least suggest completions + // If we didn't find a match, at least suggest corrections. if (foundWord == null && (mSuggest.isValidWord(touching.mWord) || mSuggest.isValidWord(touching.mWord.toString().toLowerCase()))) { @@ -2038,7 +2042,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen mAutoCorrectEnabled = isAutoCorrectEnabled(prefs); mBigramSuggestionEnabled = mAutoCorrectEnabled && isBigramSuggestionEnabled(prefs); - loadAndSetAutoCompletionThreshold(prefs); + loadAndSetAutoCorrectionThreshold(prefs); mVoiceConnector.loadSettings(attribute, prefs); @@ -2049,50 +2053,47 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen } /** - * load Auto completion threshold from SharedPreferences, - * and modify mSuggest's threshold. + * Load Auto correction threshold from SharedPreferences, and modify mSuggest's threshold. */ - private void loadAndSetAutoCompletionThreshold(SharedPreferences sp) { + private void loadAndSetAutoCorrectionThreshold(SharedPreferences sp) { // When mSuggest is not initialized, cannnot modify mSuggest's threshold. if (mSuggest == null) return; - // When auto completion setting is turned off, the threshold is ignored. + // When auto correction setting is turned off, the threshold is ignored. if (!isAutoCorrectEnabled(sp)) return; - final String currentAutoCompletionSetting = sp.getString( - Settings.PREF_AUTO_COMPLETION_THRESHOLD, - mResources.getString(R.string.auto_completion_threshold_mode_value_modest)); - final String[] autoCompletionThresholdValues = mResources.getStringArray( - R.array.auto_complete_threshold_values); - // When autoCompletionThreshold is greater than 1.0, - // auto completion is virtually turned off. - double autoCompletionThreshold = Double.MAX_VALUE; + final String currentAutoCorrectionSetting = sp.getString( + Settings.PREF_AUTO_CORRECTION_THRESHOLD, + mResources.getString(R.string.auto_correction_threshold_mode_value_modest)); + final String[] autoCorrectionThresholdValues = mResources.getStringArray( + R.array.auto_correction_threshold_mode_values); + // When autoCrrectionThreshold is greater than 1.0, auto correction is virtually turned off. + double autoCorrectionThreshold = Double.MAX_VALUE; try { - final int arrayIndex = Integer.valueOf(currentAutoCompletionSetting); - if (arrayIndex >= 0 && arrayIndex < autoCompletionThresholdValues.length) { - autoCompletionThreshold = Double.parseDouble( - autoCompletionThresholdValues[arrayIndex]); + final int arrayIndex = Integer.valueOf(currentAutoCorrectionSetting); + if (arrayIndex >= 0 && arrayIndex < autoCorrectionThresholdValues.length) { + autoCorrectionThreshold = Double.parseDouble( + autoCorrectionThresholdValues[arrayIndex]); } } catch (NumberFormatException e) { - // Whenever the threshold settings are correct, - // never come here. - autoCompletionThreshold = Double.MAX_VALUE; - Log.w(TAG, "Cannot load auto completion threshold setting." - + " currentAutoCompletionSetting: " + currentAutoCompletionSetting - + ", autoCompletionThresholdValues: " - + Arrays.toString(autoCompletionThresholdValues)); + // Whenever the threshold settings are correct, never come here. + autoCorrectionThreshold = Double.MAX_VALUE; + Log.w(TAG, "Cannot load auto correction threshold setting." + + " currentAutoCorrectionSetting: " + currentAutoCorrectionSetting + + ", autoCorrectionThresholdValues: " + + Arrays.toString(autoCorrectionThresholdValues)); } // TODO: This should be refactored : - // setAutoCompleteThreshold should be called outside of this method. - mSuggest.setAutoCompleteThreshold(autoCompletionThreshold); + // setAutoCorrectionThreshold should be called outside of this method. + mSuggest.setAutoCorrectionThreshold(autoCorrectionThreshold); } private boolean isAutoCorrectEnabled(SharedPreferences sp) { - final String currentAutoCompletionSetting = sp.getString( - Settings.PREF_AUTO_COMPLETION_THRESHOLD, - mResources.getString(R.string.auto_completion_threshold_mode_value_modest)); - final String autoCompletionOff = mResources.getString( - R.string.auto_completion_threshold_mode_value_off); - return !currentAutoCompletionSetting.equals(autoCompletionOff); + final String currentAutoCorrectionSetting = sp.getString( + Settings.PREF_AUTO_CORRECTION_THRESHOLD, + mResources.getString(R.string.auto_correction_threshold_mode_value_modest)); + final String autoCorrectionOff = mResources.getString( + R.string.auto_correction_threshold_mode_value_off); + return !currentAutoCorrectionSetting.equals(autoCorrectionOff); } private boolean isBigramSuggestionEnabled(SharedPreferences sp) { @@ -2166,7 +2167,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen p.println(" mPredicting=" + mPredicting); p.println(" mAutoCorrectOn=" + mAutoCorrectOn); p.println(" mAutoSpace=" + mAutoSpace); - p.println(" mCompletionOn=" + mCompletionOn); + p.println(" mApplicationSpecifiedCompletionOn=" + mApplicationSpecifiedCompletionOn); p.println(" TextEntryState.state=" + TextEntryState.getState()); p.println(" mSoundOn=" + mSoundOn); p.println(" mVibrateOn=" + mVibrateOn); diff --git a/java/src/com/android/inputmethod/latin/Settings.java b/java/src/com/android/inputmethod/latin/Settings.java index 9c7c5aa71..d2ec917d0 100644 --- a/java/src/com/android/inputmethod/latin/Settings.java +++ b/java/src/com/android/inputmethod/latin/Settings.java @@ -57,7 +57,7 @@ public class Settings extends PreferenceActivity public static final String PREF_PREDICTION_SETTINGS_KEY = "prediction_settings"; public static final String PREF_QUICK_FIXES = "quick_fixes"; public static final String PREF_SHOW_SUGGESTIONS_SETTING = "show_suggestions_setting"; - public static final String PREF_AUTO_COMPLETION_THRESHOLD = "auto_completion_threshold"; + public static final String PREF_AUTO_CORRECTION_THRESHOLD = "auto_correction_threshold"; public static final String PREF_BIGRAM_SUGGESTIONS = "bigram_suggestion"; // Dialog ids @@ -66,7 +66,7 @@ public class Settings extends PreferenceActivity private CheckBoxPreference mQuickFixes; private ListPreference mVoicePreference; private ListPreference mSettingsKeyPreference; - private ListPreference mAutoCompletionThreshold; + private ListPreference mAutoCorrectionThreshold; private CheckBoxPreference mBigramSuggestion; private boolean mVoiceOn; @@ -77,11 +77,11 @@ public class Settings extends PreferenceActivity private boolean mOkClicked = false; private String mVoiceModeOff; - private void ensureConsistencyOfAutoCompletionSettings() { - final String autoCompletionOff = getResources().getString( - R.string.auto_completion_threshold_mode_value_off); - final String currentSetting = mAutoCompletionThreshold.getValue(); - mBigramSuggestion.setEnabled(!currentSetting.equals(autoCompletionOff)); + private void ensureConsistencyOfAutoCorrectionSettings() { + final String autoCorrectionOff = getResources().getString( + R.string.auto_correction_threshold_mode_value_off); + final String currentSetting = mAutoCorrectionThreshold.getValue(); + mBigramSuggestion.setEnabled(!currentSetting.equals(autoCorrectionOff)); } @Override protected void onCreate(Bundle icicle) { @@ -98,9 +98,9 @@ public class Settings extends PreferenceActivity .equals(mVoiceModeOff)); mLogger = VoiceInputLogger.getLogger(this); - mAutoCompletionThreshold = (ListPreference) findPreference(PREF_AUTO_COMPLETION_THRESHOLD); + mAutoCorrectionThreshold = (ListPreference) findPreference(PREF_AUTO_CORRECTION_THRESHOLD); mBigramSuggestion = (CheckBoxPreference) findPreference(PREF_BIGRAM_SUGGESTIONS); - ensureConsistencyOfAutoCompletionSettings(); + ensureConsistencyOfAutoCorrectionSettings(); final boolean showSettingsKeyOption = getResources().getBoolean( R.bool.config_enable_show_settings_key_option); @@ -155,7 +155,7 @@ public class Settings extends PreferenceActivity showVoiceConfirmation(); } } - ensureConsistencyOfAutoCompletionSettings(); + ensureConsistencyOfAutoCorrectionSettings(); mVoiceOn = !(prefs.getString(PREF_VOICE_SETTINGS_KEY, mVoiceModeOff) .equals(mVoiceModeOff)); updateVoiceModeSummary(); diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java index 237d7cb67..77e0a3dde 100644 --- a/java/src/com/android/inputmethod/latin/Suggest.java +++ b/java/src/com/android/inputmethod/latin/Suggest.java @@ -81,7 +81,7 @@ public class Suggest implements Dictionary.WordCallback { private boolean mAutoTextEnabled; - private double mAutoCompleteThreshold; + private double mAutoCorrectionThreshold; private int[] mPriorities = new int[mPrefMaxSuggestions]; private int[] mBigramPriorities = new int[PREF_MAX_BIGRAMS]; @@ -164,8 +164,8 @@ public class Suggest implements Dictionary.WordCallback { mUserBigramDictionary = userBigramDictionary; } - public void setAutoCompleteThreshold(double threshold) { - mAutoCompleteThreshold = threshold; + public void setAutoCorrectionThreshold(double threshold) { + mAutoCorrectionThreshold = threshold; } /** @@ -294,9 +294,9 @@ public class Suggest implements Dictionary.WordCallback { if (LatinImeLogger.sDBG) { Log.d(TAG, "Normalized " + mOriginalWord + "," + mSuggestions.get(0) + "," + mPriorities[0] + normalizedScore - + "(" + mAutoCompleteThreshold + ")"); + + "(" + mAutoCorrectionThreshold + ")"); } - if (normalizedScore >= mAutoCompleteThreshold) { + if (normalizedScore >= mAutoCorrectionThreshold) { mHaveCorrection = true; } }