aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2011-10-25 21:54:35 +0900
committerJean Chalard <jchalard@google.com>2011-10-25 21:57:30 +0900
commitd0c5f9395a1b94e8425982e353d090f972dc44f0 (patch)
treec1e4dc1b9dd58aef4253bfb2d6edf1bdb0f65941 /java/src
parentce668e7a0b6ae7046e1f22a162ad174d58dfe145 (diff)
downloadlatinime-d0c5f9395a1b94e8425982e353d090f972dc44f0.tar.gz
latinime-d0c5f9395a1b94e8425982e353d090f972dc44f0.tar.xz
latinime-d0c5f9395a1b94e8425982e353d090f972dc44f0.zip
Cleanup.
Remove a state that can never be reached, and ajust all the callers that would always have received false. Change-Id: Iac025568be11743428419e0772da306a4f0a0bf1
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java18
-rw-r--r--java/src/com/android/inputmethod/latin/TextEntryState.java15
2 files changed, 8 insertions, 25 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 90fc818bb..94be6f0fd 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -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);
- }
+ // 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.
diff --git a/java/src/com/android/inputmethod/latin/TextEntryState.java b/java/src/com/android/inputmethod/latin/TextEntryState.java
index 4204b8a4f..82242f87e 100644
--- a/java/src/com/android/inputmethod/latin/TextEntryState.java
+++ b/java/src/com/android/inputmethod/latin/TextEntryState.java
@@ -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);
- }
+ 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";
}
}