diff --git a/java/res/values/donottranslate-altchars.xml b/java/res/values/donottranslate-altchars.xml index 41c498ee35db3264d95d5eecebbd6c3c60e9965d..de4250edf4b79edd1790f83f3de5aef7af47a44b 100644 --- a/java/res/values/donottranslate-altchars.xml +++ b/java/res/values/donottranslate-altchars.xml @@ -43,4 +43,14 @@ <string name="alternates_for_scandinavia_row2_11"></string> <string name="alternates_for_cyrillic_e"></string> <string name="alternates_for_cyrillic_soft_sign"></string> + <!-- popular web domains for the locale - most popular, displayed on the keyboard --> + <string name="popular_domain_0">".com"</string> + <!-- popular web domains for the locale - item 1, displayed in the popup --> + <string name="popular_domain_1">".net"</string> + <!-- popular web domains for the locale - item 2, displayed in the popup --> + <string name="popular_domain_2">".org"</string> + <!-- popular web domains for the locale - item 3, displayed in the popup --> + <string name="popular_domain_3">".gov"</string> + <!-- popular web domains for the locale - item 4, displayed in the popup --> + <string name="popular_domain_4">".edu"</string> </resources> diff --git a/java/res/values/donottranslate.xml b/java/res/values/donottranslate.xml index 453e188ff779c6effee9f5be7bcd348fc120ed47..cfca4d624c971c377e609f7362136c0baee7b736 100644 --- a/java/res/values/donottranslate.xml +++ b/java/res/values/donottranslate.xml @@ -27,31 +27,93 @@ <!-- Option values to show/hide the settings key in onscreen keyboard --> <!-- Automatically decide to show or hide the settings key --> - <string name="settings_key_mode_auto" translatable="false">0</string> + <string name="settings_key_mode_auto">0</string> <!-- Always show the settings key --> - <string name="settings_key_mode_always_show" translatable="false">1</string> + <string name="settings_key_mode_always_show">1</string> <!-- Always hide the settings key --> - <string name="settings_key_mode_always_hide" translatable="false">2</string> + <string name="settings_key_mode_always_hide">2</string> + <!-- Array of the settings key mode values --> + <string-array name="settings_key_modes_values"> + <item>@string/settings_key_mode_auto</item> + <item>@string/settings_key_mode_always_show</item> + <item>@string/settings_key_mode_always_hide</item> + </string-array> + <!-- Array of the settings key modes --> + <string-array name="settings_key_modes"> + <item>@string/settings_key_mode_auto_name</item> + <item>@string/settings_key_mode_always_show_name</item> + <item>@string/settings_key_mode_always_hide_name</item> + </string-array> <!-- Always show the suggestion strip --> - <string name="prefs_suggestion_visibility_show_value" translatable="false">0</string> + <string name="prefs_suggestion_visibility_show_value">0</string> <!-- Show the suggestion strip only on portrait mode --> - <string name="prefs_suggestion_visibility_show_only_portrait_value" translatable="false">1</string> + <string name="prefs_suggestion_visibility_show_only_portrait_value">1</string> <!-- Always hide the suggestion strip --> - <string name="prefs_suggestion_visibility_hide_value" translatable="false">2</string> + <string name="prefs_suggestion_visibility_hide_value">2</string> <!-- Default value of the visibility of the suggestion strip --> - <string name="prefs_suggestion_visibility_default_value" translatable="false">0</string> + <string name="prefs_suggestion_visibility_default_value">0</string> + <!-- Option to show/hide the suggestion strip --> + <string-array name="prefs_suggestion_visibility_values"> + <item>@string/prefs_suggestion_visibility_show_value</item> + <item>@string/prefs_suggestion_visibility_show_only_portrait_value</item> + <item>@string/prefs_suggestion_visibility_hide_value</item> + </string-array> + <string-array name="prefs_suggestion_visibilities"> + <item>@string/prefs_suggestion_visibility_show_name</item> + <item>@string/prefs_suggestion_visibility_show_only_portrait_name</item> + <item>@string/prefs_suggestion_visibility_hide_name</item> + </string-array> + + <string name="auto_correction_threshold_mode_value_off">0</string> + <string name="auto_correction_threshold_mode_value_modest">1</string> + <string name="auto_correction_threshold_mode_value_aggeressive">2</string> + <string-array name="auto_correction_threshold_mode_values"> + <item>@string/auto_correction_threshold_mode_value_off</item> + <item>@string/auto_correction_threshold_mode_value_modest</item> + <item>@string/auto_correction_threshold_mode_value_aggeressive</item> + </string-array> + <string-array name="auto_correction_threshold_modes"> + <item>@string/auto_correction_threshold_mode_off</item> + <item>@string/auto_correction_threshold_mode_modest</item> + <item>@string/auto_correction_threshold_mode_aggeressive</item> + </string-array> + + <string name="voice_mode_main">0</string> + <string name="voice_mode_symbols">1</string> + <string name="voice_mode_off">2</string> + <string-array name="voice_input_modes_values"> + <item>@string/voice_mode_main</item> + <item>@string/voice_mode_symbols</item> + <item>@string/voice_mode_off</item> + </string-array> + <!-- Array of Voice Input modes --> + <string-array name="voice_input_modes"> + <item>@string/voice_input_modes_main_keyboard</item> + <item>@string/voice_input_modes_symbols_keyboard</item> + <item>@string/voice_input_modes_off</item> + </string-array> + <!-- Array of Voice Input modes summary --> + <string-array name="voice_input_modes_summary"> + <item>@string/voice_input_modes_summary_main_keyboard</item> + <item>@string/voice_input_modes_summary_symbols_keyboard</item> + <item>@string/voice_input_modes_summary_off</item> + </string-array> + + <!-- Title for Latin keyboard debug settings activity / dialog --> + <string name="english_ime_debug_settings">Android keyboard Debug settings</string> + <string name="prefs_debug_mode">Debug Mode</string> <!-- Keyboard theme names --> - <string name="layout_basic" translatable="false">Basic</string> - <string name="layout_high_contrast" translatable="false">Basic (High Contrast)</string> - <string name="layout_stone_bold" translatable="false">Stone (bold)</string> - <string name="layout_stone_normal" translatable="false">Stone (normal)</string> - <string name="layout_gingerbread" translatable="false">Gingerbread</string> - <string name="layout_honeycomb" translatable="false">Honeycomb</string> + <string name="layout_basic">Basic</string> + <string name="layout_high_contrast">Basic (High Contrast)</string> + <string name="layout_stone_bold">Stone (bold)</string> + <string name="layout_stone_normal">Stone (normal)</string> + <string name="layout_gingerbread">Gingerbread</string> + <string name="layout_honeycomb">Honeycomb</string> <!-- For keyboard theme switcher dialog --> - <string-array name="keyboard_layout_modes" translatable="false"> + <string-array name="keyboard_layout_modes"> <item>@string/layout_basic</item> <item>@string/layout_high_contrast</item> <item>@string/layout_stone_normal</item> @@ -59,7 +121,7 @@ <item>@string/layout_gingerbread</item> <item>@string/layout_honeycomb</item> </string-array> - <string-array name="keyboard_layout_modes_values" translatable="false"> + <string-array name="keyboard_layout_modes_values"> <item>0</item> <item>1</item> <item>2</item> diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml index da315df80a637e8421196c64ba2798d98d04dec0..c244ad214f02d83a0a3a39c53b397a0b2e02f5d4 100644 --- a/java/res/values/strings.xml +++ b/java/res/values/strings.xml @@ -34,182 +34,54 @@ <!-- Option to control whether or not to show a popup with a larger font on each key press. --> <string name="popup_on_keypress">Popup on keypress</string> - <!-- Option to enable using nearby keys when correcting/predicting --> - <string name="hit_correction">Correct typing errors</string> - - <!-- Description for hit_correction --> - <string name="hit_correction_summary">Enable input error correction</string> - - <!-- Option to enable using nearby keys when correcting/predicting in landscape--> - <string name="hit_correction_land">Landscape input errors</string> - - <!-- Description for hit_correction in landscape --> - <string name="hit_correction_land_summary">Enable input error correction</string> - - <!-- Option to automatically correct word on hitting space --> - <string name="auto_correction">Word suggestions</string> - - <!-- Description for auto_correction --> - <string name="auto_correction_summary">Automatically correct the previous word</string> - - <!-- Option to enable text prediction --> - <string name="prediction">Word suggestions</string> <!-- Category title for text prediction --> <string name="prediction_category">Word suggestion settings</string> - <!-- Description for text prediction --> - <string name="prediction_summary">Enable auto completion while typing</string> - - <!-- Dialog title for auto complete choices --> - <string name="auto_complete_dialog_title">Auto completion</string> - - <!-- Option to enable text prediction in landscape --> - <string name="prediction_landscape">Increase text field size</string> - <!-- Description for text prediction --> - <string name="prediction_landscape_summary">Hide word suggestions in landscape view</string> <!-- Option to enable auto capitalization of sentences --> <string name="auto_cap">Auto-capitalization</string> - <!-- Description for auto cap --> - <string name="auto_cap_summary">Capitalize the start of a sentence</string> - <!-- Option to enable auto punctuate --> - <string name="auto_punctuate">Auto-punctuate</string> - <!-- Description for auto punctuate --> - <string name="auto_punctuate_summary"></string> - + <!-- Option to enable quick fixes --> <string name="quick_fixes">Quick fixes</string> <!-- Description for quick fixes --> <string name="quick_fixes_summary">Corrects commonly typed mistakes</string> - + <!-- Option to enable showing suggestions --> <string name="prefs_show_suggestions">Show suggestions</string> <!-- Description for show suggestions --> <string name="prefs_show_suggestions_summary">Display suggested words while typing</string> - <!-- Option to show/hide the suggestion strip --> - <string-array name="prefs_suggestion_visibility_values" translatable="false"> - <item>@string/prefs_suggestion_visibility_show_value</item> - <item>@string/prefs_suggestion_visibility_show_only_portrait_value</item> - <item>@string/prefs_suggestion_visibility_hide_value</item> - </string-array> <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> - <string-array name="prefs_suggestion_visibilities" translatable="false"> - <item>@string/prefs_suggestion_visibility_show_name</item> - <item>@string/prefs_suggestion_visibility_show_only_portrait_name</item> - <item>@string/prefs_suggestion_visibility_hide_name</item> - </string-array> <!-- Option to show/hide the settings key --> <string name="prefs_settings_key">Show settings key</string> - <!-- Array of the settings key mode values --> - <string-array name="settings_key_modes_values" translatable="false"> - <item>@string/settings_key_mode_auto</item> - <item>@string/settings_key_mode_always_show</item> - <item>@string/settings_key_mode_always_hide</item> - </string-array> <!-- Option to automatically decide to show/hide the settings key --> <string name="settings_key_mode_auto_name">Automatic</string> <!-- Option to always show the settings key --> <string name="settings_key_mode_always_show_name">Always show</string> <!-- Option to always hide the settings key --> <string name="settings_key_mode_always_hide_name">Always hide</string> - <!-- Array of the settings key modes --> - <string-array name="settings_key_modes"> - <item>@string/settings_key_mode_auto_name</item> - <item>@string/settings_key_mode_always_show_name</item> - <item>@string/settings_key_mode_always_hide_name</item> - </string-array> - - <!-- Option to decide the auto completion threshold score --> - <!-- Option to enable auto completion --> - <string name="auto_complete">Auto-complete</string> - <!-- Description for auto completion --> - <string name="auto_complete_summary">Spacebar and punctuation automatically insert highlighted word</string> - <string name="auto_completion_threshold_mode_value_off" translatable="false">0</string> - <string name="auto_completion_threshold_mode_value_modest" translatable="false">1</string> - <string name="auto_completion_threshold_mode_value_aggeressive" translatable="false">2</string> - <string-array name="auto_completion_threshold_mode_values" translatable="false"> - <item>@string/auto_completion_threshold_mode_value_off</item> - <item>@string/auto_completion_threshold_mode_value_modest</item> - <item>@string/auto_completion_threshold_mode_value_aggeressive</item> - </string-array> - <!-- Option to disable auto completion. --> - <string name="auto_completion_threshold_mode_off">Off</string> + + <!-- Option to decide the auto correction threshold score --> + <!-- Option to enable auto correction --> + <string name="auto_correction">Auto correction</string> + <!-- Description for auto correction --> + <string name="auto_correction_summary">Spacebar and punctuation automatically insert highlighted word</string> + <!-- Option to disable auto correction. --> + <string name="auto_correction_threshold_mode_off">Off</string> <!-- Option to use modest auto completion. --> - <string name="auto_completion_threshold_mode_modest">Modest</string> + <string name="auto_correction_threshold_mode_modest">Modest</string> <!-- Option to use aggressive auto completion. --> - <string name="auto_completion_threshold_mode_aggeressive">Aggressive</string> - <string-array name="auto_completion_threshold_modes"> - <item>@string/auto_completion_threshold_mode_off</item> - <item>@string/auto_completion_threshold_mode_modest</item> - <item>@string/auto_completion_threshold_mode_aggeressive</item> - </string-array> + <string name="auto_correction_threshold_mode_aggeressive">Aggressive</string> <!-- Option to enable bigram completion --> <string name="bigram_suggestion">Bigram Suggestions</string> <!-- Description for auto completion --> <string name="bigram_suggestion_summary">Use previous word to improve suggestion</string> - <!-- Array of prediction modes --> - <string-array name="prediction_modes"> - <item>None</item> - <item>Basic</item> - <item>Advanced</item> - </string-array> - - <!-- Don't translate --> - <string name="prediction_none" translatable="false">0</string> - <!-- Don't translate --> - <string name="prediction_basic" translatable="false">1</string> - <!-- Don't translate --> - <string name="prediction_full" translatable="false">2</string> - - <string-array name="prediction_modes_values" translatable="false"> - <item>@string/prediction_none</item> - <item>@string/prediction_basic</item> - <item>@string/prediction_full</item> - </string-array> - <!-- Indicates that a word has been added to the dictionary --> <string name="added_word"><xliff:g id="word">%s</xliff:g> : Saved</string> - <!-- Tip to long press on keys --> - <string name="tip_long_press">Hold a key down to see accents (ø, ö, etc.)</string> - <!-- Tip to dismiss keyboard --> - <string name="tip_dismiss">Press the back key \u21B6 to close the keyboard at any point</string> - <!-- Tip to press ?123 to access numbers and symbols --> - <string name="tip_access_symbols">Access numbers and symbols</string> - <!-- Tip to long press on typed word to add to dictionary --> - <string name="tip_add_to_dictionary">Press and hold the left-most word to add it to the dictionary - </string> - - <!-- Instruction to touch the bubble to continue --> - <string name="touch_to_continue">Touch this hint to continue »</string> - - <!-- Instruction to touch the bubble to start typing --> - <string name="touch_to_finish">Touch here to close this hint and start typing!</string> - - <!-- Tutorial tip 1 - The keyboard opens any time you touch a text field --> - <string name="tip_to_open_keyboard"><b>The keyboard opens any time you touch a text field</b></string> - - <!-- Tutorial tip 2 - Touch and hold a key to view accents (examples) --> - <string name="tip_to_view_accents"><b>Touch & hold a key to view accents\n(ø, ö, ô, ó, and so on)</b> - </string> - - <!-- Tutorial tip 3 - How to switch to number/symbol keyboard --> - <string name="tip_to_open_symbols"><b>Switch to numbers and symbols by touching this key</b></string> - - <!-- Tutorial tip 4 - How to switch back to alphabet keyboard --> - <string name="tip_to_close_symbols"><b>Go back to letters by touching this key again</b></string> - - <!-- Tutorial tip 5 - How to launch keyboard settings --> - <string name="tip_to_launch_settings"><b>Touch & hold this key to change keyboard settings, like auto complete</b></string> - - <!-- Tutorial tip 6 - Done with the tutorial --> - <string name="tip_to_start_typing"><b>Try it!</b></string> - - <!-- Label for soft enter key when it performs GO action. Must be short to fit on key! --> <string name="label_go_key">Go</string> <!-- Label for soft enter key when it performs NEXT action. Must be short to fit on key! --> @@ -308,62 +180,14 @@ <!-- Preferences item for enabling speech input --> <string name="voice_input">Voice input</string> - <!-- Array of Voice Input modes --> - <string-array name="voice_input_modes"> - <item>On main keyboard</item> - <item>On symbols keyboard</item> - <item>Off</item> - </string-array> - - <!-- Don't translate --> - <string name="voice_mode_main" translatable="false">0</string> - <!-- Don't translate --> - <string name="voice_mode_symbols" translatable="false">1</string> - <!-- Don't translate --> - <string name="voice_mode_off" translatable="false">2</string> - - <string-array name="voice_input_modes_values" translatable="false"> - <item>@string/voice_mode_main</item> - <item>@string/voice_mode_symbols</item> - <item>@string/voice_mode_off</item> - </string-array> - - <!-- Array of Voice Input modes summary --> - <string-array name="voice_input_modes_summary"> - <item>Mic on main keyboard</item> - <item>Mic on symbols keyboard</item> - <item>Voice input is disabled</item> - </string-array> - - <!-- Press the "enter" key after the user speaks. Option on settings.--> - <string name="auto_submit">Auto submit after voice</string> - - <!-- Press the "enter" key after the user speaks. Summary of option in settings.--> - <string name="auto_submit_summary">Automatically press enter when searching or going to the next field.</string> - - <!-- IME Tutorial screen (ROMAN) --><skip /> - <!-- appears above image showing the user to click on a TextView to show the IME --> - <string name="open_the_keyboard"><font size="17"><b>Open the keyboard\n</b></font><font size="3">\n</font>Touch any text field.</string> - - <!-- appears above the image showing the back button used to close the keyboard --> - <string name="close_the_keyboard"><font size="17"><b>Close the keyboard\n</b></font><font size="3">\n</font>Press the Back key.</string> - - <!-- appears above image showing how to use touch and hold --> - <string name="touch_and_hold"><font size="17"><b>Touch \u0026 hold a key for options\n</b></font><font size="3">\n</font>Access punctuation and accents.</string> - - <!-- appears above image showing how to access keyboard settings --> - <string name="keyboard_settings"><font size="17"><b>Keyboard settings\n</b></font><font size="3">\n</font>Touch \u0026 hold the <b>\?123\</b> key.</string> - - <!-- popular web domains for the locale - most popular, displayed on the keyboard --> - <string name="popular_domain_0">".com"</string> - <!-- popular web domains for the locale - item 1, displayed in the popup --> - <string name="popular_domain_1">".net"</string> - <!-- popular web domains for the locale - item 2, displayed in the popup --> - <string name="popular_domain_2">".org"</string> - <!-- popular web domains for the locale - item 3, displayed in the popup --> - <string name="popular_domain_3">".gov"</string> - <!-- popular web domains for the locale - item 4, displayed in the popup --> - <string name="popular_domain_4">".edu"</string> + <!-- Voice Input modes --> + <string name="voice_input_modes_main_keyboard">On main keyboard</string> + <string name="voice_input_modes_symbols_keyboard">On symbols keyboard</string> + <string name="voice_input_modes_off">Off</string> + <!-- Voice Input modes summary --> + <string name="voice_input_modes_summary_main_keyboard">Mic on main keyboard</string> + <string name="voice_input_modes_summary_symbols_keyboard">Mic on symbols keyboard</string> + <string name="voice_input_modes_summary_off">Voice input is disabled</string> <!-- Menu item for launching Input method picker --> <string name="selectInputMethod">Select input method</string> @@ -391,8 +215,6 @@ <!-- Description for keyboard theme switcher --> <string name="keyboard_layout">Keyboard Theme</string> - <string name="subtype_mode_keyboard">keyboard</string> - <string name="subtype_mode_voice">voice</string> <string name="subtype_mode_cs_keyboard">Czech Keyboard</string> <string name="subtype_mode_da_keyboard">Danish Keyboard</string> <string name="subtype_mode_de_keyboard">German Keyboard</string> @@ -428,9 +250,6 @@ <string name="subtype_mode_zh_CN_voice">Chinese (China) Voice</string> <string name="subtype_mode_zh_TW_voice">Chinese (Taiwan) Voice</string> - <!-- Title for Latin keyboard debug settings activity / dialog --> - <string name="english_ime_debug_settings" translatable="false">Android keyboard Debug settings</string> - <string name="prefs_debug_mode" translatable="false">Debug Mode</string> <!-- Title of an option for usability study mode --> <string name="prefs_usability_study_mode">Usability Study Mode</string> </resources> diff --git a/java/res/xml-xlarge/kbd_key_styles.xml b/java/res/xml-xlarge/kbd_key_styles.xml index 8a1f6ffc69aa9a7d5ac42c48a23739204436e1ab..9ff3340b8d1968951deab294086d969b816c7101 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" /> <key-style latin:styleName="comKeyStyle" - latin:keyLabel=".com" + latin:keyLabel="@string/popular_domain_0" latin:keyLabelOption="fontNormal" - latin:keyOutputText=".com" + latin:keyOutputText="@string/popular_domain_0" latin:keyHintIcon="@drawable/hint_popup_holo" latin:popupKeyboard="@xml/popup_domains" /> </merge> diff --git a/java/res/xml/prefs.xml b/java/res/xml/prefs.xml index 85612b049badd18f662a915638882cf0977a3d02..1bc33950d664400aed935445f699b71121a712fc 100644 --- a/java/res/xml/prefs.xml +++ b/java/res/xml/prefs.xml @@ -102,13 +102,13 @@ /> <ListPreference - android:key="auto_completion_threshold" - android:title="@string/auto_complete" - android:summary="@string/auto_complete_summary" + android:key="auto_correction_threshold" + android:title="@string/auto_correction" + android:summary="@string/auto_correction_summary" android:persistent="true" - android:entryValues="@array/auto_completion_threshold_mode_values" - android:entries="@array/auto_completion_threshold_modes" - android:defaultValue="@string/auto_completion_threshold_mode_value_modest" + android:entryValues="@array/auto_correction_threshold_mode_values" + android:entries="@array/auto_correction_threshold_modes" + android:defaultValue="@string/auto_correction_threshold_mode_value_modest" /> <CheckBoxPreference diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java index 51e878c885bcbd2dec8fc670015c6a26422e601c..cd57db360b03b21433f593bb5d87ec9285ef9812 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java @@ -74,9 +74,9 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha private int mMode = KeyboardId.MODE_TEXT; /* default value */ private int mImeOptions; private boolean mIsSymbols; - /** mIsAutoCompletionActive indicates that auto completed word will be input instead of + /** mIsAutoCorrectionActive indicates that auto corrected word will be input instead of * what user actually typed. */ - private boolean mIsAutoCompletionActive; + private boolean mIsAutoCorrectionActive; private boolean mVoiceKeyEnabled; private boolean mVoiceButtonOnPrimary; private int mSymbolsModeState = SYMBOLS_MODE_STATE_NONE; @@ -197,7 +197,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha Log.d(TAG, "keyboard cache size=" + mKeyboardCache.size() + ": HIT id=" + id); } - keyboard.onAutoCompletionStateChanged(mIsAutoCompletionActive); + keyboard.onAutoCorrectionStateChanged(mIsAutoCorrectionActive); keyboard.setShifted(false); return keyboard; } @@ -617,12 +617,12 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha ? mInputView.getColorScheme() : KeyboardView.COLOR_SCHEME_WHITE; } - public void onAutoCompletionStateChanged(boolean isAutoCompletion) { - if (isAutoCompletion != mIsAutoCompletionActive) { + public void onAutoCorrectionStateChanged(boolean isAutoCorrection) { + if (isAutoCorrection != mIsAutoCorrectionActive) { LatinKeyboardView keyboardView = getInputView(); - mIsAutoCompletionActive = isAutoCompletion; + mIsAutoCorrectionActive = isAutoCorrection; keyboardView.invalidateKey(((LatinKeyboard) keyboardView.getKeyboard()) - .onAutoCompletionStateChanged(isAutoCompletion)); + .onAutoCorrectionStateChanged(isAutoCorrection)); } } diff --git a/java/src/com/android/inputmethod/keyboard/LatinKeyboard.java b/java/src/com/android/inputmethod/keyboard/LatinKeyboard.java index 8087f030e3dff6a24701935b1362b67c5bd8b90b..0a42857ff0e4118745ee931a357a0bb9039d5110 100644 --- a/java/src/com/android/inputmethod/keyboard/LatinKeyboard.java +++ b/java/src/com/android/inputmethod/keyboard/LatinKeyboard.java @@ -45,7 +45,7 @@ public class LatinKeyboard extends Keyboard { private static final int SPACE_LED_LENGTH_PERCENT = 80; private Drawable mShiftLockPreviewIcon; - private Drawable mSpaceAutoCompletionIndicator; + private Drawable mSpaceAutoCorrectionIndicator; private final Drawable mButtonArrowLeftIcon; private final Drawable mButtonArrowRightIcon; private final int mSpaceBarTextShadowColor; @@ -89,7 +89,7 @@ public class LatinKeyboard extends Keyboard { } mShiftLockPreviewIcon = res.getDrawable(R.drawable.sym_keyboard_feedback_shift_locked); setDefaultBounds(mShiftLockPreviewIcon); - mSpaceAutoCompletionIndicator = res.getDrawable(R.drawable.sym_keyboard_space_led); + mSpaceAutoCorrectionIndicator = res.getDrawable(R.drawable.sym_keyboard_space_led); mButtonArrowLeftIcon = res.getDrawable(R.drawable.sym_keyboard_language_arrows_left); mButtonArrowRightIcon = res.getDrawable(R.drawable.sym_keyboard_language_arrows_right); sSpacebarVerticalCorrection = res.getDimensionPixelOffset( @@ -100,22 +100,22 @@ public class LatinKeyboard extends Keyboard { /** * @return a key which should be invalidated. */ - public Key onAutoCompletionStateChanged(boolean isAutoCompletion) { - updateSpaceBarForLocale(isAutoCompletion); + public Key onAutoCorrectionStateChanged(boolean isAutoCorrection) { + updateSpaceBarForLocale(isAutoCorrection); return mSpaceKey; } - private void updateSpaceBarForLocale(boolean isAutoCompletion) { + private void updateSpaceBarForLocale(boolean isAutoCorrection) { final Resources res = mRes; // If application locales are explicitly selected. if (SubtypeSwitcher.getInstance().needsToDisplayLanguage()) { mSpaceKey.setIcon(new BitmapDrawable(res, - drawSpaceBar(OPACITY_FULLY_OPAQUE, isAutoCompletion))); + drawSpaceBar(OPACITY_FULLY_OPAQUE, isAutoCorrection))); } else { // sym_keyboard_space_led can be shared with Black and White symbol themes. - if (isAutoCompletion) { + if (isAutoCorrection) { mSpaceKey.setIcon(new BitmapDrawable(res, - drawSpaceBar(OPACITY_FULLY_OPAQUE, isAutoCompletion))); + drawSpaceBar(OPACITY_FULLY_OPAQUE, isAutoCorrection))); } else { mSpaceKey.setIcon(mSpaceIcon); } @@ -173,7 +173,7 @@ public class LatinKeyboard extends Keyboard { } @SuppressWarnings("unused") - private Bitmap drawSpaceBar(int opacity, boolean isAutoCompletion) { + private Bitmap drawSpaceBar(int opacity, boolean isAutoCorrection) { final int width = mSpaceKey.mWidth; final int height = mSpaceIcon.getIntrinsicHeight(); final Bitmap buffer = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); @@ -212,13 +212,13 @@ public class LatinKeyboard extends Keyboard { } // Draw the spacebar icon at the bottom - if (isAutoCompletion) { + if (isAutoCorrection) { final int iconWidth = width * SPACE_LED_LENGTH_PERCENT / 100; - final int iconHeight = mSpaceAutoCompletionIndicator.getIntrinsicHeight(); + final int iconHeight = mSpaceAutoCorrectionIndicator.getIntrinsicHeight(); int x = (width - iconWidth) / 2; int y = height - iconHeight; - mSpaceAutoCompletionIndicator.setBounds(x, y, x + iconWidth, y + iconHeight); - mSpaceAutoCompletionIndicator.draw(canvas); + mSpaceAutoCorrectionIndicator.setBounds(x, y, x + iconWidth, y + iconHeight); + mSpaceAutoCorrectionIndicator.draw(canvas); } else { final int iconWidth = mSpaceIcon.getIntrinsicWidth(); final int iconHeight = mSpaceIcon.getIntrinsicHeight(); diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 46b735ab2b046436fdda4ffbc404340b73cf3f7a..a34d883ba672dd834cdbe08a2b49987907011028 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -63,6 +63,7 @@ import android.view.ViewParent; import android.view.Window; import android.view.WindowManager; import android.view.inputmethod.CompletionInfo; +import android.view.inputmethod.CorrectionInfo; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.ExtractedText; import android.view.inputmethod.ExtractedTextRequest; @@ -119,7 +120,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen private View mCandidateViewContainer; private CandidateView mCandidateView; private Suggest mSuggest; - private CompletionInfo[] mCompletions; + private CompletionInfo[] mApplicationSpecifiedCompletions; private AlertDialog mOptionsDialog; @@ -141,7 +142,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen private CharSequence mBestWord; private boolean mPredicting; private boolean mPredictionOn; - private boolean mCompletionOn; + private boolean mApplicationSpecifiedCompletionOn; private boolean mHasDictionary; private boolean mAutoSpace; private boolean mJustAddedAutoSpace; @@ -393,7 +394,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen int[] dictionaries = getDictionary(orig); mSuggest = new Suggest(this, dictionaries); - loadAndSetAutoCompletionThreshold(prefs); + loadAndSetAutoCorrectionThreshold(prefs); if (mUserDictionary != null) mUserDictionary.close(); mUserDictionary = new UserDictionary(this, locale); if (mContactsDictionary == null) { @@ -519,8 +520,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen mVoiceConnector.resetVoiceStates(isPasswordVariation(variation)); mInputTypeNoAutoCorrect = false; mPredictionOn = false; - mCompletionOn = false; - mCompletions = null; + mApplicationSpecifiedCompletionOn = false; + mApplicationSpecifiedCompletions = null; mEnteredText = null; final int mode; @@ -579,7 +580,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen } if ((attribute.inputType & InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE) != 0) { mPredictionOn = false; - mCompletionOn = isFullscreenMode(); + mApplicationSpecifiedCompletionOn = isFullscreenMode(); } break; default: @@ -654,7 +655,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen super.onFinishInput(); LatinImeLogger.commit(); - mKeyboardSwitcher.onAutoCompletionStateChanged(false); + mKeyboardSwitcher.onAutoCorrectionStateChanged(false); mVoiceConnector.flushVoiceInputLogs(mConfigurationChanging); @@ -789,7 +790,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen @Override public void hideWindow() { LatinImeLogger.commit(); - mKeyboardSwitcher.onAutoCompletionStateChanged(false); + mKeyboardSwitcher.onAutoCorrectionStateChanged(false); if (TRACE) Debug.stopMethodTracing(); if (mOptionsDialog != null && mOptionsDialog.isShowing()) { @@ -803,22 +804,24 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen } @Override - public void onDisplayCompletions(CompletionInfo[] completions) { + public void onDisplayCompletions(CompletionInfo[] applicationSpecifiedCompletions) { if (DEBUG) { Log.i("foo", "Received completions:"); - for (int i=0; i<(completions != null ? completions.length : 0); i++) { - Log.i("foo", " #" + i + ": " + completions[i]); + final int count = (applicationSpecifiedCompletions != null) + ? applicationSpecifiedCompletions.length : 0; + for (int i = 0; i < count; i++) { + Log.i("foo", " #" + i + ": " + applicationSpecifiedCompletions[i]); } } - if (mCompletionOn) { - mCompletions = completions; - if (completions == null) { + if (mApplicationSpecifiedCompletionOn) { + mApplicationSpecifiedCompletions = applicationSpecifiedCompletions; + if (applicationSpecifiedCompletions == null) { clearSuggestions(); return; } SuggestedWords.Builder builder = new SuggestedWords.Builder() - .setApplicationSpecifiedCompletions(completions) + .setApplicationSpecifiedCompletions(applicationSpecifiedCompletions) .setTypedWordValid(true) .setHasMinimalSuggestion(true); // When in fullscreen mode, show completions generated by the application @@ -1291,7 +1294,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen boolean pickedDefault = false; // Handle separator - InputConnection ic = getCurrentInputConnection(); + final InputConnection ic = getCurrentInputConnection(); if (ic != null) { ic.beginBatchEdit(); abortCorrection(false); @@ -1392,8 +1395,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen private boolean isCandidateStripVisible() { boolean forceVisible = mCandidateView.isShowingAddToDictionaryHint() || TextEntryState.isCorrecting(); - return forceVisible || (isSuggestionShown() - && (isPredictionOn() || mCompletionOn || isShowingPunctuationList())); + return forceVisible || ( + isSuggestionShown() && (isPredictionOn() || mApplicationSpecifiedCompletionOn + || isShowingPunctuationList())); } public void switchToKeyboardView() { @@ -1431,7 +1435,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen if (mCandidateView != null) { mCandidateView.setSuggestions(words); if (mCandidateView.isConfigCandidateHighlightFontColorEnabled()) - mKeyboardSwitcher.onAutoCompletionStateChanged(words.hasAutoCorrectionWord()); + mKeyboardSwitcher.onAutoCorrectionStateChanged(words.hasAutoCorrectionWord()); } } @@ -1537,9 +1541,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen if (ic != null) { ic.beginBatchEdit(); } - if (mCompletionOn && mCompletions != null && index >= 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 9c7c5aa71f6d057b3e182af073e615f92b3e98ef..d2ec917d04d8ccfea1fbc92937b3db6b08c22b19 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 237d7cb67906b2df97a6c8cf8f69f0a4e293c8b9..77e0a3dde6daf81a351551e7c9de7e1b403c1e27 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; } }