diff options
author | 2014-09-14 16:53:33 +0900 | |
---|---|---|
committer | 2014-09-18 16:06:35 +0900 | |
commit | 5896153f931ac876ad667d73d7703289a63e9bf5 (patch) | |
tree | d3e46957d77f6b3d5cc91ae704cbc7fa8dec5372 /java/src/com/android/inputmethod/compat | |
parent | 5b9a1e59bb7434cce740616c64e274a130a66ee6 (diff) | |
download | latinime-5896153f931ac876ad667d73d7703289a63e9bf5.tar.gz latinime-5896153f931ac876ad667d73d7703289a63e9bf5.tar.xz latinime-5896153f931ac876ad667d73d7703289a63e9bf5.zip |
Use Add-To-Dictionary indicator only
With this CL, the previously used commit indicator was reverted.
Instead we use the add-to-dictionary indicator only at the moment.
This CL also fixes the indicator position in bidi context.
BUG: 17335734
Change-Id: I5f7cf173ddc30876e2b01320acaff8ba4265edf6
Diffstat (limited to 'java/src/com/android/inputmethod/compat')
-rw-r--r-- | java/src/com/android/inputmethod/compat/CursorAnchorInfoCompatWrapper.java | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/java/src/com/android/inputmethod/compat/CursorAnchorInfoCompatWrapper.java b/java/src/com/android/inputmethod/compat/CursorAnchorInfoCompatWrapper.java index 8a2818508..c937eeeaa 100644 --- a/java/src/com/android/inputmethod/compat/CursorAnchorInfoCompatWrapper.java +++ b/java/src/com/android/inputmethod/compat/CursorAnchorInfoCompatWrapper.java @@ -41,6 +41,8 @@ public final class CursorAnchorInfoCompatWrapper { // Note that CursorAnchorInfo has been introduced in API level XX (Build.VERSION_CODE.LXX). private static final CompatUtils.ClassWrapper sCursorAnchorInfoClass; + private static final CompatUtils.ToIntMethodWrapper sGetSelectionStartMethod; + private static final CompatUtils.ToIntMethodWrapper sGetSelectionEndMethod; private static final CompatUtils.ToObjectMethodWrapper<RectF> sGetCharacterBoundsMethod; private static final CompatUtils.ToIntMethodWrapper sGetCharacterBoundsFlagsMethod; private static final CompatUtils.ToObjectMethodWrapper<CharSequence> sGetComposingTextMethod; @@ -52,10 +54,14 @@ public final class CursorAnchorInfoCompatWrapper { private static final CompatUtils.ToObjectMethodWrapper<Matrix> sGetMatrixMethod; private static final CompatUtils.ToIntMethodWrapper sGetInsertionMarkerFlagsMethod; - private static int COMPOSING_TEXT_START_DEFAULT = -1; + private static int INVALID_TEXT_INDEX = -1; static { sCursorAnchorInfoClass = CompatUtils.getClassWrapper( "android.view.inputmethod.CursorAnchorInfo"); + sGetSelectionStartMethod = sCursorAnchorInfoClass.getPrimitiveMethod( + "getSelectionStart", INVALID_TEXT_INDEX); + sGetSelectionEndMethod = sCursorAnchorInfoClass.getPrimitiveMethod( + "getSelectionEnd", INVALID_TEXT_INDEX); sGetCharacterBoundsMethod = sCursorAnchorInfoClass.getMethod( "getCharacterBounds", (RectF)null, int.class); sGetCharacterBoundsFlagsMethod = sCursorAnchorInfoClass.getPrimitiveMethod( @@ -63,7 +69,7 @@ public final class CursorAnchorInfoCompatWrapper { sGetComposingTextMethod = sCursorAnchorInfoClass.getMethod( "getComposingText", (CharSequence)null); sGetComposingTextStartMethod = sCursorAnchorInfoClass.getPrimitiveMethod( - "getComposingTextStart", COMPOSING_TEXT_START_DEFAULT); + "getComposingTextStart", INVALID_TEXT_INDEX); sGetInsertionMarkerBaselineMethod = sCursorAnchorInfoClass.getPrimitiveMethod( "getInsertionMarkerBaseline", 0.0f); sGetInsertionMarkerBottomMethod = sCursorAnchorInfoClass.getPrimitiveMethod( @@ -105,6 +111,14 @@ public final class CursorAnchorInfoCompatWrapper { return FakeHolder.sInstance; } + public int getSelectionStart() { + return sGetSelectionStartMethod.invoke(mInstance); + } + + public int getSelectionEnd() { + return sGetSelectionEndMethod.invoke(mInstance); + } + public CharSequence getComposingText() { return sGetComposingTextMethod.invoke(mInstance); } |