summaryrefslogtreecommitdiffstats
path: root/core/java/android/inputmethodservice
diff options
context:
space:
mode:
authorYohei Yukawa <yukawa@google.com>2014-04-17 12:40:31 +0900
committerYohei Yukawa <yukawa@google.com>2014-04-29 03:53:34 +0900
commit4de04795f988cc7447feb9ad00e179273f75a6a3 (patch)
tree999217c65b333c8731a3d65a06b0cd94593d646e /core/java/android/inputmethodservice
parent250bb6e3e045a88022db526b074e7ab38c47d93c (diff)
downloadframeworks_base-4de04795f988cc7447feb9ad00e179273f75a6a3.zip
frameworks_base-4de04795f988cc7447feb9ad00e179273f75a6a3.tar.gz
frameworks_base-4de04795f988cc7447feb9ad00e179273f75a6a3.tar.bz2
Return the cursor position in screen coordinates
From its beginning, InputMethodService#onUpdateCursor has provided the cursor position in local coordinates in the attached view. However, the local coordinates is not useful for IMEs to render a floating UI near the cursor because the IME is not able to know the origin of the attached view. With this CL, CURSOR_ANCHOR_MONITOR_MODE_CURSOR_RECT also means that the IME will receive the cursor position in screen coordinates. Because this is a new constant in the next release, conditionally changing the coordinates never causes compatibility issues as long as its behavior is well documented. BUG: 14323360 Change-Id: I3acf2317ae1d763d11dae5ef73c2a1348b377c71
Diffstat (limited to 'core/java/android/inputmethodservice')
-rw-r--r--core/java/android/inputmethodservice/InputMethodService.java11
1 files changed, 7 insertions, 4 deletions
diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java
index c51d1a7..ec581d1 100644
--- a/core/java/android/inputmethodservice/InputMethodService.java
+++ b/core/java/android/inputmethodservice/InputMethodService.java
@@ -255,7 +255,8 @@ public class InputMethodService extends AbstractInputMethodService {
public static final int CURSOR_ANCHOR_MONITOR_MODE_NONE = 0x0;
/**
- * The IME expects that {@link #onUpdateCursor(Rect)} is called back.
+ * The IME will receive {@link #onUpdateCursor(Rect)} called back with the current
+ * cursor rectangle in screen coordinates.
*/
public static final int CURSOR_ANCHOR_MONITOR_MODE_CURSOR_RECT = 0x1;
@@ -1703,9 +1704,11 @@ public class InputMethodService extends AbstractInputMethodService {
}
/**
- * Called when the application has reported a new location of its text
- * cursor. This is only called if explicitly requested by the input method.
- * The default implementation does nothing.
+ * Called when the application has reported a new location of its text cursor. This is only
+ * called if explicitly requested by the input method. The default implementation does nothing.
+ * @param newCursor The new cursor position, in screen coordinates if the input method calls
+ * {@link #setCursorAnchorMonitorMode} with {@link #CURSOR_ANCHOR_MONITOR_MODE_CURSOR_RECT}.
+ * Otherwise, this is in local coordinates.
*/
public void onUpdateCursor(Rect newCursor) {
// Intentionally empty