aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/compat/CursorAnchorInfoCompatWrapper.java
diff options
context:
space:
mode:
authorYohei Yukawa <yukawa@google.com>2014-09-18 07:38:20 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-09-18 07:38:20 +0000
commit233a2f21c38a27049fa3b03af699593f629d1681 (patch)
treecc79f1178e773ed12b4e6ae9b639b47589994ddc /java/src/com/android/inputmethod/compat/CursorAnchorInfoCompatWrapper.java
parent902cefb6635053b682a917259eb5a964a17506fd (diff)
parent8c9948f436bd764c6483d9af8c730e1b91e3b7ab (diff)
downloadlatinime-233a2f21c38a27049fa3b03af699593f629d1681.tar.gz
latinime-233a2f21c38a27049fa3b03af699593f629d1681.tar.xz
latinime-233a2f21c38a27049fa3b03af699593f629d1681.zip
am 8c9948f4: am fa63d910: Merge "Use Add-To-Dictionary indicator only" into lmp-dev
* commit '8c9948f436bd764c6483d9af8c730e1b91e3b7ab': Use Add-To-Dictionary indicator only
Diffstat (limited to 'java/src/com/android/inputmethod/compat/CursorAnchorInfoCompatWrapper.java')
-rw-r--r--java/src/com/android/inputmethod/compat/CursorAnchorInfoCompatWrapper.java18
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);
}