diff options
author | 2013-04-17 19:47:27 -0700 | |
---|---|---|
committer | 2013-04-17 19:47:27 -0700 | |
commit | fe48f31e56d5dfffc84d0be18b0eb6002662337f (patch) | |
tree | 6036e6dfd1efcf2072d2731b1af74d1b7bb531d2 /java/src/com/android/inputmethod/latin/LatinIME.java | |
parent | 57ac9afcc8e35aa118a431978b1eac0b79772e19 (diff) | |
parent | ced547f74156a3482698037bdfaa82ac78b01a91 (diff) | |
download | latinime-fe48f31e56d5dfffc84d0be18b0eb6002662337f.tar.gz latinime-fe48f31e56d5dfffc84d0be18b0eb6002662337f.tar.xz latinime-fe48f31e56d5dfffc84d0be18b0eb6002662337f.zip |
am ced547f7: am e259b9f5: Merge "Clean up RecapitalizeStatus"
* commit 'ced547f74156a3482698037bdfaa82ac78b01a91':
Clean up RecapitalizeStatus
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinIME.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIME.java | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 6cc220614..4b33867c0 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -161,7 +161,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction mPositionalInfoForUserDictPendingAddition = null; private final WordComposer mWordComposer = new WordComposer(); private final RichInputConnection mConnection = new RichInputConnection(this); - private RecapitalizeStatus mRecapitalizeStatus = null; + private final RecapitalizeStatus mRecapitalizeStatus = new RecapitalizeStatus(); // Keep track of the last selection range to decide if we need to show word alternatives private static final int NOT_A_CURSOR_POSITION = -1; @@ -742,6 +742,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction resetComposingState(true /* alsoResetLastComposedWord */); mDeleteCount = 0; mSpaceState = SPACE_STATE_NONE; + mRecapitalizeStatus.deactivate(); mCurrentlyPressedHardwareKeys.clear(); if (mSuggestionStripView != null) { @@ -925,7 +926,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction // We moved the cursor. If we are touching a word, we need to resume suggestion. mHandler.postResumeSuggestions(); // Reset the last recapitalization. - mRecapitalizeStatus = null; + mRecapitalizeStatus.deactivate(); mKeyboardSwitcher.updateShiftState(); } mExpectingUpdateSelection = false; @@ -1953,10 +1954,9 @@ public final class LatinIME extends InputMethodService implements KeyboardAction private void handleRecapitalize() { if (mLastSelectionStart == mLastSelectionEnd) return; // No selection // If we have a recapitalize in progress, use it; otherwise, create a new one. - if (null == mRecapitalizeStatus + if (!mRecapitalizeStatus.isActive() || !mRecapitalizeStatus.isSetAt(mLastSelectionStart, mLastSelectionEnd)) { - mRecapitalizeStatus = - new RecapitalizeStatus(mLastSelectionStart, mLastSelectionEnd, + mRecapitalizeStatus.initialize(mLastSelectionStart, mLastSelectionEnd, mConnection.getSelectedText(0 /* flags, 0 for no styles */).toString(), mSettings.getCurrentLocale(), mSettings.getWordSeparators()); // We trim leading and trailing whitespace. |