am d0c5f939: Cleanup.

* commit 'd0c5f9395a1b94e8425982e353d090f972dc44f0':
  Cleanup.
main
Jean Chalard 2011-10-25 06:11:00 -07:00 committed by Android Git Automerger
commit d7d5a8ce9b
2 changed files with 8 additions and 25 deletions

View File

@ -1630,7 +1630,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
public boolean isSuggestionsStripVisible() {
if (mSuggestionsView == null)
return false;
if (mSuggestionsView.isShowingAddToDictionaryHint() || TextEntryState.isRecorrecting())
if (mSuggestionsView.isShowingAddToDictionaryHint())
return true;
if (!isShowingSuggestionsStrip())
return false;
@ -1735,7 +1735,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
}
// Don't auto-correct words with multiple capital letter
autoCorrectionAvailable &= !wordComposer.isMostlyCaps();
autoCorrectionAvailable &= !TextEntryState.isRecorrecting();
// Basically, we update the suggestion strip only when suggestion count > 1. However,
// there is an exception: We update the suggestion strip whenever typed word's length
@ -1808,7 +1807,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
mVoiceProxy.flushAndLogAllTextModificationCounters(index, suggestion,
mSettingsValues.mWordSeparators);
final boolean recorrecting = TextEntryState.isRecorrecting();
final InputConnection ic = getCurrentInputConnection();
if (ic != null) {
ic.beginBatchEdit();
@ -1882,7 +1880,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
suggestion.toString(), index, suggestions.mWords);
TextEntryState.acceptedSuggestion(mComposingStringBuilder.toString(), suggestion);
// Follow it with a space
if (mInsertSpaceOnPickSuggestionManually && !recorrecting) {
if (mInsertSpaceOnPickSuggestionManually) {
sendMagicSpace();
}
@ -1902,13 +1900,11 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|| !AutoCorrection.isValidWord(
mSuggest.getUnigramDictionaries(), suggestion, true));
if (!recorrecting) {
// Fool the state watcher so that a subsequent backspace will not do a revert, unless
// we just did a correction, in which case we need to stay in
// TextEntryState.State.PICKED_SUGGESTION state.
TextEntryState.typedCharacter((char) Keyboard.CODE_SPACE, true,
WordComposer.NOT_A_COORDINATE, WordComposer.NOT_A_COORDINATE);
}
if (!showingAddToDictionaryHint) {
// If we're not showing the "Touch again to save", then show corrections again.
// In case the cursor position doesn't change, make sure we show the suggestions again.

View File

@ -34,7 +34,6 @@ public class TextEntryState {
private static final int SPACE_AFTER_ACCEPTED = 6;
private static final int SPACE_AFTER_PICKED = 7;
private static final int UNDO_COMMIT = 8;
private static final int PICKED_RECORRECTION = 9;
private static int sState = UNKNOWN;
private static int sPreviousState = UNKNOWN;
@ -77,13 +76,7 @@ public class TextEntryState {
}
public static void acceptedSuggestion(CharSequence typedWord, CharSequence actualWord) {
if (sState == PICKED_RECORRECTION) {
// TODO: this seems to be the only place where setState(PICKED_RECORRECTION) is done
// so this state should never be reached. Check this and remove.
setState(PICKED_RECORRECTION);
} else {
setState(PICKED_SUGGESTION);
}
if (DEBUG)
displayState("acceptedSuggestion", "typedWord", typedWord, "actualWord", actualWord);
}
@ -111,7 +104,6 @@ public class TextEntryState {
}
break;
case PICKED_SUGGESTION:
case PICKED_RECORRECTION:
if (isSpace) {
setState(SPACE_AFTER_PICKED);
} else if (isSeparator) {
@ -166,10 +158,6 @@ public class TextEntryState {
return sState == UNDO_COMMIT;
}
public static boolean isRecorrecting() {
return sState == PICKED_RECORRECTION;
}
public static String getState() {
return stateName(sState);
}
@ -184,7 +172,6 @@ public class TextEntryState {
case SPACE_AFTER_ACCEPTED: return "SPACE_AFTER_ACCEPTED";
case SPACE_AFTER_PICKED: return "SPACE_AFTER_PICKED";
case UNDO_COMMIT: return "UNDO_COMMIT";
case PICKED_RECORRECTION: return "PICKED_RECORRECTION";
default: return "UNKNOWN";
}
}