From 2b6a1fed767080aaa71acbd591d30b9f436b0499 Mon Sep 17 00:00:00 2001 From: Ken Wakasa Date: Wed, 5 Dec 2012 12:35:41 +0900 Subject: [PATCH] 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(); }