diff options
author | 2014-09-18 18:26:06 +0900 | |
---|---|---|
committer | 2014-09-18 18:27:45 +0900 | |
commit | eddfe51b38755e0068e3c322868c5e209f212f6f (patch) | |
tree | 280fda5e51e269da433b9e3acccfa33025833481 /java/src/com/android/inputmethod/compat/CursorAnchorInfoCompatWrapper.java | |
parent | cdabc71c6da00ea1c2254e13021973c762c79be4 (diff) | |
parent | 233a2f21c38a27049fa3b03af699593f629d1681 (diff) | |
download | latinime-eddfe51b38755e0068e3c322868c5e209f212f6f.tar.gz latinime-eddfe51b38755e0068e3c322868c5e209f212f6f.tar.xz latinime-eddfe51b38755e0068e3c322868c5e209f212f6f.zip |
resolved conflicts for merge of 233a2f21 to master
Change-Id: If391cc622367dfb4448c6a5c32b82111d352d86e
Diffstat (limited to 'java/src/com/android/inputmethod/compat/CursorAnchorInfoCompatWrapper.java')
-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); } |