diff options
author | 2011-12-13 05:48:29 -0800 | |
---|---|---|
committer | 2011-12-13 05:48:29 -0800 | |
commit | d31eb2e5eeca44c9bd92d0bbd79e2edac1b1dae9 (patch) | |
tree | 623839cb19a173156a701403961f6ec8f8574a3f /java/src/com/android/inputmethod/latin/WordComposer.java | |
parent | 42eee3cac911134721ac9d8e3f0677854a8d0293 (diff) | |
parent | 117fc93f373cb86d4120c1261f9d0562c6529fec (diff) | |
download | latinime-d31eb2e5eeca44c9bd92d0bbd79e2edac1b1dae9.tar.gz latinime-d31eb2e5eeca44c9bd92d0bbd79e2edac1b1dae9.tar.xz latinime-d31eb2e5eeca44c9bd92d0bbd79e2edac1b1dae9.zip |
am 117fc93f: Move mBestWord to the word composer.
* commit '117fc93f373cb86d4120c1261f9d0562c6529fec':
Move mBestWord to the word composer.
Diffstat (limited to 'java/src/com/android/inputmethod/latin/WordComposer.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/WordComposer.java | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/java/src/com/android/inputmethod/latin/WordComposer.java b/java/src/com/android/inputmethod/latin/WordComposer.java index dfb00c8ab..fcaf81cd5 100644 --- a/java/src/com/android/inputmethod/latin/WordComposer.java +++ b/java/src/com/android/inputmethod/latin/WordComposer.java @@ -41,6 +41,8 @@ public class WordComposer { private int[] mYCoordinates; private StringBuilder mTypedWord; + // An auto-correction for this word out of the dictionary. + private CharSequence mAutoCorrection; private int mCapsCount; @@ -60,6 +62,7 @@ public class WordComposer { mXCoordinates = new int[N]; mYCoordinates = new int[N]; mTrailingSingleQuotesCount = 0; + mAutoCorrection = null; } public WordComposer(WordComposer source) { @@ -75,6 +78,7 @@ public class WordComposer { mIsFirstCharCapitalized = source.mIsFirstCharCapitalized; mAutoCapitalized = source.mAutoCapitalized; mTrailingSingleQuotesCount = source.mTrailingSingleQuotesCount; + mAutoCorrection = null; } /** @@ -86,6 +90,7 @@ public class WordComposer { mCapsCount = 0; mIsFirstCharCapitalized = false; mTrailingSingleQuotesCount = 0; + mAutoCorrection = null; } /** @@ -140,6 +145,7 @@ public class WordComposer { } else { mTrailingSingleQuotesCount = 0; } + mAutoCorrection = null; } /** @@ -173,6 +179,7 @@ public class WordComposer { int codePoint = word.charAt(i); addKeyInfo(codePoint, keyboard, keyDetector); } + mAutoCorrection = null; } /** @@ -224,11 +231,12 @@ public class WordComposer { ++mTrailingSingleQuotesCount; } } + mAutoCorrection = null; } /** * Returns the word as it was typed, without any correction applied. - * @return the word that was typed so far + * @return the word that was typed so far. Never returns null. */ public String getTypedWord() { return mTypedWord.toString(); @@ -277,4 +285,25 @@ public class WordComposer { public boolean isAutoCapitalized() { return mAutoCapitalized; } + + /** + * Sets the auto-correction for this word. + */ + public void setAutoCorrection(final CharSequence correction) { + mAutoCorrection = correction; + } + + /** + * Remove any auto-correction that may have been set. + */ + public void deleteAutoCorrection() { + mAutoCorrection = null; + } + + /** + * @return the auto-correction for this world, or null if none. + */ + public CharSequence getAutoCorrectionOrNull() { + return mAutoCorrection; + } } |