aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/WordComposer.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2013-04-12 20:45:18 +0900
committerJean Chalard <jchalard@google.com>2013-04-15 16:36:44 +0900
commitd40f3f6bc1bcf07800fbee0468fe90d307ca28bb (patch)
treea4aad6d8af977b9e3a5200fb0f21681de4ea07e4 /java/src/com/android/inputmethod/latin/WordComposer.java
parent2cd1136b8ebedc7cf939d7d7546ed753191f8677 (diff)
downloadlatinime-d40f3f6bc1bcf07800fbee0468fe90d307ca28bb.tar.gz
latinime-d40f3f6bc1bcf07800fbee0468fe90d307ca28bb.tar.xz
latinime-d40f3f6bc1bcf07800fbee0468fe90d307ca28bb.zip
Reject a previously user-refused suggestion.
If the user gestures a word, then hits backspace in disapproval, and gestures about the same thing again, make sure that we don't suggest the same thing again. Bug: 7549311 Change-Id: I793bc4df7c3841fa8f2f4146707c26e873f374c1
Diffstat (limited to 'java/src/com/android/inputmethod/latin/WordComposer.java')
-rw-r--r--java/src/com/android/inputmethod/latin/WordComposer.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/latin/WordComposer.java b/java/src/com/android/inputmethod/latin/WordComposer.java
index 1af12428d..098e8ac7b 100644
--- a/java/src/com/android/inputmethod/latin/WordComposer.java
+++ b/java/src/com/android/inputmethod/latin/WordComposer.java
@@ -42,6 +42,13 @@ public final class WordComposer {
private String mAutoCorrection;
private boolean mIsResumed;
private boolean mIsBatchMode;
+ // A memory of the last rejected batch mode suggestion, if any. This goes like this: the user
+ // gestures a word, is displeased with the results and hits backspace, then gestures again.
+ // At the very least we should avoid re-suggesting the same thing, and to do that we memorize
+ // the rejected suggestion in this variable.
+ // TODO: this should be done in a comprehensive way by the User History feature instead of
+ // as an ad-hockery here.
+ private String mRejectedBatchModeSuggestion;
// Cache these values for performance
private int mCapsCount;
@@ -64,6 +71,7 @@ public final class WordComposer {
mIsResumed = false;
mIsBatchMode = false;
mCursorPositionWithinWord = 0;
+ mRejectedBatchModeSuggestion = null;
refreshSize();
}
@@ -79,6 +87,7 @@ public final class WordComposer {
mIsResumed = source.mIsResumed;
mIsBatchMode = source.mIsBatchMode;
mCursorPositionWithinWord = source.mCursorPositionWithinWord;
+ mRejectedBatchModeSuggestion = source.mRejectedBatchModeSuggestion;
refreshSize();
}
@@ -95,6 +104,7 @@ public final class WordComposer {
mIsResumed = false;
mIsBatchMode = false;
mCursorPositionWithinWord = 0;
+ mRejectedBatchModeSuggestion = null;
refreshSize();
}
@@ -384,6 +394,7 @@ public final class WordComposer {
mAutoCorrection = null;
mCursorPositionWithinWord = 0;
mIsResumed = false;
+ mRejectedBatchModeSuggestion = null;
return lastComposedWord;
}
@@ -396,10 +407,19 @@ public final class WordComposer {
mCapitalizedMode = lastComposedWord.mCapitalizedMode;
mAutoCorrection = null; // This will be filled by the next call to updateSuggestion.
mCursorPositionWithinWord = mCodePointSize;
+ mRejectedBatchModeSuggestion = null;
mIsResumed = true;
}
public boolean isBatchMode() {
return mIsBatchMode;
}
+
+ public void setRejectedBatchModeSuggestion(final String rejectedSuggestion) {
+ mRejectedBatchModeSuggestion = rejectedSuggestion;
+ }
+
+ public String getRejectedBatchModeSuggestion() {
+ return mRejectedBatchModeSuggestion;
+ }
}