From 43e0fa3abe195e87e847122d9d6fb60534510e9c Mon Sep 17 00:00:00 2001 From: Eric Fischer Date: Fri, 29 Apr 2011 14:02:22 -0700 Subject: [PATCH 01/19] Import revised translations. DO NOT MERGE Change-Id: Ifb14123f6b1f46cbfa8501696164db7b1ceb66f9 --- java/res/values-de/strings.xml | 6 +++--- 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 | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/java/res/values-de/strings.xml b/java/res/values-de/strings.xml index 396d74dd8..e79d2c833 100644 --- a/java/res/values-de/strings.xml +++ b/java/res/values-de/strings.xml @@ -40,11 +40,11 @@ "Automatisch" "Immer anzeigen" "Immer ausblenden" - "Auto-Korrektur" + "Autokorrektur" "Korrektur fehlerhafter Wörter durch Leertaste und Satzzeichen" "Aus" "Mäßig" - "Aggressiv" + "Stark" "Bigramm-Vorschläge" "Zur Verbesserung des Vorschlags vorheriges Wort verwenden" "%s: gespeichert" @@ -94,7 +94,7 @@ "Aus" "Mikro auf Haupttastatur" "Mikro auf Symboltastatur" - "Spracheing. deaktiviert" + "Spracheingabe deaktiviert" "Eingabemethode auswählen" "Eingabesprachen" "Finger über die Leertaste bewegen, um die Eingabesprache zu wechseln" diff --git a/java/res/values-el/strings.xml b/java/res/values-el/strings.xml index 6d0869bf1..4412fa45d 100644 --- a/java/res/values-el/strings.xml +++ b/java/res/values-el/strings.xml @@ -48,7 +48,7 @@ "Προτάσεις bigram" "Χρήση προηγούμενης λέξης για τη βελτίωση πρότασης" "%s : Αποθηκεύτηκε" - "Μετάβαση" + "Μετ." "Επόμενο" "Τέλος" "Αποστολή" diff --git a/java/res/values-nl/strings.xml b/java/res/values-nl/strings.xml index e5439eb38..a1213ec33 100644 --- a/java/res/values-nl/strings.xml +++ b/java/res/values-nl/strings.xml @@ -48,7 +48,7 @@ "Digram-suggesties" "Vorig woord gebruiken om suggestie te verbeteren" "%s: opgeslagen" - "Beginnen" + "Start" "Volgende" "Gereed" "Verzenden" diff --git a/java/res/values-ro/strings.xml b/java/res/values-ro/strings.xml index 52bed2785..9c973922a 100644 --- a/java/res/values-ro/strings.xml +++ b/java/res/values-ro/strings.xml @@ -48,7 +48,7 @@ "Sugestii pentru cuvinte de două litere" "Utilizaţi cuvântul anterior pentru a îmbunătăţi sugestia" "%s: salvat" - "Accesaţi" + "OK" "Înainte" "Terminat" "Trimiteţi" diff --git a/java/res/values-tl/strings.xml b/java/res/values-tl/strings.xml index 55f98de10..386b1fdd8 100644 --- a/java/res/values-tl/strings.xml +++ b/java/res/values-tl/strings.xml @@ -48,7 +48,7 @@ "Mga Suhestiyon na Bigram" "Gamitin ang nakaraang salita upang pahusayin ang suhestiyon" "%s : Na-save" - "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 c9c7ae88a..a3bf911a1 100644 --- a/java/res/values-zh-rTW/strings.xml +++ b/java/res/values-zh-rTW/strings.xml @@ -33,12 +33,12 @@ "修正一般打字錯誤" "顯示修正建議" "輸入時顯示建議字詞" - "永遠顯示" + "一律顯示" "以垂直模式顯示" "永遠隱藏" "顯示設定金鑰" "自動" - "永遠顯示" + "一律顯示" "永遠隱藏" "自動修正" "自動插入空白鍵和標點符號鍵盤,以修正拼字錯誤" From 14de691f22f5eec357ab671699965546dcf5dfec Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Mon, 9 May 2011 12:13:10 +0900 Subject: [PATCH 02/19] Include horizontal and vertical gap in the count of Key.isOnKey This change considers that the point is on the key while sorting in proximity key detection. This change is the cherry-pick of I3ee91367. Bug: 4353949 Change-Id: I04fa0acf4d32c18bea9640b39a5c770466a37803 --- .../com/android/inputmethod/keyboard/Key.java | 25 ++++++++++--------- .../inputmethod/keyboard/KeyDetector.java | 4 +-- .../keyboard/ProximityKeyDetector.java | 8 +++--- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/java/src/com/android/inputmethod/keyboard/Key.java b/java/src/com/android/inputmethod/keyboard/Key.java index 7396f0518..24e8926c5 100644 --- a/java/src/com/android/inputmethod/keyboard/Key.java +++ b/java/src/com/android/inputmethod/keyboard/Key.java @@ -196,8 +196,8 @@ public class Key { } // Horizontal gap is divided equally to both sides of the key. - this.mX = x + mGap / 2; - this.mY = y; + mX = x + mGap / 2; + mY = y; final TypedArray keyAttr = res.obtainAttributes(Xml.asAttributeSet(parser), R.styleable.Keyboard_Key); @@ -350,12 +350,13 @@ public class Key { final boolean rightEdge = (flags & Keyboard.EDGE_RIGHT) != 0; final boolean topEdge = (flags & Keyboard.EDGE_TOP) != 0; final boolean bottomEdge = (flags & Keyboard.EDGE_BOTTOM) != 0; - final int left = this.mX; - final int right = left + this.mWidth; - final int top = this.mY; - final int bottom = top + this.mHeight; - return (x >= left || leftEdge) && (x < right || rightEdge) - && (y >= top || topEdge) && (y < bottom || bottomEdge); + final int left = mX - mGap / 2; + final int right = left + mWidth + mGap; + final int top = mY; + final int bottom = top + mHeight + mKeyboard.getVerticalGap(); + // In order to mitigate rounding errors, we use (left <= x <= right) here. + return (x >= left || leftEdge) && (x <= right || rightEdge) + && (y >= top || topEdge) && (y <= bottom || bottomEdge); } /** @@ -365,10 +366,10 @@ public class Key { * @return the square of the distance of the point from the nearest edge of the key */ public int squaredDistanceToEdge(int x, int y) { - final int left = this.mX; - final int right = left + this.mWidth; - final int top = this.mY; - final int bottom = top + this.mHeight; + final int left = mX; + final int right = left + mWidth; + final int top = mY; + final int bottom = top + mHeight; final int edgeX = x < left ? left : (x > right ? right : x); final int edgeY = y < top ? top : (y > bottom ? bottom : y); final int dx = x - edgeX; diff --git a/java/src/com/android/inputmethod/keyboard/KeyDetector.java b/java/src/com/android/inputmethod/keyboard/KeyDetector.java index 1a4f90195..a7ede5f26 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyDetector.java +++ b/java/src/com/android/inputmethod/keyboard/KeyDetector.java @@ -81,11 +81,11 @@ public abstract class KeyDetector { * * @return Allocates and returns an array that can hold all key indices returned by * {@link #getKeyIndexAndNearbyCodes} method. All elements in the returned array are - * initialized by {@link #NOT_A_KEY} value. + * initialized by {@link #NOT_A_CODE} value. */ public int[] newCodeArray() { int[] codes = new int[getMaxNearbyKeys()]; - Arrays.fill(codes, NOT_A_KEY); + Arrays.fill(codes, NOT_A_CODE); return codes; } diff --git a/java/src/com/android/inputmethod/keyboard/ProximityKeyDetector.java b/java/src/com/android/inputmethod/keyboard/ProximityKeyDetector.java index c3fd1984b..87f3e1497 100644 --- a/java/src/com/android/inputmethod/keyboard/ProximityKeyDetector.java +++ b/java/src/com/android/inputmethod/keyboard/ProximityKeyDetector.java @@ -45,13 +45,15 @@ public class ProximityKeyDetector extends KeyDetector { * * @param keyIndex index of the key. * @param distance distance between the key's edge and user touched point. + * @param isOnKey true if the point is on the key. * @return order of the key in the nearby buffer, 0 if it is the nearest key. */ - private int sortNearbyKeys(int keyIndex, int distance) { + private int sortNearbyKeys(int keyIndex, int distance, boolean isOnKey) { final int[] distances = mDistances; final int[] indices = mIndices; for (int insertPos = 0; insertPos < distances.length; insertPos++) { - if (distance < distances[insertPos]) { + final int comparingDistance = distances[insertPos]; + if (distance < comparingDistance || (distance == comparingDistance && isOnKey)) { final int nextPos = insertPos + 1; if (nextPos < distances.length) { System.arraycopy(distances, insertPos, distances, nextPos, @@ -103,7 +105,7 @@ public class ProximityKeyDetector extends KeyDetector { final boolean isInside = key.isInside(touchX, touchY); final int distance = key.squaredDistanceToEdge(touchX, touchY); if (isInside || (mProximityCorrectOn && distance < mProximityThresholdSquare)) { - final int insertedPosition = sortNearbyKeys(index, distance); + final int insertedPosition = sortNearbyKeys(index, distance, isInside); if (insertedPosition == 0 && isInside) primaryIndex = index; } From 6efb50ba07186f9e823d253ded50ff091133bbd9 Mon Sep 17 00:00:00 2001 From: Eric Fischer Date: Mon, 9 May 2011 17:05:02 -0700 Subject: [PATCH 03/19] Import revised translations. DO NOT MERGE Change-Id: I7d3771cac30793818a12ddd57baf980d7495c87e --- java/res/values-de/strings.xml | 6 +++--- java/res/values-el/strings.xml | 2 +- java/res/values-es/strings.xml | 8 ++++---- 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 | 4 ++-- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/java/res/values-de/strings.xml b/java/res/values-de/strings.xml index 396d74dd8..e79d2c833 100644 --- a/java/res/values-de/strings.xml +++ b/java/res/values-de/strings.xml @@ -40,11 +40,11 @@ "Automatisch" "Immer anzeigen" "Immer ausblenden" - "Auto-Korrektur" + "Autokorrektur" "Korrektur fehlerhafter Wörter durch Leertaste und Satzzeichen" "Aus" "Mäßig" - "Aggressiv" + "Stark" "Bigramm-Vorschläge" "Zur Verbesserung des Vorschlags vorheriges Wort verwenden" "%s: gespeichert" @@ -94,7 +94,7 @@ "Aus" "Mikro auf Haupttastatur" "Mikro auf Symboltastatur" - "Spracheing. deaktiviert" + "Spracheingabe deaktiviert" "Eingabemethode auswählen" "Eingabesprachen" "Finger über die Leertaste bewegen, um die Eingabesprache zu wechseln" diff --git a/java/res/values-el/strings.xml b/java/res/values-el/strings.xml index 6d0869bf1..4412fa45d 100644 --- a/java/res/values-el/strings.xml +++ b/java/res/values-el/strings.xml @@ -48,7 +48,7 @@ "Προτάσεις bigram" "Χρήση προηγούμενης λέξης για τη βελτίωση πρότασης" "%s : Αποθηκεύτηκε" - "Μετάβαση" + "Μετ." "Επόμενο" "Τέλος" "Αποστολή" diff --git a/java/res/values-es/strings.xml b/java/res/values-es/strings.xml index f9a86ffd6..24e975baa 100644 --- a/java/res/values-es/strings.xml +++ b/java/res/values-es/strings.xml @@ -90,11 +90,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-nl/strings.xml b/java/res/values-nl/strings.xml index e5439eb38..a1213ec33 100644 --- a/java/res/values-nl/strings.xml +++ b/java/res/values-nl/strings.xml @@ -48,7 +48,7 @@ "Digram-suggesties" "Vorig woord gebruiken om suggestie te verbeteren" "%s: opgeslagen" - "Beginnen" + "Start" "Volgende" "Gereed" "Verzenden" diff --git a/java/res/values-ro/strings.xml b/java/res/values-ro/strings.xml index 52bed2785..9c973922a 100644 --- a/java/res/values-ro/strings.xml +++ b/java/res/values-ro/strings.xml @@ -48,7 +48,7 @@ "Sugestii pentru cuvinte de două litere" "Utilizaţi cuvântul anterior pentru a îmbunătăţi sugestia" "%s: salvat" - "Accesaţi" + "OK" "Înainte" "Terminat" "Trimiteţi" diff --git a/java/res/values-tl/strings.xml b/java/res/values-tl/strings.xml index 55f98de10..386b1fdd8 100644 --- a/java/res/values-tl/strings.xml +++ b/java/res/values-tl/strings.xml @@ -48,7 +48,7 @@ "Mga Suhestiyon na Bigram" "Gamitin ang nakaraang salita upang pahusayin ang suhestiyon" "%s : Na-save" - "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 c9c7ae88a..a3bf911a1 100644 --- a/java/res/values-zh-rTW/strings.xml +++ b/java/res/values-zh-rTW/strings.xml @@ -33,12 +33,12 @@ "修正一般打字錯誤" "顯示修正建議" "輸入時顯示建議字詞" - "永遠顯示" + "一律顯示" "以垂直模式顯示" "永遠隱藏" "顯示設定金鑰" "自動" - "永遠顯示" + "一律顯示" "永遠隱藏" "自動修正" "自動插入空白鍵和標點符號鍵盤,以修正拼字錯誤" From 4f3b59711f6985d39e0cc908d2431ae6715d9b26 Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Wed, 11 May 2011 12:40:17 +0900 Subject: [PATCH 04/19] Fix a bug where suggestion strip pick would reset magic space Bug: 4391347 Change-Id: I93c3c821d3ab78a300edc3d251ce7b1ee0dc3958 --- java/src/com/android/inputmethod/latin/LatinIME.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 375529f25..abe6bdd0d 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -1579,11 +1579,12 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar // 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); + final boolean oldMagicSpace = mJustAddedMagicSpace; if (Keyboard.CODE_SPACE == toLeft) mJustAddedMagicSpace = true; onCodeInput(primaryCode, new int[] { primaryCode }, KeyboardActionListener.NOT_A_TOUCH_COORDINATE, KeyboardActionListener.NOT_A_TOUCH_COORDINATE); - mJustAddedMagicSpace = false; + mJustAddedMagicSpace = oldMagicSpace; if (ic != null) { ic.endBatchEdit(); } From 17c7ffeb1e10348227c5dff1c319d2099c1b5d0e Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Tue, 10 May 2011 15:51:43 +0900 Subject: [PATCH 05/19] Refactor settings flags. This needs Ic5bd9b45 to not break the build. Change-Id: I9684be89baba0f855f19c11d000c5638c04cc26e --- .../android/inputmethod/latin/LatinIME.java | 365 ++++++------------ .../android/inputmethod/latin/Settings.java | 187 +++++++++ 2 files changed, 295 insertions(+), 257 deletions(-) diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 375529f25..a4f98e6aa 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -22,7 +22,6 @@ import com.android.inputmethod.compat.InputConnectionCompatUtils; import com.android.inputmethod.compat.InputMethodManagerCompatWrapper; import com.android.inputmethod.compat.InputMethodServiceCompatWrapper; import com.android.inputmethod.compat.InputTypeCompatUtils; -import com.android.inputmethod.compat.VibratorCompatWrapper; import com.android.inputmethod.deprecated.LanguageSwitcherProxy; import com.android.inputmethod.deprecated.VoiceProxy; import com.android.inputmethod.keyboard.Keyboard; @@ -73,7 +72,6 @@ import android.widget.LinearLayout; import java.io.FileDescriptor; import java.io.PrintWriter; -import java.util.Arrays; import java.util.Locale; /** @@ -135,6 +133,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar SUGGESTION_VISIBILILTY_HIDE_VALUE }; + private Settings.Values mSettingsValues; + private View mCandidateViewContainer; private int mCandidateStripHeight; private CandidateView mCandidateView; @@ -174,26 +174,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar // 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; - // 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 - private boolean mBigramPredictionEnabled; - private boolean mAutoCorrectOn; - private boolean mVibrateOn; - private boolean mSoundOn; - private boolean mPopupOn; - private boolean mAutoCap; - private boolean mQuickFixes; - 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; private int mCorrectionMode; private int mCommittedLength; @@ -201,7 +181,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar // Keep track of the last selection range to decide if we need to show word alternatives private int mLastSelectionStart; private int mLastSelectionEnd; - private SuggestedWords mSuggestPuncList; // Indicates whether the suggestion strip is to be on in landscape private boolean mJustAccepted; @@ -211,12 +190,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar private AudioManager mAudioManager; // Align sound effect volume on music volume private static final float FX_VOLUME = -1.0f; - private boolean mSilentMode; + private boolean mSilentModeOn; // System-wide current configuration - /* package */ String mWordSeparators; - private String mMagicSpaceStrippers; - private String mMagicSpaceSwappers; - private String mSuggestPuncs; // TODO: Move this flag to VoiceProxy private boolean mConfigurationChanging; @@ -251,7 +226,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar case MSG_UPDATE_OLD_SUGGESTIONS: mRecorrection.setRecorrectionSuggestions(mVoiceProxy, mCandidateView, mSuggest, mKeyboardSwitcher, mWord, mHasUncommittedTypedChars, mLastSelectionStart, - mLastSelectionEnd, mWordSeparators); + mLastSelectionEnd, mSettingsValues.mWordSeparators); break; case MSG_UPDATE_SHIFT_STATE: switcher.updateShiftState(); @@ -264,17 +239,20 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar || (switcher.isAlphabetMode() && switcher.isShiftedOrShiftLocked())); break; case MSG_FADEOUT_LANGUAGE_ON_SPACEBAR: - if (inputView != null) + if (inputView != null) { inputView.setSpacebarTextFadeFactor( - (1.0f + mConfigFinalFadeoutFactorOfLanguageOnSpacebar) / 2, + (1.0f + mSettingsValues.mFinalFadeoutFactorOfLanguageOnSpacebar) / 2, (LatinKeyboard)msg.obj); + } sendMessageDelayed(obtainMessage(MSG_DISMISS_LANGUAGE_ON_SPACEBAR, msg.obj), - mConfigDurationOfFadeoutLanguageOnSpacebar); + mSettingsValues.mDurationOfFadeoutLanguageOnSpacebar); break; case MSG_DISMISS_LANGUAGE_ON_SPACEBAR: - if (inputView != null) + if (inputView != null) { inputView.setSpacebarTextFadeFactor( - mConfigFinalFadeoutFactorOfLanguageOnSpacebar, (LatinKeyboard)msg.obj); + mSettingsValues.mFinalFadeoutFactorOfLanguageOnSpacebar, + (LatinKeyboard)msg.obj); + } break; } } @@ -282,7 +260,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar public void postUpdateSuggestions() { removeMessages(MSG_UPDATE_SUGGESTIONS); sendMessageDelayed(obtainMessage(MSG_UPDATE_SUGGESTIONS), - mConfigDelayUpdateSuggestions); + mSettingsValues.mDelayUpdateSuggestions); } public void cancelUpdateSuggestions() { @@ -296,7 +274,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar public void postUpdateOldSuggestions() { removeMessages(MSG_UPDATE_OLD_SUGGESTIONS); sendMessageDelayed(obtainMessage(MSG_UPDATE_OLD_SUGGESTIONS), - mConfigDelayUpdateOldSuggestions); + mSettingsValues.mDelayUpdateOldSuggestions); } public void cancelUpdateOldSuggestions() { @@ -305,7 +283,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar public void postUpdateShiftKeyState() { removeMessages(MSG_UPDATE_SHIFT_STATE); - sendMessageDelayed(obtainMessage(MSG_UPDATE_SHIFT_STATE), mConfigDelayUpdateShiftState); + sendMessageDelayed(obtainMessage(MSG_UPDATE_SHIFT_STATE), + mSettingsValues.mDelayUpdateShiftState); } public void cancelUpdateShiftState() { @@ -315,7 +294,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar public void postUpdateBigramPredictions() { removeMessages(MSG_SET_BIGRAM_PREDICTIONS); sendMessageDelayed(obtainMessage(MSG_SET_BIGRAM_PREDICTIONS), - mConfigDelayUpdateSuggestions); + mSettingsValues.mDelayUpdateSuggestions); } public void cancelUpdateBigramPredictions() { @@ -334,15 +313,16 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar final LatinKeyboard keyboard = mKeyboardSwitcher.getLatinKeyboard(); // The language is always displayed when the delay is negative. final boolean needsToDisplayLanguage = localeChanged - || mConfigDelayBeforeFadeoutLanguageOnSpacebar < 0; + || mSettingsValues.mDelayBeforeFadeoutLanguageOnSpacebar < 0; // The language is never displayed when the delay is zero. - if (mConfigDelayBeforeFadeoutLanguageOnSpacebar != 0) + if (mSettingsValues.mDelayBeforeFadeoutLanguageOnSpacebar != 0) { inputView.setSpacebarTextFadeFactor(needsToDisplayLanguage ? 1.0f - : mConfigFinalFadeoutFactorOfLanguageOnSpacebar, keyboard); + : mSettingsValues.mFinalFadeoutFactorOfLanguageOnSpacebar, keyboard); + } // The fadeout animation will start when the delay is positive. - if (localeChanged && mConfigDelayBeforeFadeoutLanguageOnSpacebar > 0) { + if (localeChanged && mSettingsValues.mDelayBeforeFadeoutLanguageOnSpacebar > 0) { sendMessageDelayed(obtainMessage(MSG_FADEOUT_LANGUAGE_ON_SPACEBAR, keyboard), - mConfigDelayBeforeFadeoutLanguageOnSpacebar); + mSettingsValues.mDelayBeforeFadeoutLanguageOnSpacebar); } } } @@ -350,7 +330,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar public void startDoubleSpacesTimer() { removeMessages(MSG_SPACE_TYPED); sendMessageDelayed(obtainMessage(MSG_SPACE_TYPED), - mConfigDoubleSpacesTurnIntoPeriodTimeout); + mSettingsValues.mDoubleSpacesTurnIntoPeriodTimeout); } public void cancelDoubleSpacesTimer() { @@ -382,26 +362,11 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar mAccessibilityUtils = AccessibilityUtils.getInstance(); mRecorrection = Recorrection.getInstance(); + loadSettings(); + final Resources res = getResources(); mResources = res; - mConfigEnableShowSubtypeSettings = res.getBoolean( - R.bool.config_enable_show_subtype_settings); - mConfigSwipeDownDismissKeyboardEnabled = res.getBoolean( - 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( - R.integer.config_final_fadeout_percentage_of_language_on_spacebar) / 100.0f; - mConfigDoubleSpacesTurnIntoPeriodTimeout = res.getInteger( - R.integer.config_double_spaces_turn_into_period_timeout); - Utils.GCUtils.getInstance().reset(); boolean tryGC = true; for (int i = 0; i < Utils.GCUtils.GC_TRY_LOOP_MAX && tryGC; ++i) { @@ -414,7 +379,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar } mOrientation = res.getConfiguration().orientation; - initSuggestPuncList(); // Register to receive ringer mode change and network state change. // Also receive installation and removal of a dictionary pack. @@ -436,6 +400,13 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar registerReceiver(mDictionaryPackInstallReceiver, newDictFilter); } + // Has to be package-visible for unit tests + /* package */ void loadSettings() { + if (null == mPrefs) mPrefs = PreferenceManager.getDefaultSharedPreferences(this); + if (null == mSubtypeSwitcher) mSubtypeSwitcher = SubtypeSwitcher.getInstance(); + mSettingsValues = new Settings.Values(mPrefs, this, mSubtypeSwitcher.getInputLocaleStr()); + } + private void initSuggest() { final String localeStr = mSubtypeSwitcher.getInputLocaleStr(); final Locale keyboardLocale = new Locale(localeStr); @@ -445,12 +416,12 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar if (mSuggest != null) { mSuggest.close(); } - final SharedPreferences prefs = mPrefs; - mQuickFixes = isQuickFixesEnabled(prefs); int mainDicResId = Utils.getMainDictionaryResourceId(res); mSuggest = new Suggest(this, mainDicResId, keyboardLocale); - loadAndSetAutoCorrectionThreshold(prefs); + if (mSettingsValues.mAutoCorrectEnabled) { + mSuggest.setAutoCorrectionThreshold(mSettingsValues.mAutoCorrectionThreshold); + } updateAutoTextEnabled(); mUserDictionary = new UserDictionary(this, localeStr); @@ -466,14 +437,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar mSuggest.setUserBigramDictionary(mUserBigramDictionary); updateCorrectionMode(); - 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); } @@ -571,7 +534,18 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar mDeleteCount = 0; mJustAddedMagicSpace = false; - loadSettings(attribute); + loadSettings(); + updateCorrectionMode(); + updateAutoTextEnabled(); + updateSuggestionVisibility(mPrefs, mResources); + + if (mSuggest != null && mSettingsValues.mAutoCorrectEnabled) { + mSuggest.setAutoCorrectionThreshold(mSettingsValues.mAutoCorrectionThreshold); + } + mVoiceProxy.loadSettings(attribute, mPrefs); + // This will work only when the subtype is not supported. + LanguageSwitcherProxy.loadSettings(); + if (mSubtypeSwitcher.isKeyboardMode()) { switcher.loadKeyboard(attribute, mSubtypeSwitcher.isShortcutImeEnabled() && voiceIme.isVoiceButtonEnabled(), @@ -587,7 +561,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar final boolean accessibilityEnabled = mAccessibilityUtils.isAccessibilityEnabled(); - inputView.setKeyPreviewEnabled(mPopupOn); + inputView.setKeyPreviewEnabled(mSettingsValues.mPopupOn); inputView.setProximityCorrectionEnabled(true); inputView.setAccessibilityEnabled(accessibilityEnabled); // If we just entered a text field, maybe it has some old text that requires correction @@ -953,7 +927,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar public boolean getCurrentAutoCapsState() { InputConnection ic = getCurrentInputConnection(); EditorInfo ei = getCurrentInputEditorInfo(); - if (mAutoCap && ic != null && ei != null && ei.inputType != InputType.TYPE_NULL) { + if (mSettingsValues.mAutoCap && ic != null && ei != null + && ei.inputType != InputType.TYPE_NULL) { return ic.getCursorCapsMode(ei.inputType) != 0; } return false; @@ -1038,7 +1013,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar private void onSettingsKeyPressed() { if (!isShowingOptionDialog()) { - if (!mConfigEnableShowSubtypeSettings) { + if (!mSettingsValues.mEnableShowSubtypeSettings) { showSubtypeSelectorAndSettings(); } else if (Utils.hasMultipleEnabledIMEsOrSubtypes(mImm)) { showOptionsMenu(); @@ -1116,7 +1091,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar handleTab(); break; default: - if (isWordSeparator(primaryCode)) { + if (mSettingsValues.isWordSeparator(primaryCode)) { handleSeparator(primaryCode, x, y); } else { handleCharacter(primaryCode, keyCodes, x, y); @@ -1241,7 +1216,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar private void handleCharacter(int primaryCode, int[] keyCodes, int x, int y) { mVoiceProxy.handleCharacter(); - if (mJustAddedMagicSpace && isMagicSpaceStripper(primaryCode)) { + if (mJustAddedMagicSpace && mSettingsValues.isMagicSpaceStripper(primaryCode)) { removeTrailingSpace(); } @@ -1297,7 +1272,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar } else { sendKeyChar((char)code); } - if (mJustAddedMagicSpace && isMagicSpaceSwapper(primaryCode)) { + if (mJustAddedMagicSpace && mSettingsValues.isMagicSpaceSwapper(primaryCode)) { swapSwapperAndSpace(); } else { mJustAddedMagicSpace = false; @@ -1305,7 +1280,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar switcher.updateShiftState(); if (LatinIME.PERF_DEBUG) measureCps(); - TextEntryState.typedCharacter((char) code, isWordSeparator(code), x, y); + TextEntryState.typedCharacter((char) code, mSettingsValues.isWordSeparator(code), x, y); } private void handleSeparator(int primaryCode, int x, int y) { @@ -1329,7 +1304,10 @@ 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 != Keyboard.CODE_SINGLE_QUOTE) { + final boolean shouldAutoCorrect = + (mSettingsValues.mAutoCorrectEnabled || mSettingsValues.mQuickFixes) + && !mInputTypeNoAutoCorrect && mHasDictionary; + if (shouldAutoCorrect && primaryCode != Keyboard.CODE_SINGLE_QUOTE) { pickedDefault = pickDefaultSuggestion(primaryCode); } else { commitTyped(ic); @@ -1337,11 +1315,11 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar } if (mJustAddedMagicSpace) { - if (isMagicSpaceSwapper(primaryCode)) { + if (mSettingsValues.isMagicSpaceSwapper(primaryCode)) { sendKeyChar((char)primaryCode); swapSwapperAndSpace(); } else { - if (isMagicSpaceStripper(primaryCode)) removeTrailingSpace(); + if (mSettingsValues.isMagicSpaceStripper(primaryCode)) removeTrailingSpace(); sendKeyChar((char)primaryCode); mJustAddedMagicSpace = false; } @@ -1397,7 +1375,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar } public boolean isShowingPunctuationList() { - return mSuggestPuncList == mCandidateView.getSuggestions(); + return mSettingsValues.mSuggestPuncList == mCandidateView.getSuggestions(); } public boolean isShowingSuggestionsStrip() { @@ -1471,7 +1449,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar private void showSuggestions(WordComposer word) { // TODO: May need a better way of retrieving previous word CharSequence prevWord = EditingUtils.getPreviousWord(getCurrentInputConnection(), - mWordSeparators); + mSettingsValues.mWordSeparators); SuggestedWords.Builder builder = mSuggest.getSuggestedWordBuilder( mKeyboardSwitcher.getInputView(), word, prevWord); @@ -1499,7 +1477,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar builder.setTypedWordValid(typedWordValid).setHasMinimalSuggestion(correctionAvailable); } else { final SuggestedWords previousSuggestions = mCandidateView.getSuggestions(); - if (previousSuggestions == mSuggestPuncList) + if (previousSuggestions == mSettingsValues.mSuggestPuncList) return; builder.addTypedWordAndPreviousSuggestions(typedWord, previousSuggestions); } @@ -1535,14 +1513,14 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar // Add the word to the auto dictionary if it's not a known word addToAutoAndUserBigramDictionaries(mBestWord, AutoDictionary.FREQUENCY_FOR_TYPED); return true; - } return false; } public void pickSuggestionManually(int index, CharSequence suggestion) { SuggestedWords suggestions = mCandidateView.getSuggestions(); - mVoiceProxy.flushAndLogAllTextModificationCounters(index, suggestion, mWordSeparators); + mVoiceProxy.flushAndLogAllTextModificationCounters(index, suggestion, + mSettingsValues.mWordSeparators); final boolean recorrecting = TextEntryState.isRecorrecting(); InputConnection ic = getCurrentInputConnection(); @@ -1567,8 +1545,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar } // If this is a punctuation, apply it through the normal key press - if (suggestion.length() == 1 && (isWordSeparator(suggestion.charAt(0)) - || isSuggestedPunctuation(suggestion.charAt(0)))) { + if (suggestion.length() == 1 && (mSettingsValues.isWordSeparator(suggestion.charAt(0)) + || mSettingsValues.isSuggestedPunctuation(suggestion.charAt(0)))) { // Word separators are suggested before the user inputs something. // So, LatinImeLogger logs "" as a user's input. LatinImeLogger.logOnManualSuggestion( @@ -1658,7 +1636,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar return; InputConnection ic = getCurrentInputConnection(); if (ic != null) { - mVoiceProxy.rememberReplacedWord(suggestion, mWordSeparators); + mVoiceProxy.rememberReplacedWord(suggestion, mSettingsValues.mWordSeparators); ic.commitText(suggestion, 1); } mRecorrection.saveWordInHistory(mWord, suggestion); @@ -1671,13 +1649,13 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar if (mSuggest == null || !isSuggestionsRequested()) return; - if (!mBigramPredictionEnabled) { + if (!mSettingsValues.mBigramPredictionEnabled) { setPunctuationSuggestions(); return; } final CharSequence prevWord = EditingUtils.getThisWord(getCurrentInputConnection(), - mWordSeparators); + mSettingsValues.mWordSeparators); SuggestedWords.Builder builder = mSuggest.getSuggestedWordBuilder( mKeyboardSwitcher.getInputView(), sEmptyWordComposer, prevWord); @@ -1691,7 +1669,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar } public void setPunctuationSuggestions() { - setSuggestions(mSuggestPuncList); + setSuggestions(mSettingsValues.mSuggestPuncList); setCandidatesViewShown(isCandidateStripVisible()); } @@ -1734,7 +1712,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar // For example "I will, and you too" : we don't want the pair ("will" "and") to be // a bigram. CharSequence prevWord = EditingUtils.getPreviousWord(getCurrentInputConnection(), - mWordSeparators); + mSettingsValues.mWordSeparators); if (!TextUtils.isEmpty(prevWord)) { mUserBigramDictionary.addBigrams(prevWord.toString(), suggestion.toString()); } @@ -1747,13 +1725,13 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar CharSequence toLeft = ic.getTextBeforeCursor(1, 0); CharSequence toRight = ic.getTextAfterCursor(1, 0); if (!TextUtils.isEmpty(toLeft) - && !isWordSeparator(toLeft.charAt(0)) - && !isSuggestedPunctuation(toLeft.charAt(0))) { + && !mSettingsValues.isWordSeparator(toLeft.charAt(0)) + && !mSettingsValues.isSuggestedPunctuation(toLeft.charAt(0))) { return true; } if (!TextUtils.isEmpty(toRight) - && !isWordSeparator(toRight.charAt(0)) - && !isSuggestedPunctuation(toRight.charAt(0))) { + && !mSettingsValues.isWordSeparator(toRight.charAt(0)) + && !mSettingsValues.isSuggestedPunctuation(toRight.charAt(0))) { return true; } return false; @@ -1772,14 +1750,16 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar if (deleteChar) ic.deleteSurroundingText(1, 0); int toDelete = mCommittedLength; final CharSequence toTheLeft = ic.getTextBeforeCursor(mCommittedLength, 0); - if (!TextUtils.isEmpty(toTheLeft) && isWordSeparator(toTheLeft.charAt(0))) { + if (!TextUtils.isEmpty(toTheLeft) + && mSettingsValues.isWordSeparator(toTheLeft.charAt(0))) { toDelete--; } ic.deleteSurroundingText(toDelete, 0); // Re-insert punctuation only when the deleted character was word separator and the // composing text wasn't equal to the auto-corrected text. if (deleteChar - && !TextUtils.isEmpty(punctuation) && isWordSeparator(punctuation.charAt(0)) + && !TextUtils.isEmpty(punctuation) + && mSettingsValues.isWordSeparator(punctuation.charAt(0)) && !TextUtils.equals(mComposing, toTheLeft)) { ic.commitText(mComposing, 1); TextEntryState.acceptedTyped(mComposing); @@ -1800,21 +1780,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar } } - protected String getWordSeparators() { - return mWordSeparators; - } - public boolean isWordSeparator(int code) { - String separators = getWordSeparators(); - return separators.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)); + return mSettingsValues.isWordSeparator(code); } private void sendMagicSpace() { @@ -1835,6 +1802,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar mSubtypeSwitcher.isShortcutImeEnabled() && mVoiceProxy.isVoiceButtonEnabled(), mVoiceProxy.isVoiceButtonOnPrimary()); initSuggest(); + loadSettings(); mKeyboardSwitcher.updateShiftState(); } @@ -1843,12 +1811,14 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar if (mSubtypeSwitcher.useSpacebarLanguageSwitcher()) { mSubtypeSwitcher.toggleLanguage(next); } - onRefreshKeyboard();// no need?? - } + // The following is necessary because on API levels < 10, we don't get notified when + // subtype changes. + onRefreshKeyboard(); + } @Override public void onSwipeDown() { - if (mConfigSwipeDownDismissKeyboardEnabled) + if (mSettingsValues.mSwipeDownDismissKeyboardEnabled) handleClose(); } @@ -1903,7 +1873,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); } if (mAudioManager != null) { - mSilentMode = (mAudioManager.getRingerMode() != AudioManager.RINGER_MODE_NORMAL); + mSilentModeOn = (mAudioManager.getRingerMode() != AudioManager.RINGER_MODE_NORMAL); } } @@ -1915,7 +1885,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar updateRingerMode(); } } - if (mSoundOn && !mSilentMode) { + if (isSoundOn()) { // FIXME: Volume and enable should come from UI settings // FIXME: These should be triggered after auto-repeat logic int sound = AudioManager.FX_KEYPRESS_STANDARD; @@ -1935,7 +1905,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar } public void vibrate() { - if (!mVibrateOn) { + if (!mSettingsValues.mVibrateOn) { return; } LatinKeyboardView inputView = mKeyboardSwitcher.getInputView(); @@ -1956,18 +1926,22 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar } public boolean getPopupOn() { - return mPopupOn; + return mSettingsValues.mPopupOn; + } + boolean isSoundOn() { + return mSettingsValues.mSoundOn && !mSilentModeOn; } private void updateCorrectionMode() { // TODO: cleanup messy flags mHasDictionary = mSuggest != null ? mSuggest.hasMainDictionary() : false; - mAutoCorrectOn = (mAutoCorrectEnabled || mQuickFixes) - && !mInputTypeNoAutoCorrect && mHasDictionary; - mCorrectionMode = (mAutoCorrectOn && mAutoCorrectEnabled) + final boolean shouldAutoCorrect = (mSettingsValues.mAutoCorrectEnabled + || mSettingsValues.mQuickFixes) && !mInputTypeNoAutoCorrect && mHasDictionary; + mCorrectionMode = (shouldAutoCorrect && mSettingsValues.mAutoCorrectEnabled) ? Suggest.CORRECTION_FULL - : (mAutoCorrectOn ? Suggest.CORRECTION_BASIC : Suggest.CORRECTION_NONE); - mCorrectionMode = (mBigramSuggestionEnabled && mAutoCorrectOn && mAutoCorrectEnabled) + : (shouldAutoCorrect ? Suggest.CORRECTION_BASIC : Suggest.CORRECTION_NONE); + mCorrectionMode = (mSettingsValues.mBigramSuggestionEnabled && shouldAutoCorrect + && mSettingsValues.mAutoCorrectEnabled) ? Suggest.CORRECTION_FULL_BIGRAM : mCorrectionMode; if (mSuggest != null) { mSuggest.setCorrectionMode(mCorrectionMode); @@ -1976,12 +1950,11 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar private void updateAutoTextEnabled() { if (mSuggest == null) return; - mSuggest.setQuickFixesEnabled(mQuickFixes + mSuggest.setQuickFixesEnabled(mSettingsValues.mQuickFixes && SubtypeSwitcher.getInstance().isSystemLanguageSameAsInputLanguage()); } - private void updateSuggestionVisibility(SharedPreferences prefs) { - final Resources res = mResources; + private void updateSuggestionVisibility(final SharedPreferences prefs, final Resources res) { final String suggestionVisiblityStr = prefs.getString( Settings.PREF_SHOW_SUGGESTIONS_SETTING, res.getString(R.string.prefs_suggestion_visibility_default_value)); @@ -2009,128 +1982,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar startActivity(intent); } - private void loadSettings(EditorInfo attribute) { - // Get the settings preferences - final SharedPreferences prefs = mPrefs; - final boolean hasVibrator = VibratorCompatWrapper.getInstance(this).hasVibrator(); - mVibrateOn = hasVibrator && prefs.getBoolean(Settings.PREF_VIBRATE_ON, false); - mSoundOn = prefs.getBoolean(Settings.PREF_SOUND_ON, - mResources.getBoolean(R.bool.config_default_sound_enabled)); - - mPopupOn = isPopupEnabled(prefs); - mAutoCap = prefs.getBoolean(Settings.PREF_AUTO_CAP, true); - mQuickFixes = isQuickFixesEnabled(prefs); - - mAutoCorrectEnabled = isAutoCorrectEnabled(prefs); - mBigramSuggestionEnabled = mAutoCorrectEnabled && isBigramSuggestionEnabled(prefs); - mBigramPredictionEnabled = mBigramSuggestionEnabled && isBigramPredictionEnabled(prefs); - loadAndSetAutoCorrectionThreshold(prefs); - - mVoiceProxy.loadSettings(attribute, prefs); - - updateCorrectionMode(); - updateAutoTextEnabled(); - updateSuggestionVisibility(prefs); - - // This will work only when the subtype is not supported. - LanguageSwitcherProxy.loadSettings(); - } - - /** - * Load Auto correction threshold from SharedPreferences, and modify mSuggest's threshold. - */ - private void loadAndSetAutoCorrectionThreshold(SharedPreferences sp) { - // When mSuggest is not initialized, cannnot modify mSuggest's threshold. - if (mSuggest == null) return; - // When auto correction setting is turned off, the threshold is ignored. - if (!isAutoCorrectEnabled(sp)) return; - - final String currentAutoCorrectionSetting = sp.getString( - Settings.PREF_AUTO_CORRECTION_THRESHOLD, - mResources.getString(R.string.auto_correction_threshold_mode_index_modest)); - final String[] autoCorrectionThresholdValues = mResources.getStringArray( - R.array.auto_correction_threshold_values); - // When autoCrrectionThreshold is greater than 1.0, auto correction is virtually turned off. - double autoCorrectionThreshold = Double.MAX_VALUE; - try { - final int arrayIndex = Integer.valueOf(currentAutoCorrectionSetting); - if (arrayIndex >= 0 && arrayIndex < autoCorrectionThresholdValues.length) { - autoCorrectionThreshold = Double.parseDouble( - autoCorrectionThresholdValues[arrayIndex]); - } - } catch (NumberFormatException e) { - // Whenever the threshold settings are correct, never come here. - autoCorrectionThreshold = Double.MAX_VALUE; - Log.w(TAG, "Cannot load auto correction threshold setting." - + " currentAutoCorrectionSetting: " + currentAutoCorrectionSetting - + ", autoCorrectionThresholdValues: " - + Arrays.toString(autoCorrectionThresholdValues)); - } - // TODO: This should be refactored : - // setAutoCorrectionThreshold should be called outside of this method. - mSuggest.setAutoCorrectionThreshold(autoCorrectionThreshold); - } - - private boolean isPopupEnabled(SharedPreferences sp) { - final boolean showPopupOption = getResources().getBoolean( - R.bool.config_enable_show_popup_on_keypress_option); - if (!showPopupOption) return mResources.getBoolean(R.bool.config_default_popup_preview); - return sp.getBoolean(Settings.PREF_POPUP_ON, - mResources.getBoolean(R.bool.config_default_popup_preview)); - } - - private boolean isQuickFixesEnabled(SharedPreferences sp) { - final boolean showQuickFixesOption = mResources.getBoolean( - R.bool.config_enable_quick_fixes_option); - if (!showQuickFixesOption) { - return isAutoCorrectEnabled(sp); - } - return sp.getBoolean(Settings.PREF_QUICK_FIXES, mResources.getBoolean( - R.bool.config_default_quick_fixes)); - } - - private boolean isAutoCorrectEnabled(SharedPreferences sp) { - final String currentAutoCorrectionSetting = sp.getString( - Settings.PREF_AUTO_CORRECTION_THRESHOLD, - mResources.getString(R.string.auto_correction_threshold_mode_index_modest)); - final String autoCorrectionOff = mResources.getString( - R.string.auto_correction_threshold_mode_index_off); - return !currentAutoCorrectionSetting.equals(autoCorrectionOff); - } - - private boolean isBigramSuggestionEnabled(SharedPreferences sp) { - final boolean showBigramSuggestionsOption = mResources.getBoolean( - R.bool.config_enable_bigram_suggestions_option); - if (!showBigramSuggestionsOption) { - return isAutoCorrectEnabled(sp); - } - return sp.getBoolean(Settings.PREF_BIGRAM_SUGGESTIONS, mResources.getBoolean( - R.bool.config_default_bigram_suggestions)); - } - - private boolean isBigramPredictionEnabled(SharedPreferences sp) { - return sp.getBoolean(Settings.PREF_BIGRAM_PREDICTIONS, mResources.getBoolean( - R.bool.config_default_bigram_prediction)); - } - - private void initSuggestPuncList() { - if (mSuggestPuncs != null || mSuggestPuncList != null) - return; - SuggestedWords.Builder builder = new SuggestedWords.Builder(); - String puncs = mResources.getString(R.string.suggested_punctuations); - if (puncs != null) { - for (int i = 0; i < puncs.length(); i++) { - builder.addWord(puncs.subSequence(i, i + 1)); - } - } - mSuggestPuncList = builder.build(); - mSuggestPuncs = puncs; - } - - private boolean isSuggestedPunctuation(int code) { - return mSuggestPuncs.contains(String.valueOf((char)code)); - } - private void showSubtypeSelectorAndSettings() { final CharSequence title = getString(R.string.english_ime_input_options); final CharSequence[] items = new CharSequence[] { @@ -2214,13 +2065,13 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar p.println(" mIsSuggestionsRequested=" + mIsSettingsSuggestionStripOn); p.println(" mCorrectionMode=" + mCorrectionMode); p.println(" mHasUncommittedTypedChars=" + mHasUncommittedTypedChars); - p.println(" mAutoCorrectOn=" + mAutoCorrectOn); + p.println(" mAutoCorrectEnabled=" + mSettingsValues.mAutoCorrectEnabled); p.println(" mShouldInsertMagicSpace=" + mShouldInsertMagicSpace); p.println(" mApplicationSpecifiedCompletionOn=" + mApplicationSpecifiedCompletionOn); p.println(" TextEntryState.state=" + TextEntryState.getState()); - p.println(" mSoundOn=" + mSoundOn); - p.println(" mVibrateOn=" + mVibrateOn); - p.println(" mPopupOn=" + mPopupOn); + p.println(" mSoundOn=" + mSettingsValues.mSoundOn); + p.println(" mVibrateOn=" + mSettingsValues.mVibrateOn); + p.println(" mPopupOn=" + mSettingsValues.mPopupOn); } // Characters per second measurement diff --git a/java/src/com/android/inputmethod/latin/Settings.java b/java/src/com/android/inputmethod/latin/Settings.java index 42b0fadc2..5eb365774 100644 --- a/java/src/com/android/inputmethod/latin/Settings.java +++ b/java/src/com/android/inputmethod/latin/Settings.java @@ -25,9 +25,11 @@ import com.android.inputmethod.compat.VibratorCompatWrapper; import android.app.AlertDialog; import android.app.Dialog; import android.app.backup.BackupManager; +import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; +import android.content.res.Resources; import android.os.Bundle; import android.preference.CheckBoxPreference; import android.preference.ListPreference; @@ -43,6 +45,7 @@ import android.text.method.LinkMovementMethod; import android.util.Log; import android.widget.TextView; +import java.util.Arrays; import java.util.Locale; public class Settings extends PreferenceActivity @@ -79,6 +82,190 @@ public class Settings extends PreferenceActivity // Dialog ids private static final int VOICE_INPUT_CONFIRM_DIALOG = 0; + public static class Values { + // From resources: + public final boolean mEnableShowSubtypeSettings; + public final boolean mSwipeDownDismissKeyboardEnabled; + public final int mDelayBeforeFadeoutLanguageOnSpacebar; + public final int mDelayUpdateSuggestions; + public final int mDelayUpdateOldSuggestions; + public final int mDelayUpdateShiftState; + public final int mDurationOfFadeoutLanguageOnSpacebar; + public final float mFinalFadeoutFactorOfLanguageOnSpacebar; + public final long mDoubleSpacesTurnIntoPeriodTimeout; + public final String mWordSeparators; + public final String mMagicSpaceStrippers; + public final String mMagicSpaceSwappers; + public final String mSuggestPuncs; + public final SuggestedWords mSuggestPuncList; + + // From preferences: + public final boolean mSoundOn; // Sound setting private to Latin IME (see mSilentModeOn) + public final boolean mVibrateOn; + public final boolean mPopupOn; // Warning : this escapes through LatinIME#isPopupOn + public final boolean mAutoCap; + public final boolean mQuickFixes; + public final boolean mAutoCorrectEnabled; + public final double mAutoCorrectionThreshold; + // Suggestion: use bigrams to adjust scores of suggestions obtained from unigram dictionary + public final boolean mBigramSuggestionEnabled; + // Prediction: use bigrams to predict the next word when there is no input for it yet + public final boolean mBigramPredictionEnabled; + + public Values(final SharedPreferences prefs, final Context context, + final String localeStr) { + final Resources res = context.getResources(); + final Locale savedLocale; + if (null != localeStr) { + final Locale keyboardLocale = new Locale(localeStr); + savedLocale = Utils.setSystemLocale(res, keyboardLocale); + } else { + savedLocale = null; + } + + // Get the resources + mEnableShowSubtypeSettings = res.getBoolean( + R.bool.config_enable_show_subtype_settings); + mSwipeDownDismissKeyboardEnabled = res.getBoolean( + R.bool.config_swipe_down_dismiss_keyboard_enabled); + mDelayBeforeFadeoutLanguageOnSpacebar = res.getInteger( + R.integer.config_delay_before_fadeout_language_on_spacebar); + mDelayUpdateSuggestions = + res.getInteger(R.integer.config_delay_update_suggestions); + mDelayUpdateOldSuggestions = res.getInteger( + R.integer.config_delay_update_old_suggestions); + mDelayUpdateShiftState = + res.getInteger(R.integer.config_delay_update_shift_state); + mDurationOfFadeoutLanguageOnSpacebar = res.getInteger( + R.integer.config_duration_of_fadeout_language_on_spacebar); + mFinalFadeoutFactorOfLanguageOnSpacebar = res.getInteger( + R.integer.config_final_fadeout_percentage_of_language_on_spacebar) / 100.0f; + mDoubleSpacesTurnIntoPeriodTimeout = res.getInteger( + R.integer.config_double_spaces_turn_into_period_timeout); + 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; + mSuggestPuncs = res.getString(R.string.suggested_punctuations); + // TODO: it would be nice not to recreate this each time we change the configuration + mSuggestPuncList = createSuggestPuncList(mSuggestPuncs); + + // Get the settings preferences + final boolean hasVibrator = VibratorCompatWrapper.getInstance(context).hasVibrator(); + mVibrateOn = hasVibrator && prefs.getBoolean(Settings.PREF_VIBRATE_ON, false); + mSoundOn = prefs.getBoolean(Settings.PREF_SOUND_ON, + res.getBoolean(R.bool.config_default_sound_enabled)); + + mPopupOn = isPopupEnabled(prefs, res); + mAutoCap = prefs.getBoolean(Settings.PREF_AUTO_CAP, true); + mQuickFixes = isQuickFixesEnabled(prefs, res); + + mAutoCorrectEnabled = isAutoCorrectEnabled(prefs, res); + mBigramSuggestionEnabled = mAutoCorrectEnabled + && isBigramSuggestionEnabled(prefs, res, mAutoCorrectEnabled); + mBigramPredictionEnabled = mBigramSuggestionEnabled + && isBigramPredictionEnabled(prefs, res); + + mAutoCorrectionThreshold = getAutoCorrectionThreshold(prefs, res); + } + + public boolean isSuggestedPunctuation(int code) { + return mSuggestPuncs.contains(String.valueOf((char)code)); + } + + public boolean isWordSeparator(int code) { + return mWordSeparators.contains(String.valueOf((char)code)); + } + + public boolean isMagicSpaceStripper(int code) { + return mMagicSpaceStrippers.contains(String.valueOf((char)code)); + } + + public boolean isMagicSpaceSwapper(int code) { + return mMagicSpaceSwappers.contains(String.valueOf((char)code)); + } + + // Helper methods + private static boolean isQuickFixesEnabled(SharedPreferences sp, Resources resources) { + final boolean showQuickFixesOption = resources.getBoolean( + R.bool.config_enable_quick_fixes_option); + if (!showQuickFixesOption) { + return isAutoCorrectEnabled(sp, resources); + } + return sp.getBoolean(Settings.PREF_QUICK_FIXES, resources.getBoolean( + R.bool.config_default_quick_fixes)); + } + private static boolean isAutoCorrectEnabled(SharedPreferences sp, Resources resources) { + final String currentAutoCorrectionSetting = sp.getString( + Settings.PREF_AUTO_CORRECTION_THRESHOLD, + resources.getString(R.string.auto_correction_threshold_mode_index_modest)); + final String autoCorrectionOff = resources.getString( + R.string.auto_correction_threshold_mode_index_off); + return !currentAutoCorrectionSetting.equals(autoCorrectionOff); + } + private static boolean isPopupEnabled(SharedPreferences sp, Resources resources) { + final boolean showPopupOption = resources.getBoolean( + R.bool.config_enable_show_popup_on_keypress_option); + if (!showPopupOption) return resources.getBoolean(R.bool.config_default_popup_preview); + return sp.getBoolean(Settings.PREF_POPUP_ON, + resources.getBoolean(R.bool.config_default_popup_preview)); + } + private static boolean isBigramSuggestionEnabled(SharedPreferences sp, Resources resources, + boolean autoCorrectEnabled) { + final boolean showBigramSuggestionsOption = resources.getBoolean( + R.bool.config_enable_bigram_suggestions_option); + if (!showBigramSuggestionsOption) { + return autoCorrectEnabled; + } + return sp.getBoolean(Settings.PREF_BIGRAM_SUGGESTIONS, resources.getBoolean( + R.bool.config_default_bigram_suggestions)); + } + private static boolean isBigramPredictionEnabled(SharedPreferences sp, + Resources resources) { + return sp.getBoolean(Settings.PREF_BIGRAM_PREDICTIONS, resources.getBoolean( + R.bool.config_default_bigram_prediction)); + } + private static double getAutoCorrectionThreshold(SharedPreferences sp, + Resources resources) { + final String currentAutoCorrectionSetting = sp.getString( + Settings.PREF_AUTO_CORRECTION_THRESHOLD, + resources.getString(R.string.auto_correction_threshold_mode_index_modest)); + final String[] autoCorrectionThresholdValues = resources.getStringArray( + R.array.auto_correction_threshold_values); + // When autoCorrectionThreshold is greater than 1.0, it's like auto correction is off. + double autoCorrectionThreshold = Double.MAX_VALUE; + try { + final int arrayIndex = Integer.valueOf(currentAutoCorrectionSetting); + if (arrayIndex >= 0 && arrayIndex < autoCorrectionThresholdValues.length) { + autoCorrectionThreshold = Double.parseDouble( + autoCorrectionThresholdValues[arrayIndex]); + } + } catch (NumberFormatException e) { + // Whenever the threshold settings are correct, never come here. + autoCorrectionThreshold = Double.MAX_VALUE; + Log.w(TAG, "Cannot load auto correction threshold setting." + + " currentAutoCorrectionSetting: " + currentAutoCorrectionSetting + + ", autoCorrectionThresholdValues: " + + Arrays.toString(autoCorrectionThresholdValues)); + } + return autoCorrectionThreshold; + } + private static SuggestedWords createSuggestPuncList(final String puncs) { + SuggestedWords.Builder builder = new SuggestedWords.Builder(); + if (puncs != null) { + for (int i = 0; i < puncs.length(); i++) { + builder.addWord(puncs.subSequence(i, i + 1)); + } + } + return builder.build(); + } + } + private PreferenceScreen mInputLanguageSelection; private CheckBoxPreference mQuickFixes; private ListPreference mVoicePreference; From 287d0d47ff9033cd198eebbbb0dbbc3a718c9994 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Wed, 11 May 2011 20:32:40 +0900 Subject: [PATCH 06/19] Fix Serbian (Cyrillic) keyboard layout Bug: 4406840 Change-Id: Iae1d8e9752c355d08d7f3d0fe7057fce61ea702f --- java/res/xml-xlarge/kbd_sr_rows.xml | 20 +++++++++++--------- java/res/xml/kbd_sr_rows.xml | 17 +++++++++-------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/java/res/xml-xlarge/kbd_sr_rows.xml b/java/res/xml-xlarge/kbd_sr_rows.xml index ce9e20817..be0058505 100644 --- a/java/res/xml-xlarge/kbd_sr_rows.xml +++ b/java/res/xml-xlarge/kbd_sr_rows.xml @@ -30,7 +30,7 @@ @@ -101,7 +101,7 @@ latin:keyLabel="ћ" /> - + latin:keyLabel="ѕ" /> + + - + latin:keyLabel="ѕ" /> + + Date: Wed, 11 May 2011 20:48:20 +0900 Subject: [PATCH 07/19] Revert "Added support for speaking keys through accessibility service." This reverts commit dcade18113286a132a2f5fb508fdba836470c3fb. Bug: 4379983 Change-Id: I2448d8f03990a39a3e328a88904d82efc70241a2 --- java/res/values-ar/strings.xml | 12 - java/res/values-bg/strings.xml | 12 - java/res/values-ca/strings.xml | 12 - java/res/values-cs/strings.xml | 12 - java/res/values-da/strings.xml | 12 - java/res/values-de/strings.xml | 12 - java/res/values-el/strings.xml | 12 - java/res/values-en-rGB/strings.xml | 12 - java/res/values-es-rUS/strings.xml | 12 - java/res/values-es/strings.xml | 12 - java/res/values-fa/strings.xml | 12 - java/res/values-fi/strings.xml | 12 - java/res/values-fr/strings.xml | 12 - java/res/values-hr/strings.xml | 12 - java/res/values-hu/strings.xml | 12 - java/res/values-in/strings.xml | 12 - java/res/values-it/strings.xml | 12 - java/res/values-iw/strings.xml | 12 - java/res/values-ja/strings.xml | 12 - java/res/values-ko/strings.xml | 12 - java/res/values-lt/strings.xml | 12 - java/res/values-lv/strings.xml | 12 - java/res/values-nb/strings.xml | 12 - java/res/values-nl/strings.xml | 12 - java/res/values-pl/strings.xml | 12 - java/res/values-pt-rPT/strings.xml | 12 - java/res/values-pt/strings.xml | 12 - java/res/values-rm/strings.xml | 24 -- java/res/values-ro/strings.xml | 12 - java/res/values-ru/strings.xml | 12 - java/res/values-sk/strings.xml | 12 - java/res/values-sl/strings.xml | 12 - java/res/values-sr/strings.xml | 12 - java/res/values-sv/strings.xml | 12 - java/res/values-th/strings.xml | 12 - java/res/values-tl/strings.xml | 12 - java/res/values-tr/strings.xml | 12 - java/res/values-uk/strings.xml | 12 - java/res/values-vi/strings.xml | 12 - java/res/values-zh-rCN/strings.xml | 12 - java/res/values-zh-rTW/strings.xml | 12 - java/res/values/keycodes.xml | 20 -- java/res/values/strings.xml | 25 --- .../keyboard/KeyboardSwitcher.java | 22 +- .../inputmethod/keyboard/KeyboardView.java | 40 +--- .../keyboard/LatinKeyboardView.java | 4 - .../inputmethod/keyboard/PointerTracker.java | 28 +-- .../inputmethod/latin/AccessibilityUtils.java | 211 ------------------ .../android/inputmethod/latin/LatinIME.java | 14 +- 49 files changed, 13 insertions(+), 855 deletions(-) delete mode 100644 java/src/com/android/inputmethod/latin/AccessibilityUtils.java diff --git a/java/res/values-ar/strings.xml b/java/res/values-ar/strings.xml index 4107d0f88..df5b87ac1 100644 --- a/java/res/values-ar/strings.xml +++ b/java/res/values-ar/strings.xml @@ -61,18 +61,6 @@ "المزيد" "توقف مؤقت" "انتظار" - "حذف" - "رجوع" - "الإعدادات" - "العالي" - "مسافة" - "الرموز" - "Tab" - "الإدخال الصوتي" - "تشغيل الرموز" - "إيقاف الرموز" - "تشغيل العالي" - "إيقاف العالي" "الإدخال الصوتي" "الإدخال الصوتي غير معتمد حاليًا للغتك، ولكنه يعمل باللغة الإنجليزية." "يستخدم الإدخال الصوتي خاصية التعرف على الكلام من Google. تنطبق ""سياسة خصوصية الجوال""." diff --git a/java/res/values-bg/strings.xml b/java/res/values-bg/strings.xml index aab33df78..7f59a13db 100644 --- a/java/res/values-bg/strings.xml +++ b/java/res/values-bg/strings.xml @@ -61,18 +61,6 @@ "Още" "Пауза" "Чака" - "Изтриване" - "Return" - "Настройки" - "Shift" - "Интервал" - "Символи" - "Tab" - "Гласово въвеждане" - "Символите са включени" - "Символите са изключени" - "Shift е включен" - "Shift е изключен" "Гласово въвеждане" "За вашия език понастоящем не се поддържа гласово въвеждане, но можете да го използвате на английски." "Гласовото въвеждане използва функцията на Google за разпознаване на говор. В сила е ""Декларацията за поверителност за мобилни устройства""." diff --git a/java/res/values-ca/strings.xml b/java/res/values-ca/strings.xml index 85ac44588..36939fef7 100644 --- a/java/res/values-ca/strings.xml +++ b/java/res/values-ca/strings.xml @@ -61,18 +61,6 @@ "Més" "Pausa" "Espera" - "Suprimeix" - "Retorn" - "Configuració" - "Majúscules" - "Espai" - "Símbols" - "Tabulador" - "Entrada de veu" - "Símbols activats" - "Símbols desactivats" - "Majúscules activades" - "Majúscules desactivades" "Entrada de veu" "Actualment, l\'entrada de veu no és compatible amb el vostre idioma, però funciona en anglès." "L\'entrada de veu utilitza el reconeixement de veu de Google. S\'hi aplica la ""Política de privadesa de Google Mobile""." diff --git a/java/res/values-cs/strings.xml b/java/res/values-cs/strings.xml index b35520ae5..132bc1c29 100644 --- a/java/res/values-cs/strings.xml +++ b/java/res/values-cs/strings.xml @@ -61,18 +61,6 @@ "Další" "Pauza" "Čekat" - "Smazat" - "Enter" - "Nastavení" - "Shift" - "mezera" - "Symboly" - "Karta" - "Hlasový vstup" - "Symboly jsou zapnuty" - "Symboly jsou vypnuty" - "Režim Shift je zapnutý" - "Režim Shift je vypnutý" "Hlasový vstup" "Pro váš jazyk aktuálně není hlasový vstup podporován, ale funguje v angličtině." "Hlasový vstup používá rozpoznávání hlasu Google a vztahují se na něj ""Zásady ochrany osobních údajů pro mobilní služby""." diff --git a/java/res/values-da/strings.xml b/java/res/values-da/strings.xml index 9c7dedf7f..ad92b24d1 100644 --- a/java/res/values-da/strings.xml +++ b/java/res/values-da/strings.xml @@ -61,18 +61,6 @@ "Mere" "Pause" "Vent" - "Slet" - "Tilbage" - "Indstillinger" - "Shift" - "Mellemrum" - "Symboler" - "Fane" - "Stemmeinput" - "Symboler: Til" - "Symboler: Fra" - "Shift: Til" - "Shift: Fra" "Stemmeinput" "Stemmeinput understøttes i øjeblikket ikke for dit sprog, men fungerer på engelsk." "Stemmeinput anvender Googles stemmegenkendelse. ""Fortrolighedspolitikken for mobilenheder"" gælder." diff --git a/java/res/values-de/strings.xml b/java/res/values-de/strings.xml index a8b671757..65f0faa32 100644 --- a/java/res/values-de/strings.xml +++ b/java/res/values-de/strings.xml @@ -61,18 +61,6 @@ "Mehr" "Pause" "Warten" - "Löschen" - "Eingabe" - "Einstellungen" - "Umschalt" - "Leerzeichen" - "Symbole" - "Tab" - "Spracheingabe" - "Symbole an" - "Symbole aus" - "Umschalt an" - "Umschalt aus" "Spracheingabe" "Spracheingaben werden derzeit nicht für Ihre Sprache unterstützt, funktionieren jedoch in Englisch." "Die Spracheingabe verwendet die Spracherkennung von Google. Es gelten die ""Google Mobile-Datenschutzbestimmungen""." diff --git a/java/res/values-el/strings.xml b/java/res/values-el/strings.xml index a23959d1c..5cee959a0 100644 --- a/java/res/values-el/strings.xml +++ b/java/res/values-el/strings.xml @@ -61,18 +61,6 @@ "Περισσότερα" "Παύση" "Αναμ." - "Delete" - "Return" - "Ρυθμίσεις" - "Shift" - "Κενό" - "Σύμβολα" - "Tab" - "Φωνητική εντολή" - "Σύμβολα ενεργά" - "Σύμβολα ανενεργά" - "Shift ενεργό" - "Shift ανενεργό" "Φωνητική είσοδος" "Η φωνητική είσοδος δεν υποστηρίζεται αυτή τη στιγμή για τη γλώσσα σας, ωστόσο λειτουργεί στα Αγγλικά." "Οι φωνητικές εντολές χρησιμοποιούν την τεχνολογία αναγνώρισης φωνής της Google. Ισχύει ""η Πολιτική Απορρήτου για κινητά""." diff --git a/java/res/values-en-rGB/strings.xml b/java/res/values-en-rGB/strings.xml index 57d4ec4f8..7d5d50177 100644 --- a/java/res/values-en-rGB/strings.xml +++ b/java/res/values-en-rGB/strings.xml @@ -61,18 +61,6 @@ "More" "Pause" "Wait" - "Delete" - "Return" - "Settings" - "Shift" - "Space" - "Symbols" - "Tab" - "Voice Input" - "Symbols on" - "Symbols off" - "Shift on" - "Shift off" "Voice input" "Voice input is not currently supported for your language, but does work in English." "Voice input uses Google\'s speech recognition. ""The Mobile Privacy Policy"" applies." diff --git a/java/res/values-es-rUS/strings.xml b/java/res/values-es-rUS/strings.xml index 48f82f978..e40f98b3b 100644 --- a/java/res/values-es-rUS/strings.xml +++ b/java/res/values-es-rUS/strings.xml @@ -61,18 +61,6 @@ "Más" "Pausa" "Espera" - "Eliminar" - "Volver" - "Configuración" - "Mayús" - "Espacio" - "Símbolos" - "Tab" - "Entrada de voz" - "Símbolos activados" - "Símbolos desactivados" - "Mayús activado" - "Mayús desactivado" "Entrada por voz" "La entrada por voz no está admitida en tu idioma, pero sí funciona en inglés." "La entrada de voz usa el reconocimiento de voz de Google. ""Se aplica la política de privacidad para"" celulares." diff --git a/java/res/values-es/strings.xml b/java/res/values-es/strings.xml index 2116044c1..e1532427a 100644 --- a/java/res/values-es/strings.xml +++ b/java/res/values-es/strings.xml @@ -67,18 +67,6 @@ "Más" "Pausa" "Espera" - "Eliminar" - "Retroceso" - "Ajustes" - "Mayús" - "Espacio" - "Símbolos" - "Tabulador" - "Entrada de voz" - "Símbolos activados" - "Símbolos desactivados" - "Mayús activadas" - "Mayús desactivadas" "Introducción de voz" "Actualmente la introducción de voz no está disponible en tu idioma, pero se puede utilizar en inglés." "La entrada de voz utiliza el reconocimiento de voz de Google. Se aplica la ""Política de privacidad de Google para móviles""." diff --git a/java/res/values-fa/strings.xml b/java/res/values-fa/strings.xml index e57eb8a03..25ee9dff8 100644 --- a/java/res/values-fa/strings.xml +++ b/java/res/values-fa/strings.xml @@ -61,18 +61,6 @@ "بیشتر" "توقف موقت" "منتظر بمانید" - "Delete" - "Return" - "تنظیمات" - "Shift" - "فاصله" - "نمادها" - "Tab" - "ورودی صوتی" - "نمادها روشن" - "نمادها خاموش" - "Shift روشن" - "Shift خاموش" "ورودی صوتی" "ورودی صوتی در حال حاضر برای زبان شما پشتیبانی نمی شود اما برای زبان انگلیسی فعال است." "ورودی صوتی از تشخیص صدای Google استفاده می کند. ""خط مشی رازداری Mobile "" اعمال می شود." diff --git a/java/res/values-fi/strings.xml b/java/res/values-fi/strings.xml index 5be26f1e6..f02e8217d 100644 --- a/java/res/values-fi/strings.xml +++ b/java/res/values-fi/strings.xml @@ -61,18 +61,6 @@ "Lisää" "Tauko" "Odota" - "Poista" - "Rivinvaihto" - "Asetukset" - "Shift" - "Välilyönti" - "Symbolit" - "Sarkain" - "Äänisyöte" - "Symbolit käytössä" - "Symbolit pois käytöstä" - "Shift käytössä" - "Shift pois käytöstä" "Äänisyöte" "Äänisyötettä ei vielä tueta kielelläsi, mutta voit käyttää sitä englanniksi." "Äänisyöte käyttää Googlen puheentunnistusta. ""Mobile-tietosuojakäytäntö"" on voimassa." diff --git a/java/res/values-fr/strings.xml b/java/res/values-fr/strings.xml index 0526899df..276aed2c5 100644 --- a/java/res/values-fr/strings.xml +++ b/java/res/values-fr/strings.xml @@ -61,18 +61,6 @@ "Plus" "Pause" "Attente" - "Supprimer" - "Entrée" - "Paramètres" - "Maj" - "Espace" - "Symboles" - "Tabulation" - "Saisie vocale" - "Symboles activés" - "Symboles désactivés" - "Maj activée" - "Maj désactivée" "Saisie vocale" "La saisie vocale n\'est pas encore prise en charge pour votre langue, mais elle fonctionne en anglais." "La saisie vocale fait appel à la reconnaissance vocale de Google. Les ""Règles de confidentialité Google Mobile"" s\'appliquent." diff --git a/java/res/values-hr/strings.xml b/java/res/values-hr/strings.xml index 0307afa0c..6117821ee 100644 --- a/java/res/values-hr/strings.xml +++ b/java/res/values-hr/strings.xml @@ -61,18 +61,6 @@ "Više" "Pauza" "Pričekaj" - "Delete" - "Enter" - "Postavke" - "Shift" - "Razmaknica" - "Simboli" - "Tabulator" - "Glasovni unos" - "Simboli uključeni" - "Simboli isključeni" - "Shift uključen" - "Shift isključen" "Glasovni unos" "Vaš jezik trenutno nije podržan za glasovni unos, ali radi za engleski." "Glasovni unos upotrebljava Googleovo prepoznavanje govora. Primjenjuju se ""Pravila o privatnosti za uslugu Mobile""." diff --git a/java/res/values-hu/strings.xml b/java/res/values-hu/strings.xml index e2c1decb3..81255d719 100644 --- a/java/res/values-hu/strings.xml +++ b/java/res/values-hu/strings.xml @@ -61,18 +61,6 @@ "Egyebek" "Szün." "Vár" - "Törlés" - "Vissza" - "Beállítások" - "Shift" - "Szóköz" - "Szimbólumok" - "Tab" - "Hangbevitel" - "Szimbólumok be" - "Szimbólumok ki" - "Shift be" - "Shift ki" "Hangbevitel" "A hangbevitel szolgáltatás jelenleg nem támogatja az Ön nyelvét, ám angolul működik." "A hangbevitel a Google beszédfelismerő technológiáját használja, amelyre a ""Mobil adatvédelmi irányelvek"" érvényesek." diff --git a/java/res/values-in/strings.xml b/java/res/values-in/strings.xml index 4abc4e51b..32ef38d35 100644 --- a/java/res/values-in/strings.xml +++ b/java/res/values-in/strings.xml @@ -61,18 +61,6 @@ "Lainnya" "Jeda" "Tunggu" - "Hapus" - "Enter" - "Setelan" - "Shift" - "Spasi" - "Simbol" - "Tab" - "Masukan Suara" - "Simbol hidup" - "Simbol mati" - "Shift hidup" - "Shift mati" "Masukan suara" "Masukan suara saat ini tidak didukung untuk bahasa Anda, tetapi bekerja dalam Bahasa Inggris." "Masukan suara menggunakan pengenalan ucapan Google. ""Kebijakan Privasi Seluler"" berlaku." diff --git a/java/res/values-it/strings.xml b/java/res/values-it/strings.xml index d661c8975..3a896fcd7 100644 --- a/java/res/values-it/strings.xml +++ b/java/res/values-it/strings.xml @@ -61,18 +61,6 @@ "Altro" "Pausa" "Attesa" - "Cancella" - "Invio" - "Impostazioni" - "Maiuscolo" - "Spazio" - "Simboli" - "Tabulazione" - "Input vocale" - "Simboli attivati" - "Simboli disattivati" - "Maiuscole attivate" - "Maiuscole disattivate" "Comandi vocali" "I comandi vocali non sono attualmente supportati per la tua lingua ma funzionano in inglese." "L\'input vocale utilizza il riconoscimento vocale di Google. Sono valide le ""norme sulla privacy di Google Mobile""." diff --git a/java/res/values-iw/strings.xml b/java/res/values-iw/strings.xml index 678804449..0b26ed9fe 100644 --- a/java/res/values-iw/strings.xml +++ b/java/res/values-iw/strings.xml @@ -61,18 +61,6 @@ "עוד" "השהה" "המתן" - "מחק" - "חזור" - "הגדרות" - "Shift" - "רווח" - "סמלים" - "כרטיסייה" - "קלט קולי" - "מצב סמלים פועל" - "מצב סמלים כבוי" - "Shift פועל" - "Shift כבוי" "קלט קולי" "קלט קולי אינו נתמך בשלב זה בשפתך, אך הוא פועל באנגלית." "קלט קולי משתמש בזיהוי דיבור של Google.‏ ""מדיניות הפרטיות של \'Google לנייד\'"" חלה במקרה זה." diff --git a/java/res/values-ja/strings.xml b/java/res/values-ja/strings.xml index 3c6ba0d3a..402c35675 100644 --- a/java/res/values-ja/strings.xml +++ b/java/res/values-ja/strings.xml @@ -61,18 +61,6 @@ "Shift" "停止" "待機" - "Del" - "Enter" - "設定" - "Shift" - "Space" - "記号" - "Tab" - "音声入力" - "記号ON" - "記号OFF" - "Shift ON" - "Shift OFF" "音声入力" "音声入力は現在英語には対応していますが、日本語には対応していません。" "音声入力ではGoogleの音声認識技術を利用します。""モバイルプライバシーポリシー""が適用されます。" diff --git a/java/res/values-ko/strings.xml b/java/res/values-ko/strings.xml index 01484d797..ca2f570a8 100644 --- a/java/res/values-ko/strings.xml +++ b/java/res/values-ko/strings.xml @@ -61,18 +61,6 @@ "더보기" "일시 중지" "대기" - "삭제" - "리턴" - "설정" - "시프트" - "스페이스" - "기호" - "탭" - "음성 입력" - "기호 사용" - "기호 사용 안함" - "시프트 사용" - "시프트 사용 안함" "음성 입력" "음성 입력은 현재 자국어로 지원되지 않으며 영어로 작동됩니다." "음성 입력에서는 Google의 음성 인식 기능을 사용합니다. ""모바일 개인정보취급방침""이 적용됩니다." diff --git a/java/res/values-lt/strings.xml b/java/res/values-lt/strings.xml index e808426a8..fbe50e005 100644 --- a/java/res/values-lt/strings.xml +++ b/java/res/values-lt/strings.xml @@ -61,18 +61,6 @@ "Daugiau" "Prist." "Lauk." - "Ištrinti" - "Grįžti" - "Nustatymai" - "Keitimas" - "Tarpas" - "Simboliai" - "Skirtukas" - "Balso įvestis" - "Simboliai įjungti" - "Simboliai išjungti" - "Keitimas įjungtas" - "Keitimas išjungtas" "Balso įvestis" "Šiuo metu balso įvestis jūsų kompiuteryje nepalaikoma, bet ji veikia anglų k." "Balso įvesčiai naudojamas „Google“ kalbos atpažinimas. Taikoma ""privatumo politika mobiliesiems""." diff --git a/java/res/values-lv/strings.xml b/java/res/values-lv/strings.xml index 69d4ba092..84bee5382 100644 --- a/java/res/values-lv/strings.xml +++ b/java/res/values-lv/strings.xml @@ -61,18 +61,6 @@ "Vairāk" "Pauze" "Gaidīt" - "Dzēšanas taustiņš" - "Atgriešanās taustiņš" - "Iestatījumu taustiņš" - "Pārslēgšanas taustiņš" - "Atstarpes taustiņš" - "Simbolu taustiņš" - "Tabulēšanas taustiņš" - "Runas ievades taustiņš" - "Simbolu režīms ir ieslēgts." - "Simbolu režīms ir izslēgts." - "Pārslēgšanas režīms ir ieslēgts." - "Pārslēgšanas režīms ir izslēgts." "Balss ievade" "Balss ievade jūsu valodā pašlaik netiek atbalstīta, taču tā ir pieejama angļu valodā." "Balss ievadei tiek izmantota Google runas atpazīšanas funkcija. Uz šīs funkcijas lietošanu attiecas ""mobilo sakaru ierīču lietošanas konfidencialitātes politika""." diff --git a/java/res/values-nb/strings.xml b/java/res/values-nb/strings.xml index 8b4874d91..e20c9515e 100644 --- a/java/res/values-nb/strings.xml +++ b/java/res/values-nb/strings.xml @@ -61,18 +61,6 @@ "Mer" "Pause" "Vent" - "Delete" - "Enter" - "Innstillinger" - "Shift" - "Mellomrom" - "Symboler" - "Tab" - "Taleinndata" - "Symboler er slått på" - "Symboler er slått av" - "Shift på" - "Shift av" "Stemmedata" "Stemmedata håndteres foreløpig ikke på ditt språk, men fungerer på engelsk." "Google Voice bruker Googles talegjenkjenning. ""Personvernreglene for mobil"" gjelder." diff --git a/java/res/values-nl/strings.xml b/java/res/values-nl/strings.xml index ab3f1857d..89b714bc8 100644 --- a/java/res/values-nl/strings.xml +++ b/java/res/values-nl/strings.xml @@ -61,18 +61,6 @@ "Meer" "Onderbr." "Wacht" - "Delete" - "Return" - "Instellingen" - "Shift" - "Spatie" - "Symbolen" - "Tab" - "Spraakinvoer" - "Symbolen aan" - "Symbolen uit" - "Shift aan" - "Shift uit" "Spraakinvoer" "Spraakinvoer wordt momenteel niet ondersteund in uw taal, maar is wel beschikbaar in het Engels." "Spraakinvoer maakt gebruik van de spraakherkenning van Google. Het ""Privacybeleid van Google Mobile"" is van toepassing." diff --git a/java/res/values-pl/strings.xml b/java/res/values-pl/strings.xml index bc352f036..65240d748 100644 --- a/java/res/values-pl/strings.xml +++ b/java/res/values-pl/strings.xml @@ -61,18 +61,6 @@ "Więcej" "Pauza" "Czekaj" - "Delete" - "Enter" - "Ustawienia" - "Shift" - "Spacja" - "Symbole" - "Tab" - "Wprowadzanie głosowe" - "Symbole włączone" - "Symbole wyłączone" - "Shift włączony" - "Shift wyłączony" "Wprowadzanie głosowe" "Wprowadzanie głosowe obecnie nie jest obsługiwane w Twoim języku, ale działa w języku angielskim." "Funkcja wprowadzania głosowego wykorzystuje mechanizm rozpoznawania mowy. Obowiązuje ""Polityka prywatności Google Mobile""." diff --git a/java/res/values-pt-rPT/strings.xml b/java/res/values-pt-rPT/strings.xml index b881d880f..b972ce049 100644 --- a/java/res/values-pt-rPT/strings.xml +++ b/java/res/values-pt-rPT/strings.xml @@ -61,18 +61,6 @@ "Mais" "Pausa" "Esp." - "Delete" - "Enter" - "Definições" - "Shift" - "Espaço" - "Símbolos" - "Tab" - "Entrada de voz" - "Símbolos ativados" - "Símbolos desativados" - "Shift ativado" - "Shift desativado" "Entrada de voz" "Actualmente, a entrada de voz não é suportada para o seu idioma, mas funciona em inglês." "A entrada de voz utiliza o reconhecimento de voz da Google. É aplicável a ""Política de privacidade do Google Mobile""." diff --git a/java/res/values-pt/strings.xml b/java/res/values-pt/strings.xml index dedd06e97..a999dc67e 100644 --- a/java/res/values-pt/strings.xml +++ b/java/res/values-pt/strings.xml @@ -61,18 +61,6 @@ "Mais" "Pausa" "Esp." - "Excluir" - "Voltar" - "Configurações" - "Shift" - "Espaço" - "Símbolos" - "Tab" - "Entrada de texto por voz" - "Símbolos ativados" - "Símbolos desativados" - "Shift ativado" - "Shift desativado" "Entrada de voz" "A entrada de voz não é suportada no momento para o seu idioma, mas funciona em inglês." "A entrada de texto por voz usa o reconhecimento de voz do Google. ""A política de privacidade para celulares"" é aplicada." diff --git a/java/res/values-rm/strings.xml b/java/res/values-rm/strings.xml index 8328fc9e8..b0c1bea24 100644 --- a/java/res/values-rm/strings.xml +++ b/java/res/values-rm/strings.xml @@ -85,30 +85,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - "Cumonds vocals" "\"Cumonds vocals en Vossa lingua na vegnan actualmain betg sustegnids, ma la funcziun è disponibla per englais.\"" "Ils cumonds vocals èn ina funcziunalitad experimentala che utilisescha la renconuschientscha vocala da rait da Google." diff --git a/java/res/values-ro/strings.xml b/java/res/values-ro/strings.xml index 680bdb8b1..0fcefd1f2 100644 --- a/java/res/values-ro/strings.xml +++ b/java/res/values-ro/strings.xml @@ -61,18 +61,6 @@ "Mai multe" "Pauză" "Aşt." - "Ştergeţi" - "Tasta Enter" - "Setări" - "Shift" - "Tasta Space" - "Simboluri" - "Tasta Tab" - "Intrare vocală" - "Simbolurile sunt activate" - "Simbolurile sunt dezactivate" - "Tasta Shift este activată" - "Tasta Shift este dezactivată" "Intrare voce" "Intrarea vocală nu este acceptată în prezent pentru limba dvs., însă funcţionează în limba engleză." "Intrarea vocală utilizează funcţia Google de recunoaştere vocală. Se aplică ""Politica de confidenţialitate Google Mobil""." diff --git a/java/res/values-ru/strings.xml b/java/res/values-ru/strings.xml index ae3138ba1..2e8577ea1 100644 --- a/java/res/values-ru/strings.xml +++ b/java/res/values-ru/strings.xml @@ -61,18 +61,6 @@ "Ещё" "Приостановить" "Подождите" - "Клавиша удаления" - "Клавиша \"Ввод\"" - "Клавиша настроек" - "Клавиша верхнего регистра" - "Клавиша \"Пробел\"" - "Клавиша символов" - "Клавиша табуляции" - "Клавиша голосового ввода" - "Клавиши символов выключены" - "Клавиши символов включены" - "Верхний регистр включен" - "Верхний регистр выключен" "Голосовой ввод" "В настоящее время функция голосового ввода не поддерживает ваш язык, но вы можете пользоваться ей на английском." "Голосовой ввод использует алгоритмы распознавания речи Google. Действует ""политика конфиденциальности для мобильных устройств""." diff --git a/java/res/values-sk/strings.xml b/java/res/values-sk/strings.xml index 70f9f8bf7..eeefa820f 100644 --- a/java/res/values-sk/strings.xml +++ b/java/res/values-sk/strings.xml @@ -61,18 +61,6 @@ "Viac" "Pozastaviť" "Čakajte" - "Delete" - "Return" - "Nastavenia" - "Shift" - "Medzera" - "Symboly" - "Tab" - "Hlasový vstup" - "Symboly zapnuté" - "Symboly vypnuté" - "Shift zapnutý" - "Shift vypnutý" "Hlasový vstup" "Pre váš jazyk aktuálne nie je hlasový vstup podporovaný, ale funguje v angličtine." "Hlasový vstup používa rozpoznávanie hlasu Google. Na používanie hlasového vstupu sa vzťahujú ""Pravidlá ochrany osobných údajov pre mobilné služby""." diff --git a/java/res/values-sl/strings.xml b/java/res/values-sl/strings.xml index babf8b097..91f9036e6 100644 --- a/java/res/values-sl/strings.xml +++ b/java/res/values-sl/strings.xml @@ -61,18 +61,6 @@ "Več" "Premor" "Čakaj" - "Izbriši" - "Vračalka" - "Nastavitve" - "Dvigalka" - "Preslednica" - "Znaki" - "Tabulatorka" - "Glasovni vnos" - "Znaki vklopljeni" - "Znaki izklopljeni" - "Dvigalka vklopljena" - "Dvigalka izklopljena" "Glasovni vnos" "Glasovni vnos trenutno ni podprt v vašem jeziku, deluje pa v angleščini." "Glasovni vnos uporablja Googlovo prepoznavanje govora. Zanj velja ""pravilnik o zasebnosti za mobilne naprave""." diff --git a/java/res/values-sr/strings.xml b/java/res/values-sr/strings.xml index 7a90fbfdc..b20f1df2e 100644 --- a/java/res/values-sr/strings.xml +++ b/java/res/values-sr/strings.xml @@ -61,18 +61,6 @@ "Још" "Паузирај" "Сачекајте" - "Delete" - "Return" - "Подешавања" - "Shift" - "Размак" - "Симболи" - "Tab" - "Гласовни унос" - "Симболи су укључени" - "Симболи су искључени" - "Shift је укључен" - "Shift је искључен" "Гласовни унос" "Гласовни унос тренутно није подржан за ваш језик, али функционише на енглеском." "Гласовни унос користи Google-ову функцију за препознавање гласа. Примењује се ""политика приватности за мобилне уређаје""." diff --git a/java/res/values-sv/strings.xml b/java/res/values-sv/strings.xml index 922cbf7de..2d35fd87b 100644 --- a/java/res/values-sv/strings.xml +++ b/java/res/values-sv/strings.xml @@ -61,18 +61,6 @@ "Mer" "Pausa" "Vänta" - "Ta bort" - "Retur" - "Inställningar" - "Skift" - "Blanksteg" - "Symboler" - "Tabb" - "Röstinmatning" - "Aktivera symboler" - "Inaktivera symboler" - "Aktivera Skift" - "Inaktivera Skift" "Röstindata" "Röstindata stöds inte på ditt språk än, men tjänsten fungerar på engelska." "Röstinmatning använder sig av Googles tjänst för taligenkänning. ""Sekretesspolicyn för mobila enheter"" gäller." diff --git a/java/res/values-th/strings.xml b/java/res/values-th/strings.xml index de75300ef..cd7fe95c0 100644 --- a/java/res/values-th/strings.xml +++ b/java/res/values-th/strings.xml @@ -61,18 +61,6 @@ "เพิ่มเติม" "หยุดชั่วคราว" "รอ" - "ลบ" - "Return" - "การตั้งค่า" - "Shift" - "Space" - "สัญลักษณ์" - "Tab" - "ป้อนข้อมูลด้วยเสียง" - "สัญลักษณ์เปิดอยู่" - "สัญลักษณ์ปิดอยู่" - "Shift เปิดอยู่" - "Shift ปิดอยู่" "การป้อนข้อมูลด้วยเสียง" "ขณะนี้การป้อนข้อมูลด้วยเสียงยังไม่ได้รับการสนับสนุนในภาษาของคุณ แต่ใช้ได้ในภาษาอังกฤษ" "ป้อนข้อมูลด้วยเสียงใช้การจดจำคำพูดของ Google "" นโยบายส่วนบุคคลของมือถือ""มีผลบังคับใช้" diff --git a/java/res/values-tl/strings.xml b/java/res/values-tl/strings.xml index 779c56b4f..da62eafc6 100644 --- a/java/res/values-tl/strings.xml +++ b/java/res/values-tl/strings.xml @@ -61,18 +61,6 @@ "Higit pa" "Pause" "Intay" - "Tanggalin" - "Bumalik" - "Mga Setting" - "Shift" - "Puwang" - "Mga Simbolo" - "Tab" - "Input ng Boses" - "Naka-on ang mga simbolo" - "Naka-off ang mga simbolo" - "Naka-on ang shift" - "Naka-off ang shift" "Pag-input ng boses" "Hindi kasalukuyang suportado ang pag-input ng boses para sa iyong wika, ngunit gumagana sa Ingles." "Gumagamit ang pag-input ng boses ng speech recognition ng Google. Nalalapat ""Ang Patakaran sa Privacy ng Mobile""." diff --git a/java/res/values-tr/strings.xml b/java/res/values-tr/strings.xml index cb993619b..2607ae257 100644 --- a/java/res/values-tr/strings.xml +++ b/java/res/values-tr/strings.xml @@ -61,18 +61,6 @@ "Diğer" "Durkl" "Bekle" - "Sil" - "Return" - "Ayarlar" - "Üst Karakter" - "Boşluk" - "Simgeler" - "Sekme" - "Ses Girişi" - "Simgeler açık" - "Simgeler kapalı" - "Üst Karakter açık" - "Üst Karakter kapalı" "Ses girişi" "Ses girişi, şu anda sizin diliniz için desteklenmiyor ama İngilizce dilinde kullanılabilir." "Ses girişi Google\'ın konuşma tanıma işlevini kullanır. "" Mobil Gizlilik Politikası"" geçerlidir." diff --git a/java/res/values-uk/strings.xml b/java/res/values-uk/strings.xml index ad2665544..a2f589d1d 100644 --- a/java/res/values-uk/strings.xml +++ b/java/res/values-uk/strings.xml @@ -61,18 +61,6 @@ "Більше" "Пауза" "Чек." - "Клавіша Delete" - "Клавіша Return" - "Клавіша Settings" - "Клавіша Shift" - "Клавіша Space" - "Клавіша Symbols" - "Клавіша Tab" - "Клавіша Voice Input" - "Символи ввімкнено" - "Символи вимкнено" - "Shift увімкнено" - "Shift вимкнено" "Голос. ввід" "Голос. ввід наразі не підтрим. для вашої мови, але можна користуватися англійською." "Голосовий ввід використовує розпізнавання мовлення Google. Застосовується ""Політика конфіденційності для мобільних пристроїв""." diff --git a/java/res/values-vi/strings.xml b/java/res/values-vi/strings.xml index cc74b4ea5..81be8264e 100644 --- a/java/res/values-vi/strings.xml +++ b/java/res/values-vi/strings.xml @@ -61,18 +61,6 @@ "Khác" "Tạm dừng" "Đợi" - "Xóa" - "Quay lại" - "Cài đặt" - "Shift" - "Dấu cách" - "Biểu tượng" - "Tab" - "Nhập liệu bằng giọng nói" - "Bật biểu tượng" - "Tắt biểu tượng" - "Bật Shift" - "Tắt Shift" "Nhập liệu bằng giọng nói" "Nhập liệu bằng giọng nói hiện không được hỗ trợ cho ngôn ngữ của bạn nhưng hoạt động với ngôn ngữ tiếng Anh." "Nhập liệu bằng giọng nói sử dụng nhận dạng giọng nói của Google. Áp dụng ""Chính sách bảo mật dành cho điện thoại di động""." diff --git a/java/res/values-zh-rCN/strings.xml b/java/res/values-zh-rCN/strings.xml index a8edf1039..1f15831b3 100644 --- a/java/res/values-zh-rCN/strings.xml +++ b/java/res/values-zh-rCN/strings.xml @@ -61,18 +61,6 @@ "更多" "暂停" "等待" - "删除" - "回车" - "设置" - "Shift" - "空格" - "符号" - "Tab" - "语音输入" - "符号模式已打开" - "符号模式已关闭" - "Shift 模式已打开" - "Shift 模式已关闭" "语音输入" "语音输入功能当前还不支持您的语言,您只能输入英语语音。" "语音输入采用了 Google 的语音识别技术,因此请遵守""“Google 移动”隐私权政策""。" diff --git a/java/res/values-zh-rTW/strings.xml b/java/res/values-zh-rTW/strings.xml index 58e2bcd45..8a89aeb08 100644 --- a/java/res/values-zh-rTW/strings.xml +++ b/java/res/values-zh-rTW/strings.xml @@ -61,18 +61,6 @@ "更多" "暫停" "等候" - "刪除" - "返回" - "設定" - "Shift 鍵" - "空白鍵" - "符號" - "Tab 鍵" - "語音輸入" - "開啟符號" - "關閉符號" - "開啟位移" - "關閉位移" "語音輸入" "語音輸入目前不支援您的語言,但是可以辨識英文。" "語音輸入使用 Google 的語音辨識功能,並遵循《""行動服務隱私權政策""》。" diff --git a/java/res/values/keycodes.xml b/java/res/values/keycodes.xml index 7145af574..d5926ecfd 100644 --- a/java/res/values/keycodes.xml +++ b/java/res/values/keycodes.xml @@ -31,24 +31,4 @@ -5 -6 -8 - - - - @integer/key_tab - @string/description_tab_key - @integer/key_return - @string/description_return_key - @integer/key_space - @string/description_space_key - @integer/key_shift - @string/description_shift_key - @integer/key_switch_alpha_symbol - @string/description_switch_alpha_symbol_key - @integer/key_delete - @string/description_delete_key - @integer/key_settings - @string/description_settings_key - @integer/key_shortcut - @string/description_voice_key - diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml index b58efe082..823f1e58f 100644 --- a/java/res/values/strings.xml +++ b/java/res/values/strings.xml @@ -114,31 +114,6 @@ Wait - - Delete - - Return - - Settings - - Shift - - Space - - Symbols - - Tab - - Voice Input - - Symbols on - - Symbols off - - Shift on - - Shift off - 1.100in + 45%p 0.020in diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml index e88b007a9..7f2a400df 100644 --- a/java/res/values/attrs.xml +++ b/java/res/values/attrs.xml @@ -80,6 +80,9 @@ + + 1.285in + 50%p + -61.8%p 0.035in @@ -41,10 +43,11 @@ to user's finger. --> -0.05in - 0.13in - 0.083in + + 21dip + 13dip - 0.13in + 21dip 80sp 0.000in 36sp diff --git a/java/res/xml-ar/kbd_qwerty.xml b/java/res/xml-ar/kbd_qwerty.xml index 5faf60336..93310bf9c 100644 --- a/java/res/xml-ar/kbd_qwerty.xml +++ b/java/res/xml-ar/kbd_qwerty.xml @@ -21,7 +21,8 @@ Date: Thu, 12 May 2011 18:02:53 +0900 Subject: [PATCH 09/19] Fix a bug where suggestions would not update in Froyo WebTextView Bug: 4396864 Change-Id: Ia45466319498ae7e35fe8a39b4e3a361d66ac2cc --- java/src/com/android/inputmethod/latin/LatinIME.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index d15fc36d9..f9483540b 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -1610,7 +1610,10 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar // TextEntryState.State.PICKED_SUGGESTION state. TextEntryState.typedCharacter((char) Keyboard.CODE_SPACE, true, WordComposer.NOT_A_COORDINATE, WordComposer.NOT_A_COORDINATE); - // From there on onUpdateSelection() will fire so suggestions will be updated + // On Honeycomb+, onUpdateSelection() will fire, but in Gingerbread- in WebTextView + // only it does not, for some reason. Force update suggestions so that it works + // in Gingerbread- in WebTextView too. + mHandler.postUpdateSuggestions(); } else if (!showingAddToDictionaryHint) { // If we're not showing the "Touch again to save", then show corrections again. // In case the cursor position doesn't change, make sure we show the suggestions again. From 0d2843d8524227fb28081cf7507844a171ad6cc2 Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Thu, 12 May 2011 18:50:21 +0900 Subject: [PATCH 10/19] Fix a bug where the locale of the keyboard app would end up wrong. Change-Id: I1f9172dd987f8c2ed9b2f3d16a494e4cd264ead7 --- java/src/com/android/inputmethod/latin/Settings.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/java/src/com/android/inputmethod/latin/Settings.java b/java/src/com/android/inputmethod/latin/Settings.java index 5eb365774..8953731a5 100644 --- a/java/src/com/android/inputmethod/latin/Settings.java +++ b/java/src/com/android/inputmethod/latin/Settings.java @@ -172,6 +172,8 @@ public class Settings extends PreferenceActivity && isBigramPredictionEnabled(prefs, res); mAutoCorrectionThreshold = getAutoCorrectionThreshold(prefs, res); + + Utils.setSystemLocale(res, savedLocale); } public boolean isSuggestedPunctuation(int code) { From f733074aaecdfd6e89cfee2daff8a9c1233b60f1 Mon Sep 17 00:00:00 2001 From: satok Date: Wed, 11 May 2011 15:19:24 +0900 Subject: [PATCH 11/19] Fix the available input locales and moved Recorrection Bug: 4409091 Change-Id: I6efd23ebb9528bf1bd35320057a0ea264c187451 --- java/res/values/strings.xml | 2 + java/res/xml-de/kbd_qwerty.xml | 2 +- java/res/xml-es/kbd_qwerty.xml | 35 ++++++ java/res/xml-fr/kbd_qwerty.xml | 2 +- java/res/xml-pl/kbd_qwerty.xml | 2 +- java/res/xml-pt/kbd_qwerty.xml | 35 ++++++ java/res/xml-ru/kbd_qwerty.xml | 2 +- java/res/xml/method.xml | 5 + .../InputLanguageSelection.java | 102 +++++++++++------- .../recorrection}/Recorrection.java | 90 +++++++++------- .../RecorrectionSuggestionEntries.java} | 11 +- .../inputmethod/latin/DictionaryFactory.java | 19 ++++ .../android/inputmethod/latin/LatinIME.java | 7 +- .../inputmethod/latin/WordComposer.java | 2 +- 14 files changed, 225 insertions(+), 91 deletions(-) create mode 100644 java/res/xml-es/kbd_qwerty.xml create mode 100644 java/res/xml-pt/kbd_qwerty.xml rename java/src/com/android/inputmethod/{latin => deprecated/recorrection}/Recorrection.java (73%) rename java/src/com/android/inputmethod/{latin/WordAlternatives.java => deprecated/recorrection/RecorrectionSuggestionEntries.java} (83%) diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml index b58efe082..cb4319597 100644 --- a/java/res/values/strings.xml +++ b/java/res/values/strings.xml @@ -285,6 +285,8 @@ Dutch Keyboard Polish Keyboard + + Portuguese Keyboard Russian Keyboard diff --git a/java/res/xml-de/kbd_qwerty.xml b/java/res/xml-de/kbd_qwerty.xml index e6569667d..6b5c22391 100644 --- a/java/res/xml-de/kbd_qwerty.xml +++ b/java/res/xml-de/kbd_qwerty.xml @@ -28,7 +28,7 @@ latin:verticalGap="@dimen/key_bottom_gap" latin:popupKeyboardTemplate="@xml/kbd_popup_template" latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column" - latin:keyboardLocale="de_DE" + latin:keyboardLocale="de" > diff --git a/java/res/xml-es/kbd_qwerty.xml b/java/res/xml-es/kbd_qwerty.xml new file mode 100644 index 000000000..8e7c1e09b --- /dev/null +++ b/java/res/xml-es/kbd_qwerty.xml @@ -0,0 +1,35 @@ + + + + + + diff --git a/java/res/xml-fr/kbd_qwerty.xml b/java/res/xml-fr/kbd_qwerty.xml index 2f8e67bb1..e4b73bf21 100644 --- a/java/res/xml-fr/kbd_qwerty.xml +++ b/java/res/xml-fr/kbd_qwerty.xml @@ -28,7 +28,7 @@ latin:verticalGap="@dimen/key_bottom_gap" latin:popupKeyboardTemplate="@xml/kbd_popup_template" latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column" - latin:keyboardLocale="fr_FR" + latin:keyboardLocale="fr" > diff --git a/java/res/xml-pl/kbd_qwerty.xml b/java/res/xml-pl/kbd_qwerty.xml index fad28d641..ea52b296f 100644 --- a/java/res/xml-pl/kbd_qwerty.xml +++ b/java/res/xml-pl/kbd_qwerty.xml @@ -28,7 +28,7 @@ latin:verticalGap="@dimen/key_bottom_gap" latin:popupKeyboardTemplate="@xml/kbd_popup_template" latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column" - latin:keyboardLocale="pl_PL" + latin:keyboardLocale="pl" > diff --git a/java/res/xml-pt/kbd_qwerty.xml b/java/res/xml-pt/kbd_qwerty.xml new file mode 100644 index 000000000..64c1a0137 --- /dev/null +++ b/java/res/xml-pt/kbd_qwerty.xml @@ -0,0 +1,35 @@ + + + + + + diff --git a/java/res/xml-ru/kbd_qwerty.xml b/java/res/xml-ru/kbd_qwerty.xml index e5aea581e..065cf3afc 100644 --- a/java/res/xml-ru/kbd_qwerty.xml +++ b/java/res/xml-ru/kbd_qwerty.xml @@ -27,7 +27,7 @@ latin:verticalGap="@dimen/key_bottom_gap" latin:popupKeyboardTemplate="@xml/kbd_popup_template" latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column" - latin:keyboardLocale="ru_RU" + latin:keyboardLocale="ru" > diff --git a/java/res/xml/method.xml b/java/res/xml/method.xml index df43701d3..aba6974a8 100644 --- a/java/res/xml/method.xml +++ b/java/res/xml/method.xml @@ -150,6 +150,11 @@ android:imeSubtypeLocale="pl" android:imeSubtypeMode="keyboard" /> + mLocaleMap = new HashMap(); - private static class Loc implements Comparable { + private static class LocaleEntry implements Comparable { private static Collator sCollator = Collator.getInstance(); private String mLabel; public final Locale mLocale; - public Loc(String label, Locale locale) { + public LocaleEntry(String label, Locale locale) { this.mLabel = label; this.mLocale = locale; } - public void setLabel(String label) { - this.mLabel = label; - } - @Override public String toString() { return this.mLabel; @@ -73,7 +71,7 @@ public class InputLanguageSelection extends PreferenceActivity { @Override public int compareTo(Object o) { - return sCollator.compare(this.mLabel, ((Loc) o).mLabel); + return sCollator.compare(this.mLabel, ((LocaleEntry) o).mLabel); } } @@ -85,21 +83,58 @@ public class InputLanguageSelection extends PreferenceActivity { mPrefs = PreferenceManager.getDefaultSharedPreferences(this); mSelectedLanguages = mPrefs.getString(Settings.PREF_SELECTED_LANGUAGES, ""); String[] languageList = mSelectedLanguages.split(","); - ArrayList availableLanguages = getUniqueLocales(); + ArrayList availableLanguages = getUniqueLocales(); PreferenceGroup parent = getPreferenceScreen(); + final HashMap dictionaryIdLocaleMap = new HashMap(); + final TreeMap localeHasDictionaryMap = + new TreeMap(); for (int i = 0; i < availableLanguages.size(); i++) { - Locale locale = availableLanguages.get(i).mLocale; - final Pair hasDictionaryOrLayout = hasDictionaryOrLayout(locale); - final boolean hasDictionary = hasDictionaryOrLayout.first; + LocaleEntry loc = availableLanguages.get(i); + Locale locale = loc.mLocale; + final Pair hasDictionaryOrLayout = hasDictionaryOrLayout(locale); + final Long dictionaryId = hasDictionaryOrLayout.first; final boolean hasLayout = hasDictionaryOrLayout.second; + final boolean hasDictionary = dictionaryId != null; // Add this locale to the supported list if: - // 1) this locale has a layout/ 2) this locale has a dictionary and the length - // of the locale is equal to or larger than 5. - if (!hasLayout && !(hasDictionary && locale.toString().length() >= 5)) { + // 1) this locale has a layout/ 2) this locale has a dictionary + // If some locales have no layout but have a same dictionary, the shortest locale + // will be added to the supported list. + if (!hasLayout && !hasDictionary) { continue; } + if (hasLayout) { + localeHasDictionaryMap.put(loc, hasDictionary); + } + if (!hasDictionary) { + continue; + } + if (dictionaryIdLocaleMap.containsKey(dictionaryId)) { + final String newLocale = locale.toString(); + final String oldLocale = + dictionaryIdLocaleMap.get(dictionaryId).mLocale.toString(); + // Check if this locale is more appropriate to be the candidate of the input locale. + if (oldLocale.length() <= newLocale.length() && !hasLayout) { + // Don't add this new locale to the map if: + // 1) the new locale's name is longer than the existing one, and + // 2) the new locale doesn't have its layout + continue; + } + } + dictionaryIdLocaleMap.put(dictionaryId, loc); + } + + for (LocaleEntry localeEntry : dictionaryIdLocaleMap.values()) { + if (!localeHasDictionaryMap.containsKey(localeEntry)) { + localeHasDictionaryMap.put(localeEntry, true); + } + } + + for (Entry entry : localeHasDictionaryMap.entrySet()) { + final LocaleEntry localeEntry = entry.getKey(); + final Locale locale = localeEntry.mLocale; + final Boolean hasDictionary = entry.getValue(); CheckBoxPreference pref = new CheckBoxPreference(this); - pref.setTitle(SubtypeSwitcher.getFullDisplayName(locale, true)); + pref.setTitle(localeEntry.mLabel); boolean checked = isLocaleIn(locale, languageList); pref.setChecked(checked); if (hasDictionary) { @@ -118,11 +153,11 @@ public class InputLanguageSelection extends PreferenceActivity { return false; } - private Pair hasDictionaryOrLayout(Locale locale) { - if (locale == null) return new Pair(false, false); + private Pair hasDictionaryOrLayout(Locale locale) { + if (locale == null) return new Pair(null, false); final Resources res = getResources(); final Locale saveLocale = Utils.setSystemLocale(res, locale); - final boolean hasDictionary = DictionaryFactory.isDictionaryAvailable(this, locale); + final Long dictionaryId = DictionaryFactory.getDictionaryId(this, locale); boolean hasLayout = false; try { @@ -141,7 +176,7 @@ public class InputLanguageSelection extends PreferenceActivity { } catch (IOException e) { } Utils.setSystemLocale(res, saveLocale); - return new Pair(hasDictionary, hasLayout); + return new Pair(dictionaryId, hasLayout); } private String get5Code(Locale locale) { @@ -174,13 +209,13 @@ public class InputLanguageSelection extends PreferenceActivity { SharedPreferencesCompat.apply(editor); } - public ArrayList getUniqueLocales() { + public ArrayList getUniqueLocales() { String[] locales = getAssets().getLocales(); Arrays.sort(locales); - ArrayList uniqueLocales = new ArrayList(); + ArrayList uniqueLocales = new ArrayList(); final int origSize = locales.length; - Loc[] preprocess = new Loc[origSize]; + LocaleEntry[] preprocess = new LocaleEntry[origSize]; int finalSize = 0; for (int i = 0 ; i < origSize; i++ ) { String s = locales[i]; @@ -202,26 +237,13 @@ public class InputLanguageSelection extends PreferenceActivity { if (finalSize == 0) { preprocess[finalSize++] = - new Loc(SubtypeSwitcher.getFullDisplayName(l, true), l); + new LocaleEntry(SubtypeSwitcher.getFullDisplayName(l, false), l); } else { - // check previous entry: - // same lang and a country -> upgrade to full name and - // insert ours with full name - // diff lang -> insert ours with lang-only name - if (preprocess[finalSize-1].mLocale.getLanguage().equals( - language)) { - preprocess[finalSize-1].setLabel(SubtypeSwitcher.getFullDisplayName( - preprocess[finalSize-1].mLocale, false)); - preprocess[finalSize++] = - new Loc(SubtypeSwitcher.getFullDisplayName(l, false), l); + if (s.equals("zz_ZZ")) { + // ignore this locale } else { - String displayName; - if (s.equals("zz_ZZ")) { - // ignore this locale - } else { - displayName = SubtypeSwitcher.getFullDisplayName(l, true); - preprocess[finalSize++] = new Loc(displayName, l); - } + final String displayName = SubtypeSwitcher.getFullDisplayName(l, false); + preprocess[finalSize++] = new LocaleEntry(displayName, l); } } } diff --git a/java/src/com/android/inputmethod/latin/Recorrection.java b/java/src/com/android/inputmethod/deprecated/recorrection/Recorrection.java similarity index 73% rename from java/src/com/android/inputmethod/latin/Recorrection.java rename to java/src/com/android/inputmethod/deprecated/recorrection/Recorrection.java index 3fa6292ba..adf4204f8 100644 --- a/java/src/com/android/inputmethod/latin/Recorrection.java +++ b/java/src/com/android/inputmethod/deprecated/recorrection/Recorrection.java @@ -14,11 +14,21 @@ * the License. */ -package com.android.inputmethod.latin; +package com.android.inputmethod.deprecated.recorrection; import com.android.inputmethod.compat.InputConnectionCompatUtils; import com.android.inputmethod.deprecated.VoiceProxy; import com.android.inputmethod.keyboard.KeyboardSwitcher; +import com.android.inputmethod.latin.AutoCorrection; +import com.android.inputmethod.latin.CandidateView; +import com.android.inputmethod.latin.EditingUtils; +import com.android.inputmethod.latin.LatinIME; +import com.android.inputmethod.latin.R; +import com.android.inputmethod.latin.Settings; +import com.android.inputmethod.latin.Suggest; +import com.android.inputmethod.latin.SuggestedWords; +import com.android.inputmethod.latin.TextEntryState; +import com.android.inputmethod.latin.WordComposer; import android.content.SharedPreferences; import android.content.res.Resources; @@ -37,7 +47,8 @@ public class Recorrection { private LatinIME mService; private boolean mRecorrectionEnabled = false; - private final ArrayList mWordHistory = new ArrayList(); + private final ArrayList mRecorrectionSuggestionsList = + new ArrayList(); public static Recorrection getInstance() { return sInstance; @@ -98,42 +109,42 @@ public class Recorrection { } public void updateRecorrectionSelection(KeyboardSwitcher keyboardSwitcher, - CandidateView candidateView, int candidatesStart, int candidatesEnd, int newSelStart, - int newSelEnd, int oldSelStart, int lastSelectionStart, + 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 { - 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(); - } + if (!mRecorrectionEnabled) return; + if (!mService.isShowingSuggestionsStrip()) return; + if (!keyboardSwitcher.isInputViewShown()) return; + if (!mService.isSuggestionsRequested()) return; + // Don't look for corrections if the keyboard is not visible + // Check if we should go in or out of correction mode. + if ((candidatesStart == candidatesEnd || newSelStart != oldSelStart || TextEntryState + .isRecorrecting()) + && (newSelStart < newSelEnd - 1 || !hasUncommittedTypedChars)) { + if (mService.isCursorTouchingWord() || lastSelectionStart < lastSelectionEnd) { + mService.mHandler.cancelUpdateBigramPredictions(); + mService.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 (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(); } } } } } - public void saveWordInHistory(WordComposer word, CharSequence result) { + public void saveRecorrectionSuggestion(WordComposer word, CharSequence result) { + if (!mRecorrectionEnabled) return; if (word.size() <= 1) { return; } @@ -144,12 +155,13 @@ public class Recorrection { // Make a copy of the CharSequence, since it is/could be a mutable CharSequence final String resultCopy = result.toString(); - WordAlternatives entry = new WordAlternatives(resultCopy, new WordComposer(word)); - mWordHistory.add(entry); + RecorrectionSuggestionEntries entry = new RecorrectionSuggestionEntries( + resultCopy, new WordComposer(word)); + mRecorrectionSuggestionsList.add(entry); } public void clearWordsInHistory() { - mWordHistory.clear(); + mRecorrectionSuggestionsList.clear(); } /** @@ -162,9 +174,9 @@ public class Recorrection { KeyboardSwitcher keyboardSwitcher, EditingUtils.SelectedWord touching) { // If we didn't find a match, search for result in typed word history WordComposer foundWord = null; - WordAlternatives alternatives = null; + RecorrectionSuggestionEntries alternatives = null; // Search old suggestions to suggest re-corrected suggestions. - for (WordAlternatives entry : mWordHistory) { + for (RecorrectionSuggestionEntries entry : mRecorrectionSuggestionsList) { if (TextUtils.equals(entry.getChosenWord(), touching.mWord)) { foundWord = entry.mWordComposer; alternatives = entry; @@ -186,7 +198,7 @@ public class Recorrection { // Found a match, show suggestions if (foundWord != null || alternatives != null) { if (alternatives == null) { - alternatives = new WordAlternatives(touching.mWord, foundWord); + alternatives = new RecorrectionSuggestionEntries(touching.mWord, foundWord); } showRecorrections(suggest, keyboardSwitcher, alternatives); if (foundWord != null) { @@ -201,10 +213,10 @@ public class Recorrection { private void showRecorrections(Suggest suggest, KeyboardSwitcher keyboardSwitcher, - WordAlternatives alternatives) { - SuggestedWords.Builder builder = alternatives.getAlternatives(suggest, keyboardSwitcher); + RecorrectionSuggestionEntries entries) { + SuggestedWords.Builder builder = entries.getAlternatives(suggest, keyboardSwitcher); builder.setTypedWordValid(false).setHasMinimalSuggestion(false); - mService.showSuggestions(builder.build(), alternatives.getOriginalWord()); + mService.showSuggestions(builder.build(), entries.getOriginalWord()); } public void setRecorrectionSuggestions(VoiceProxy voiceProxy, CandidateView candidateView, diff --git a/java/src/com/android/inputmethod/latin/WordAlternatives.java b/java/src/com/android/inputmethod/deprecated/recorrection/RecorrectionSuggestionEntries.java similarity index 83% rename from java/src/com/android/inputmethod/latin/WordAlternatives.java rename to java/src/com/android/inputmethod/deprecated/recorrection/RecorrectionSuggestionEntries.java index 0e9914400..914e2cbc1 100644 --- a/java/src/com/android/inputmethod/latin/WordAlternatives.java +++ b/java/src/com/android/inputmethod/deprecated/recorrection/RecorrectionSuggestionEntries.java @@ -14,17 +14,20 @@ * the License. */ -package com.android.inputmethod.latin; +package com.android.inputmethod.deprecated.recorrection; import com.android.inputmethod.keyboard.KeyboardSwitcher; +import com.android.inputmethod.latin.Suggest; +import com.android.inputmethod.latin.SuggestedWords; +import com.android.inputmethod.latin.WordComposer; import android.text.TextUtils; -public class WordAlternatives { +public class RecorrectionSuggestionEntries { public final CharSequence mChosenWord; public final WordComposer mWordComposer; - public WordAlternatives(CharSequence chosenWord, WordComposer wordComposer) { + public RecorrectionSuggestionEntries(CharSequence chosenWord, WordComposer wordComposer) { mChosenWord = chosenWord; mWordComposer = wordComposer; } @@ -56,4 +59,4 @@ public class WordAlternatives { Suggest suggest, KeyboardSwitcher keyboardSwitcher, WordComposer word) { return suggest.getSuggestedWordBuilder(keyboardSwitcher.getInputView(), word, null); } -} \ No newline at end of file +} diff --git a/java/src/com/android/inputmethod/latin/DictionaryFactory.java b/java/src/com/android/inputmethod/latin/DictionaryFactory.java index 605676d70..bba331868 100644 --- a/java/src/com/android/inputmethod/latin/DictionaryFactory.java +++ b/java/src/com/android/inputmethod/latin/DictionaryFactory.java @@ -142,6 +142,25 @@ public class DictionaryFactory { return hasDictionary; } + // TODO: Do not use the size of the dictionary as an unique dictionary ID. + public static Long getDictionaryId(Context context, Locale locale) { + final Resources res = context.getResources(); + final Locale saveLocale = Utils.setSystemLocale(res, locale); + + final int resourceId = Utils.getMainDictionaryResourceId(res); + final AssetFileDescriptor afd = res.openRawResourceFd(resourceId); + final Long size = (afd != null && afd.getLength() > PLACEHOLDER_LENGTH) + ? afd.getLength() + : null; + try { + if (null != afd) afd.close(); + } catch (java.io.IOException e) { + } + + Utils.setSystemLocale(res, saveLocale); + return size; + } + // TODO: Find the Right Way to find out whether the resource is a placeholder or not. // Suggestion : strip the locale, open the placeholder file and store its offset. // Upon opening the file, if it's the same offset, then it's the placeholder. diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index abe6bdd0d..2858b2fb9 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -25,6 +25,7 @@ import com.android.inputmethod.compat.InputTypeCompatUtils; import com.android.inputmethod.compat.VibratorCompatWrapper; import com.android.inputmethod.deprecated.LanguageSwitcherProxy; import com.android.inputmethod.deprecated.VoiceProxy; +import com.android.inputmethod.deprecated.recorrection.Recorrection; import com.android.inputmethod.keyboard.Keyboard; import com.android.inputmethod.keyboard.KeyboardActionListener; import com.android.inputmethod.keyboard.KeyboardSwitcher; @@ -717,7 +718,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar // If the composing span has been cleared, save the typed word in the history for // recorrection before we reset the candidate strip. Then, we'll be able to show // suggestions for recorrection right away. - mRecorrection.saveWordInHistory(mWord, mComposing); + mRecorrection.saveRecorrectionSuggestion(mWord, mComposing); } mComposing.setLength(0); mHasUncommittedTypedChars = false; @@ -1254,7 +1255,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar if (!mHasUncommittedTypedChars) { mHasUncommittedTypedChars = true; mComposing.setLength(0); - mRecorrection.saveWordInHistory(mWord, mBestWord); + mRecorrection.saveRecorrectionSuggestion(mWord, mBestWord); mWord.reset(); clearSuggestions(); } @@ -1662,7 +1663,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar mVoiceProxy.rememberReplacedWord(suggestion, mWordSeparators); ic.commitText(suggestion, 1); } - mRecorrection.saveWordInHistory(mWord, suggestion); + mRecorrection.saveRecorrectionSuggestion(mWord, suggestion); mHasUncommittedTypedChars = false; mCommittedLength = suggestion.length(); } diff --git a/java/src/com/android/inputmethod/latin/WordComposer.java b/java/src/com/android/inputmethod/latin/WordComposer.java index cf0592920..af5e4b179 100644 --- a/java/src/com/android/inputmethod/latin/WordComposer.java +++ b/java/src/com/android/inputmethod/latin/WordComposer.java @@ -62,7 +62,7 @@ public class WordComposer { mYCoordinates = new int[N]; } - WordComposer(WordComposer source) { + public WordComposer(WordComposer source) { init(source); } From b05c913fb18a3e9d1209d3980c6c236700961f5e Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Fri, 13 May 2011 12:36:49 +0900 Subject: [PATCH 12/19] Remove double high-reversed-9 quotation mark Because current DroidSans font lacks double high-reversed-9 quotation mark '\u201f' glyph (Bug: 4368421), this change remove it from symbol keyboard popup mini keyboard. This change also removes corresponding double low-9 quotation marks as well. Bug: 4347045 Change-Id: I30d1493376efe5af98722e76999107de5dfcae3e --- java/res/xml-xlarge/kbd_symbols.xml | 13 +++++++++---- java/res/xml/kbd_azerty_rows.xml | 3 ++- java/res/xml/kbd_symbols.xml | 5 +++-- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/java/res/xml-xlarge/kbd_symbols.xml b/java/res/xml-xlarge/kbd_symbols.xml index f1deae0f9..312eb139b 100644 --- a/java/res/xml-xlarge/kbd_symbols.xml +++ b/java/res/xml-xlarge/kbd_symbols.xml @@ -137,7 +137,8 @@ latin:mode="url" > + latin:keyLabel="\'" + latin:popupCharacters="‘,’,‚,‛" /> + latin:keyLabel="\'" + latin:popupCharacters="‘,’,‚,‛" /> + + + latin:popupCharacters="“,”,«,»" /> + + latin:popupCharacters="“,”,«,»,‘,’,‚,‛" /> diff --git a/java/res/xml/kbd_azerty_rows.xml b/java/res/xml/kbd_azerty_rows.xml index ab3e1a097..e805d5b1b 100644 --- a/java/res/xml/kbd_azerty_rows.xml +++ b/java/res/xml/kbd_azerty_rows.xml @@ -128,7 +128,8 @@ latin:keyLabel="n" latin:popupCharacters="@string/alternates_for_n" /> + latin:keyLabel="\'" + latin:popupCharacters="‘,’,‚,‛" /> + + latin:popupCharacters="‘,’,‚,‛" /> Date: Fri, 13 May 2011 18:15:39 +0900 Subject: [PATCH 13/19] Update the setting of re-correction when user changed Bug: 4401929 Change-Id: I5929e44f27ba057201110d814e9ec767d09c0ee7 --- .../deprecated/recorrection/Recorrection.java | 44 ++++++++++++++----- 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/java/src/com/android/inputmethod/deprecated/recorrection/Recorrection.java b/java/src/com/android/inputmethod/deprecated/recorrection/Recorrection.java index adf4204f8..bf69d5ced 100644 --- a/java/src/com/android/inputmethod/deprecated/recorrection/Recorrection.java +++ b/java/src/com/android/inputmethod/deprecated/recorrection/Recorrection.java @@ -42,7 +42,8 @@ import java.util.ArrayList; /** * Manager of re-correction functionalities */ -public class Recorrection { +public class Recorrection implements SharedPreferences.OnSharedPreferenceChangeListener { + public static final boolean USE_LEGACY_RECORRECTION = true; private static final Recorrection sInstance = new Recorrection(); private LatinIME mService; @@ -69,20 +70,17 @@ public class Recorrection { } 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); + if (!USE_LEGACY_RECORRECTION) { + mRecorrectionEnabled = false; + return; } + updateRecorrectionEnabled(context.getResources(), prefs); mService = context; + prefs.registerOnSharedPreferenceChangeListener(this); } public void checkRecorrectionOnStart() { - if (!mRecorrectionEnabled) return; + if (!USE_LEGACY_RECORRECTION || !mRecorrectionEnabled) return; final InputConnection ic = mService.getCurrentInputConnection(); if (ic == null) return; @@ -112,7 +110,7 @@ public class Recorrection { CandidateView candidateView, int candidatesStart, int candidatesEnd, int newSelStart, int newSelEnd, int oldSelStart, int lastSelectionStart, int lastSelectionEnd, boolean hasUncommittedTypedChars) { - if (!mRecorrectionEnabled) return; + if (!USE_LEGACY_RECORRECTION || !mRecorrectionEnabled) return; if (!mService.isShowingSuggestionsStrip()) return; if (!keyboardSwitcher.isInputViewShown()) return; if (!mService.isSuggestionsRequested()) return; @@ -144,7 +142,7 @@ public class Recorrection { } public void saveRecorrectionSuggestion(WordComposer word, CharSequence result) { - if (!mRecorrectionEnabled) return; + if (!USE_LEGACY_RECORRECTION || !mRecorrectionEnabled) return; if (word.size() <= 1) { return; } @@ -172,6 +170,7 @@ public class Recorrection { */ public boolean applyTypedAlternatives(WordComposer word, Suggest suggest, KeyboardSwitcher keyboardSwitcher, EditingUtils.SelectedWord touching) { + if (!USE_LEGACY_RECORRECTION || !mRecorrectionEnabled) return false; // If we didn't find a match, search for result in typed word history WordComposer foundWord = null; RecorrectionSuggestionEntries alternatives = null; @@ -224,6 +223,7 @@ public class Recorrection { boolean hasUncommittedTypedChars, int lastSelectionStart, int lastSelectionEnd, String wordSeparators) { if (!InputConnectionCompatUtils.RECORRECTION_SUPPORTED) return; + if (!USE_LEGACY_RECORRECTION || !mRecorrectionEnabled) return; voiceProxy.setShowingVoiceSuggestions(false); if (candidateView != null && candidateView.isShowingAddToDictionaryHint()) { return; @@ -257,6 +257,7 @@ public class Recorrection { } public void abortRecorrection(boolean force) { + if (!USE_LEGACY_RECORRECTION) return; if (force || TextEntryState.isRecorrecting()) { TextEntryState.onAbortRecorrection(); mService.setCandidatesViewShown(mService.isCandidateStripVisible()); @@ -264,4 +265,23 @@ public class Recorrection { mService.clearSuggestions(); } } + + public void updateRecorrectionEnabled(Resources res, SharedPreferences prefs) { + // 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); + } + } + + @Override + public void onSharedPreferenceChanged(SharedPreferences prefs, String key) { + if (!USE_LEGACY_RECORRECTION) return; + if (key.equals(Settings.PREF_RECORRECTION_ENABLED)) { + updateRecorrectionEnabled(mService.getResources(), prefs); + } + } } From d157834345f2817cb80db3fdb7e6f22efa92f70c Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Thu, 12 May 2011 23:49:19 +0900 Subject: [PATCH 14/19] Auto text sizing using fraction of key height Bug: 4411676 Change-Id: I8f289dcebe577d277fe2ad6a8331d59f735cbada --- java/res/values-land/dimens.xml | 3 ++ java/res/values-xlarge-land/dimens.xml | 4 +-- java/res/values-xlarge/dimens.xml | 6 ++-- java/res/values/attrs.xml | 10 +++--- java/res/values/dimens.xml | 7 ++--- java/res/values/styles.xml | 4 +-- .../inputmethod/keyboard/KeyboardView.java | 31 ++++++++++++++----- 7 files changed, 43 insertions(+), 22 deletions(-) diff --git a/java/res/values-land/dimens.xml b/java/res/values-land/dimens.xml index 496da3de1..a541287f0 100644 --- a/java/res/values-land/dimens.xml +++ b/java/res/values-land/dimens.xml @@ -29,6 +29,9 @@ 0.0in 0.0in 0.0in + 55% + 35% + 90% 38dip 63dip 2dip diff --git a/java/res/values-xlarge-land/dimens.xml b/java/res/values-xlarge-land/dimens.xml index fd6b1f386..ade125639 100644 --- a/java/res/values-xlarge-land/dimens.xml +++ b/java/res/values-xlarge-land/dimens.xml @@ -30,8 +30,8 @@ 0.0mm 0.0mm - 28dip - 20dip + 30.7% + 21.9% 18dip 26.5mm diff --git a/java/res/values-xlarge/dimens.xml b/java/res/values-xlarge/dimens.xml index 4f78bea4f..2796b6fcb 100644 --- a/java/res/values-xlarge/dimens.xml +++ b/java/res/values-xlarge/dimens.xml @@ -37,11 +37,11 @@ -13.0mm - 26dip - 16dip + 34.4% + 21.2% 6dip - 24dip + 26.3% 23.0mm 8.0mm diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml index 7f2a400df..f03da4f8f 100644 --- a/java/res/values/attrs.xml +++ b/java/res/values/attrs.xml @@ -25,11 +25,13 @@ checkable+checked+pressed. --> - - + + - - + + diff --git a/java/res/values/dimens.xml b/java/res/values/dimens.xml index 82abf3b05..8f719541e 100644 --- a/java/res/values/dimens.xml +++ b/java/res/values/dimens.xml @@ -43,14 +43,13 @@ to user's finger. --> -0.05in - - 21dip - 13dip + 45% + 29% 21dip 80sp 0.000in - 36sp + 82% 130sp 0.193in diff --git a/java/res/values/styles.xml b/java/res/values/styles.xml index 8a4b16d7a..3a389e57b 100644 --- a/java/res/values/styles.xml +++ b/java/res/values/styles.xml @@ -19,14 +19,14 @@ @drawable/keyboard_background @drawable/btn_keyboard_key - @dimen/key_letter_size + @fraction/key_letter_ratio normal #FFFFFFFF #FFFFFFFF @layout/key_preview @dimen/key_preview_offset @dimen/key_preview_height - @dimen/key_label_text_size + @fraction/key_label_text_ratio @layout/keyboard_popup @dimen/key_hysteresis_distance @dimen/keyboard_vertical_correction diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java index bbda4009f..1ea1436d3 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java @@ -86,10 +86,12 @@ public class KeyboardView extends View implements PointerTracker.UIProxy { private static final int HINT_ICON_VERTICAL_ADJUSTMENT_PIXEL = -1; // XML attribute + private float mKeyLetterRatio; private int mKeyLetterSize; private int mKeyTextColor; private int mKeyTextColorDisabled; private Typeface mKeyLetterStyle = Typeface.DEFAULT; + private float mLabelTextRatio; private int mLabelTextSize; private int mColorScheme = COLOR_SCHEME_WHITE; private int mShadowColor; @@ -108,7 +110,8 @@ public class KeyboardView extends View implements PointerTracker.UIProxy { // Key preview private boolean mInForeground; private TextView mPreviewText; - private int mPreviewTextSizeLarge; + private float mPreviewTextRatio; + private int mPreviewTextSize; private boolean mShowKeyPreview = true; private int mKeyPreviewDisplayedY; private final int mDelayBeforePreview; @@ -327,8 +330,8 @@ public class KeyboardView extends View implements PointerTracker.UIProxy { case R.styleable.KeyboardView_keyPreviewHeight: mPreviewHeight = a.getDimensionPixelSize(attr, 80); break; - case R.styleable.KeyboardView_keyLetterSize: - mKeyLetterSize = a.getDimensionPixelSize(attr, 18); + case R.styleable.KeyboardView_keyLetterRatio: + mKeyLetterRatio = getRatio(a, attr); break; case R.styleable.KeyboardView_keyTextColor: mKeyTextColor = a.getColor(attr, 0xFF000000); @@ -336,8 +339,8 @@ public class KeyboardView extends View implements PointerTracker.UIProxy { case R.styleable.KeyboardView_keyTextColorDisabled: mKeyTextColorDisabled = a.getColor(attr, 0xFF000000); break; - case R.styleable.KeyboardView_labelTextSize: - mLabelTextSize = a.getDimensionPixelSize(attr, 14); + case R.styleable.KeyboardView_labelTextRatio: + mLabelTextRatio = getRatio(a, attr); break; case R.styleable.KeyboardView_popupLayout: mPopupLayout = a.getResourceId(attr, 0); @@ -365,7 +368,7 @@ public class KeyboardView extends View implements PointerTracker.UIProxy { if (previewLayout != 0) { mPreviewText = (TextView) LayoutInflater.from(context).inflate(previewLayout, null); - mPreviewTextSizeLarge = (int) res.getDimension(R.dimen.key_preview_text_size_large); + mPreviewTextRatio = getRatio(res, R.fraction.key_preview_text_ratio); } else { mShowKeyPreview = false; } @@ -460,6 +463,16 @@ public class KeyboardView extends View implements PointerTracker.UIProxy { mKeyRepeatInterval = res.getInteger(R.integer.config_key_repeat_interval); } + // Read fraction value in TypedArray as float. + private static float getRatio(TypedArray a, int index) { + return a.getFraction(index, 1000, 1000, 1) / 1000.0f; + } + + // Read fraction value in resource as float. + private static float getRatio(Resources res, int id) { + return res.getFraction(id, 1000, 1000) / 1000.0f; + } + public void startIgnoringDoubleTap() { if (ENABLE_CAPSLOCK_BY_DOUBLETAP) mHandler.startIgnoringDoubleTap(); @@ -506,6 +519,10 @@ public class KeyboardView extends View implements PointerTracker.UIProxy { invalidateAllKeys(); mKeyDetector.setProximityThreshold(keyboard.getMostCommonKeyWidth()); mPopupPanelCache.clear(); + final int keyHeight = keyboard.getRowHeight() - keyboard.getVerticalGap(); + mKeyLetterSize = (int)(keyHeight * mKeyLetterRatio); + mLabelTextSize = (int)(keyHeight * mLabelTextRatio); + mPreviewTextSize = (int)(keyHeight * mPreviewTextRatio); } /** @@ -938,7 +955,7 @@ public class KeyboardView extends View implements PointerTracker.UIProxy { previewText.setTextSize(TypedValue.COMPLEX_UNIT_PX, mKeyLetterSize); previewText.setTypeface(Typeface.DEFAULT_BOLD); } else { - previewText.setTextSize(TypedValue.COMPLEX_UNIT_PX, mPreviewTextSizeLarge); + previewText.setTextSize(TypedValue.COMPLEX_UNIT_PX, mPreviewTextSize); previewText.setTypeface(mKeyLetterStyle); } } else { From 777118a40a363ccab69a00016d3156066513cb78 Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Fri, 13 May 2011 19:33:33 +0900 Subject: [PATCH 15/19] Fix a bug with dictionary add interface. Fix a bug where the "Touch again to save" message would not stay on screen, following a wrong fix for a problem where Gingerbread- would not display punctuation in the suggestion strip in WebTextView. Change-Id: I3556f83f867240ed7f16753450e6c975853208e5 --- java/src/com/android/inputmethod/latin/LatinIME.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 2d4d7b989..126fe0c18 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -1603,11 +1603,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar // TextEntryState.State.PICKED_SUGGESTION state. TextEntryState.typedCharacter((char) Keyboard.CODE_SPACE, true, WordComposer.NOT_A_COORDINATE, WordComposer.NOT_A_COORDINATE); - // On Honeycomb+, onUpdateSelection() will fire, but in Gingerbread- in WebTextView - // only it does not, for some reason. Force update suggestions so that it works - // in Gingerbread- in WebTextView too. - mHandler.postUpdateSuggestions(); - } else if (!showingAddToDictionaryHint) { + } + if (!showingAddToDictionaryHint) { // If we're not showing the "Touch again to save", then show corrections again. // In case the cursor position doesn't change, make sure we show the suggestions again. clearSuggestions(); From bdd9341f616262f5a5cc49d4a337bac605db8e46 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Fri, 13 May 2011 19:29:25 +0900 Subject: [PATCH 16/19] Refactor KeyboardView constructor Change-Id: I1fd869c180c6c9f966936fce90bc031bc7824983 --- .../inputmethod/keyboard/KeyboardView.java | 127 +++++++----------- 1 file changed, 48 insertions(+), 79 deletions(-) diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java index 1ea1436d3..31188480f 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java @@ -58,14 +58,22 @@ import java.util.WeakHashMap; * A view that renders a virtual {@link Keyboard}. It handles rendering of keys and detecting key * presses and touch movements. * + * @attr ref R.styleable#KeyboardView_backgroundDimAmount + * @attr ref R.styleable#KeyboardView_colorScheme * @attr ref R.styleable#KeyboardView_keyBackground + * @attr ref R.styleable#KeyboardView_keyHysteresisDistance + * @attr ref R.styleable#KeyboardView_keyLetterRatio + * @attr ref R.styleable#KeyboardView_keyLetterStyle * @attr ref R.styleable#KeyboardView_keyPreviewLayout * @attr ref R.styleable#KeyboardView_keyPreviewOffset - * @attr ref R.styleable#KeyboardView_labelTextSize - * @attr ref R.styleable#KeyboardView_keyTextSize + * @attr ref R.styleable#KeyboardView_keyPreviewHeight * @attr ref R.styleable#KeyboardView_keyTextColor + * @attr ref R.styleable#KeyboardView_keyTextColorDisabled + * @attr ref R.styleable#KeyboardView_labelTextRatio * @attr ref R.styleable#KeyboardView_verticalCorrection * @attr ref R.styleable#KeyboardView_popupLayout + * @attr ref R.styleable#KeyboardView_shadowColor + * @attr ref R.styleable#KeyboardView_shadowRadius */ public class KeyboardView extends View implements PointerTracker.UIProxy { private static final String TAG = KeyboardView.class.getSimpleName(); @@ -86,26 +94,26 @@ public class KeyboardView extends View implements PointerTracker.UIProxy { private static final int HINT_ICON_VERTICAL_ADJUSTMENT_PIXEL = -1; // XML attribute - private float mKeyLetterRatio; - private int mKeyLetterSize; - private int mKeyTextColor; - private int mKeyTextColorDisabled; - private Typeface mKeyLetterStyle = Typeface.DEFAULT; - private float mLabelTextRatio; - private int mLabelTextSize; - private int mColorScheme = COLOR_SCHEME_WHITE; - private int mShadowColor; - private float mShadowRadius; - private Drawable mKeyBackground; - private float mBackgroundDimAmount; - private float mKeyHysteresisDistance; - private float mVerticalCorrection; - private int mPreviewOffset; - private int mPreviewHeight; - private int mPopupLayout; + private final float mKeyLetterRatio; + private final int mKeyTextColor; + private final int mKeyTextColorDisabled; + private final Typeface mKeyLetterStyle; + private final float mLabelTextRatio; + private final int mColorScheme; + private final int mShadowColor; + private final float mShadowRadius; + private final Drawable mKeyBackground; + private final float mBackgroundDimAmount; + private final float mKeyHysteresisDistance; + private final float mVerticalCorrection; + private final int mPreviewOffset; + private final int mPreviewHeight; + private final int mPopupLayout; // Main keyboard private Keyboard mKeyboard; + private int mKeyLetterSize; + private int mLabelTextSize; // Key preview private boolean mInForeground; @@ -303,66 +311,28 @@ public class KeyboardView extends View implements PointerTracker.UIProxy { final TypedArray a = context.obtainStyledAttributes( attrs, R.styleable.KeyboardView, defStyle, R.style.KeyboardView); - int previewLayout = 0; - int keyTextSize = 0; - int n = a.getIndexCount(); - - for (int i = 0; i < n; i++) { - int attr = a.getIndex(i); - - switch (attr) { - case R.styleable.KeyboardView_keyBackground: - mKeyBackground = a.getDrawable(attr); - break; - case R.styleable.KeyboardView_keyHysteresisDistance: - mKeyHysteresisDistance = a.getDimensionPixelOffset(attr, 0); - break; - case R.styleable.KeyboardView_verticalCorrection: - mVerticalCorrection = a.getDimensionPixelOffset(attr, 0); - break; - case R.styleable.KeyboardView_keyPreviewLayout: - previewLayout = a.getResourceId(attr, 0); - break; - case R.styleable.KeyboardView_keyPreviewOffset: - mPreviewOffset = a.getDimensionPixelOffset(attr, 0); - break; - case R.styleable.KeyboardView_keyPreviewHeight: - mPreviewHeight = a.getDimensionPixelSize(attr, 80); - break; - case R.styleable.KeyboardView_keyLetterRatio: - mKeyLetterRatio = getRatio(a, attr); - break; - case R.styleable.KeyboardView_keyTextColor: - mKeyTextColor = a.getColor(attr, 0xFF000000); - break; - case R.styleable.KeyboardView_keyTextColorDisabled: - mKeyTextColorDisabled = a.getColor(attr, 0xFF000000); - break; - case R.styleable.KeyboardView_labelTextRatio: - mLabelTextRatio = getRatio(a, attr); - break; - case R.styleable.KeyboardView_popupLayout: - mPopupLayout = a.getResourceId(attr, 0); - break; - case R.styleable.KeyboardView_shadowColor: - mShadowColor = a.getColor(attr, 0); - break; - case R.styleable.KeyboardView_shadowRadius: - mShadowRadius = a.getFloat(attr, 0f); - break; - // TODO: Use Theme (android.R.styleable.Theme_backgroundDimAmount) - case R.styleable.KeyboardView_backgroundDimAmount: - mBackgroundDimAmount = a.getFloat(attr, 0.5f); - break; - case R.styleable.KeyboardView_keyLetterStyle: - mKeyLetterStyle = Typeface.defaultFromStyle(a.getInt(attr, Typeface.NORMAL)); - break; - case R.styleable.KeyboardView_colorScheme: - mColorScheme = a.getInt(attr, COLOR_SCHEME_WHITE); - break; - } - } + mKeyBackground = a.getDrawable(R.styleable.KeyboardView_keyBackground); + mKeyHysteresisDistance = a.getDimensionPixelOffset( + R.styleable.KeyboardView_keyHysteresisDistance, 0); + mVerticalCorrection = a.getDimensionPixelOffset( + R.styleable.KeyboardView_verticalCorrection, 0); + final int previewLayout = a.getResourceId(R.styleable.KeyboardView_keyPreviewLayout, 0); + mPreviewOffset = a.getDimensionPixelOffset(R.styleable.KeyboardView_keyPreviewOffset, 0); + mPreviewHeight = a.getDimensionPixelSize(R.styleable.KeyboardView_keyPreviewHeight, 80); + mKeyLetterRatio = getRatio(a, R.styleable.KeyboardView_keyLetterRatio); + mKeyTextColor = a.getColor(R.styleable.KeyboardView_keyTextColor, 0xFF000000); + mKeyTextColorDisabled = a.getColor( + R.styleable.KeyboardView_keyTextColorDisabled, 0xFF000000); + mLabelTextRatio = getRatio(a, R.styleable.KeyboardView_labelTextRatio); + mPopupLayout = a.getResourceId(R.styleable.KeyboardView_popupLayout, 0); + mShadowColor = a.getColor(R.styleable.KeyboardView_shadowColor, 0); + mShadowRadius = a.getFloat(R.styleable.KeyboardView_shadowRadius, 0f); + // TODO: Use Theme (android.R.styleable.Theme_backgroundDimAmount) + mBackgroundDimAmount = a.getFloat(R.styleable.KeyboardView_backgroundDimAmount, 0.5f); + mKeyLetterStyle = Typeface.defaultFromStyle( + a.getInt(R.styleable.KeyboardView_keyLetterStyle, Typeface.NORMAL)); + mColorScheme = a.getInt(R.styleable.KeyboardView_colorScheme, COLOR_SCHEME_WHITE); final Resources res = getResources(); @@ -379,7 +349,6 @@ public class KeyboardView extends View implements PointerTracker.UIProxy { mPaint = new Paint(); mPaint.setAntiAlias(true); - mPaint.setTextSize(keyTextSize); mPaint.setTextAlign(Align.CENTER); mPaint.setAlpha(255); From fe1a6d961cf039357f061482461e4d2e951ad346 Mon Sep 17 00:00:00 2001 From: satok Date: Fri, 13 May 2011 20:27:01 +0900 Subject: [PATCH 17/19] Fix null pointer exception in LatinIME Change-Id: Ic4d60fe651bdc83771137c0f61f07c3879a3f1a1 --- .../android/inputmethod/latin/LatinIME.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 2d4d7b989..e1fa0abf6 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -1465,14 +1465,17 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar // in most cases, suggestion count is 1 when typed word's length is 1, but we do always // need to clear the previous state when the user starts typing a word (i.e. typed word's // length == 1). - if (builder.size() > 1 || typedWord.length() == 1 || typedWordValid - || mCandidateView.isShowingAddToDictionaryHint()) { - builder.setTypedWordValid(typedWordValid).setHasMinimalSuggestion(correctionAvailable); - } else { - final SuggestedWords previousSuggestions = mCandidateView.getSuggestions(); - if (previousSuggestions == mSettingsValues.mSuggestPuncList) - return; - builder.addTypedWordAndPreviousSuggestions(typedWord, previousSuggestions); + if (typedWord != null) { + if (builder.size() > 1 || typedWord.length() == 1 || typedWordValid + || mCandidateView.isShowingAddToDictionaryHint()) { + builder.setTypedWordValid(typedWordValid).setHasMinimalSuggestion( + correctionAvailable); + } else { + final SuggestedWords previousSuggestions = mCandidateView.getSuggestions(); + if (previousSuggestions == mSettingsValues.mSuggestPuncList) + return; + builder.addTypedWordAndPreviousSuggestions(typedWord, previousSuggestions); + } } showSuggestions(builder.build(), typedWord); } From 240297d0ee186b14e795016e9b1bd168c8d8acf8 Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Wed, 11 May 2011 20:51:07 +0900 Subject: [PATCH 18/19] Add advanced settings screen Also add an option for popup dismissal delay so as to inaugurate the new screen. Besides, remove a path for options to escape from LatinIME and replace with a direct read from the settings. Change-Id: I7ec6e724262871fa6523506ecc39f65c5fbe34da --- java/res/values/strings.xml | 12 +++ java/res/xml/prefs.xml | 9 ++ .../keyboard/KeyboardSwitcher.java | 4 +- .../inputmethod/keyboard/KeyboardView.java | 30 +++---- .../keyboard/LatinKeyboardView.java | 9 +- .../keyboard/PopupMiniKeyboardView.java | 13 +-- .../android/inputmethod/latin/LatinIME.java | 8 +- .../android/inputmethod/latin/Settings.java | 82 +++++++++++++++---- 8 files changed, 123 insertions(+), 44 deletions(-) diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml index 51fafd4f1..88f07f558 100644 --- a/java/res/values/strings.xml +++ b/java/res/values/strings.xml @@ -46,6 +46,18 @@ Other options + + Advanced settings + + Options for expert users + + + Key popup dismiss delay + + No delay + + Default + Auto-capitalization diff --git a/java/res/xml/prefs.xml b/java/res/xml/prefs.xml index 24a1d45a5..b0497a51c 100644 --- a/java/res/xml/prefs.xml +++ b/java/res/xml/prefs.xml @@ -130,6 +130,15 @@ android:entries="@array/keyboard_layout_modes" android:defaultValue="@string/config_default_keyboard_theme_id" /> + + + + 21dip 80sp - 0.000in + 0.1in 82% 130sp 0.193in