From 4a1113b6b065931322df8bba375864274a898acf Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Wed, 4 Jun 2014 15:19:10 +0900 Subject: Refactoring Rename `initialize' to `start' and `deactivate' to `stop' for ease of understanding. It's completely bizarre that you can "deactivate" a recapitalization and that will just restart a new one the next time you press shift. Start and stop are easier to understand. Change-Id: I455175aebfcfe11198c6c61bf2c6b19efc3f82df --- .../android/inputmethod/latin/inputlogic/InputLogic.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java') diff --git a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java index f36b42a40..55cc135d3 100644 --- a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java +++ b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java @@ -134,7 +134,7 @@ public final class InputLogic { resetComposingState(true /* alsoResetLastComposedWord */); mDeleteCount = 0; mSpaceState = SpaceState.NONE; - mRecapitalizeStatus.deactivate(); + mRecapitalizeStatus.stop(); // In case a recapitalization is started mCurrentlyPressedHardwareKeys.clear(); mSuggestedWords = SuggestedWords.EMPTY; // In some cases (namely, after rotation of the device) editorInfo.initialSelStart is lying @@ -347,8 +347,8 @@ public final class InputLogic { // We moved the cursor. If we are touching a word, we need to resume suggestion. mLatinIME.mHandler.postResumeSuggestions(); - // Reset the last recapitalization. - mRecapitalizeStatus.deactivate(); + // Stop the last recapitalization, if started. + mRecapitalizeStatus.stop(); return true; } @@ -1149,13 +1149,13 @@ public final class InputLogic { // to suck possibly multiple-megabyte data. return; } - // If we have a recapitalize in progress, use it; otherwise, create a new one. - if (!mRecapitalizeStatus.isActive() + // If we have a recapitalize in progress, use it; otherwise, start a new one. + if (!mRecapitalizeStatus.isStarted() || !mRecapitalizeStatus.isSetAt(selectionStart, selectionEnd)) { final CharSequence selectedText = mConnection.getSelectedText(0 /* flags, 0 for no styles */); if (TextUtils.isEmpty(selectedText)) return; // Race condition with the input connection - mRecapitalizeStatus.initialize(selectionStart, selectionEnd, selectedText.toString(), + mRecapitalizeStatus.start(selectionStart, selectionEnd, selectedText.toString(), settingsValues.mLocale, settingsValues.mSpacingAndPunctuations.mSortedWordSeparators); // We trim leading and trailing whitespace. @@ -1498,7 +1498,7 @@ public final class InputLogic { } public int getCurrentRecapitalizeState() { - if (!mRecapitalizeStatus.isActive() + if (!mRecapitalizeStatus.isStarted() || !mRecapitalizeStatus.isSetAt(mConnection.getExpectedSelectionStart(), mConnection.getExpectedSelectionEnd())) { // Not recapitalizing at the moment -- cgit v1.2.3-83-g751a