Small refactoring

Change-Id: Ifc33e109562abb3dd720ad4fed76add8ab1a64aa
This commit is contained in:
Jean Chalard 2011-10-03 14:58:34 +09:00
parent ad2dfa7697
commit 4c0fe57198

View file

@ -884,15 +884,16 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
final boolean selectionChanged = (newSelStart != candidatesEnd final boolean selectionChanged = (newSelStart != candidatesEnd
|| newSelEnd != candidatesEnd) && mLastSelectionStart != newSelStart; || newSelEnd != candidatesEnd) && mLastSelectionStart != newSelStart;
final boolean candidatesCleared = candidatesStart == -1 && candidatesEnd == -1; final boolean candidatesCleared = candidatesStart == -1 && candidatesEnd == -1;
if (!mExpectingUpdateSelection if (!mExpectingUpdateSelection) {
&& ((mComposingStringBuilder.length() > 0 && mHasUncommittedTypedChars) if (((mComposingStringBuilder.length() > 0 && mHasUncommittedTypedChars)
|| mVoiceProxy.isVoiceInputHighlighted()) || mVoiceProxy.isVoiceInputHighlighted())
&& (selectionChanged || candidatesCleared)) { && (selectionChanged || candidatesCleared)) {
if (candidatesCleared) { if (candidatesCleared) {
// If the composing span has been cleared, save the typed word in the history for // If the composing span has been cleared, save the typed word in the history
// recorrection before we reset the suggestions strip. Then, we'll be able to show // for recorrection before we reset the suggestions strip. Then, we'll be able
// suggestions for recorrection right away. // to show suggestions for recorrection right away.
mRecorrection.saveRecorrectionSuggestion(mWordComposer, mComposingStringBuilder); mRecorrection.saveRecorrectionSuggestion(mWordComposer,
mComposingStringBuilder);
} }
mComposingStringBuilder.setLength(0); mComposingStringBuilder.setLength(0);
mHasUncommittedTypedChars = false; mHasUncommittedTypedChars = false;
@ -908,11 +909,9 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
ic.finishComposingText(); ic.finishComposingText();
} }
mVoiceProxy.setVoiceInputHighlighted(false); mVoiceProxy.setVoiceInputHighlighted(false);
} else if (!mHasUncommittedTypedChars && !mExpectingUpdateSelection } else if (!mHasUncommittedTypedChars && TextEntryState.isAcceptedDefault()) {
&& TextEntryState.isAcceptedDefault()) {
TextEntryState.reset(); TextEntryState.reset();
} }
if (!mExpectingUpdateSelection) {
mJustAddedMagicSpace = false; // The user moved the cursor. mJustAddedMagicSpace = false; // The user moved the cursor.
mJustReplacedDoubleSpace = false; mJustReplacedDoubleSpace = false;
} }