diff options
author | 2010-09-27 09:26:39 -0700 | |
---|---|---|
committer | 2010-09-27 09:26:39 -0700 | |
commit | 7f2a6a056b67efa2a1fb623ca4cf73f7fb6c7d8c (patch) | |
tree | d0062970c6907bab4d88c90a3b719fe07b551467 /java/src/com/android/inputmethod/latin/Suggest.java | |
parent | b9c0ed59d0b1565eafbe34d7e38bee7564dbe3fd (diff) | |
parent | 0b4ae1f578e768eec4ada90aeb81d11acb10eb2e (diff) | |
download | latinime-7f2a6a056b67efa2a1fb623ca4cf73f7fb6c7d8c.tar.gz latinime-7f2a6a056b67efa2a1fb623ca4cf73f7fb6c7d8c.tar.xz latinime-7f2a6a056b67efa2a1fb623ca4cf73f7fb6c7d8c.zip |
am 0b4ae1f5: Capitalize the displayed text in the suggestion bar when all of the user typed chars are upper case
Merge commit '0b4ae1f578e768eec4ada90aeb81d11acb10eb2e' into gingerbread-plus-aosp
* commit '0b4ae1f578e768eec4ada90aeb81d11acb10eb2e':
Capitalize the displayed text in the suggestion bar when all of the user typed chars are upper case
Diffstat (limited to 'java/src/com/android/inputmethod/latin/Suggest.java')
-rwxr-xr-x | java/src/com/android/inputmethod/latin/Suggest.java | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java index 92bbe4362..3b898941f 100755 --- a/java/src/com/android/inputmethod/latin/Suggest.java +++ b/java/src/com/android/inputmethod/latin/Suggest.java @@ -96,7 +96,10 @@ public class Suggest implements Dictionary.WordCallback { private boolean mHaveCorrection; private CharSequence mOriginalWord; private String mLowerOriginalWord; - private boolean mCapitalize; + + // TODO: Remove these member variables by passing more context to addWord() callback method + private boolean mIsFirstCharCapitalized; + private boolean mIsAllUpperCase; private int mCorrectionMode = CORRECTION_BASIC; @@ -219,7 +222,8 @@ public class Suggest implements Dictionary.WordCallback { boolean includeTypedWordIfValid, CharSequence prevWordForBigram) { LatinImeLogger.onStartSuggestion(prevWordForBigram); mHaveCorrection = false; - mCapitalize = wordComposer.isCapitalized(); + mIsFirstCharCapitalized = wordComposer.isFirstCharCapitalized(); + mIsAllUpperCase = wordComposer.isAllUpperCase(); collectGarbage(mSuggestions, mPrefMaxSuggestions); Arrays.fill(mPriorities, 0); Arrays.fill(mNextLettersFrequencies, 0); @@ -453,7 +457,9 @@ public class Suggest implements Dictionary.WordCallback { StringBuilder sb = poolSize > 0 ? (StringBuilder) mStringPool.remove(poolSize - 1) : new StringBuilder(getApproxMaxWordLength()); sb.setLength(0); - if (mCapitalize) { + if (mIsAllUpperCase) { + sb.append(new String(word, offset, length).toUpperCase()); + } else if (mIsFirstCharCapitalized) { sb.append(Character.toUpperCase(word[offset])); if (length > 1) { sb.append(word, offset + 1, length - 1); |