am 1f8fc62c: Add useful information to LastComposedWord (A2)

* commit '1f8fc62ccb5018716457dc309ab11ad3e1506ad1':
  Add useful information to LastComposedWord (A2)
main
Jean Chalard 2012-01-26 00:52:57 -08:00 committed by Android Git Automerger
commit 183ba6a09e
2 changed files with 18 additions and 2 deletions

View File

@ -16,6 +16,8 @@
package com.android.inputmethod.latin; package com.android.inputmethod.latin;
import java.util.ArrayList;
/** /**
* This class encapsulates data about a word previously composed, but that has been * 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. * 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 static final int COMMIT_TYPE_CANCEL_AUTO_CORRECT = 3;
public final int mType; public final int mType;
public final ArrayList<int[]> 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<int[]> codes, final int[] xCoordinates,
final int[] yCoordinates, final String typedWord, final String autoCorrection) {
mType = type; mType = type;
mCodes = codes;
mXCoordinates = xCoordinates;
mYCoordinates = yCoordinates;
mTypedWord = typedWord;
mAutoCorrection = autoCorrection;
} }
} }

View File

@ -346,9 +346,12 @@ public class WordComposer {
// Only ever revert an auto-correct. // Only ever revert an auto-correct.
mCommittedWordSavedForSuggestionResuming.mAutoCorrection = null; 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. // TODO: improve performance by swapping buffers instead of creating a new object.
mCurrentWord = new CharacterStore(); mCurrentWord = new CharacterStore();
return new LastComposedWord(type); return lastComposedWord;
} }
public boolean hasWordKeptForSuggestionResuming() { public boolean hasWordKeptForSuggestionResuming() {