aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYohei Yukawa <yukawa@google.com>2014-09-08 17:07:34 +0900
committerYohei Yukawa <yukawa@google.com>2014-09-08 17:07:34 +0900
commita8ecd29646c2df413edfb3f705249c9753d45127 (patch)
tree93e237554a3492de34aa4bd0cd498198a19d2325
parent727e818e95ef68460ebafb2eb3b11c23a2d8fcd8 (diff)
downloadlatinime-a8ecd29646c2df413edfb3f705249c9753d45127.tar.gz
latinime-a8ecd29646c2df413edfb3f705249c9753d45127.tar.xz
latinime-a8ecd29646c2df413edfb3f705249c9753d45127.zip
Follow up API signature changes of CursorAnchorInfo
This is a follow up CL for Ic8c6fab58c01206872a34e7ee604cdda. No behavior change is intended in this CL. BUG: 17365414 BUG: 17335734 Change-Id: I4299536d0cb0c660b7b564653c72c9cb409a7aa5
-rw-r--r--java/src/com/android/inputmethod/compat/CursorAnchorInfoCompatWrapper.java25
-rw-r--r--java/src/com/android/inputmethod/keyboard/TextDecorator.java6
2 files changed, 18 insertions, 13 deletions
diff --git a/java/src/com/android/inputmethod/compat/CursorAnchorInfoCompatWrapper.java b/java/src/com/android/inputmethod/compat/CursorAnchorInfoCompatWrapper.java
index 3a86ccbda..8a2818508 100644
--- a/java/src/com/android/inputmethod/compat/CursorAnchorInfoCompatWrapper.java
+++ b/java/src/com/android/inputmethod/compat/CursorAnchorInfoCompatWrapper.java
@@ -34,10 +34,15 @@ public final class CursorAnchorInfoCompatWrapper {
*/
public static final int FLAG_HAS_INVISIBLE_REGION = 0x02;
+ /**
+ * The insertion marker or character bounds is placed at right-to-left (RTL) character.
+ */
+ public static final int FLAG_IS_RTL = 0x04;
+
// Note that CursorAnchorInfo has been introduced in API level XX (Build.VERSION_CODE.LXX).
private static final CompatUtils.ClassWrapper sCursorAnchorInfoClass;
- private static final CompatUtils.ToObjectMethodWrapper<RectF> sGetCharacterRectMethod;
- private static final CompatUtils.ToIntMethodWrapper sGetCharacterRectFlagsMethod;
+ private static final CompatUtils.ToObjectMethodWrapper<RectF> sGetCharacterBoundsMethod;
+ private static final CompatUtils.ToIntMethodWrapper sGetCharacterBoundsFlagsMethod;
private static final CompatUtils.ToObjectMethodWrapper<CharSequence> sGetComposingTextMethod;
private static final CompatUtils.ToIntMethodWrapper sGetComposingTextStartMethod;
private static final CompatUtils.ToFloatMethodWrapper sGetInsertionMarkerBaselineMethod;
@@ -51,10 +56,10 @@ public final class CursorAnchorInfoCompatWrapper {
static {
sCursorAnchorInfoClass = CompatUtils.getClassWrapper(
"android.view.inputmethod.CursorAnchorInfo");
- sGetCharacterRectMethod = sCursorAnchorInfoClass.getMethod(
- "getCharacterRect", (RectF)null, int.class);
- sGetCharacterRectFlagsMethod = sCursorAnchorInfoClass.getPrimitiveMethod(
- "getCharacterRectFlags", 0, int.class);
+ sGetCharacterBoundsMethod = sCursorAnchorInfoClass.getMethod(
+ "getCharacterBounds", (RectF)null, int.class);
+ sGetCharacterBoundsFlagsMethod = sCursorAnchorInfoClass.getPrimitiveMethod(
+ "getCharacterBoundsFlags", 0, int.class);
sGetComposingTextMethod = sCursorAnchorInfoClass.getMethod(
"getComposingText", (CharSequence)null);
sGetComposingTextStartMethod = sCursorAnchorInfoClass.getPrimitiveMethod(
@@ -112,12 +117,12 @@ public final class CursorAnchorInfoCompatWrapper {
return sGetMatrixMethod.invoke(mInstance);
}
- public RectF getCharacterRect(final int index) {
- return sGetCharacterRectMethod.invoke(mInstance, index);
+ public RectF getCharacterBounds(final int index) {
+ return sGetCharacterBoundsMethod.invoke(mInstance, index);
}
- public int getCharacterRectFlags(final int index) {
- return sGetCharacterRectFlagsMethod.invoke(mInstance, index);
+ public int getCharacterBoundsFlags(final int index) {
+ return sGetCharacterBoundsFlagsMethod.invoke(mInstance, index);
}
public float getInsertionMarkerBaseline() {
diff --git a/java/src/com/android/inputmethod/keyboard/TextDecorator.java b/java/src/com/android/inputmethod/keyboard/TextDecorator.java
index 9192853ca..cf58d6a09 100644
--- a/java/src/com/android/inputmethod/keyboard/TextDecorator.java
+++ b/java/src/com/android/inputmethod/keyboard/TextDecorator.java
@@ -274,8 +274,8 @@ public class TextDecorator {
}
final int composingTextStart = info.getComposingTextStart();
final int lastCharRectIndex = composingTextStart + composingText.length() - 1;
- final RectF lastCharRect = info.getCharacterRect(lastCharRectIndex);
- final int lastCharRectFlag = info.getCharacterRectFlags(lastCharRectIndex);
+ final RectF lastCharRect = info.getCharacterBounds(lastCharRectIndex);
+ final int lastCharRectFlag = info.getCharacterBoundsFlags(lastCharRectIndex);
final boolean hasInvisibleRegionInLastCharRect =
(lastCharRectFlag & CursorAnchorInfoCompatWrapper.FLAG_HAS_INVISIBLE_REGION)
!= 0;
@@ -285,7 +285,7 @@ public class TextDecorator {
}
final RectF segmentStartCharRect = new RectF(lastCharRect);
for (int i = composingText.length() - 2; i >= 0; --i) {
- final RectF charRect = info.getCharacterRect(composingTextStart + i);
+ final RectF charRect = info.getCharacterBounds(composingTextStart + i);
if (charRect == null) {
break;
}