diff options
author | 2012-09-18 00:32:07 -0700 | |
---|---|---|
committer | 2012-09-18 00:32:07 -0700 | |
commit | d287c369b6509401523733a276032bd03291fd29 (patch) | |
tree | f80fa7296d9292cef961b6c380bda7ffb81405fa /java/src/com/android/inputmethod/latin/RichInputConnection.java | |
parent | 4ca7275bd754cc483bb77d0f780dc59d27c70bf4 (diff) | |
parent | b128b1cdfee1956dff2cefc6d5308706a7fc186f (diff) | |
download | latinime-d287c369b6509401523733a276032bd03291fd29.tar.gz latinime-d287c369b6509401523733a276032bd03291fd29.tar.xz latinime-d287c369b6509401523733a276032bd03291fd29.zip |
am b128b1cd: Merge "Take space state into account for caps (A11)" into jb-mr1-dev
* commit 'b128b1cdfee1956dff2cefc6d5308706a7fc186f':
Take space state into account for caps (A11)
Diffstat (limited to 'java/src/com/android/inputmethod/latin/RichInputConnection.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/RichInputConnection.java | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/java/src/com/android/inputmethod/latin/RichInputConnection.java b/java/src/com/android/inputmethod/latin/RichInputConnection.java index b85f9dcd7..cbc6a93fa 100644 --- a/java/src/com/android/inputmethod/latin/RichInputConnection.java +++ b/java/src/com/android/inputmethod/latin/RichInputConnection.java @@ -190,7 +190,23 @@ public class RichInputConnection { } } - public int getCursorCapsMode(final int inputType, final Locale locale) { + /** + * Gets the caps modes we should be in after this specific string. + * + * This returns a bit set of TextUtils#CAP_MODE_*, masked by the inputType argument. + * This method also supports faking an additional space after the string passed in argument, + * to support cases where a space will be added automatically, like in phantom space + * state for example. + * Note that for English, we are using American typography rules (which are not specific to + * American English, it's just the most common set of rules for English). + * + * @param inputType a mask of the caps modes to test for. + * @param locale what language should be considered. + * @param hasSpaceBefore if we should consider there should be a space after the string. + * @return the caps modes that should be on as a set of bits + */ + public int getCursorCapsMode(final int inputType, final Locale locale, + final boolean hasSpaceBefore) { mIC = mParent.getCurrentInputConnection(); if (null == mIC) return Constants.TextUtils.CAP_MODE_OFF; if (!TextUtils.isEmpty(mComposingText)) return Constants.TextUtils.CAP_MODE_OFF; @@ -205,7 +221,8 @@ public class RichInputConnection { } // This never calls InputConnection#getCapsMode - in fact, it's a static method that // never blocks or initiates IPC. - return StringUtils.getCapsMode(mCommittedTextBeforeComposingText, inputType, locale); + return StringUtils.getCapsMode(mCommittedTextBeforeComposingText, inputType, locale, + hasSpaceBefore); } public CharSequence getTextBeforeCursor(final int i, final int j) { |