diff options
author | 2014-06-16 09:58:04 +0000 | |
---|---|---|
committer | 2014-06-16 09:58:04 +0000 | |
commit | de1d005dd03496836394a4f96c84c4874112b275 (patch) | |
tree | 0026bf97e6c9cd1d3b546dc11c122090a290225d /java/src/com/android/inputmethod/latin/WordComposer.java | |
parent | e8eb3c245a6ee610afd51e079b042feada02a9dc (diff) | |
parent | 8a23703763fdbda06f1d272f47064334a5eeda14 (diff) | |
download | latinime-de1d005dd03496836394a4f96c84c4874112b275.tar.gz latinime-de1d005dd03496836394a4f96c84c4874112b275.tar.xz latinime-de1d005dd03496836394a4f96c84c4874112b275.zip |
am 8a237037: Merge "[CM1] Let predictions be aware of capitalize mode."
* commit '8a23703763fdbda06f1d272f47064334a5eeda14':
[CM1] Let predictions be aware of capitalize mode.
Diffstat (limited to 'java/src/com/android/inputmethod/latin/WordComposer.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/WordComposer.java | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/java/src/com/android/inputmethod/latin/WordComposer.java b/java/src/com/android/inputmethod/latin/WordComposer.java index 6ce1f85c5..21fe7e0eb 100644 --- a/java/src/com/android/inputmethod/latin/WordComposer.java +++ b/java/src/com/android/inputmethod/latin/WordComposer.java @@ -310,12 +310,18 @@ public final class WordComposer { } /** - * Whether or not the user typed a capital letter as the first letter in the word, and no - * other letter is capitalized + * Whether this composer is composing or about to compose a word in which only the first letter + * is a capital. + * + * If we do have a composing word, we just return whether the word has indeed only its first + * character capitalized. If we don't, then we return a value based on the capitalized mode, + * which tell us what is likely to happen for the next composing word. + * * @return capitalization preference */ - public boolean isOnlyFirstCharCapitalized() { - return mIsOnlyFirstCharCapitalized; + public boolean isOrWillBeOnlyFirstCharCapitalized() { + return isComposingWord() ? mIsOnlyFirstCharCapitalized + : (CAPS_MODE_OFF != mCapitalizedMode); } /** @@ -366,6 +372,20 @@ public final class WordComposer { } /** + * Before fetching suggestions, we don't necessarily know about the capitalized mode yet. + * + * If we don't have a composing word yet, we take a note of this mode so that we can then + * supply this information to the suggestion process. If we have a composing word, then + * the previous mode has priority over this. + * @param mode the mode just before fetching suggestions + */ + public void adviseCapitalizedModeBeforeFetchingSuggestions(final int mode) { + if (!isComposingWord()) { + mCapitalizedMode = mode; + } + } + + /** * Returns whether the word was automatically capitalized. * @return whether the word was automatically capitalized */ |