From 1f8fc62ccb5018716457dc309ab11ad3e1506ad1 Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Thu, 26 Jan 2012 16:05:09 +0900 Subject: [PATCH] Add useful information to LastComposedWord (A2) Change-Id: Idf47f2e2bdd1d6394fc4b1ab7df28d64a808da1e --- .../inputmethod/latin/LastComposedWord.java | 15 ++++++++++++++- .../android/inputmethod/latin/WordComposer.java | 5 ++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/java/src/com/android/inputmethod/latin/LastComposedWord.java b/java/src/com/android/inputmethod/latin/LastComposedWord.java index dcecdb3b5..612ed424d 100644 --- a/java/src/com/android/inputmethod/latin/LastComposedWord.java +++ b/java/src/com/android/inputmethod/latin/LastComposedWord.java @@ -16,6 +16,8 @@ package com.android.inputmethod.latin; +import java.util.ArrayList; + /** * This class encapsulates data about a word previously composed, but that has been * committed already. This is used for resuming suggestion, and cancel auto-correction. @@ -37,8 +39,19 @@ public class LastComposedWord { public static final int COMMIT_TYPE_CANCEL_AUTO_CORRECT = 3; public final int mType; + public final ArrayList mCodes; + public final int[] mXCoordinates; + public final int[] mYCoordinates; + public final String mTypedWord; + public final String mAutoCorrection; - public LastComposedWord(final int type) { + public LastComposedWord(final int type, final ArrayList codes, final int[] xCoordinates, + final int[] yCoordinates, final String typedWord, final String autoCorrection) { mType = type; + mCodes = codes; + mXCoordinates = xCoordinates; + mYCoordinates = yCoordinates; + mTypedWord = typedWord; + mAutoCorrection = autoCorrection; } } diff --git a/java/src/com/android/inputmethod/latin/WordComposer.java b/java/src/com/android/inputmethod/latin/WordComposer.java index 02968c934..adadd9394 100644 --- a/java/src/com/android/inputmethod/latin/WordComposer.java +++ b/java/src/com/android/inputmethod/latin/WordComposer.java @@ -346,9 +346,12 @@ public class WordComposer { // Only ever revert an auto-correct. mCommittedWordSavedForSuggestionResuming.mAutoCorrection = null; } + final LastComposedWord lastComposedWord = new LastComposedWord(type, mCurrentWord.mCodes, + mCurrentWord.mXCoordinates, mCurrentWord.mYCoordinates, + mCurrentWord.mTypedWord.toString(), mCurrentWord.mAutoCorrection.toString()); // TODO: improve performance by swapping buffers instead of creating a new object. mCurrentWord = new CharacterStore(); - return new LastComposedWord(type); + return lastComposedWord; } public boolean hasWordKeptForSuggestionResuming() {