From c741398f36db3cf1c32d4189f270ad5ce9233725 Mon Sep 17 00:00:00 2001 From: Eric Fischer Date: Wed, 27 Apr 2011 13:54:15 -0700 Subject: [PATCH 01/12] Import revised translations. DO NOT MERGE Change-Id: I781027464664f612f90ae946e0a28ca51e3b19e7 --- java/res/values-el/strings.xml | 2 +- java/res/values-nl/strings.xml | 2 +- java/res/values-ro/strings.xml | 2 +- java/res/values-tl/strings.xml | 2 +- java/res/values-zh-rTW/strings.xml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/java/res/values-el/strings.xml b/java/res/values-el/strings.xml index ce731b187..5e5c583bf 100644 --- a/java/res/values-el/strings.xml +++ b/java/res/values-el/strings.xml @@ -75,7 +75,7 @@ "Επιστρέψτε στα γράμματα αγγίζοντας ξανά αυτό το πλήκτρο" "Αγγίξτε και κρατήστε πατημένο αυτό το πληκτρολόγιο για να αλλάξετε τις ρυθμίσεις πληκτρολογίου, όπως η αυτόματη συμπλήρωση" "Δοκιμάστε το!" - "Μετάβαση" + "Μετ." "Επόμενο" "Τέλος" "Αποστολή" diff --git a/java/res/values-nl/strings.xml b/java/res/values-nl/strings.xml index 1de743434..2dc77c700 100644 --- a/java/res/values-nl/strings.xml +++ b/java/res/values-nl/strings.xml @@ -75,7 +75,7 @@ "Ga terug naar letters door deze toets nogmaals aan te raken" "Blijf deze toets aanraken om toetsenbordinstellingen te wijzigen, zoals auto-aanvullen" "Probeer het zelf!" - "Beginnen" + "Start" "Volgende" "Gereed" "Verzenden" diff --git a/java/res/values-ro/strings.xml b/java/res/values-ro/strings.xml index e0628ca6a..37fdeb4cb 100644 --- a/java/res/values-ro/strings.xml +++ b/java/res/values-ro/strings.xml @@ -75,7 +75,7 @@ "Reveniţi la litere prin atingerea acestei taste din nou" "Apăsaţi şi ţineţi apăsată această tastă pentru a schimba setările tastaturii, cum ar fi completarea automată" "Încercaţi!" - "Accesaţi" + "OK" "Înainte" "Terminat" "Trimiteţi" diff --git a/java/res/values-tl/strings.xml b/java/res/values-tl/strings.xml index 2ab36ea35..d2c25d871 100644 --- a/java/res/values-tl/strings.xml +++ b/java/res/values-tl/strings.xml @@ -75,7 +75,7 @@ "Pumunta muli sa mga titik sa pamamagitan ng muling paggalaw sa key na ito" "Galawin & pinduting nang matagal ang key na ito upang baguhin ang mga setting ng keyboard, tulad ng awtomatikong pagkumpleto" "Subukan ito!" - "Pumunta" + "Punta" "Susunod" "Tapos na" "Ipadala" diff --git a/java/res/values-zh-rTW/strings.xml b/java/res/values-zh-rTW/strings.xml index 387711393..dd5996d25 100644 --- a/java/res/values-zh-rTW/strings.xml +++ b/java/res/values-zh-rTW/strings.xml @@ -50,7 +50,7 @@ "在反白顯示的字詞處自動插入空白鍵和標點符號鍵盤" "顯示設定金鑰" "自動" - "永遠顯示" + "一律顯示" "永遠隱藏" From 9b2192bfd2d3a06df3c685ed4287e192dbaabf32 Mon Sep 17 00:00:00 2001 From: Ken Wakasa Date: Fri, 29 Apr 2011 17:06:17 +0900 Subject: [PATCH 02/12] Revert the suggestion update delay to the original value (100msec) for phones. This is actually a follow-up to I385f9eb2 bug: 4361287 Change-Id: I4c4a0a96a7fa28f4f96dd984453d2c9f3fa7d6c2 --- java/res/values-xlarge/config.xml | 3 +-- java/res/values/config.xml | 3 +++ .../android/inputmethod/latin/LatinIME.java | 20 ++++++++++++------- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/java/res/values-xlarge/config.xml b/java/res/values-xlarge/config.xml index 2c125dc7e..80ef3cd8e 100644 --- a/java/res/values-xlarge/config.xml +++ b/java/res/values-xlarge/config.xml @@ -37,8 +37,7 @@ false true - - 1200 + 180 5 medium diff --git a/java/res/values/config.xml b/java/res/values/config.xml index 4651de785..ee86fbd59 100644 --- a/java/res/values/config.xml +++ b/java/res/values/config.xml @@ -50,6 +50,9 @@ false 1200 + 100 + 300 + 100 50 50 0 diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 105ec5a62..3c0aec762 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -110,9 +110,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar */ public static final String IME_OPTION_NO_SETTINGS_KEY = "noSettingsKey"; - private static final int DELAY_UPDATE_SUGGESTIONS = 180; - private static final int DELAY_UPDATE_OLD_SUGGESTIONS = 300; - private static final int DELAY_UPDATE_SHIFT_STATE = 100; private static final int EXTENDED_TOUCHABLE_REGION_HEIGHT = 100; // How many continuous deletes at which to start deleting at a higher speed. @@ -190,6 +187,9 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar private boolean mConfigEnableShowSubtypeSettings; private boolean mConfigSwipeDownDismissKeyboardEnabled; private int mConfigDelayBeforeFadeoutLanguageOnSpacebar; + private int mConfigDelayUpdateSuggestions; + private int mConfigDelayUpdateOldSuggestions; + private int mConfigDelayUpdateShiftState; private int mConfigDurationOfFadeoutLanguageOnSpacebar; private float mConfigFinalFadeoutFactorOfLanguageOnSpacebar; private long mConfigDoubleSpacesTurnIntoPeriodTimeout; @@ -310,7 +310,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar public void postUpdateSuggestions() { removeMessages(MSG_UPDATE_SUGGESTIONS); - sendMessageDelayed(obtainMessage(MSG_UPDATE_SUGGESTIONS), DELAY_UPDATE_SUGGESTIONS); + sendMessageDelayed(obtainMessage(MSG_UPDATE_SUGGESTIONS), + mConfigDelayUpdateSuggestions); } public void cancelUpdateSuggestions() { @@ -324,7 +325,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar public void postUpdateOldSuggestions() { removeMessages(MSG_UPDATE_OLD_SUGGESTIONS); sendMessageDelayed(obtainMessage(MSG_UPDATE_OLD_SUGGESTIONS), - DELAY_UPDATE_OLD_SUGGESTIONS); + mConfigDelayUpdateOldSuggestions); } public void cancelUpdateOldSuggestions() { @@ -333,7 +334,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar public void postUpdateShiftKeyState() { removeMessages(MSG_UPDATE_SHIFT_STATE); - sendMessageDelayed(obtainMessage(MSG_UPDATE_SHIFT_STATE), DELAY_UPDATE_SHIFT_STATE); + sendMessageDelayed(obtainMessage(MSG_UPDATE_SHIFT_STATE), mConfigDelayUpdateShiftState); } public void cancelUpdateShiftState() { @@ -342,7 +343,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar public void postUpdateBigramPredictions() { removeMessages(MSG_SET_BIGRAM_PREDICTIONS); - sendMessageDelayed(obtainMessage(MSG_SET_BIGRAM_PREDICTIONS), DELAY_UPDATE_SUGGESTIONS); + sendMessageDelayed(obtainMessage(MSG_SET_BIGRAM_PREDICTIONS), + mConfigDelayUpdateSuggestions); } public void cancelUpdateBigramPredictions() { @@ -425,6 +427,10 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar R.bool.config_swipe_down_dismiss_keyboard_enabled); mConfigDelayBeforeFadeoutLanguageOnSpacebar = res.getInteger( R.integer.config_delay_before_fadeout_language_on_spacebar); + mConfigDelayUpdateSuggestions = res.getInteger(R.integer.config_delay_update_suggestions); + mConfigDelayUpdateOldSuggestions = res.getInteger( + R.integer.config_delay_update_old_suggestions); + mConfigDelayUpdateShiftState = res.getInteger(R.integer.config_delay_update_shift_state); mConfigDurationOfFadeoutLanguageOnSpacebar = res.getInteger( R.integer.config_duration_of_fadeout_language_on_spacebar); mConfigFinalFadeoutFactorOfLanguageOnSpacebar = res.getInteger( From 0730bbfbf5e37bbcb5c287aeff71b304c833a36e Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Thu, 28 Apr 2011 15:39:39 +0900 Subject: [PATCH 03/12] Straighten out magic space vs real spaces behavior. Picking a suggestion inserts a space after the word. This change makes this space a magic space. Incidentally, do some minor cleanup: add CODE_DASH, CODE_SINGLE_QUOTE and CODE_DOUBLE_QUOTE to Keyboard and use them throughout the code, and remove a useless import directive in some unrelated file. Bug: 4319740 Change-Id: I245f396c34dd0af820bca91edc4ec363238a4ae4 --- java/res/values/keycodes.xml | 3 + .../inputmethod/keyboard/Keyboard.java | 3 + .../keyboard/KeyboardSwitcher.java | 2 +- .../inputmethod/latin/ContactsDictionary.java | 7 +- .../inputmethod/latin/DictionaryFactory.java | 1 - .../latin/ExpandableDictionary.java | 7 +- .../android/inputmethod/latin/LatinIME.java | 87 ++++++++----------- 7 files changed, 53 insertions(+), 57 deletions(-) diff --git a/java/res/values/keycodes.xml b/java/res/values/keycodes.xml index 0f0a74aea..7145af574 100644 --- a/java/res/values/keycodes.xml +++ b/java/res/values/keycodes.xml @@ -23,6 +23,9 @@ 9 10 32 + 45 + 39 + 34 -1 -2 -5 diff --git a/java/src/com/android/inputmethod/keyboard/Keyboard.java b/java/src/com/android/inputmethod/keyboard/Keyboard.java index c02c22494..fa2e0855d 100644 --- a/java/src/com/android/inputmethod/keyboard/Keyboard.java +++ b/java/src/com/android/inputmethod/keyboard/Keyboard.java @@ -63,6 +63,9 @@ public class Keyboard { public static final int CODE_TAB = '\t'; public static final int CODE_SPACE = ' '; public static final int CODE_PERIOD = '.'; + public static final int CODE_DASH = '-'; + public static final int CODE_SINGLE_QUOTE = '\''; + public static final int CODE_DOUBLE_QUOTE = '"'; /** Special keys code. These should be aligned with values/keycodes.xml */ public static final int CODE_DUMMY = 0; diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java index fbfde97ef..4f1ad576d 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java @@ -626,7 +626,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha private static boolean isQuoteCharacter(int c) { // Apostrophe, quotation mark. - if (c == '\'' || c == '"') + if (c == Keyboard.CODE_SINGLE_QUOTE || c == Keyboard.CODE_DOUBLE_QUOTE) return true; // \u2018: Left single quotation mark // \u2019: Right single quotation mark diff --git a/java/src/com/android/inputmethod/latin/ContactsDictionary.java b/java/src/com/android/inputmethod/latin/ContactsDictionary.java index bdb68cac7..b057cf4e3 100644 --- a/java/src/com/android/inputmethod/latin/ContactsDictionary.java +++ b/java/src/com/android/inputmethod/latin/ContactsDictionary.java @@ -26,6 +26,8 @@ import android.provider.ContactsContract.Contacts; import android.text.TextUtils; import android.util.Log; +import com.android.inputmethod.keyboard.Keyboard; + public class ContactsDictionary extends ExpandableDictionary { private static final String[] PROJECTION = { @@ -123,8 +125,9 @@ public class ContactsDictionary extends ExpandableDictionary { for (j = i + 1; j < len; j++) { char c = name.charAt(j); - if (!(c == '-' || c == '\'' || - Character.isLetter(c))) { + if (!(c == Keyboard.CODE_DASH + || c == Keyboard.CODE_SINGLE_QUOTE + || Character.isLetter(c))) { break; } } diff --git a/java/src/com/android/inputmethod/latin/DictionaryFactory.java b/java/src/com/android/inputmethod/latin/DictionaryFactory.java index 2dbd582f3..fcb634371 100644 --- a/java/src/com/android/inputmethod/latin/DictionaryFactory.java +++ b/java/src/com/android/inputmethod/latin/DictionaryFactory.java @@ -18,7 +18,6 @@ package com.android.inputmethod.latin; import android.content.Context; import android.content.res.AssetFileDescriptor; -import android.content.res.Configuration; import android.content.res.Resources; import android.util.Log; diff --git a/java/src/com/android/inputmethod/latin/ExpandableDictionary.java b/java/src/com/android/inputmethod/latin/ExpandableDictionary.java index be2c6b21b..26391fe46 100644 --- a/java/src/com/android/inputmethod/latin/ExpandableDictionary.java +++ b/java/src/com/android/inputmethod/latin/ExpandableDictionary.java @@ -19,6 +19,8 @@ package com.android.inputmethod.latin; import android.content.Context; import android.os.AsyncTask; +import com.android.inputmethod.keyboard.Keyboard; + import java.util.LinkedList; /** @@ -41,8 +43,6 @@ public class ExpandableDictionary extends Dictionary { private int mMaxDepth; private int mInputLength; - private static final char QUOTE = '\''; - private boolean mRequiresReload; private boolean mUpdatingDictionary; @@ -304,7 +304,8 @@ public class ExpandableDictionary extends Dictionary { getWordsRec(children, codes, word, depth + 1, completion, snr, inputIndex, skipPos, callback); } - } else if ((c == QUOTE && currentChars[0] != QUOTE) || depth == skipPos) { + } else if ((c == Keyboard.CODE_SINGLE_QUOTE + && currentChars[0] != Keyboard.CODE_SINGLE_QUOTE) || depth == skipPos) { // Skip the ' and continue deeper word[depth] = c; if (children != null) { diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 105ec5a62..17a78d590 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -161,8 +161,9 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar private ContactsDictionary mContactsDictionary; private AutoDictionary mAutoDictionary; + // TODO: Create an inner class to group options and pseudo-options to improve readability. // These variables are initialized according to the {@link EditorInfo#inputType}. - private boolean mAutoSpace; + private boolean mShouldInsertMagicSpace; private boolean mInputTypeNoAutoCorrect; private boolean mIsSettingsSuggestionStripOn; private boolean mApplicationSpecifiedCompletionOn; @@ -174,7 +175,9 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar private CharSequence mBestWord; private boolean mHasUncommittedTypedChars; private boolean mHasDictionary; - private boolean mJustAddedAutoSpace; + // Magic space: a space that should disappear on space/apostrophe insertion, move after the + // punctuation on punctuation insertion, and become a real space on alpha char insertion. + private boolean mJustAddedMagicSpace; // This indicates whether the last char is a magic space. private boolean mAutoCorrectEnabled; private boolean mRecorrectionEnabled; // Suggestion: use bigrams to adjust scores of suggestions obtained from unigram dictionary @@ -593,7 +596,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar mComposing.setLength(0); mHasUncommittedTypedChars = false; mDeleteCount = 0; - mJustAddedAutoSpace = false; + mJustAddedMagicSpace = false; loadSettings(attribute); if (mSubtypeSwitcher.isKeyboardMode()) { @@ -628,7 +631,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar return; final int inputType = attribute.inputType; final int variation = inputType & InputType.TYPE_MASK_VARIATION; - mAutoSpace = false; + mShouldInsertMagicSpace = false; mInputTypeNoAutoCorrect = false; mIsSettingsSuggestionStripOn = false; mApplicationSpecifiedCompletionOn = false; @@ -643,9 +646,9 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar } if (InputTypeCompatUtils.isEmailVariation(variation) || variation == InputType.TYPE_TEXT_VARIATION_PERSON_NAME) { - mAutoSpace = false; + mShouldInsertMagicSpace = false; } else { - mAutoSpace = true; + mShouldInsertMagicSpace = true; } if (InputTypeCompatUtils.isEmailVariation(variation)) { mIsSettingsSuggestionStripOn = false; @@ -789,7 +792,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar if (TextEntryState.isAcceptedDefault() || TextEntryState.isSpaceAfterPicked()) { if (TextEntryState.isAcceptedDefault()) TextEntryState.reset(); - mJustAddedAutoSpace = false; // The user moved the cursor. + mJustAddedMagicSpace = false; // The user moved the cursor. } } mJustAccepted = false; @@ -1042,23 +1045,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar ic.commitText(lastTwo.charAt(1) + " ", 1); ic.endBatchEdit(); mKeyboardSwitcher.updateShiftState(); - mJustAddedAutoSpace = true; - } - } - - private void reswapPeriodAndSpace() { - final InputConnection ic = getCurrentInputConnection(); - if (ic == null) return; - CharSequence lastThree = ic.getTextBeforeCursor(3, 0); - if (lastThree != null && lastThree.length() == 3 - && lastThree.charAt(0) == Keyboard.CODE_PERIOD - && lastThree.charAt(1) == Keyboard.CODE_SPACE - && lastThree.charAt(2) == Keyboard.CODE_PERIOD) { - ic.beginBatchEdit(); - ic.deleteSurroundingText(3, 0); - ic.commitText(" ..", 1); - ic.endBatchEdit(); - mKeyboardSwitcher.updateShiftState(); } } @@ -1078,7 +1064,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar ic.commitText(". ", 1); ic.endBatchEdit(); mKeyboardSwitcher.updateShiftState(); - mJustAddedAutoSpace = true; } else { mHandler.startDoubleSpacesTimer(); } @@ -1205,9 +1190,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar handleTab(); break; default: - if (primaryCode != Keyboard.CODE_ENTER) { - mJustAddedAutoSpace = false; - } if (isWordSeparator(primaryCode)) { handleSeparator(primaryCode, x, y); } else { @@ -1232,7 +1214,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar ic.endBatchEdit(); mKeyboardSwitcher.updateShiftState(); mKeyboardSwitcher.onKey(Keyboard.CODE_DUMMY); - mJustAddedAutoSpace = false; + mJustAddedMagicSpace = false; mEnteredText = text; } @@ -1342,6 +1324,13 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar private void handleCharacter(int primaryCode, int[] keyCodes, int x, int y) { mVoiceProxy.handleCharacter(); + if (mJustAddedMagicSpace && primaryCode == Keyboard.CODE_SINGLE_QUOTE) { + removeTrailingSpace(); + } + if (primaryCode != Keyboard.CODE_ENTER) { + mJustAddedMagicSpace = false; + } + if (mLastSelectionStart == mLastSelectionEnd && TextEntryState.isRecorrecting()) { abortRecorrection(false); } @@ -1420,35 +1409,33 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar // not to auto correct, but accept the typed word. For instance, // in Italian dov' should not be expanded to dove' because the elision // requires the last vowel to be removed. - if (mAutoCorrectOn && primaryCode != '\'') { + if (mAutoCorrectOn && primaryCode != Keyboard.CODE_SINGLE_QUOTE) { pickedDefault = pickDefaultSuggestion(primaryCode); - // Picked the suggestion by the space key. We consider this - // as "added an auto space". - if (primaryCode == Keyboard.CODE_SPACE) { - mJustAddedAutoSpace = true; - } } else { commitTyped(ic); } } - if (mJustAddedAutoSpace && primaryCode == Keyboard.CODE_ENTER) { - removeTrailingSpace(); - mJustAddedAutoSpace = false; - } - sendKeyChar((char)primaryCode); - // Handle the case of ". ." -> " .." with auto-space if necessary - // before changing the TextEntryState. - if (TextEntryState.isPunctuationAfterAccepted() && primaryCode == Keyboard.CODE_PERIOD) { - reswapPeriodAndSpace(); + if (mJustAddedMagicSpace && primaryCode == Keyboard.CODE_SPACE) { + mJustAddedMagicSpace = false; + } else if (mJustAddedMagicSpace && primaryCode == Keyboard.CODE_ENTER) { + removeTrailingSpace(); + mJustAddedMagicSpace = false; + sendKeyChar((char)primaryCode); + } else { + sendKeyChar((char)primaryCode); } TextEntryState.typedCharacter((char) primaryCode, true, x, y); - if (TextEntryState.isPunctuationAfterAccepted() && primaryCode != Keyboard.CODE_ENTER) { + if (TextEntryState.isPunctuationAfterAccepted() && primaryCode != Keyboard.CODE_ENTER + && mJustAddedMagicSpace) { swapPunctuationAndSpace(); } else if (isSuggestionsRequested() && primaryCode == Keyboard.CODE_SPACE) { doubleSpace(); + mJustAddedMagicSpace = false; + } else { + mJustAddedMagicSpace = false; } if (pickedDefault) { CharSequence typedWord = mWord.getTypedWord(); @@ -1720,9 +1707,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar index, suggestions.mWords); TextEntryState.acceptedSuggestion(mComposing.toString(), suggestion); // Follow it with a space - if (mAutoSpace && !recorrecting) { - sendSpace(); - mJustAddedAutoSpace = true; + if (mShouldInsertMagicSpace && !recorrecting) { + sendMagicSpace(); } // We should show the hint if the user pressed the first entry AND either: @@ -2005,8 +1991,9 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar return mSentenceSeparators.contains(String.valueOf((char)code)); } - private void sendSpace() { + private void sendMagicSpace() { sendKeyChar((char)Keyboard.CODE_SPACE); + mJustAddedMagicSpace = true; mKeyboardSwitcher.updateShiftState(); } @@ -2402,7 +2389,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar p.println(" mCorrectionMode=" + mCorrectionMode); p.println(" mHasUncommittedTypedChars=" + mHasUncommittedTypedChars); p.println(" mAutoCorrectOn=" + mAutoCorrectOn); - p.println(" mAutoSpace=" + mAutoSpace); + p.println(" mShouldInsertMagicSpace=" + mShouldInsertMagicSpace); p.println(" mApplicationSpecifiedCompletionOn=" + mApplicationSpecifiedCompletionOn); p.println(" TextEntryState.state=" + TextEntryState.getState()); p.println(" mSoundOn=" + mSoundOn); From 80bcf30dd6dabb56076c7dc246eaa54fd43d783c Mon Sep 17 00:00:00 2001 From: Eric Fischer Date: Mon, 2 May 2011 15:55:46 -0700 Subject: [PATCH 04/12] Import revised translations. Change-Id: I255568e425169188a3be66c56fc36434e0b325fb --- java/res/values-ar/strings.xml | 20 +++++++------------- java/res/values-bg/strings.xml | 20 +++++++------------- java/res/values-ca/strings.xml | 20 +++++++------------- java/res/values-cs/strings.xml | 20 +++++++------------- java/res/values-da/strings.xml | 20 +++++++------------- java/res/values-de/strings.xml | 20 +++++++------------- java/res/values-el/strings.xml | 20 +++++++------------- java/res/values-en-rGB/strings.xml | 20 +++++++------------- java/res/values-es-rUS/strings.xml | 20 +++++++------------- java/res/values-es/strings.xml | 8 ++++---- java/res/values-fa/strings.xml | 20 +++++++------------- java/res/values-fi/strings.xml | 20 +++++++------------- java/res/values-fr/strings.xml | 20 +++++++------------- java/res/values-hr/strings.xml | 20 +++++++------------- java/res/values-hu/strings.xml | 20 +++++++------------- java/res/values-in/strings.xml | 20 +++++++------------- java/res/values-it/strings.xml | 20 +++++++------------- java/res/values-iw/strings.xml | 20 +++++++------------- java/res/values-ja/strings.xml | 20 +++++++------------- java/res/values-ko/strings.xml | 20 +++++++------------- java/res/values-lt/strings.xml | 20 +++++++------------- java/res/values-lv/strings.xml | 20 +++++++------------- java/res/values-nb/strings.xml | 20 +++++++------------- java/res/values-nl/strings.xml | 20 +++++++------------- java/res/values-pl/strings.xml | 20 +++++++------------- java/res/values-pt-rPT/strings.xml | 20 +++++++------------- java/res/values-pt/strings.xml | 20 +++++++------------- java/res/values-ro/strings.xml | 20 +++++++------------- java/res/values-ru/strings.xml | 20 +++++++------------- java/res/values-sk/strings.xml | 20 +++++++------------- java/res/values-sl/strings.xml | 20 +++++++------------- java/res/values-sr/strings.xml | 20 +++++++------------- java/res/values-sv/strings.xml | 20 +++++++------------- java/res/values-th/strings.xml | 20 +++++++------------- java/res/values-tl/strings.xml | 20 +++++++------------- java/res/values-tr/strings.xml | 20 +++++++------------- java/res/values-uk/strings.xml | 20 +++++++------------- java/res/values-vi/strings.xml | 20 +++++++------------- java/res/values-zh-rCN/strings.xml | 20 +++++++------------- java/res/values-zh-rTW/strings.xml | 20 +++++++------------- 40 files changed, 277 insertions(+), 511 deletions(-) diff --git a/java/res/values-ar/strings.xml b/java/res/values-ar/strings.xml index fecb97fae..4107d0f88 100644 --- a/java/res/values-ar/strings.xml +++ b/java/res/values-ar/strings.xml @@ -27,12 +27,9 @@ "صوت عند الضغط على مفتاح" "انبثاق عند الضغط على المفاتيح" "عام" - - - - - - + "تصحيح النص" + "الاقتراحات بناءً على الكلمات السابقة" + "خيارات أخرى" "استخدام الأحرف الكبيرة تلقائيًا" "إصلاحات سريعة" "تصحيح الأخطاء المكتوبة الشائعة" @@ -41,8 +38,7 @@ "عرض دومًا" "عرض في وضع رأسي" "إخفاء دومًا" - - + "استخدام مفتاح المسافة لتبديل اللغة" "عرض مفتاح الإعدادات" "تلقائي" "إظهار بشكل دائم" @@ -52,12 +48,10 @@ "إيقاف" "معتدل" "حاد" - "اقتراحات ثنائية" + "اقتراحات ثنائية" "استخدام الكلمة السابقة لتحسين الاقتراح" - - - - + "التنبؤ الثنائي" + "استخدام الكلمة السابقة أيضًا للتنبؤ" "%s : تم الحفظ" "تنفيذ" "التالي" diff --git a/java/res/values-bg/strings.xml b/java/res/values-bg/strings.xml index 1c30fb6e7..aab33df78 100644 --- a/java/res/values-bg/strings.xml +++ b/java/res/values-bg/strings.xml @@ -27,12 +27,9 @@ "Звук при натискане на клавиш" "Изскачащ прозорец при натискане на клавиш" "Общи" - - - - - - + "Корекция на текста" + "Предложения въз на основа на предишни думи" + "Други опции" "Автоматично поставяне на главни букви" "Бързи корекции" "Коригира най-честите грешки при въвеждане" @@ -41,8 +38,7 @@ "Винаги да се показва" "Показване с вертикална ориентация" "Винаги да се скрива" - - + "Клавишът интервал да превкл. езика" "Показване на клавиша за настройки" "Автоматично" "Да се показва винаги" @@ -52,12 +48,10 @@ "Изкл." "Умерено" "Агресивно" - "Предложения за биграми" + "Предложения за биграми" "Използване на предишната дума за подобряване на предложението" - - - - + "Предвиждане за биграми" + "Използване на предишната дума и за предвиждане" "%s : Запазено" "Старт" "Напред" diff --git a/java/res/values-ca/strings.xml b/java/res/values-ca/strings.xml index b569520ad..85ac44588 100644 --- a/java/res/values-ca/strings.xml +++ b/java/res/values-ca/strings.xml @@ -27,12 +27,9 @@ "So en prémer una tecla" "Finestra emergent en prémer un botó" "General" - - - - - - + "Correcció de text" + "Suggeriments basats en paraules anteriors" + "Altres opcions" "Majúscules automàtiques" "Correccions ràpides" "Corregeix els errors d\'ortografia habituals" @@ -41,8 +38,7 @@ "Mostra sempre" "Mostra en mode vertical" "Amaga sempre" - - + "Utilitza el canvi d\'idioma amb la barra espaiadora" "Mostra la tecla de configuració" "Automàtic" "Mostra sempre" @@ -52,12 +48,10 @@ "Desactiva" "Moderada" "Total" - "Suggeriments Bigram" + "Suggeriments Bigram" "Utilitza la paraula anterior per millorar el suggeriment" - - - - + "Predicció Bigram" + "Utilitza la paraula anterior per a la predicció també" "%s: desada" "Vés" "Següent" diff --git a/java/res/values-cs/strings.xml b/java/res/values-cs/strings.xml index bfe309eb7..b35520ae5 100644 --- a/java/res/values-cs/strings.xml +++ b/java/res/values-cs/strings.xml @@ -27,12 +27,9 @@ "Zvuk při stisku klávesy" "Zobrazit znaky při stisku klávesy" "Obecné" - - - - - - + "Oprava textu" + "Návrhy na základě předchozích slov" + "Další možnosti" "Velká písmena automaticky" "Rychlé opravy" "Opravuje nejčastější chyby při psaní" @@ -41,8 +38,7 @@ "Vždy zobrazovat" "Zobrazit v režimu na výšku" "Vždy skrývat" - - + "Přepínání jazyků mezerníkem" "Zobrazit klávesu Nastavení" "Automaticky" "Vždy zobrazovat" @@ -52,12 +48,10 @@ "Vypnuto" "Mírné" "Agresivní" - "Návrh Bigram" + "Návrhy Bigram" "Použít předchozí slovo ke zlepšení návrhu" - - - - + "Odhady Bigram" + "Použít předchozí slovo také pro odhad" "%s: Uloženo" "Přejít" "Další" diff --git a/java/res/values-da/strings.xml b/java/res/values-da/strings.xml index 381eaaab9..9c7dedf7f 100644 --- a/java/res/values-da/strings.xml +++ b/java/res/values-da/strings.xml @@ -27,12 +27,9 @@ "Lyd ved tastetryk" "Popup ved tastetryk" "Generelt" - - - - - - + "Tekstkorrigering" + "Forslag baseret på tidligere ord" + "Andre valgmuligheder" "Skriv aut. med stort" "Hurtige løsninger" "Retter almindelige stavefejl" @@ -41,8 +38,7 @@ "Vis altid" "Vis i portrættilstand" "Skjul altid" - - + "Brug mellemrumst. som sprogskifter" "Vis indstillingsnøgle" "Automatisk" "Vis altid" @@ -52,12 +48,10 @@ "Fra" "Beskeden" "Aggressiv" - "Bigram-forslag" + "Bigram-forslag" "Brug forrige ord for at forbedre forslag" - - - - + "Bigram-forudsigelse" + "Brug også tidligere ord til forudsigelse" "%s: Gemt" "Gå" "Næste" diff --git a/java/res/values-de/strings.xml b/java/res/values-de/strings.xml index 55766eb74..a8b671757 100644 --- a/java/res/values-de/strings.xml +++ b/java/res/values-de/strings.xml @@ -27,12 +27,9 @@ "Ton bei Tastendruck" "Pop-up bei Tastendruck" "Allgemein" - - - - - - + "Textkorrektur" + "Vorschläge basieren auf bisherigen Wörtern" + "Sonstige Optionen" "Autom. Groß-/Kleinschr." "Quick Fixes" "Korrigiert gängige Tippfehler" @@ -41,8 +38,7 @@ "Immer anzeigen" "Im Hochformat anzeigen" "Immer ausblenden" - - + "Sprache mit Leertaste ändern" "Einstellungstaste anz." "Automatisch" "Immer anzeigen" @@ -52,12 +48,10 @@ "Aus" "Mäßig" "Stark" - "Bigramm-Vorschläge" + "Bigramm-Vorschläge" "Zur Verbesserung des Vorschlags vorheriges Wort verwenden" - - - - + "Bigramm-Vervollständigung" + "Vorheriges Wort auch für Vervollständigung verwenden" "%s: gespeichert" "Los" "Weiter" diff --git a/java/res/values-el/strings.xml b/java/res/values-el/strings.xml index 019d7e943..a23959d1c 100644 --- a/java/res/values-el/strings.xml +++ b/java/res/values-el/strings.xml @@ -27,12 +27,9 @@ "Ήχος κατά το πάτημα πλήκτρων" "Εμφάνιση με το πάτημα πλήκτρου" "Γενικά" - - - - - - + "Διόρθωση κειμένου" + "Προτάσεις που βασίζονται σε προηγούμενες λέξεις" + "Άλλες επιλογές" "Αυτόματη χρήση κεφαλαίων" "Γρήγορες διορθώσεις" "Διορθώνει συνηθισμένα λάθη πληκτρολόγησης" @@ -41,8 +38,7 @@ "Να εμφανίζεται πάντα" "Εμφάνιση σε λειτουργία κατακόρυφης προβολής" "Πάντα απόκρυψη" - - + "Χρησιμοποιήστε τη δυνατότητα εναλλαγής γλώσσας του πλήκτρου διαστήματος" "Εμφάνιση πλήκτρου ρυθμίσεων" "Αυτόματο" "Να εμφανίζεται πάντα" @@ -52,12 +48,10 @@ "Απενεργοποίηση" "Μέτρια" "Υψηλή" - "Προτάσεις bigram" + "Προτάσεις bigram" "Χρήση προηγούμενης λέξης για τη βελτίωση πρότασης" - - - - + "Πρόβλεψη bigram" + "Χρησιμοποιήστε, επίσης, την προηγούμενη λέξη για πρόβλεψη" "%s : Αποθηκεύτηκε" "Μετ." "Επόμενο" diff --git a/java/res/values-en-rGB/strings.xml b/java/res/values-en-rGB/strings.xml index 30d20b2df..57d4ec4f8 100644 --- a/java/res/values-en-rGB/strings.xml +++ b/java/res/values-en-rGB/strings.xml @@ -27,12 +27,9 @@ "Sound on key-press" "Pop-up on key press" "General" - - - - - - + "Text correction" + "Suggestions based on previous words" + "Other Options" "Auto-capitalisation" "Quick fixes" "Corrects commonly typed mistakes" @@ -41,8 +38,7 @@ "Always show" "Show on portrait mode" "Always hide" - - + "Use the spacebar language switcher" "Show settings key" "Automatic" "Always show" @@ -52,12 +48,10 @@ "Off" "Modest" "Aggressive" - "Bigram Suggestions" + "Bigram Suggestions" "Use previous word to improve suggestion" - - - - + "Bigram prediction" + "Use previous word also for prediction" "%s : Saved" "Go" "Next" diff --git a/java/res/values-es-rUS/strings.xml b/java/res/values-es-rUS/strings.xml index aae15d5c8..48f82f978 100644 --- a/java/res/values-es-rUS/strings.xml +++ b/java/res/values-es-rUS/strings.xml @@ -27,12 +27,9 @@ "Sonar al pulsar las teclas" "Aviso emergente al pulsar tecla" "General" - - - - - - + "Corrección de texto" + "Sugerencias sobre la base de palabras anteriores" + "Otras opciones" "Mayúsculas automáticas" "Arreglos rápidos" "Corrige errores de escritura comunes" @@ -41,8 +38,7 @@ "Mostrar siempre" "Mostrar en modo retrato" "Ocultar siempre" - - + "Usa select. de id. de barra espac." "Mostrar tecla de configuración" "Automático" "Mostrar siempre" @@ -52,12 +48,10 @@ "Desactivado" "Moderado" "Total" - "Sugerencias de bigramas" + "Sugerencias de bigramas" "Utiliza la palabra anterior para mejorar la sugerencia" - - - - + "Predicción de biagramas" + "Usar la palabra anterior también para predicción." "%s: guardada" "Ir" "Siguiente" diff --git a/java/res/values-es/strings.xml b/java/res/values-es/strings.xml index 89435f596..2116044c1 100644 --- a/java/res/values-es/strings.xml +++ b/java/res/values-es/strings.xml @@ -101,11 +101,11 @@ "Aceptar" "Introducción de voz" "En teclado principal" - "En teclado símbolos" + "En teclado de símbolos" "Desactivada" - "Micro en tecl princ" - "Micro en tecl símb" - "Entrada de voz inhab" + "Micro en teclado principal" + "Micro en teclado de símbolos" + "Entrada de voz inhabilitada" "Seleccionar método de introducción de texto" "Idiomas" "Deslizar el dedo por la barra espaciadora para cambiar el idioma" diff --git a/java/res/values-fa/strings.xml b/java/res/values-fa/strings.xml index 87af40406..e57eb8a03 100644 --- a/java/res/values-fa/strings.xml +++ b/java/res/values-fa/strings.xml @@ -27,12 +27,9 @@ "صدا با فشار کلید" "بازشو با فشار کلید" "کلی" - - - - - - + "تصحیح متن" + "پیشنهادهایی بر اساس کلمه های قبلی" + "سایر گزینه ها" "نوشتن با حروف بزرگ خودکار" "راه حل های سریع" "تصحیح خطاهای تایپی رایج" @@ -41,8 +38,7 @@ "همیشه نمایش داده شود" "نمایش در حالت عمودی" "همیشه پنهان شود" - - + "از ویژگی تعویض زبان کلید فاصله استفاده شود" "نمایش کلید تنظیمات" "خودکار" "همیشه نمایش" @@ -52,12 +48,10 @@ "خاموش" "متوسط" "فعال" - "پیشنهادات بیگرام" + "پیشنهادهای Bigram" "برای بهبود پیشنهاد از کلمه قبلی استفاده شود" - - - - + "پیش بینی Bigram" + "استفاده از کلمه قبلی برای پیش بینی" "%s : ذخیره شد" "برو" "بعدی" diff --git a/java/res/values-fi/strings.xml b/java/res/values-fi/strings.xml index 4fb3aa87e..5be26f1e6 100644 --- a/java/res/values-fi/strings.xml +++ b/java/res/values-fi/strings.xml @@ -27,12 +27,9 @@ "Toista ääni näppäimiä painettaessa" "Ponnahdusikkuna painalluksella" "Yleinen" - - - - - - + "Tekstin korjaus" + "Aiempiin sanoihin perustuvat ehdotukset" + "Muut vaihtoehdot" "Automaattiset isot kirjaimet" "Pikakorjaukset" "Korjaa yleiset kirjoitusvirheet" @@ -41,8 +38,7 @@ "Näytä aina" "Näytä pystysuunnassa" "Piilota aina" - - + "Vaihda kieli välil." "Näytä asetukset-näppäin" "Automaattinen" "Näytä aina" @@ -52,12 +48,10 @@ "Älä käytä" "Osittainen" "Täysi" - "Bigram-ehdotukset" + "Bigram-ehdotukset" "Paranna ehdotusta aiemman sanan avulla" - - - - + "Bigram-ennakointi" + "Käytä edellistä sanaa myös ennakointiin" "%s : Tallennettu" "Siirry" "Seuraava" diff --git a/java/res/values-fr/strings.xml b/java/res/values-fr/strings.xml index 0b03b6a16..0526899df 100644 --- a/java/res/values-fr/strings.xml +++ b/java/res/values-fr/strings.xml @@ -27,12 +27,9 @@ "Son à chaque touche" "Agrandir les caractères" "Général" - - - - - - + "Correction du texte" + "Suggestions basées sur les mots précédents" + "Autres options" "Majuscules auto" "Corrections rapides" "Corrige les fautes de frappe courantes" @@ -41,8 +38,7 @@ "Toujours afficher" "Afficher en mode Portrait" "Toujours masquer" - - + "Sélecteur langue barre d\'espace" "Afficher touche param." "Automatique" "Toujours afficher" @@ -52,12 +48,10 @@ "Désactiver" "Simple" "Proactive" - "Suggestions de type bigramme" + "Suggestions de type bigramme" "Améliorer la suggestion en fonction du mot précédent" - - - - + "Prédiction bigramme" + "Utiliser le mot précédent pour la prédiction" "%s : enregistré" "OK" "Suivant" diff --git a/java/res/values-hr/strings.xml b/java/res/values-hr/strings.xml index e1da48e14..0307afa0c 100644 --- a/java/res/values-hr/strings.xml +++ b/java/res/values-hr/strings.xml @@ -27,12 +27,9 @@ "Zvuk pri pritisku tipke" "Povećanja na pritisak tipke" "Općenito" - - - - - - + "Ispravak teksta" + "Prijedlozi na temelju prethodnih riječi" + "Ostale opcije" "Automatsko pisanje velikih slova" "Brzi popravci" "Ispravlja uobičajene pogreške u pisanju" @@ -41,8 +38,7 @@ "Uvijek prikaži" "Prikaži u portretnom načinu" "Uvijek sakrij" - - + "Koristite razmaknicu za prebacivanje jezika" "Prikaži tipku postavki" "Automatski" "Uvijek prikaži" @@ -52,12 +48,10 @@ "Isključeno" "Skromno" "Agresivno" - "Bigram prijedlozi" + "Bigram prijedlozi" "Upotrijebi prethodnu riječ radi poboljšanja prijedloga" - - - - + "Bigram predviđanje" + "Koristite prethodnu riječ i za predviđanje" "%s : Spremljeno" "Idi" "Dalje" diff --git a/java/res/values-hu/strings.xml b/java/res/values-hu/strings.xml index cf4f9f5da..e2c1decb3 100644 --- a/java/res/values-hu/strings.xml +++ b/java/res/values-hu/strings.xml @@ -27,12 +27,9 @@ "Hangjelzés billentyű megnyomása esetén" "Legyen nagyobb billentyű lenyomásakor" "Általános" - - - - - - + "Szövegjavítás" + "Javaslatok korábbi szavak alapján" + "Egyéb beállítások" "Automatikusan nagy kezdőbetű" "Gyorsjavítások" "Kijavítja a gyakori gépelési hibákat" @@ -41,8 +38,7 @@ "Mindig látszik" "Megjelenítés álló tájolásban" "Mindig rejtve" - - + "Nyelvváltó: szóköz" "Beállítások billentyű megjelenítése" "Automatikus" "Mindig látszik" @@ -52,12 +48,10 @@ "Ki" "Mérsékelt" "Agresszív" - "Bigram javaslatok" + "Bigram javaslatok" "Előző szó használata a javaslatok javításához" - - - - + "Bigram előrejelzés" + "Az előző szó használata a prediktív bevitelhez is" "%s : mentve" "Ugrás" "Tovább" diff --git a/java/res/values-in/strings.xml b/java/res/values-in/strings.xml index 1b62b6c30..4abc4e51b 100644 --- a/java/res/values-in/strings.xml +++ b/java/res/values-in/strings.xml @@ -27,12 +27,9 @@ "Berbunyi jika tombol ditekan" "Muncul saat tombol ditekan" "Umum" - - - - - - + "Koreksi teks" + "Saran berdasarkan kata sebelumnya" + "Opsi lain" "Kapitalisasi otomatis" "Perbaikan cepat" "Memperbaiki kesalahan ketik umum" @@ -41,8 +38,7 @@ "Selalu tampilkan" "Tampilkan pada mode potret" "Selalu sembunyikan" - - + "Gunakan pengalih bahasa bilah spasi" "Lihat tombol setelan" "Otomatis" "Selalu tampilkan" @@ -52,12 +48,10 @@ "Mati" "Sederhana" "Agresif" - "Saran Bigram" + "Saran bigram" "Gunakan kata sebelumnya untuk meningkatkan sara" - - - - + "Prediksi bigram" + "Gunakan kata sebelumnya juga untuk prediksi" "%s : Telah disimpan" "Buka" "Berikutnya" diff --git a/java/res/values-it/strings.xml b/java/res/values-it/strings.xml index 0d0f8db3b..d661c8975 100644 --- a/java/res/values-it/strings.xml +++ b/java/res/values-it/strings.xml @@ -27,12 +27,9 @@ "Suono tasti" "Popup sui tasti" "Generali" - - - - - - + "Correzione testo" + "Suggerimenti in base alle parole precedenti" + "Altre opzioni" "Maiuscole automatiche" "Correzioni veloci" "Corregge gli errori di digitazione più comuni" @@ -41,8 +38,7 @@ "Mostra sempre" "Mostra in modalità verticale" "Nascondi sempre" - - + "Selettore lingua da barra spaziatrice" "Mostra tasto impostaz." "Automatico" "Mostra sempre" @@ -52,12 +48,10 @@ "Off" "Media" "Massima" - "Suggerimenti sui bigrammi" + "Suggerimenti sui bigrammi" "Utilizza parola precedente per migliorare il suggerimento" - - - - + "Previsione bigramma" + "Usa anche la parola precedente per la previsione" "%s : parola salvata" "Vai" "Avanti" diff --git a/java/res/values-iw/strings.xml b/java/res/values-iw/strings.xml index dfbfb659f..678804449 100644 --- a/java/res/values-iw/strings.xml +++ b/java/res/values-iw/strings.xml @@ -27,12 +27,9 @@ "צלילים עם לחיצה על מקשים" "חלון קופץ עם לחיצה על מקשים" "כללי" - - - - - - + "תיקון טקסט" + "הצעות המבוססות על מילים קודמות" + "אפשרויות אחרות" "הפיכה אוטומטית של אותיות לרישיות" "תיקונים מהירים" "מתקן שגיאות הקלדה נפוצות" @@ -41,8 +38,7 @@ "הצג תמיד" "הצג בפריסה לאורך" "הסתר תמיד" - - + "השתמש במחליף השפה שבמקש הרווח" "הצג מקש הגדרות" "אוטומטי" "הצג תמיד" @@ -52,12 +48,10 @@ "כבוי" "מצומצם" "מחמיר" - "הצעות של צמדי אותיות (Bigram)" + "הצעות של צמדי אותיות (Bigram)" "השתמש במילה הקודמת כדי לשפר את ההצעה" - - - - + "חיזוי צמדי אותיות (Bigram)" + "השתמש במילה הקודמת גם עבור חיזוי" "%s : נשמרה" "בצע" "הבא" diff --git a/java/res/values-ja/strings.xml b/java/res/values-ja/strings.xml index 01619e00c..3c6ba0d3a 100644 --- a/java/res/values-ja/strings.xml +++ b/java/res/values-ja/strings.xml @@ -27,12 +27,9 @@ "キー操作音" "キー押下時ポップアップ" "全般" - - - - - - + "テキストの修正" + "前の語句に基づいた入力候補表示" + "他のオプション" "自動大文字変換" "クイックフィックス" "よくある誤字・脱字を修正します" @@ -41,8 +38,7 @@ "常に表示" "縦向きで表示" "常に非表示" - - + "スペースバーで切替" "設定キーを表示" "自動" "常に表示" @@ -52,12 +48,10 @@ "OFF" "中" "強" - "バイグラム入力候補表示" + "バイグラム入力候補表示" "直前の単語から入力候補を予測します" - - - - + "バイグラム予測" + "前の語句も予測に使用" "%s:保存しました" "実行" "次へ" diff --git a/java/res/values-ko/strings.xml b/java/res/values-ko/strings.xml index 9d442dd0a..01484d797 100644 --- a/java/res/values-ko/strings.xml +++ b/java/res/values-ko/strings.xml @@ -27,12 +27,9 @@ "키를 누를 때 소리 발생" "키를 누를 때 팝업" "일반" - - - - - - + "텍스트 수정" + "이전 단어에 기반한 추천" + "기타 옵션" "자동 대문자화" "빠른 수정" "자주 발생하는 오타를 수정합니다." @@ -41,8 +38,7 @@ "항상 표시" "세로 모드로 표시" "항상 숨기기" - - + "스페이스 바 언어 교환기 사용" "설정 키 표시" "자동" "항상 표시" @@ -52,12 +48,10 @@ "사용 안함" "보통" "적극적" - "Bigram 추천" + "Bigram 추천" "이전 단어를 사용하여 추천 기능 개선" - - - - + "Bigram 예측" + "이전 단어를 사용하여 예상 검색어를 표시합니다." "%s: 저장됨" "이동" "다음" diff --git a/java/res/values-lt/strings.xml b/java/res/values-lt/strings.xml index fb288430f..e808426a8 100644 --- a/java/res/values-lt/strings.xml +++ b/java/res/values-lt/strings.xml @@ -27,12 +27,9 @@ "Klavišo paspaudimo garsas" "Iššoka paspaudus klavišą" "Bendra" - - - - - - + "Teksto taisymas" + "Pasiūlymai pagal ankstesnius žodžius" + "Kitos parinktys" "Automatinis didžiųjų raidžių rašymas" "Greiti pataisymai" "Taiso dažnai padarytas rašybos klaidas" @@ -41,8 +38,7 @@ "Visada rodyti" "Rodyti stačiuoju režimu" "Visada slėpti" - - + "Naud. tarpo kl. k. jung." "Rodyti nustatymų raktą" "Automatinis" "Visada rodyti" @@ -52,12 +48,10 @@ "Išjungta" "Vidutinis" "Atkaklus" - "Bigramų pasiūlymai" + "Bigramų pasiūlymai" "Naudoti ankstesnį žodį pasiūlymui patobulinti" - - - - + "Bigramų numatymas" + "Numatant naudoti ir ankstesnį žodį" "%s: išsaugota" "Pradėti" "Kitas" diff --git a/java/res/values-lv/strings.xml b/java/res/values-lv/strings.xml index ff31bf8d4..69d4ba092 100644 --- a/java/res/values-lv/strings.xml +++ b/java/res/values-lv/strings.xml @@ -27,12 +27,9 @@ "Skaņa, nospiežot taustiņu" "Nospiežot taustiņu, parādīt uznirstošo izvēlni" "Vispārīgi" - - - - - - + "Teksta korekcija" + "Ieteikumi, pamatojoties uz iepriekšējiem vārdiem" + "Citas opcijas" "Automātiska lielo burtu lietošana" "Ātrie labojumi" "Nodrošina izplatītu drukas kļūdu labošanu." @@ -41,8 +38,7 @@ "Vienmēr rādīt" "Rādīt portreta režīmā" "Vienmēr slēpt" - - + "Izmantot atstarpēšanas taustiņu, lai pārslēgtu valodu" "Rādīt iestatījumu taustiņu" "Automātiski" "Vienmēr rādīt" @@ -52,12 +48,10 @@ "Izslēgta" "Mērena" "Agresīva" - "Bigram ieteikumi" + "Bigrammu ieteikumi" "Ieteikuma uzlabošanai izmantot iepriekšējo vārdu" - - - - + "Bigrammu prognozes" + "Izmantot iepriekšējo vārdu arī prognozēm" "%s: saglabāts" "Sākt" "Tālāk" diff --git a/java/res/values-nb/strings.xml b/java/res/values-nb/strings.xml index cd70aadc0..8b4874d91 100644 --- a/java/res/values-nb/strings.xml +++ b/java/res/values-nb/strings.xml @@ -27,12 +27,9 @@ "Lyd ved tastetrykk" "Hurtigvindu ved tastetrykk" "Generelt" - - - - - - + "Tekstkorrigering" + "Forslag basert på tidligere ord" + "Andre alternativer" "Stor forbokstav" "Autokorrektur" "Retter vanlige stavefeil" @@ -41,8 +38,7 @@ "Vis alltid" "Vis i stående modus" "Skjul alltid" - - + "Skift språk med mellomromstasten" "Vis innstillingsnøkkel" "Automatisk" "Vis alltid" @@ -52,12 +48,10 @@ "Av" "Moderat" "Omfattende" - "Bigram-forslag" + "Bigram-forslag" "Bruk forrige ord til å forbedre forslaget" - - - - + "Bigram-prediksjon" + "Bruk forrige ord også for forslag" "%s: Lagret" "Gå" "Neste" diff --git a/java/res/values-nl/strings.xml b/java/res/values-nl/strings.xml index 868deae42..ab3f1857d 100644 --- a/java/res/values-nl/strings.xml +++ b/java/res/values-nl/strings.xml @@ -27,12 +27,9 @@ "Geluid bij toetsaanslag" "Pop-up bij toetsaanslag" "Algemeen" - - - - - - + "Tekstcorrectie" + "Suggesties op basis van eerdere woorden" + "Andere opties" "Auto-hoofdlettergebruik" "Snelle oplossingen" "Hiermee worden veelvoorkomende typefouten gecorrigeerd" @@ -41,8 +38,7 @@ "Altijd weergeven" "Weergeven in staande modus" "Altijd verbergen" - - + "Taal schakelen via spatiebalk" "Instellingscode weergeven" "Automatisch" "Altijd weergeven" @@ -52,12 +48,10 @@ "Uitgeschakeld" "Normaal" "Agressief" - "Digram-suggesties" + "Digram-suggesties" "Vorig woord gebruiken om suggestie te verbeteren" - - - - + "Digram-voorspelling" + "Het voorgaande woord ook voor voorspelling gebruiken" "%s: opgeslagen" "Start" "Volgende" diff --git a/java/res/values-pl/strings.xml b/java/res/values-pl/strings.xml index 14380588d..bc352f036 100644 --- a/java/res/values-pl/strings.xml +++ b/java/res/values-pl/strings.xml @@ -27,12 +27,9 @@ "Dźwięk przy naciśnięciu" "Powiększ po naciśnięciu" "Ogólne" - - - - - - + "Poprawianie tekstu" + "Podpowiedzi na podstawie wcześniejszych słów" + "Inne opcje" "Wstawiaj wielkie litery" "Szybkie poprawki" "Poprawia częste błędy wpisywania" @@ -41,8 +38,7 @@ "Zawsze pokazuj" "Pokaż w trybie pionowym" "Zawsze ukrywaj" - - + "Spacja przełącza język" "Pokaż klawisz ustawień" "Automatycznie" "Zawsze pokazuj" @@ -52,12 +48,10 @@ "Wyłącz" "Umiarkowana" "Agresywna" - "Sugestie dla bigramów" + "Podpowiadanie dwuznaków" "Używaj poprzedniego wyrazu, aby polepszyć sugestię" - - - - + "Przewidywanie dwuznaków" + "Przewiduj również na podstawie poprzedniego słowa" "%s : Zapisano" "OK" "Dalej" diff --git a/java/res/values-pt-rPT/strings.xml b/java/res/values-pt-rPT/strings.xml index 258a488db..b881d880f 100644 --- a/java/res/values-pt-rPT/strings.xml +++ b/java/res/values-pt-rPT/strings.xml @@ -27,12 +27,9 @@ "Som ao premir as teclas" "Mostrar popup ao premir tecla" "Geral" - - - - - - + "Correção de texto" + "Sugestões baseadas em palavras anteriores" + "Outras opções" "Letras maiúsculas automáticas" "Correcções rápidas" "Corrige os erros de escrita comuns" @@ -41,8 +38,7 @@ "Mostrar sempre" "Mostrar no modo de retrato" "Ocultar sempre" - - + "Utilizar barra esp. alt. idioma" "Mostrar tecla das definições" "Automático" "Mostrar sempre" @@ -52,12 +48,10 @@ "Desligar" "Moderada" "Agressiva" - "Sugestões Bigram" + "Sugestões Bigram" "Utilizar a palavra anterior para melhorar a sugestão" - - - - + "Predição Bigram" + "Utilizar a palavra anterior também para predição" "%s: guardada" "Ir" "Seguinte" diff --git a/java/res/values-pt/strings.xml b/java/res/values-pt/strings.xml index 72c59fbfd..dedd06e97 100644 --- a/java/res/values-pt/strings.xml +++ b/java/res/values-pt/strings.xml @@ -27,12 +27,9 @@ "Som ao tocar a tecla" "Exibir pop-up ao digitar" "Geral" - - - - - - + "Correção de texto" + "Sugestões baseadas em palavras anteriores" + "Outras opções" "Capitaliz. automática" "Reparos rápidos" "Corrige erros comuns de digitação" @@ -41,8 +38,7 @@ "Mostrar sempre" "Mostrar em modo retrato" "Sempre ocultar" - - + "Alt. idiomas c/ a barra" "Mostrar tecla de config." "Automático" "Mostrar sempre" @@ -52,12 +48,10 @@ "Desativado" "Moderado" "Agressivo" - "Sugestões de bigrama" + "Sugestões de bigrama" "Usar palavra anterior para melhorar a sugestão" - - - - + "Previsão de bigrama" + "Use também a palavra anterior para prever" "%s : Salvo" "Ir" "Avançar" diff --git a/java/res/values-ro/strings.xml b/java/res/values-ro/strings.xml index 9f256d668..680bdb8b1 100644 --- a/java/res/values-ro/strings.xml +++ b/java/res/values-ro/strings.xml @@ -27,12 +27,9 @@ "Sunet la apăsarea tastei" "Fereastră pop-up la apăsarea tastei" "General" - - - - - - + "Corectare text" + "Sugestii bazate pe cuvinte anterioare" + "Alte opţiuni" "Auto-capitalizare" "Remedieri rapide" "Corectează greşelile introduse frecvent" @@ -41,8 +38,7 @@ "Afişaţi întotdeauna" "Afişaţi în modul Portret" "Ascundeţi întotdeauna" - - + "Sp. pt. comut. lb." "Afişaţi tasta setări" "Automat" "Afişaţi întotdeauna" @@ -52,12 +48,10 @@ "Dezactivată" "Moderată" "Agresivă" - "Sugestii pentru cuvinte de două litere" + "Sugestii pentru cuvinte de două litere" "Utilizaţi cuvântul anterior pentru a îmbunătăţi sugestia" - - - - + "Sugestii pentru cuvinte de două litere" + "De asemenea, utilizaţi pentru sugestii cuvântul precedent" "%s: salvat" "OK" "Înainte" diff --git a/java/res/values-ru/strings.xml b/java/res/values-ru/strings.xml index 26e9e2d39..ae3138ba1 100644 --- a/java/res/values-ru/strings.xml +++ b/java/res/values-ru/strings.xml @@ -27,12 +27,9 @@ "Звук клавиш" "Увеличение нажатых" "Общие" - - - - - - + "Исправление текста" + "Подсказки, основанные на предыдущих словах" + "Другие варианты" "Заглавные автоматически" "Быстрое исправление" "Исправлять распространенные опечатки" @@ -41,8 +38,7 @@ "Всегда показывать" "Показать вертикально" "Всегда скрывать" - - + "Пробел меняет язык" "Кнопка настроек" "Автоматически" "Всегда показывать" @@ -52,12 +48,10 @@ "Откл." "Умеренное" "Активное" - "Биграммные подсказки" + "Биграммные подсказки" "Используйте предыдущее слово, чтобы исправить подсказку" - - - - + "Биграммный прогноз" + "Использовать предыдущее слово для прогнозирования" "%s: сохранено" "Поиск" "Далее" diff --git a/java/res/values-sk/strings.xml b/java/res/values-sk/strings.xml index 5097615ff..70f9f8bf7 100644 --- a/java/res/values-sk/strings.xml +++ b/java/res/values-sk/strings.xml @@ -27,12 +27,9 @@ "Zvuk pri stlačení klávesu" "Zobraziť znaky pri stlačení klávesu" "Všeobecné" - - - - - - + "Oprava textu" + "Návrhy na základe predchádzajúcich slov" + "Ďalšie možnosti" "Veľké písmená automaticky" "Rýchle opravy" "Opravuje najčastejšie chyby pri písaní" @@ -41,8 +38,7 @@ "Vždy zobrazovať" "Zobraziť v režime na výšku" "Vždy skrývať" - - + "Použite medzerník na prepínanie medzi jazykmi" "Zobraziť kláves Nastavenia" "Automaticky" "Vždy zobrazovať" @@ -52,12 +48,10 @@ "Vypnuté" "Mierne" "Agresívne" - "Návrhy Bigram" + "Návrhy Bigram" "Na zlepšenie návrhu použiť predchádzajúce slovo" - - - - + "Odhady Bigram" + "Použiť predchádzajúce slovo aj pre predpoveď" "%s : Uložené" "Hľadať" "Ďalej" diff --git a/java/res/values-sl/strings.xml b/java/res/values-sl/strings.xml index 965b2b61d..babf8b097 100644 --- a/java/res/values-sl/strings.xml +++ b/java/res/values-sl/strings.xml @@ -27,12 +27,9 @@ "Zvok ob pritisku tipke" "Pojavno okno ob pritisku tipke" "Splošno" - - - - - - + "Popravek besedila" + "Predlogi, ki temeljijo na prejšnjih besedah" + "Druge možnosti" "Samodejne velike začetnice" "Hitri popravki" "Popravi pogoste tipkarske napake" @@ -41,8 +38,7 @@ "Vedno pokaži" "Pokaži v pokončnem načinu" "Vedno skrij" - - + "Preklopite med jeziki s preslednico" "Pokaži tipko za nastavitve" "Samodejno" "Vedno pokaži" @@ -52,12 +48,10 @@ "Izklopljeno" "Zmerno" "Agresivno" - "Bigramni predlogi" + "Bigramni predlogi" "Predlog izboljšaj s prejšnjo besedo" - - - - + "Bigramsko predvidevanje" + "Uporabi prejšnjo besedo tudi za predvidevanje" "%s: shranjeno" "Pojdi" "Naprej" diff --git a/java/res/values-sr/strings.xml b/java/res/values-sr/strings.xml index 26234038d..7a90fbfdc 100644 --- a/java/res/values-sr/strings.xml +++ b/java/res/values-sr/strings.xml @@ -27,12 +27,9 @@ "Звук на притисак тастера" "Искачући прозор приликом притиска тастера" "Опште" - - - - - - + "Исправљање текста" + "Предлози на основу претходних речи" + "Друге опције:" "Аутоматски унос великих слова" "Брзе исправке" "Исправља честе грешке у куцању" @@ -41,8 +38,7 @@ "Увек прикажи" "Прикажи у усправном режиму" "Увек сакриј" - - + "Користи размак за избор језика" "Прикажи тастер за подешавања" "Аутоматски" "Увек прикажи" @@ -52,12 +48,10 @@ "Искључи" "Умерено" "Агресивно" - "Bigram предлози" + "Bigram предлози" "Користи претходну реч за побољшање предлога" - - - - + "Bigram предвиђање" + "Користи претходну реч и за предвиђање" "%s : Сачувано" "Иди" "Следеће" diff --git a/java/res/values-sv/strings.xml b/java/res/values-sv/strings.xml index cf1b998aa..922cbf7de 100644 --- a/java/res/values-sv/strings.xml +++ b/java/res/values-sv/strings.xml @@ -27,12 +27,9 @@ "Knappljud" "Popup vid knapptryck" "Allmänt" - - - - - - + "Textkorrigering" + "Förslag baserade på tidigare ord" + "Andra alternativ" "Automatiska versaler" "Snabba lösningar" "Åtgärdar automatiskt vanliga misstag" @@ -41,8 +38,7 @@ "Visa alltid" "Visa stående" "Dölj alltid" - - + "Byt språk m. mellanslag" "Visa inställningsknapp" "Automatiskt" "Visa alltid" @@ -52,12 +48,10 @@ "Av" "Måttlig" "Aggressiv" - "Bigramförslag" + "Bigramförslag" "Förbättra förslaget med föregående ord" - - - - + "Bigramförslag" + "Använd även föregående ord för att ge förslag" "%s: sparat" "Kör" "Nästa" diff --git a/java/res/values-th/strings.xml b/java/res/values-th/strings.xml index 4dc0eb637..de75300ef 100644 --- a/java/res/values-th/strings.xml +++ b/java/res/values-th/strings.xml @@ -27,12 +27,9 @@ "ส่งเสียงเมื่อกดปุ่ม" "ป๊อปอัปเมื่อกดแป้น" "ทั่วไป" - - - - - - + "การแก้ไขข้อความ" + "ข้อเสนอแนะตามคำก่อนหน้านี้" + "ตัวเลือกอื่นๆ" "ปรับเป็นตัวพิมพ์ใหญ่อัตโนมัติ" "แก้ไขด่วน" "แก้ไขข้อผิดพลาดในการพิมพ์ที่พบบ่อย" @@ -41,8 +38,7 @@ "แสดงทุกครั้ง" "แสดงในโหมดแนวตั้ง" "ซ่อนทุกครั้ง" - - + "ใช้แป้น Spacebar เพื่อสลับภาษา" "แสดงแป้นการตั้งค่า" "อัตโนมัติ" "แสดงตลอดเวลา" @@ -52,12 +48,10 @@ "ปิด" "ปานกลาง" "เข้มงวด" - "คำแนะนำ Bigram" + "คำแนะนำ Bigram" "ใช้คำก่อนหน้านี้เพื่อปรับปรุงคำแนะนำ" - - - - + "การคาดคะเน Bigram" + "ใช้คำก่อนหน้านี้สำหรับการคาดคะเน" "%s : บันทึกแล้ว" "ไป" "ถัดไป" diff --git a/java/res/values-tl/strings.xml b/java/res/values-tl/strings.xml index daf2f944e..779c56b4f 100644 --- a/java/res/values-tl/strings.xml +++ b/java/res/values-tl/strings.xml @@ -27,12 +27,9 @@ "Tunog sa keypress" "Popup sa keypress" "Pangkalahatan" - - - - - - + "Pagwawasto ng teksto" + "Mga suhestiyon batay sa mga nakaraang salita" + "Iba pang mga pagpipilian" "Auto-capitalization" "Mga mabilisang pagsasaayos" "Itinatama ang mga karaniwang na-type na mali" @@ -41,8 +38,7 @@ "Palaging ipakita" "Ipakita sa portrait mode" "Palaging itago" - - + "Gamitin ang panglipat ng wika sa spacebar" "Ipakita ang key ng mga setting" "Awtomatiko" "Palaging ipakita" @@ -52,12 +48,10 @@ "Naka-off" "Modest" "Agresibo" - "Mga Suhestiyon na Bigram" + "Mga bigram na suhestiyon" "Gamitin ang nakaraang salita upang pahusayin ang suhestiyon" - - - - + "Bigram na hula" + "Gamitin ang nakaraang salita para din sa hula" "%s : Na-save" "Punta" "Susunod" diff --git a/java/res/values-tr/strings.xml b/java/res/values-tr/strings.xml index 1e168f4c8..cb993619b 100644 --- a/java/res/values-tr/strings.xml +++ b/java/res/values-tr/strings.xml @@ -27,12 +27,9 @@ "Tuşa basıldığında ses çıkar" "Tuşa basıldığında pop-up aç" "Genel" - - - - - - + "Metin düzeltme" + "Önceki kelimelere dayalı öneriler" + "Diğer seçenekler" "Otomatik olarak büyük harf yap" "Hızlı onarımlar" "Yaygın olarak yapılan yazım hatalarını düzeltir" @@ -41,8 +38,7 @@ "Her zaman göster" "Dikey modda göster" "Her zaman gizle" - - + "Dil geçişi içn boşluk çubğn kullan" "Ayarları göster tuşu" "Otomatik" "Her zaman göster" @@ -52,12 +48,10 @@ "Kapalı" "Ölçülü" "Agresif" - "Bigram Önerileri" + "Bigram önerileri" "Öneriyi geliştirmek için önceki kelimeyi kullanın" - - - - + "Bigram tahmini" + "Önceki kelimeyi de tahmin için kullan" "%s : Kaydedildi" "Git" "İleri" diff --git a/java/res/values-uk/strings.xml b/java/res/values-uk/strings.xml index c46c99d28..ad2665544 100644 --- a/java/res/values-uk/strings.xml +++ b/java/res/values-uk/strings.xml @@ -27,12 +27,9 @@ "Звук при натиску клав." "Сплив. при нат.клав." "Загальні" - - - - - - + "Виправлення тексту" + "Пропозиції на основі попередніх слів" + "Інші опції" "Авто викор. вел. літер" "Шв. виправлення" "Виправляє поширені помилки" @@ -41,8 +38,7 @@ "Завжди показувати" "Показувати в книжковому режимі" "Завжди ховати" - - + "Використ. зміну мови пробілом" "Показ. клав. налашт." "Автоматично" "Завжди показ." @@ -52,12 +48,10 @@ "Вимк." "Середнє" "Повне" - "Двобуквені пропозиції" + "Пропозиції з двох слів" "Викор. попер. слово для покращ. пропозиції" - - - - + "Передбачений запит із двох слів" + "Використовувати попереднє слово також як передбачений запит" "%s : збережено" "Іти" "Далі" diff --git a/java/res/values-vi/strings.xml b/java/res/values-vi/strings.xml index f02d12e2f..cc74b4ea5 100644 --- a/java/res/values-vi/strings.xml +++ b/java/res/values-vi/strings.xml @@ -27,12 +27,9 @@ "Âm thanh khi nhấn phím" "Cửa sổ bật lên khi nhấn phím" "Chung" - - - - - - + "Sửa văn bản" + "Đề xuất dựa trên các từ trước đó" + "Tùy chọn khác" "Tự động viết hoa" "Sửa nhanh" "Sửa lỗi nhập thông thường" @@ -41,8 +38,7 @@ "Luôn hiển thị" "Hiển thị trên chế độ khổ đứng" "Luôn ẩn" - - + "Sử dụng trình chuyển đổi ngôn ngữ thanh cách" "Hiển thị phím cài đặt" "Tự động" "Luôn hiển thị" @@ -52,12 +48,10 @@ "Tắt" "Đơn giản" "Linh hoạt" - "Đề xuất Bigram" + "Đề xuất Bigram" "Sử dụng từ trước đó để cải tiến đề xuất" - - - - + "Dự đoán Bigram" + "Cũng sử dụng từ trước đó để dự đoán" "%s : Đã lưu" "Đến" "Tiếp theo" diff --git a/java/res/values-zh-rCN/strings.xml b/java/res/values-zh-rCN/strings.xml index 95c06ed55..a8edf1039 100644 --- a/java/res/values-zh-rCN/strings.xml +++ b/java/res/values-zh-rCN/strings.xml @@ -27,12 +27,9 @@ "按键时播放音效" "按键时显示弹出窗口" "常规" - - - - - - + "文本更正" + "根据前面的字词提供建议" + "其他选项" "自动大写" "快速纠正" "纠正常见的输入错误" @@ -41,8 +38,7 @@ "始终显示" "以纵向模式显示" "始终隐藏" - - + "使用空格键切换语言" "显示设置键" "自动" "始终显示" @@ -52,12 +48,10 @@ "关闭" "部分" "全部" - "双连词建议" + "双连词建议" "使用以前的字词改进建议" - - - - + "双连词预测" + "结合前一个字词进行预测" "%s:已保存" "开始" "下一步" diff --git a/java/res/values-zh-rTW/strings.xml b/java/res/values-zh-rTW/strings.xml index e2381b426..58e2bcd45 100644 --- a/java/res/values-zh-rTW/strings.xml +++ b/java/res/values-zh-rTW/strings.xml @@ -27,12 +27,9 @@ "按鍵時播放音效" "按鍵時顯示彈出式視窗" "一般設定" - - - - - - + "文字修正" + "根據先前字詞產生的建議" + "其他選項" "自動大寫" "快速修正" "修正一般打字錯誤" @@ -41,8 +38,7 @@ "一律顯示" "以垂直模式顯示" "永遠隱藏" - - + "使用空白鍵切換語言" "顯示設定金鑰" "自動" "一律顯示" @@ -52,12 +48,10 @@ "關閉" "部分" "全部" - "雙連詞建議" + "雙連詞建議" "根據前一個字詞自動找出更適合的建議" - - - - + "雙連詞預測" + "同樣使用先前的字詞進行預測" "%s:已儲存" "開始" "繼續" From ec5ae3a1b6ce6d6c87406def849995ec63816c55 Mon Sep 17 00:00:00 2001 From: Ken Wakasa Date: Fri, 6 May 2011 13:52:07 +0900 Subject: [PATCH 05/12] Fix IndexOutOfBoundsException in LatinIME.setSuggestions bug: 4369728 Change-Id: I7f8b09ecf7fb096bdff73b2d3575ed3779ed120d --- java/src/com/android/inputmethod/latin/CandidateView.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/src/com/android/inputmethod/latin/CandidateView.java b/java/src/com/android/inputmethod/latin/CandidateView.java index 6fb80adf0..11d021cb2 100644 --- a/java/src/com/android/inputmethod/latin/CandidateView.java +++ b/java/src/com/android/inputmethod/latin/CandidateView.java @@ -179,7 +179,7 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo private void updateSuggestions() { final SuggestedWords suggestions = mSuggestions; clear(); - final int count = suggestions.size(); + final int count = Math.min(mWords.size(), suggestions.size()); for (int i = 0; i < count; i++) { CharSequence word = suggestions.getWord(i); if (word == null) continue; From 0d8a4eb3678a783830ffea940ecdc01f2cff3997 Mon Sep 17 00:00:00 2001 From: satok Date: Fri, 6 May 2011 18:42:38 +0900 Subject: [PATCH 06/12] Add pl keyboard layout Bug: 4394303 Change-Id: I0fa24829e1240549728d9b81af3e39a024725016 --- java/res/values/strings.xml | 2 ++ java/res/xml-pl/kbd_qwerty.xml | 35 ++++++++++++++++++++++++++++++++++ java/res/xml/method.xml | 5 +++++ 3 files changed, 42 insertions(+) create mode 100644 java/res/xml-pl/kbd_qwerty.xml diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml index dca4b91e9..b58efe082 100644 --- a/java/res/values/strings.xml +++ b/java/res/values/strings.xml @@ -283,6 +283,8 @@ Norwegian Keyboard Dutch Keyboard + + Polish Keyboard Russian Keyboard diff --git a/java/res/xml-pl/kbd_qwerty.xml b/java/res/xml-pl/kbd_qwerty.xml new file mode 100644 index 000000000..fad28d641 --- /dev/null +++ b/java/res/xml-pl/kbd_qwerty.xml @@ -0,0 +1,35 @@ + + + + + + diff --git a/java/res/xml/method.xml b/java/res/xml/method.xml index 513076733..df43701d3 100644 --- a/java/res/xml/method.xml +++ b/java/res/xml/method.xml @@ -145,6 +145,11 @@ + Date: Fri, 6 May 2011 19:56:07 +0900 Subject: [PATCH 07/12] Tweak keyboard heights for phone, and key preview delay. Change-Id: I1c5e6db2923ce256ae70347f17ab28ff3c700ef1 --- java/res/values-land/dimens.xml | 12 ++++++------ java/res/values/config.xml | 2 +- java/res/values/dimens.xml | 14 +++++++------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/java/res/values-land/dimens.xml b/java/res/values-land/dimens.xml index 6954ba2ae..c46a51711 100644 --- a/java/res/values-land/dimens.xml +++ b/java/res/values-land/dimens.xml @@ -19,12 +19,12 @@ --> - - 1.060in + + 1.100in - + 0.020in - 0.270in + 0.280in 0.0in 0.0in 0.0in @@ -33,7 +33,7 @@ 2dip - 0.324in + 0.336in - -0.270in + -0.280in diff --git a/java/res/values/config.xml b/java/res/values/config.xml index ee86fbd59..1d24b1088 100644 --- a/java/res/values/config.xml +++ b/java/res/values/config.xml @@ -56,7 +56,7 @@ 50 50 0 - 60 + 70 0 100 400 diff --git a/java/res/values/dimens.xml b/java/res/values/dimens.xml index 0a0b16d47..3bcf37eba 100644 --- a/java/res/values/dimens.xml +++ b/java/res/values/dimens.xml @@ -19,13 +19,13 @@ --> - - 1.265in + + 1.285in - + 0.035in 0.000in - 0.325in + 0.330in 0.00in 0.06in 0.0in @@ -34,9 +34,9 @@ 8dip - 0.390in + 0.396in - -0.325in + -0.330in -0.05in @@ -58,7 +58,7 @@ 63dip 0dip 0.3in - 6dip + 1dip 18dip 4dip - - .\u0009\u0020,;:!?\n()[]*&@{}/<>_+=|\u0022 - - ., + + .,\u0022)]} + + \u0009\u0020\u0027\n-/_ + + ;:!?([*&@{<>+=| + + \u0027 diff --git a/java/res/values-it/donottranslate.xml b/java/res/values-it/donottranslate.xml index 3e3f3ef2a..adb2a9a9d 100644 --- a/java/res/values-it/donottranslate.xml +++ b/java/res/values-it/donottranslate.xml @@ -18,6 +18,6 @@ */ --> - - .\u0009\u0020,;:!?\'\n()[]*&@{}/<>_+=|\u0022 + + diff --git a/java/res/values/donottranslate.xml b/java/res/values/donottranslate.xml index 6a1069e99..1cdae3d81 100644 --- a/java/res/values/donottranslate.xml +++ b/java/res/values/donottranslate.xml @@ -18,12 +18,19 @@ */ --> - - .\u0009\u0020,;:!?\n()[]*&@{}/<>_+=|\u0022 - - .,!?) !?,\u0022\u0027:();-/@_ + + .,;:!?)]}\u0022 + + \u0009\u0020\n/_\u0027- + + ([*&@{<>+=| + + \u0027- + ALT diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 2afb1c9fc..209f2387d 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -216,7 +216,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar private boolean mSilentMode; /* package */ String mWordSeparators; - private String mSentenceSeparators; + private String mMagicSpaceStrippers; + private String mMagicSpaceSwappers; private String mSuggestPuncs; // TODO: Move this flag to VoiceProxy private boolean mConfigurationChanging; @@ -505,8 +506,14 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar mSuggest.setUserBigramDictionary(mUserBigramDictionary); updateCorrectionMode(); - mWordSeparators = res.getString(R.string.word_separators); - mSentenceSeparators = res.getString(R.string.sentence_separators); + mMagicSpaceStrippers = res.getString(R.string.magic_space_stripping_symbols); + mMagicSpaceSwappers = res.getString(R.string.magic_space_swapping_symbols); + String wordSeparators = mMagicSpaceStrippers + mMagicSpaceSwappers + + res.getString(R.string.magic_space_promoting_symbols); + final String notWordSeparators = res.getString(R.string.non_word_separator_symbols); + for (int i = notWordSeparators.length() - 1; i >= 0; --i) + wordSeparators = wordSeparators.replace(notWordSeparators.substring(i, i + 1), ""); + mWordSeparators = wordSeparators; Utils.setSystemLocale(res, savedLocale); } @@ -1039,13 +1046,13 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar return false; } - private void swapPunctuationAndSpace() { + private void swapSwapperAndSpace() { final InputConnection ic = getCurrentInputConnection(); if (ic == null) return; CharSequence lastTwo = ic.getTextBeforeCursor(2, 0); + // It is guaranteed lastTwo.charAt(1) is a swapper - else this method is not called. if (lastTwo != null && lastTwo.length() == 2 - && lastTwo.charAt(0) == Keyboard.CODE_SPACE - && isSentenceSeparator(lastTwo.charAt(1))) { + && lastTwo.charAt(0) == Keyboard.CODE_SPACE) { ic.beginBatchEdit(); ic.deleteSurroundingText(2, 0); ic.commitText(lastTwo.charAt(1) + " ", 1); @@ -1054,7 +1061,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar } } - private void doubleSpace() { + private void maybeDoubleSpace() { if (mCorrectionMode == Suggest.CORRECTION_NONE) return; final InputConnection ic = getCurrentInputConnection(); if (ic == null) return; @@ -1330,14 +1337,11 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar private void handleCharacter(int primaryCode, int[] keyCodes, int x, int y) { mVoiceProxy.handleCharacter(); - if (mJustAddedMagicSpace && primaryCode == Keyboard.CODE_SINGLE_QUOTE) { + if (mJustAddedMagicSpace && isMagicSpaceStripper(primaryCode)) { removeTrailingSpace(); } - if (primaryCode != Keyboard.CODE_ENTER) { - mJustAddedMagicSpace = false; - } - if (mLastSelectionStart == mLastSelectionEnd && TextEntryState.isRecorrecting()) { + if (mLastSelectionStart == mLastSelectionEnd) { abortRecorrection(false); } @@ -1389,6 +1393,12 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar } else { sendKeyChar((char)code); } + if (mJustAddedMagicSpace && isMagicSpaceSwapper(primaryCode)) { + swapSwapperAndSpace(); + } else { + mJustAddedMagicSpace = false; + } + switcher.updateShiftState(); if (LatinIME.PERF_DEBUG) measureCps(); TextEntryState.typedCharacter((char) code, isWordSeparator(code), x, y); @@ -1422,27 +1432,25 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar } } - if (mJustAddedMagicSpace && primaryCode == Keyboard.CODE_SPACE) { - mJustAddedMagicSpace = false; - } else if (mJustAddedMagicSpace && primaryCode == Keyboard.CODE_ENTER) { - removeTrailingSpace(); - mJustAddedMagicSpace = false; - sendKeyChar((char)primaryCode); + if (mJustAddedMagicSpace) { + if (isMagicSpaceSwapper(primaryCode)) { + sendKeyChar((char)primaryCode); + swapSwapperAndSpace(); + } else { + if (isMagicSpaceStripper(primaryCode)) removeTrailingSpace(); + sendKeyChar((char)primaryCode); + mJustAddedMagicSpace = false; + } } else { sendKeyChar((char)primaryCode); } + if (isSuggestionsRequested() && primaryCode == Keyboard.CODE_SPACE) { + maybeDoubleSpace(); + } + TextEntryState.typedCharacter((char) primaryCode, true, x, y); - if (TextEntryState.isPunctuationAfterAccepted() && primaryCode != Keyboard.CODE_ENTER - && mJustAddedMagicSpace) { - swapPunctuationAndSpace(); - } else if (isSuggestionsRequested() && primaryCode == Keyboard.CODE_SPACE) { - doubleSpace(); - mJustAddedMagicSpace = false; - } else { - mJustAddedMagicSpace = false; - } if (pickedDefault) { CharSequence typedWord = mWord.getTypedWord(); TextEntryState.backToAcceptedDefault(typedWord); @@ -1687,10 +1695,17 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar // So, LatinImeLogger logs "" as a user's input. LatinImeLogger.logOnManualSuggestion( "", suggestion.toString(), index, suggestions.mWords); + // Find out whether the previous character is a space. If it is, as a special case + // for punctuation entered through the suggestion strip, it should be considered + // a magic space even if it was a normal space. This is meant to help in case the user + // pressed space on purpose of displaying the suggestion strip punctuation. final char primaryCode = suggestion.charAt(0); + final int toLeft = (ic == null) ? 0 : ic.getTextBeforeCursor(1, 0).charAt(0); + if (Keyboard.CODE_SPACE == toLeft) mJustAddedMagicSpace = true; onCodeInput(primaryCode, new int[] { primaryCode }, KeyboardActionListener.NOT_A_TOUCH_COORDINATE, KeyboardActionListener.NOT_A_TOUCH_COORDINATE); + mJustAddedMagicSpace = false; if (ic != null) { ic.endBatchEdit(); } @@ -1917,8 +1932,11 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar } if (mUserBigramDictionary != null) { + // We don't want to register as bigrams words separated by a separator. + // For example "I will, and you too" : we don't want the pair ("will" "and") to be + // a bigram. CharSequence prevWord = EditingUtils.getPreviousWord(getCurrentInputConnection(), - mSentenceSeparators); + mWordSeparators); if (!TextUtils.isEmpty(prevWord)) { mUserBigramDictionary.addBigrams(prevWord.toString(), suggestion.toString()); } @@ -1993,8 +2011,12 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar return separators.contains(String.valueOf((char)code)); } - private boolean isSentenceSeparator(int code) { - return mSentenceSeparators.contains(String.valueOf((char)code)); + private boolean isMagicSpaceStripper(int code) { + return mMagicSpaceStrippers.contains(String.valueOf((char)code)); + } + + private boolean isMagicSpaceSwapper(int code) { + return mMagicSpaceSwappers.contains(String.valueOf((char)code)); } private void sendMagicSpace() { From ff082d081f3ea18ff0b9b22126ee4a86504cf83c Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Wed, 27 Apr 2011 14:14:45 +0900 Subject: [PATCH 09/12] Refactor KeyboardView and create MiniKeyboardView Change-Id: I8d68b944762ccde05020978f20b3742eb6ab945b --- java/res/layout/input_basic.xml | 2 +- java/res/layout/input_basic_highcontrast.xml | 2 +- java/res/layout/input_gingerbread.xml | 2 +- java/res/layout/input_honeycomb.xml | 2 +- java/res/layout/input_stone_bold.xml | 2 +- java/res/layout/input_stone_normal.xml | 2 +- java/res/layout/keyboard_popup.xml | 4 +- java/res/layout/keyboard_popup_honeycomb.xml | 4 +- java/res/layout/keyboard_popup_stone.xml | 4 +- java/res/values/styles.xml | 2 +- .../inputmethod/keyboard/KeyboardView.java | 290 +++++++----------- .../inputmethod/keyboard/MiniKeyboard.java | 17 + .../keyboard/PopupMiniKeyboardView.java | 124 ++++++++ .../inputmethod/keyboard/PopupPanel.java | 46 +++ 14 files changed, 303 insertions(+), 200 deletions(-) create mode 100644 java/src/com/android/inputmethod/keyboard/PopupMiniKeyboardView.java create mode 100644 java/src/com/android/inputmethod/keyboard/PopupPanel.java diff --git a/java/res/layout/input_basic.xml b/java/res/layout/input_basic.xml index 86ae82d51..8666daece 100644 --- a/java/res/layout/input_basic.xml +++ b/java/res/layout/input_basic.xml @@ -21,7 +21,7 @@ - - - 0.5 white - diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java index 11476e069..08e739d5a 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java @@ -35,17 +35,16 @@ import android.graphics.Typeface; import android.graphics.drawable.Drawable; import android.os.Handler; import android.os.Message; -import android.os.SystemClock; import android.util.AttributeSet; import android.util.Log; import android.util.TypedValue; import android.view.GestureDetector; -import android.view.Gravity; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewConfiguration; import android.view.ViewGroup; +import android.view.ViewGroup.MarginLayoutParams; import android.widget.FrameLayout; import android.widget.LinearLayout; import android.widget.PopupWindow; @@ -53,7 +52,6 @@ import android.widget.TextView; import java.util.ArrayList; import java.util.HashMap; -import java.util.List; import java.util.WeakHashMap; /** @@ -111,24 +109,18 @@ public class KeyboardView extends View implements PointerTracker.UIProxy { private boolean mInForeground; private TextView mPreviewText; private int mPreviewTextSizeLarge; - private final int[] mOffsetInWindow = new int[2]; private boolean mShowKeyPreview = true; private int mKeyPreviewDisplayedY; private final int mDelayBeforePreview; private final int mDelayAfterPreview; private ViewGroup mPreviewPlacer; + private final int[] mCoordinates = new int[2]; // Mini keyboard - private PopupWindow mMiniKeyboardWindow; - private KeyboardView mMiniKeyboardView; - private final WeakHashMap mMiniKeyboardCache = new WeakHashMap(); - private int mMiniKeyboardOriginX; - private int mMiniKeyboardOriginY; - private long mMiniKeyboardDisplayedTime; - private int[] mWindowOffset; - private final float mMiniKeyboardSlideAllowance; - private int mMiniKeyboardTrackerId; - private final boolean mConfigShowMiniKeyboardAtTouchedPoint; + private PopupWindow mPopupWindow; + private PopupPanel mPopupMiniKeyboardPanel; + private final WeakHashMap mPopupPanelCache = + new WeakHashMap(); /** Listener for {@link KeyboardActionListener}. */ private KeyboardActionListener mKeyboardActionListener; @@ -148,7 +140,7 @@ public class KeyboardView extends View implements PointerTracker.UIProxy { protected KeyDetector mKeyDetector = new KeyDetector(); // Swipe gesture detector - private GestureDetector mGestureDetector; + protected GestureDetector mGestureDetector; private final SwipeTracker mSwipeTracker = new SwipeTracker(); private final int mSwipeThreshold; private final boolean mDisambiguateSwipe; @@ -196,29 +188,24 @@ public class KeyboardView extends View implements PointerTracker.UIProxy { @Override public void handleMessage(Message msg) { + final PointerTracker tracker = (PointerTracker) msg.obj; switch (msg.what) { - case MSG_SHOW_KEY_PREVIEW: - showKey(msg.arg1, (PointerTracker)msg.obj); - break; - case MSG_DISMISS_KEY_PREVIEW: - mPreviewText.setVisibility(View.INVISIBLE); - break; - case MSG_REPEAT_KEY: { - final PointerTracker tracker = (PointerTracker)msg.obj; - tracker.onRepeatKey(msg.arg1); - startKeyRepeatTimer(mKeyRepeatInterval, msg.arg1, tracker); - break; - } - case MSG_LONGPRESS_KEY: { - final PointerTracker tracker = (PointerTracker)msg.obj; - openMiniKeyboardIfRequired(msg.arg1, tracker); - break; - } - case MSG_LONGPRESS_SHIFT_KEY: { - final PointerTracker tracker = (PointerTracker)msg.obj; - onLongPressShiftKey(tracker); - break; - } + case MSG_SHOW_KEY_PREVIEW: + showKey(msg.arg1, tracker); + break; + case MSG_DISMISS_KEY_PREVIEW: + mPreviewText.setVisibility(View.INVISIBLE); + break; + case MSG_REPEAT_KEY: + tracker.onRepeatKey(msg.arg1); + startKeyRepeatTimer(mKeyRepeatInterval, msg.arg1, tracker); + break; + case MSG_LONGPRESS_KEY: + openMiniKeyboardIfRequired(msg.arg1, tracker); + break; + case MSG_LONGPRESS_SHIFT_KEY: + onLongPressShiftKey(tracker); + break; } } @@ -390,12 +377,6 @@ public class KeyboardView extends View implements PointerTracker.UIProxy { mKeyLabelHorizontalPadding = (int)res.getDimension( R.dimen.key_label_horizontal_alignment_padding); - mMiniKeyboardWindow = new PopupWindow(context); - mMiniKeyboardWindow.setBackgroundDrawable(null); - mMiniKeyboardWindow.setAnimationStyle(R.style.MiniKeyboardAnimation); - // Allow popup window to be drawn off the screen. - mMiniKeyboardWindow.setClippingEnabled(false); - mPaint = new Paint(); mPaint.setAntiAlias(true); mPaint.setTextSize(keyTextSize); @@ -406,11 +387,8 @@ public class KeyboardView extends View implements PointerTracker.UIProxy { mKeyBackground.getPadding(mPadding); mSwipeThreshold = (int) (500 * res.getDisplayMetrics().density); - // TODO: Refer frameworks/base/core/res/res/values/config.xml + // TODO: Refer to frameworks/base/core/res/res/values/config.xml mDisambiguateSwipe = res.getBoolean(R.bool.config_swipeDisambiguation); - mMiniKeyboardSlideAllowance = res.getDimension(R.dimen.mini_keyboard_slide_allowance); - mConfigShowMiniKeyboardAtTouchedPoint = res.getBoolean( - R.bool.config_show_mini_keyboard_at_touched_point); GestureDetector.SimpleOnGestureListener listener = new GestureDetector.SimpleOnGestureListener() { @@ -530,7 +508,7 @@ public class KeyboardView extends View implements PointerTracker.UIProxy { mKeyboardChanged = true; invalidateAllKeys(); mKeyDetector.setProximityThreshold(keyboard.getMostCommonKeyWidth()); - mMiniKeyboardCache.clear(); + mPopupPanelCache.clear(); } /** @@ -694,7 +672,7 @@ public class KeyboardView extends View implements PointerTracker.UIProxy { } // Overlay a dark rectangle to dim the keyboard - if (mMiniKeyboardView != null) { + if (mPopupMiniKeyboardPanel != null) { mPaint.setColor((int) (mBackgroundDimAmount * 0xFF) << 24); canvas.drawRect(0, 0, width, height, mPaint); } @@ -947,8 +925,10 @@ public class KeyboardView extends View implements PointerTracker.UIProxy { mPreviewPlacer = placer; } if (placer instanceof FrameLayout) { + // Honeycomb or later. placer.addView(keyPreview, new FrameLayout.LayoutParams(0, 0)); } else { + // Gingerbread or ealier. placer.addView(keyPreview, new LinearLayout.LayoutParams(0, 0)); } } @@ -956,10 +936,11 @@ public class KeyboardView extends View implements PointerTracker.UIProxy { // TODO: Introduce minimum duration for displaying key previews // TODO: Display up to two key previews when the user presses two keys at the same time private void showKey(final int keyIndex, PointerTracker tracker) { + final TextView previewText = mPreviewText; // If the key preview has no parent view yet, add it to the ViewGroup which can place // key preview absolutely in SoftInputWindow. - if (mPreviewText.getParent() == null) { - addKeyPreview(mPreviewText); + if (previewText.getParent() == null) { + addKeyPreview(previewText); } final Key key = tracker.getKey(keyIndex); @@ -968,56 +949,51 @@ public class KeyboardView extends View implements PointerTracker.UIProxy { // WindowManager.BadTokenException. if (key == null || !mInForeground) return; + + mHandler.cancelAllDismissKeyPreviews(); + final int keyDrawX = key.mX + key.mVisualInsetsLeft; final int keyDrawWidth = key.mWidth - key.mVisualInsetsLeft - key.mVisualInsetsRight; // What we show as preview should match what we show on key top in onBufferDraw(). if (key.mLabel != null) { // TODO Should take care of temporaryShiftLabel here. - mPreviewText.setCompoundDrawables(null, null, null, null); - mPreviewText.setText(adjustCase(tracker.getPreviewText(key))); + previewText.setCompoundDrawables(null, null, null, null); + previewText.setText(adjustCase(tracker.getPreviewText(key))); if (key.mLabel.length() > 1) { - mPreviewText.setTextSize(TypedValue.COMPLEX_UNIT_PX, mKeyLetterSize); - mPreviewText.setTypeface(Typeface.DEFAULT_BOLD); + previewText.setTextSize(TypedValue.COMPLEX_UNIT_PX, mKeyLetterSize); + previewText.setTypeface(Typeface.DEFAULT_BOLD); } else { - mPreviewText.setTextSize(TypedValue.COMPLEX_UNIT_PX, mPreviewTextSizeLarge); - mPreviewText.setTypeface(mKeyLetterStyle); + previewText.setTextSize(TypedValue.COMPLEX_UNIT_PX, mPreviewTextSizeLarge); + previewText.setTypeface(mKeyLetterStyle); } } else { final Drawable previewIcon = key.getPreviewIcon(); - mPreviewText.setCompoundDrawables(null, null, null, + previewText.setCompoundDrawables(null, null, null, previewIcon != null ? previewIcon : key.getIcon()); - mPreviewText.setText(null); + previewText.setText(null); } // Set the preview background state - mPreviewText.getBackground().setState( + previewText.getBackground().setState( key.mPopupCharacters != null ? LONG_PRESSABLE_STATE_SET : EMPTY_STATE_SET); - mPreviewText.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), + previewText.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)); - int previewWidth = Math.max(mPreviewText.getMeasuredWidth(), keyDrawWidth - + mPreviewText.getPaddingLeft() + mPreviewText.getPaddingRight()); + final int previewWidth = Math.max(previewText.getMeasuredWidth(), keyDrawWidth + + previewText.getPaddingLeft() + previewText.getPaddingRight()); final int previewHeight = mPreviewHeight; - final ViewGroup.LayoutParams lp = mPreviewText.getLayoutParams(); - lp.width = previewWidth; - lp.height = previewHeight; - - int previewX = keyDrawX - (previewWidth - keyDrawWidth) / 2; - int previewY = key.mY - previewHeight + mPreviewOffset; - - mHandler.cancelAllDismissKeyPreviews(); - getLocationInWindow(mOffsetInWindow); - previewX += mOffsetInWindow[0]; - previewY += mOffsetInWindow[1]; + getLocationInWindow(mCoordinates); + final int previewX = keyDrawX - (previewWidth - keyDrawWidth) / 2 + mCoordinates[0]; + final int previewY = key.mY - previewHeight + mCoordinates[1] + mPreviewOffset; + // Record key preview position to display mini-keyboard later at the same position + mKeyPreviewDisplayedY = previewY; // Place the key preview. // TODO: Adjust position of key previews which touch screen edges - if (lp instanceof ViewGroup.MarginLayoutParams) { - ViewGroup.MarginLayoutParams mlp = (ViewGroup.MarginLayoutParams)lp; - mlp.setMargins(previewX, previewY, 0, 0); - } - // Record key preview position to display mini-keyboard later at the same position - mKeyPreviewDisplayedY = previewY; - mPreviewText.setVisibility(VISIBLE); + final MarginLayoutParams lp = (MarginLayoutParams)previewText.getLayoutParams(); + lp.width = previewWidth; + lp.height = previewHeight; + lp.setMargins(previewX, previewY, 0, 0); + previewText.setVisibility(VISIBLE); } /** @@ -1044,8 +1020,9 @@ public class KeyboardView extends View implements PointerTracker.UIProxy { if (key == null) return; mInvalidatedKey = key; - mInvalidatedKeyRect.set(0, 0, key.mWidth, key.mHeight); - mInvalidatedKeyRect.offset(key.mX + getPaddingLeft(), key.mY + getPaddingTop()); + final int x = key.mX + getPaddingLeft(); + final int y = key.mY + getPaddingTop(); + mInvalidatedKeyRect.set(x, y, x + key.mWidth, y + key.mHeight); mDirtyRect.union(mInvalidatedKeyRect); onBufferDraw(); invalidate(mInvalidatedKeyRect); @@ -1057,13 +1034,12 @@ public class KeyboardView extends View implements PointerTracker.UIProxy { return false; } - Key parentKey = tracker.getKey(keyIndex); + final Key parentKey = tracker.getKey(keyIndex); if (parentKey == null) return false; boolean result = onLongPress(parentKey, tracker); if (result) { dismissAllKeyPreviews(); - mMiniKeyboardTrackerId = tracker.mPointerId; tracker.onLongPressed(mPointerQueue); } return result; @@ -1081,13 +1057,18 @@ public class KeyboardView extends View implements PointerTracker.UIProxy { mKeyboardActionListener.onCodeInput(Keyboard.CODE_CAPSLOCK, null, 0, 0); } - private View inflateMiniKeyboardContainer(Key parentKey) { + // This default implementation returns a popup mini keyboard panel. + // A derived class may return a language switcher popup panel, for instance. + protected PopupPanel onCreatePopupPanel(Key parentKey) { + if (parentKey.mPopupCharacters == null) + return null; + final View container = LayoutInflater.from(getContext()).inflate(mPopupLayout, null); if (container == null) throw new NullPointerException(); - final KeyboardView miniKeyboardView = - (KeyboardView)container.findViewById(R.id.KeyboardView); + final PopupMiniKeyboardView miniKeyboardView = + (PopupMiniKeyboardView)container.findViewById(R.id.mini_keyboard_view); miniKeyboardView.setOnKeyboardActionListener(new KeyboardActionListener() { @Override public void onCodeInput(int primaryCode, int[] keyCodes, int x, int y) { @@ -1120,10 +1101,6 @@ public class KeyboardView extends View implements PointerTracker.UIProxy { mKeyboardActionListener.onRelease(primaryCode, withSliding); } }); - // Override default ProximityKeyDetector. - miniKeyboardView.mKeyDetector = new MiniKeyboardKeyDetector(mMiniKeyboardSlideAllowance); - // Remove gesture detector on mini-keyboard - miniKeyboardView.mGestureDetector = null; final Keyboard keyboard = new MiniKeyboardBuilder(this, mKeyboard.getPopupKeyboardResId(), parentKey).build(); @@ -1132,87 +1109,39 @@ public class KeyboardView extends View implements PointerTracker.UIProxy { container.measure(MeasureSpec.makeMeasureSpec(getWidth(), MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(getHeight(), MeasureSpec.AT_MOST)); - return container; - } - - private static boolean isOneRowKeys(List keys) { - if (keys.size() == 0) return false; - final int edgeFlags = keys.get(0).mEdgeFlags; - // HACK: The first key of mini keyboard which was inflated from xml and has multiple rows, - // does not have both top and bottom edge flags on at the same time. On the other hand, - // the first key of mini keyboard that was created with popupCharacters must have both top - // and bottom edge flags on. - // When you want to use one row mini-keyboard from xml file, make sure that the row has - // both top and bottom edge flags set. - return (edgeFlags & Keyboard.EDGE_TOP) != 0 - && (edgeFlags & Keyboard.EDGE_BOTTOM) != 0; + return miniKeyboardView; } /** - * Called when a key is long pressed. By default this will open any mini keyboard associated - * with this key through the attributes popupLayout and popupCharacters. + * Called when a key is long pressed. By default this will open mini keyboard associated + * with this key. * @param parentKey the key that was long pressed + * @param tracker the pointer tracker which pressed the parent key * @return true if the long press is handled, false otherwise. Subclasses should call the * method on the base class if the subclass doesn't wish to handle the call. */ protected boolean onLongPress(Key parentKey, PointerTracker tracker) { - if (parentKey.mPopupCharacters == null) - return false; - - View container = mMiniKeyboardCache.get(parentKey); - if (container == null) { - container = inflateMiniKeyboardContainer(parentKey); - mMiniKeyboardCache.put(parentKey, container); + PopupPanel popupPanel = mPopupPanelCache.get(parentKey); + if (popupPanel == null) { + popupPanel = onCreatePopupPanel(parentKey); + if (popupPanel == null) + return false; + mPopupPanelCache.put(parentKey, popupPanel); } - mMiniKeyboardView = (KeyboardView)container.findViewById(R.id.KeyboardView); - final MiniKeyboard miniKeyboard = (MiniKeyboard)mMiniKeyboardView.getKeyboard(); - - if (mWindowOffset == null) { - mWindowOffset = new int[2]; - getLocationInWindow(mWindowOffset); + if (mPopupWindow == null) { + mPopupWindow = new PopupWindow(getContext()); + mPopupWindow.setBackgroundDrawable(null); + mPopupWindow.setAnimationStyle(R.style.PopupMiniKeyboardAnimation); + // Allow popup window to be drawn off the screen. + mPopupWindow.setClippingEnabled(false); } - final int pointX = (mConfigShowMiniKeyboardAtTouchedPoint) ? tracker.getLastX() - : parentKey.mX + parentKey.mWidth / 2; - final int miniKeyboardX = pointX - miniKeyboard.getDefaultCoordX() - - container.getPaddingLeft() - + getPaddingLeft() + mWindowOffset[0]; - final int miniKeyboardY = parentKey.mY - mKeyboard.getVerticalGap() - - (container.getMeasuredHeight() - container.getPaddingBottom()) - + getPaddingTop() + mWindowOffset[1]; - final int x = miniKeyboardX; - final int y = mShowKeyPreview && isOneRowKeys(miniKeyboard.getKeys()) - ? mKeyPreviewDisplayedY : miniKeyboardY; - - mMiniKeyboardOriginX = x + container.getPaddingLeft() - mWindowOffset[0]; - mMiniKeyboardOriginY = y + container.getPaddingTop() - mWindowOffset[1]; - if (miniKeyboard.setShifted( - mKeyboard == null ? false : mKeyboard.isShiftedOrShiftLocked())) { - mMiniKeyboardView.invalidateAllKeys(); - } - // Mini keyboard needs no pop-up key preview displayed. - mMiniKeyboardView.setKeyPreviewEnabled(false); - mMiniKeyboardWindow.setContentView(container); - mMiniKeyboardWindow.setWidth(container.getMeasuredWidth()); - mMiniKeyboardWindow.setHeight(container.getMeasuredHeight()); - mMiniKeyboardWindow.showAtLocation(this, Gravity.NO_GRAVITY, x, y); - - // Inject down event on the key to mini keyboard. - final long eventTime = SystemClock.uptimeMillis(); - mMiniKeyboardDisplayedTime = eventTime; - final MotionEvent downEvent = generateMiniKeyboardMotionEvent(MotionEvent.ACTION_DOWN, - pointX, parentKey.mY + parentKey.mHeight / 2, eventTime); - mMiniKeyboardView.onTouchEvent(downEvent); - downEvent.recycle(); + mPopupMiniKeyboardPanel = popupPanel; + popupPanel.showPanel(this, parentKey, tracker, mKeyPreviewDisplayedY, mPopupWindow); invalidateAllKeys(); return true; } - private MotionEvent generateMiniKeyboardMotionEvent(int action, int x, int y, long eventTime) { - return MotionEvent.obtain(mMiniKeyboardDisplayedTime, eventTime, action, - x - mMiniKeyboardOriginX, y - mMiniKeyboardOriginY, 0); - } - private PointerTracker getPointerTracker(final int id) { final ArrayList pointers = mPointerTrackers; final KeyboardActionListener listener = mKeyboardActionListener; @@ -1232,8 +1161,8 @@ public class KeyboardView extends View implements PointerTracker.UIProxy { } public boolean isInSlidingKeyInput() { - if (mMiniKeyboardView != null) { - return mMiniKeyboardView.isInSlidingKeyInput(); + if (mPopupMiniKeyboardPanel != null) { + return mPopupMiniKeyboardPanel.isInSlidingKeyInput(); } else { return mPointerQueue.isInSlidingKeyInput(); } @@ -1264,7 +1193,7 @@ public class KeyboardView extends View implements PointerTracker.UIProxy { // Gesture detector must be enabled only when mini-keyboard is not on the screen and // accessibility is not enabled. // TODO: Reconcile gesture detection and accessibility features. - if (mMiniKeyboardView == null && !mIsAccessibilityEnabled + if (mPopupMiniKeyboardPanel == null && !mIsAccessibilityEnabled && mGestureDetector != null && mGestureDetector.onTouchEvent(me)) { dismissAllKeyPreviews(); mHandler.cancelKeyTimers(); @@ -1277,19 +1206,10 @@ public class KeyboardView extends View implements PointerTracker.UIProxy { final int x = (int)me.getX(index); final int y = (int)me.getY(index); - // Needs to be called after the gesture detector gets a turn, as it may have - // displayed the mini keyboard - if (mMiniKeyboardView != null) { - final int miniKeyboardPointerIndex = me.findPointerIndex(mMiniKeyboardTrackerId); - if (miniKeyboardPointerIndex >= 0 && miniKeyboardPointerIndex < pointerCount) { - final int miniKeyboardX = (int)me.getX(miniKeyboardPointerIndex); - final int miniKeyboardY = (int)me.getY(miniKeyboardPointerIndex); - MotionEvent translated = generateMiniKeyboardMotionEvent(action, - miniKeyboardX, miniKeyboardY, eventTime); - mMiniKeyboardView.onTouchEvent(translated); - translated.recycle(); - } - return true; + // Needs to be called after the gesture detector gets a turn, as it may have displayed the + // mini keyboard + if (mPopupMiniKeyboardPanel != null) { + return mPopupMiniKeyboardPanel.onTouchEvent(me); } if (mHandler.isInKeyRepeat()) { @@ -1370,7 +1290,7 @@ public class KeyboardView extends View implements PointerTracker.UIProxy { dismissMiniKeyboard(); mDirtyRect.union(0, 0, getWidth(), getHeight()); - mMiniKeyboardCache.clear(); + mPopupPanelCache.clear(); requestLayout(); } @@ -1385,21 +1305,17 @@ public class KeyboardView extends View implements PointerTracker.UIProxy { closing(); } - private void dismissMiniKeyboard() { - if (mMiniKeyboardWindow.isShowing()) { - mMiniKeyboardWindow.dismiss(); - mMiniKeyboardView = null; - mMiniKeyboardOriginX = 0; - mMiniKeyboardOriginY = 0; + private boolean dismissMiniKeyboard() { + if (mPopupWindow != null && mPopupWindow.isShowing()) { + mPopupWindow.dismiss(); + mPopupMiniKeyboardPanel = null; invalidateAllKeys(); - } - } - - public boolean handleBack() { - if (mMiniKeyboardWindow.isShowing()) { - dismissMiniKeyboard(); return true; } return false; } + + public boolean handleBack() { + return dismissMiniKeyboard(); + } } diff --git a/java/src/com/android/inputmethod/keyboard/MiniKeyboard.java b/java/src/com/android/inputmethod/keyboard/MiniKeyboard.java index 3b1408ccf..5dde15e94 100644 --- a/java/src/com/android/inputmethod/keyboard/MiniKeyboard.java +++ b/java/src/com/android/inputmethod/keyboard/MiniKeyboard.java @@ -18,6 +18,8 @@ package com.android.inputmethod.keyboard; import android.content.Context; +import java.util.List; + public class MiniKeyboard extends Keyboard { private int mDefaultKeyCoordX; @@ -32,4 +34,19 @@ public class MiniKeyboard extends Keyboard { public int getDefaultCoordX() { return mDefaultKeyCoordX; } + + public boolean isOneRowKeyboard() { + final List keys = getKeys(); + if (keys.size() == 0) return false; + final int edgeFlags = keys.get(0).mEdgeFlags; + // HACK: The first key of mini keyboard which was inflated from xml and has multiple rows, + // does not have both top and bottom edge flags on at the same time. On the other hand, + // the first key of mini keyboard that was created with popupCharacters must have both top + // and bottom edge flags on. + // When you want to use one row mini-keyboard from xml file, make sure that the row has + // both top and bottom edge flags set. + return (edgeFlags & Keyboard.EDGE_TOP) != 0 + && (edgeFlags & Keyboard.EDGE_BOTTOM) != 0; + + } } diff --git a/java/src/com/android/inputmethod/keyboard/PopupMiniKeyboardView.java b/java/src/com/android/inputmethod/keyboard/PopupMiniKeyboardView.java new file mode 100644 index 000000000..12031f1ea --- /dev/null +++ b/java/src/com/android/inputmethod/keyboard/PopupMiniKeyboardView.java @@ -0,0 +1,124 @@ +/* + * Copyright (C) 2011 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.inputmethod.keyboard; + +import com.android.inputmethod.latin.R; + +import android.content.Context; +import android.content.res.Resources; +import android.os.SystemClock; +import android.util.AttributeSet; +import android.view.Gravity; +import android.view.MotionEvent; +import android.view.View; +import android.widget.PopupWindow; + +/** + * A view that renders a virtual {@link MiniKeyboard}. It handles rendering of keys and detecting + * key presses and touch movements. + */ +public class PopupMiniKeyboardView extends KeyboardView implements PopupPanel { + private final int[] mCoordinates = new int[2]; + private final boolean mConfigShowMiniKeyboardAtTouchedPoint; + + private int mOriginX; + private int mOriginY; + private int mTrackerId; + private long mDownTime; + + public PopupMiniKeyboardView(Context context, AttributeSet attrs) { + this(context, attrs, R.attr.keyboardViewStyle); + } + + public PopupMiniKeyboardView(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + + final Resources res = context.getResources(); + mConfigShowMiniKeyboardAtTouchedPoint = res.getBoolean( + R.bool.config_show_mini_keyboard_at_touched_point); + // Override default ProximityKeyDetector. + mKeyDetector = new MiniKeyboardKeyDetector(res.getDimension( + R.dimen.mini_keyboard_slide_allowance)); + // Remove gesture detector on mini-keyboard + mGestureDetector = null; + setKeyPreviewEnabled(false); + } + + @Override + public void setKeyPreviewEnabled(boolean previewEnabled) { + // Mini keyboard needs no pop-up key preview displayed. + super.setKeyPreviewEnabled(false); + } + + @Override + public void showPanel(KeyboardView parentKeyboardView, Key parentKey, + PointerTracker tracker, int keyPreviewY, PopupWindow window) { + final View container = (View)getParent(); + final MiniKeyboard miniKeyboard = (MiniKeyboard)getKeyboard(); + final Keyboard parentKeyboard = parentKeyboardView.getKeyboard(); + + parentKeyboardView.getLocationInWindow(mCoordinates); + final int pointX = (mConfigShowMiniKeyboardAtTouchedPoint) ? tracker.getLastX() + : parentKey.mX + parentKey.mWidth / 2; + final int pointY = parentKey.mY; + final int miniKeyboardX = pointX - miniKeyboard.getDefaultCoordX() + - container.getPaddingLeft() + + parentKeyboardView.getPaddingLeft() + mCoordinates[0]; + final int miniKeyboardY = pointY - parentKeyboard.getVerticalGap() + - (container.getMeasuredHeight() - container.getPaddingBottom()) + + parentKeyboardView.getPaddingTop() + mCoordinates[1]; + final int x = miniKeyboardX; + final int y = parentKeyboardView.isKeyPreviewEnabled() && miniKeyboard.isOneRowKeyboard() + ? keyPreviewY : miniKeyboardY; + + if (miniKeyboard.setShifted(parentKeyboard.isShiftedOrShiftLocked())) { + invalidateAllKeys(); + } + window.setContentView(container); + window.setWidth(container.getMeasuredWidth()); + window.setHeight(container.getMeasuredHeight()); + window.showAtLocation(parentKeyboardView, Gravity.NO_GRAVITY, x, y); + + mOriginX = x + container.getPaddingLeft() - mCoordinates[0]; + mOriginY = y + container.getPaddingTop() - mCoordinates[1]; + mTrackerId = tracker.mPointerId; + mDownTime = SystemClock.uptimeMillis(); + + // Inject down event on the key to mini keyboard. + final MotionEvent downEvent = translateMotionEvent(MotionEvent.ACTION_DOWN, pointX, + pointY + parentKey.mHeight / 2, mDownTime); + onTouchEvent(downEvent); + downEvent.recycle(); + } + + private MotionEvent translateMotionEvent(int action, float x, float y, long eventTime) { + return MotionEvent.obtain(mDownTime, eventTime, action, x - mOriginX, y - mOriginY, 0); + } + + @Override + public boolean onTouchEvent(MotionEvent me) { + final int index = me.getActionIndex(); + final int id = me.getPointerId(index); + if (id == mTrackerId) { + final MotionEvent translated = translateMotionEvent(me.getAction(), me.getX(index), + me.getY(index), me.getEventTime()); + super.onTouchEvent(translated); + translated.recycle(); + } + return true; + } +} diff --git a/java/src/com/android/inputmethod/keyboard/PopupPanel.java b/java/src/com/android/inputmethod/keyboard/PopupPanel.java new file mode 100644 index 000000000..6f2b16148 --- /dev/null +++ b/java/src/com/android/inputmethod/keyboard/PopupPanel.java @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2011 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.inputmethod.keyboard; + +import android.view.MotionEvent; +import android.widget.PopupWindow; + +public interface PopupPanel { + /** + * Show popup panel. + * @param parentKeyboardView the parent KeyboardView that has the parent key. + * @param parentKey the parent key that is the source of this popup panel + * @param tracker the pointer tracker that pressesd the parent key + * @param keyPreviewY the Y-coordinate of key preview + * @param window PopupWindow to be used to show this popup panel + */ + public void showPanel(KeyboardView parentKeyboardView, Key parentKey, + PointerTracker tracker, int keyPreviewY, PopupWindow window); + + /** + * Check if the pointer is in siding key input mode. + * @return true if the pointer is sliding key input mode. + */ + public boolean isInSlidingKeyInput(); + + /** + * The motion event handler. + * @param me the MotionEvent to be processed. + * @return true if the motion event is processed and should be consumed. + */ + public boolean onTouchEvent(MotionEvent me); +} From 7a8dac55278cedd838be325f56b4c52d973c61f5 Mon Sep 17 00:00:00 2001 From: satok Date: Fri, 6 May 2011 18:27:24 +0900 Subject: [PATCH 10/12] Move Recorrection functions to Recorrection.java Change-Id: I309d78c50074cd6fb02a9d6f51b675b158a56202 --- .../android/inputmethod/latin/LatinIME.java | 97 +++---------- .../inputmethod/latin/Recorrection.java | 130 ++++++++++++++++++ 2 files changed, 151 insertions(+), 76 deletions(-) create mode 100644 java/src/com/android/inputmethod/latin/Recorrection.java diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 2afb1c9fc..d6d0329bd 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -68,7 +68,6 @@ import android.view.WindowManager; import android.view.inputmethod.CompletionInfo; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.ExtractedText; -import android.view.inputmethod.ExtractedTextRequest; import android.view.inputmethod.InputConnection; import android.widget.LinearLayout; @@ -152,6 +151,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar private KeyboardSwitcher mKeyboardSwitcher; private SubtypeSwitcher mSubtypeSwitcher; private VoiceProxy mVoiceProxy; + private Recorrection mRecorrection; private UserDictionary mUserDictionary; private UserBigramDictionary mUserBigramDictionary; @@ -176,7 +176,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar // punctuation on punctuation insertion, and become a real space on alpha char insertion. private boolean mJustAddedMagicSpace; // This indicates whether the last char is a magic space. private boolean mAutoCorrectEnabled; - private boolean mRecorrectionEnabled; // Suggestion: use bigrams to adjust scores of suggestions obtained from unigram dictionary private boolean mBigramSuggestionEnabled; // Prediction: use bigrams to predict the next word when there is no input for it yet @@ -403,6 +402,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar SubtypeSwitcher.init(this, prefs); KeyboardSwitcher.init(this, prefs); AccessibilityUtils.init(this, prefs); + Recorrection.init(this, prefs); super.onCreate(); @@ -411,19 +411,11 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar mSubtypeSwitcher = SubtypeSwitcher.getInstance(); mKeyboardSwitcher = KeyboardSwitcher.getInstance(); mAccessibilityUtils = AccessibilityUtils.getInstance(); + mRecorrection = Recorrection.getInstance(); final Resources res = getResources(); mResources = res; - // If the option should not be shown, do not read the recorrection preference - // but always use the default setting defined in the resources. - if (res.getBoolean(R.bool.config_enable_show_recorrection_option)) { - mRecorrectionEnabled = prefs.getBoolean(Settings.PREF_RECORRECTION_ENABLED, - res.getBoolean(R.bool.config_default_recorrection_enabled)); - } else { - mRecorrectionEnabled = res.getBoolean(R.bool.config_default_recorrection_enabled); - } - mConfigEnableShowSubtypeSettings = res.getBoolean( R.bool.config_enable_show_subtype_settings); mConfigSwipeDownDismissKeyboardEnabled = res.getBoolean( @@ -624,7 +616,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar inputView.setProximityCorrectionEnabled(true); inputView.setAccessibilityEnabled(accessibilityEnabled); // If we just entered a text field, maybe it has some old text that requires correction - checkRecorrectionOnStart(); + mRecorrection.checkRecorrectionOnStart(); inputView.setForeground(true); voiceIme.onStartInputView(inputView.getWindowToken()); @@ -687,34 +679,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar } } - private void checkRecorrectionOnStart() { - if (!mRecorrectionEnabled) return; - - final InputConnection ic = getCurrentInputConnection(); - if (ic == null) return; - // There could be a pending composing span. Clean it up first. - ic.finishComposingText(); - - if (isShowingSuggestionsStrip() && isSuggestionsRequested()) { - // First get the cursor position. This is required by setOldSuggestions(), so that - // it can pass the correct range to setComposingRegion(). At this point, we don't - // have valid values for mLastSelectionStart/End because onUpdateSelection() has - // not been called yet. - ExtractedTextRequest etr = new ExtractedTextRequest(); - etr.token = 0; // anything is fine here - ExtractedText et = ic.getExtractedText(etr, 0); - if (et == null) return; - - mLastSelectionStart = et.startOffset + et.selectionStart; - mLastSelectionEnd = et.startOffset + et.selectionEnd; - - // Then look for possible corrections in a delayed fashion - if (!TextUtils.isEmpty(et.text) && isCursorTouchingWord()) { - mHandler.postUpdateOldSuggestions(); - } - } - } - @Override public void onFinishInput() { super.onFinishInput(); @@ -808,34 +772,15 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar mLastSelectionStart = newSelStart; mLastSelectionEnd = newSelEnd; - if (mRecorrectionEnabled && isShowingSuggestionsStrip()) { - // Don't look for corrections if the keyboard is not visible - if (mKeyboardSwitcher.isInputViewShown()) { - // Check if we should go in or out of correction mode. - if (isSuggestionsRequested() - && (candidatesStart == candidatesEnd || newSelStart != oldSelStart - || TextEntryState.isRecorrecting()) - && (newSelStart < newSelEnd - 1 || !mHasUncommittedTypedChars)) { - if (isCursorTouchingWord() || mLastSelectionStart < mLastSelectionEnd) { - mHandler.cancelUpdateBigramPredictions(); - mHandler.postUpdateOldSuggestions(); - } else { - abortRecorrection(false); - // If showing the "touch again to save" hint, do not replace it. Else, - // show the bigrams if we are at the end of the text, punctuation otherwise. - if (mCandidateView != null - && !mCandidateView.isShowingAddToDictionaryHint()) { - InputConnection ic = getCurrentInputConnection(); - if (null == ic || !TextUtils.isEmpty(ic.getTextAfterCursor(1, 0))) { - if (!isShowingPunctuationList()) setPunctuationSuggestions(); - } else { - mHandler.postUpdateBigramPredictions(); - } - } - } - } - } - } + mRecorrection.updateRecorrectionSelection(mKeyboardSwitcher, + mCandidateView, candidatesStart, candidatesEnd, newSelStart, + newSelEnd, oldSelStart, mLastSelectionStart, + mLastSelectionEnd, mHasUncommittedTypedChars); + } + + public void setLastSelection(int start, int end) { + mLastSelectionStart = start; + mLastSelectionEnd = end; } /** @@ -848,7 +793,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar */ @Override public void onExtractedTextClicked() { - if (mRecorrectionEnabled && isSuggestionsRequested()) return; + if (mRecorrection.isRecorrectionEnabled() && isSuggestionsRequested()) return; super.onExtractedTextClicked(); } @@ -864,7 +809,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar */ @Override public void onExtractedCursorMovement(int dx, int dy) { - if (mRecorrectionEnabled && isSuggestionsRequested()) return; + if (mRecorrection.isRecorrectionEnabled() && isSuggestionsRequested()) return; super.onExtractedCursorMovement(dx, dy); } @@ -1318,7 +1263,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar } } - private void abortRecorrection(boolean force) { + public void abortRecorrection(boolean force) { if (force || TextEntryState.isRecorrecting()) { TextEntryState.onAbortRecorrection(); setCandidatesViewShown(isCandidateStripVisible()); @@ -1495,16 +1440,16 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar mWordHistory.add(entry); } - private boolean isSuggestionsRequested() { + public boolean isSuggestionsRequested() { return mIsSettingsSuggestionStripOn && (mCorrectionMode > 0 || isShowingSuggestionsStrip()); } - private boolean isShowingPunctuationList() { + public boolean isShowingPunctuationList() { return mSuggestPuncList == mCandidateView.getSuggestions(); } - private boolean isShowingSuggestionsStrip() { + public boolean isShowingSuggestionsStrip() { return (mSuggestionVisibility == SUGGESTION_VISIBILILTY_SHOW_VALUE) || (mSuggestionVisibility == SUGGESTION_VISIBILILTY_SHOW_ONLY_PORTRAIT_VALUE && mOrientation == Configuration.ORIENTATION_PORTRAIT); @@ -1877,7 +1822,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar } } - private void setPunctuationSuggestions() { + public void setPunctuationSuggestions() { setSuggestions(mSuggestPuncList); setCandidatesViewShown(isCandidateStripVisible()); } @@ -1925,7 +1870,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar } } - private boolean isCursorTouchingWord() { + public boolean isCursorTouchingWord() { InputConnection ic = getCurrentInputConnection(); if (ic == null) return false; CharSequence toLeft = ic.getTextBeforeCursor(1, 0); diff --git a/java/src/com/android/inputmethod/latin/Recorrection.java b/java/src/com/android/inputmethod/latin/Recorrection.java new file mode 100644 index 000000000..71d3bdddc --- /dev/null +++ b/java/src/com/android/inputmethod/latin/Recorrection.java @@ -0,0 +1,130 @@ +/* + * Copyright (C) 2011 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package com.android.inputmethod.latin; + +import com.android.inputmethod.keyboard.KeyboardSwitcher; + +import android.content.SharedPreferences; +import android.content.res.Resources; +import android.text.TextUtils; +import android.view.inputmethod.ExtractedText; +import android.view.inputmethod.ExtractedTextRequest; +import android.view.inputmethod.InputConnection; + +/** + * Manager of re-correction functionalities + */ +public class Recorrection { + private static final Recorrection sInstance = new Recorrection(); + + private LatinIME mService; + private boolean mRecorrectionEnabled = false; + + public static Recorrection getInstance() { + return sInstance; + } + + public static void init(LatinIME context, SharedPreferences prefs) { + if (context == null || prefs == null) { + return; + } + sInstance.initInternal(context, prefs); + } + + private Recorrection() { + } + + public boolean isRecorrectionEnabled() { + return mRecorrectionEnabled; + } + + private void initInternal(LatinIME context, SharedPreferences prefs) { + final Resources res = context.getResources(); + // If the option should not be shown, do not read the re-correction preference + // but always use the default setting defined in the resources. + if (res.getBoolean(R.bool.config_enable_show_recorrection_option)) { + mRecorrectionEnabled = prefs.getBoolean(Settings.PREF_RECORRECTION_ENABLED, + res.getBoolean(R.bool.config_default_recorrection_enabled)); + } else { + mRecorrectionEnabled = res.getBoolean(R.bool.config_default_recorrection_enabled); + } + mService = context; + } + + public void checkRecorrectionOnStart() { + if (!mRecorrectionEnabled) return; + + final InputConnection ic = mService.getCurrentInputConnection(); + if (ic == null) return; + // There could be a pending composing span. Clean it up first. + ic.finishComposingText(); + + if (mService.isShowingSuggestionsStrip() && mService.isSuggestionsRequested()) { + // First get the cursor position. This is required by setOldSuggestions(), so that + // it can pass the correct range to setComposingRegion(). At this point, we don't + // have valid values for mLastSelectionStart/End because onUpdateSelection() has + // not been called yet. + ExtractedTextRequest etr = new ExtractedTextRequest(); + etr.token = 0; // anything is fine here + ExtractedText et = ic.getExtractedText(etr, 0); + if (et == null) return; + mService.setLastSelection( + et.startOffset + et.selectionStart, et.startOffset + et.selectionEnd); + + // Then look for possible corrections in a delayed fashion + if (!TextUtils.isEmpty(et.text) && mService.isCursorTouchingWord()) { + mService.mHandler.postUpdateOldSuggestions(); + } + } + } + + public void updateRecorrectionSelection(KeyboardSwitcher keyboardSwitcher, + CandidateView candidateView, int candidatesStart, int candidatesEnd, int newSelStart, + int newSelEnd, int oldSelStart, int lastSelectionStart, + int lastSelectionEnd, boolean hasUncommittedTypedChars) { + if (mRecorrectionEnabled && mService.isShowingSuggestionsStrip()) { + // Don't look for corrections if the keyboard is not visible + if (keyboardSwitcher.isInputViewShown()) { + // Check if we should go in or out of correction mode. + if (mService.isSuggestionsRequested() + && (candidatesStart == candidatesEnd || newSelStart != oldSelStart + || TextEntryState.isRecorrecting()) + && (newSelStart < newSelEnd - 1 || !hasUncommittedTypedChars)) { + if (mService.isCursorTouchingWord() || lastSelectionStart < lastSelectionEnd) { + mService.mHandler.cancelUpdateBigramPredictions(); + mService.mHandler.postUpdateOldSuggestions(); + } else { + mService.abortRecorrection(false); + // If showing the "touch again to save" hint, do not replace it. Else, + // show the bigrams if we are at the end of the text, punctuation otherwise. + if (candidateView != null + && !candidateView.isShowingAddToDictionaryHint()) { + InputConnection ic = mService.getCurrentInputConnection(); + if (null == ic || !TextUtils.isEmpty(ic.getTextAfterCursor(1, 0))) { + if (!mService.isShowingPunctuationList()) { + mService.setPunctuationSuggestions(); + } + } else { + mService.mHandler.postUpdateBigramPredictions(); + } + } + } + } + } + } + } +} From 37b6b44a909f5ce14914674eed8466af1c0dc756 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Mon, 9 May 2011 19:49:13 +0900 Subject: [PATCH 11/12] Fix suggestion strip geometry Bug: 4393288 Change-Id: I6cad1d186db25174a3f31a57975165e720b41266 --- java/res/layout-xlarge/candidate.xml | 8 ++++---- java/res/layout/candidate.xml | 8 ++++---- java/res/values-xlarge/dimens.xml | 4 ++-- java/res/values/dimens.xml | 4 ++-- java/src/com/android/inputmethod/latin/CandidateView.java | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/java/res/layout-xlarge/candidate.xml b/java/res/layout-xlarge/candidate.xml index 6d3e4ab17..582e64261 100644 --- a/java/res/layout-xlarge/candidate.xml +++ b/java/res/layout-xlarge/candidate.xml @@ -23,14 +23,15 @@ android:layout_width="wrap_content" android:layout_height="match_parent" android:orientation="horizontal" - android:paddingRight="@dimen/candidate_padding" > @@ -44,8 +45,7 @@ android:background="@drawable/btn_candidate_holo" android:focusable="true" android:clickable="true" - android:gravity="center_vertical|center_horizontal" - android:paddingLeft="@dimen/candidate_padding" /> + android:gravity="center_vertical|center_horizontal" /> @@ -44,8 +45,7 @@ android:background="@drawable/btn_candidate" android:focusable="true" android:clickable="true" - android:gravity="center_vertical|center_horizontal" - android:paddingLeft="@dimen/candidate_padding" /> + android:gravity="center_vertical|center_horizontal" /> 18mm 15.0mm - 0.3in - 12dip + 46dip + 8dip 22dip diff --git a/java/res/values/dimens.xml b/java/res/values/dimens.xml index 3bcf37eba..69f962f00 100644 --- a/java/res/values/dimens.xml +++ b/java/res/values/dimens.xml @@ -57,8 +57,8 @@ 100sp 63dip 0dip - 0.3in - 1dip + 32dip + 6dip 18dip 4dip