aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
diff options
context:
space:
mode:
authorMohammadinamul Sheik <inamul@google.com>2015-03-19 16:07:04 -0700
committerMohammadinamul Sheik <inamul@google.com>2015-03-19 16:07:04 -0700
commitab5912959435c1901e268bc9766090e604f3523d (patch)
treec96ea06ed34cd88171c999ea9059bb47c10b4589 /java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
parentb56f7d8ca47e5936afe0459928bae49cae6e3615 (diff)
downloadlatinime-ab5912959435c1901e268bc9766090e604f3523d.tar.gz
latinime-ab5912959435c1901e268bc9766090e604f3523d.tar.xz
latinime-ab5912959435c1901e268bc9766090e604f3523d.zip
Add prev words context to the SuggestedWordInfo.
Bug: 19712589 Bug: 19715579 Change-Id: Ie06665cab8405455c1b0a2ff034e0bb0731c9156
Diffstat (limited to 'java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java')
-rw-r--r--java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
index 00175f024..5e4e02f80 100644
--- a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
+++ b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
@@ -1408,7 +1408,8 @@ public final class InputLogic {
public void onGetSuggestedWords(final SuggestedWords suggestedWords) {
final String typedWordString = mWordComposer.getTypedWord();
final SuggestedWordInfo typedWordInfo = new SuggestedWordInfo(
- typedWordString, SuggestedWordInfo.MAX_SCORE,
+ typedWordString, "" /* prevWordsContext */,
+ SuggestedWordInfo.MAX_SCORE,
SuggestedWordInfo.KIND_TYPED, Dictionary.DICTIONARY_USER_TYPED,
SuggestedWordInfo.NOT_AN_INDEX /* indexOfTouchPointOfSecondWord */,
SuggestedWordInfo.NOT_A_CONFIDENCE);
@@ -1492,7 +1493,7 @@ public final class InputLogic {
final ArrayList<SuggestedWordInfo> suggestions = new ArrayList<>();
final String typedWordString = range.mWord.toString();
final SuggestedWordInfo typedWordInfo = new SuggestedWordInfo(typedWordString,
- SuggestedWords.MAX_SUGGESTIONS + 1,
+ "" /* prevWordsContext */, SuggestedWords.MAX_SUGGESTIONS + 1,
SuggestedWordInfo.KIND_TYPED, Dictionary.DICTIONARY_USER_TYPED,
SuggestedWordInfo.NOT_AN_INDEX /* indexOfTouchPointOfSecondWord */,
SuggestedWordInfo.NOT_A_CONFIDENCE /* autoCommitFirstWordConfidence */);
@@ -1507,7 +1508,7 @@ public final class InputLogic {
++i;
if (!TextUtils.equals(s, typedWordString)) {
suggestions.add(new SuggestedWordInfo(s,
- SuggestedWords.MAX_SUGGESTIONS - i,
+ "" /* prevWordsContext */, SuggestedWords.MAX_SUGGESTIONS - i,
SuggestedWordInfo.KIND_RESUMED, Dictionary.DICTIONARY_RESUMED,
SuggestedWordInfo.NOT_AN_INDEX /* indexOfTouchPointOfSecondWord */,
SuggestedWordInfo.NOT_A_CONFIDENCE
@@ -2053,8 +2054,11 @@ public final class InputLogic {
mConnection.commitCorrection(new CorrectionInfo(
mConnection.getExpectedSelectionEnd() - stringToCommit.length(),
typedWord, stringToCommit));
+ String prevWordsContext = (autoCorrectionOrNull != null)
+ ? autoCorrectionOrNull.mPrevWordsContext
+ : "";
StatsUtils.onAutoCorrection(typedWord, stringToCommit, isBatchMode,
- mDictionaryFacilitator);
+ mDictionaryFacilitator, prevWordsContext);
StatsUtils.onWordCommitAutoCorrect(stringToCommit, isBatchMode);
} else {
StatsUtils.onWordCommitUserTyped(stringToCommit, isBatchMode);