diff options
author | 2014-10-03 07:28:39 +0000 | |
---|---|---|
committer | 2014-10-03 07:28:39 +0000 | |
commit | d780b1a19ba2e5aa467cbde4baac24618f2c40af (patch) | |
tree | e19ed8de3fa26d92247d8a7b2f485adbb944658d /java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java | |
parent | 1dee4b62b03b9884ecb3b4f32eea80a343d5f541 (diff) | |
parent | a4244df846d055f1c95a68565478e2183871e489 (diff) | |
download | latinime-d780b1a19ba2e5aa467cbde4baac24618f2c40af.tar.gz latinime-d780b1a19ba2e5aa467cbde4baac24618f2c40af.tar.xz latinime-d780b1a19ba2e5aa467cbde4baac24618f2c40af.zip |
am a4244df8: Merge "Add calls to stub for API to consume gesture data."
* commit 'a4244df846d055f1c95a68565478e2183871e489':
Add calls to stub for API to consume gesture data.
Diffstat (limited to 'java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java index b4a1c3e65..1b1d5e7e5 100644 --- a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java +++ b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java @@ -2263,6 +2263,47 @@ public final class InputLogic { mConnection.setComposingText(composingTextToBeSet, newCursorPosition); } + /** + * Gets an object allowing private IME commands to be sent to the + * underlying editor. + * @return An object for sending private commands to the underlying editor. + */ + public PrivateCommandPerformer getPrivateCommandPerformer() { + return mConnection; + } + + /** + * Gets the expected index of the first char of the composing span within the editor's text. + * Returns a negative value in case there appears to be no valid composing span. + * + * @see #getComposingLength() + * @see RichInputConnection#hasSelection() + * @see RichInputConnection#isCursorPositionKnown() + * @see RichInputConnection#getExpectedSelectionStart() + * @see RichInputConnection#getExpectedSelectionEnd() + * @return The expected index in Java chars of the first char of the composing span. + */ + // TODO: try and see if we can get rid of this method. Ideally the users of this class should + // never need to know this. + public int getComposingStart() { + if (!mConnection.isCursorPositionKnown() || mConnection.hasSelection()) { + return -1; + } + return mConnection.getExpectedSelectionStart() - mWordComposer.size(); + } + + /** + * Gets the expected length in Java chars of the composing span. + * May be 0 if there is no valid composing span. + * @see #getComposingStart() + * @return The expected length of the composing span. + */ + // TODO: try and see if we can get rid of this method. Ideally the users of this class should + // never need to know this. + public int getComposingLength() { + return mWordComposer.size(); + } + ////////////////////////////////////////////////////////////////////////////////////////////// // Following methods are tentatively placed in this class for the integration with // TextDecorator. |