From 2b6a1fed767080aaa71acbd591d30b9f436b0499 Mon Sep 17 00:00:00 2001 From: Ken Wakasa Date: Wed, 5 Dec 2012 12:35:41 +0900 Subject: [PATCH 1/2] Method/variable/resource names clean up for the double-space period bug: 7664717 Change-Id: I914aa588b863c442c2d360221e3fa0f4c42640e7 --- java/res/values/config.xml | 2 +- .../android/inputmethod/latin/LatinIME.java | 44 +++++++++---------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/java/res/values/config.xml b/java/res/values/config.xml index 8d947b327..dc5a3d182 100644 --- a/java/res/values/config.xml +++ b/java/res/values/config.xml @@ -41,7 +41,7 @@ 100 32 16 - 1100 + 1100 5 5 diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index d8e536745..179b56b72 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -193,8 +193,8 @@ public final class LatinIME extends InputMethodService implements KeyboardAction private int mDelayUpdateSuggestions; private int mDelayUpdateShiftState; - private long mDoubleSpacesTurnIntoPeriodTimeout; - private long mDoubleSpaceTimerStart; + private long mDoubleSpacePeriodTimeout; + private long mDoubleSpacePeriodTimerStart; public UIHandler(final LatinIME outerInstance) { super(outerInstance); @@ -206,8 +206,8 @@ public final class LatinIME extends InputMethodService implements KeyboardAction res.getInteger(R.integer.config_delay_update_suggestions); mDelayUpdateShiftState = res.getInteger(R.integer.config_delay_update_shift_state); - mDoubleSpacesTurnIntoPeriodTimeout = res.getInteger( - R.integer.config_double_spaces_turn_into_period_timeout); + mDoubleSpacePeriodTimeout = + res.getInteger(R.integer.config_double_space_period_timeout); } @Override @@ -258,17 +258,17 @@ public final class LatinIME extends InputMethodService implements KeyboardAction .sendToTarget(); } - public void startDoubleSpacesTimer() { - mDoubleSpaceTimerStart = SystemClock.uptimeMillis(); + public void startDoubleSpacePeriodTimer() { + mDoubleSpacePeriodTimerStart = SystemClock.uptimeMillis(); } - public void cancelDoubleSpacesTimer() { - mDoubleSpaceTimerStart = 0; + public void cancelDoubleSpacePeriodTimer() { + mDoubleSpacePeriodTimerStart = 0; } - public boolean isAcceptingDoubleSpaces() { - return SystemClock.uptimeMillis() - mDoubleSpaceTimerStart - < mDoubleSpacesTurnIntoPeriodTimeout; + public boolean isAcceptingDoubleSpacePeriod() { + return SystemClock.uptimeMillis() - mDoubleSpacePeriodTimerStart + < mDoubleSpacePeriodTimeout; } // Working variables for the following methods. @@ -770,7 +770,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction mLastSelectionEnd = editorInfo.initialSelEnd; mHandler.cancelUpdateSuggestionStrip(); - mHandler.cancelDoubleSpacesTimer(); + mHandler.cancelDoubleSpacePeriodTimer(); mainKeyboardView.setMainDictionaryAvailability(mIsMainDictionaryAvailable); mainKeyboardView.setKeyPreviewPopupEnabled(mCurrentSettings.mKeyPreviewPopupOn, @@ -1175,16 +1175,16 @@ public final class LatinIME extends InputMethodService implements KeyboardAction } } - private boolean maybeDoubleSpace() { + private boolean maybeDoubleSpacePeriod() { if (!mCurrentSettings.mCorrectionEnabled) return false; if (!mCurrentSettings.mUseDoubleSpacePeriod) return false; - if (!mHandler.isAcceptingDoubleSpaces()) return false; + if (!mHandler.isAcceptingDoubleSpacePeriod()) return false; final CharSequence lastThree = mConnection.getTextBeforeCursor(3, 0); if (lastThree != null && lastThree.length() == 3 - && canBeFollowedByPeriod(lastThree.charAt(0)) + && canBeFollowedByDoubleSpacePeriod(lastThree.charAt(0)) && lastThree.charAt(1) == Constants.CODE_SPACE && lastThree.charAt(2) == Constants.CODE_SPACE) { - mHandler.cancelDoubleSpacesTimer(); + mHandler.cancelDoubleSpacePeriodTimer(); mConnection.deleteSurroundingText(2, 0); mConnection.commitText(". ", 1); mKeyboardSwitcher.updateShiftState(); @@ -1193,7 +1193,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction return false; } - private static boolean canBeFollowedByPeriod(final int codePoint) { + private static boolean canBeFollowedByDoubleSpacePeriod(final int codePoint) { // TODO: Check again whether there really ain't a better way to check this. // TODO: This should probably be language-dependant... return Character.isLetterOrDigit(codePoint) @@ -1315,9 +1315,9 @@ public final class LatinIME extends InputMethodService implements KeyboardAction final int spaceState = mSpaceState; if (!mWordComposer.isComposingWord()) mIsAutoCorrectionIndicatorOn = false; - // TODO: Consolidate the double space timer, mLastKeyTime, and the space state. + // TODO: Consolidate the double-space period timer, mLastKeyTime, and the space state. if (primaryCode != Constants.CODE_SPACE) { - mHandler.cancelDoubleSpacesTimer(); + mHandler.cancelDoubleSpacePeriodTimer(); } boolean didAutoCorrect = false; @@ -1661,7 +1661,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction return; } if (SPACE_STATE_DOUBLE == spaceState) { - mHandler.cancelDoubleSpacesTimer(); + mHandler.cancelDoubleSpacePeriodTimer(); if (mConnection.revertDoubleSpace()) { // No need to reset mSpaceState, it has already be done (that's why we // receive it as a parameter) @@ -1823,14 +1823,14 @@ public final class LatinIME extends InputMethodService implements KeyboardAction if (Constants.CODE_SPACE == primaryCode) { if (mCurrentSettings.isSuggestionsRequested(mDisplayOrientation)) { - if (maybeDoubleSpace()) { + if (maybeDoubleSpacePeriod()) { mSpaceState = SPACE_STATE_DOUBLE; } else if (!isShowingPunctuationList()) { mSpaceState = SPACE_STATE_WEAK; } } - mHandler.startDoubleSpacesTimer(); + mHandler.startDoubleSpacePeriodTimer(); if (!mConnection.isCursorTouchingWord(mCurrentSettings)) { mHandler.postUpdateSuggestionStrip(); } From 6ec4423878dc1ea040c76379d5f09fb92e212438 Mon Sep 17 00:00:00 2001 From: Baligh Uddin Date: Wed, 5 Dec 2012 14:02:25 -0800 Subject: [PATCH 2/2] Import translations. DO NOT MERGE Change-Id: I14e7f5010ca72fe9ea0ab2304ffd018a82525f6f Auto-generated-cl: translation import --- java/res/values-ca/strings.xml | 6 ++---- java/res/values-el/strings.xml | 6 ++---- java/res/values-it/strings.xml | 6 ++---- java/res/values-iw/strings.xml | 6 ++---- 4 files changed, 8 insertions(+), 16 deletions(-) diff --git a/java/res/values-ca/strings.xml b/java/res/values-ca/strings.xml index 273b555dd..4e1bbd273 100644 --- a/java/res/values-ca/strings.xml +++ b/java/res/values-ca/strings.xml @@ -44,10 +44,8 @@ "Predeterminat" "Suggereix noms de contactes" "Utilitza els noms de contactes per fer suggeriments i correccions" - - - - + "Punt amb doble espai" + "Picar dues vegades la barra espaiad. insereix punt i espai blanc" "Majúscules automàtiques" "Posa en majúscula la primera paraula de cada frase" "Diccionaris complementaris" diff --git a/java/res/values-el/strings.xml b/java/res/values-el/strings.xml index 85ed3dfd8..1ab64f9da 100644 --- a/java/res/values-el/strings.xml +++ b/java/res/values-el/strings.xml @@ -44,10 +44,8 @@ "Προεπιλογή" "Πρόταση ονομάτων επαφών" "Χρησιμοποιήστε ονόματα από τις Επαφές για προτάσεις και διορθ." - - - - + "Τελεία με διπλό πάτημα πλήκρου διαστ." + "Το διπλό πάτημα του πλήκτρ.διαστ. εισάγει μια τελεία και ένα κενό" "Αυτόματη χρήση κεφαλαίων" "Χρήση κεφαλαίου στην πρώτη λέξη κάθε πρότασης" "Πρόσθετα λεξικά" diff --git a/java/res/values-it/strings.xml b/java/res/values-it/strings.xml index fd1717fdc..a3ed5dd1f 100644 --- a/java/res/values-it/strings.xml +++ b/java/res/values-it/strings.xml @@ -44,10 +44,8 @@ "Predefinito" "Suggerisci nomi di contatti" "Utilizza nomi di Contatti per suggerimenti e correzioni" - - - - + "Doppio spazio per punto" + "Tocca due volte barra spaziatr. per inserire punto seguito da spazio" "Maiuscole automatiche" "Iniziale maiuscola per la prima parola di ogni frase" "Dizionari aggiuntivi" diff --git a/java/res/values-iw/strings.xml b/java/res/values-iw/strings.xml index 90a603299..3c58b9cc2 100644 --- a/java/res/values-iw/strings.xml +++ b/java/res/values-iw/strings.xml @@ -44,10 +44,8 @@ "ברירת מחדל" "הצע שמות של אנשי קשר" "השתמש בשמות מרשימת אנשי הקשר עבור הצעות ותיקונים" - - - - + "רווח כפול לנקודה" + "הקשה פעמיים על מקש הרווח מזינה נקודה ואחריה רווח" "הפיכת אותיות לרישיות באופן אוטומטי" "השתמש באות גדולה במילה הראשונה של כל משפט" "הוספת מילונים"