diff options
author | 2014-09-03 14:35:36 +0000 | |
---|---|---|
committer | 2014-09-03 14:35:36 +0000 | |
commit | f2c509a81ef107e6c71dc6804417469d12c94fca (patch) | |
tree | 9da5d353fd2add9e56b3c6cd731fbc5820b25a02 /java/src/com/android/inputmethod/compat/InputConnectionCompatUtils.java | |
parent | 836987c0cd3d290425b37209e98295734aedb017 (diff) | |
parent | 310da35c77779f399e12c1e4365e6372d1477ef3 (diff) | |
download | latinime-f2c509a81ef107e6c71dc6804417469d12c94fca.tar.gz latinime-f2c509a81ef107e6c71dc6804417469d12c94fca.tar.xz latinime-f2c509a81ef107e6c71dc6804417469d12c94fca.zip |
am 310da35c: Merge "Follow up API signature change" into lmp-dev
* commit '310da35c77779f399e12c1e4365e6372d1477ef3':
Follow up API signature change
Diffstat (limited to 'java/src/com/android/inputmethod/compat/InputConnectionCompatUtils.java')
-rw-r--r-- | java/src/com/android/inputmethod/compat/InputConnectionCompatUtils.java | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/java/src/com/android/inputmethod/compat/InputConnectionCompatUtils.java b/java/src/com/android/inputmethod/compat/InputConnectionCompatUtils.java index 862ec8a58..a5c71b22f 100644 --- a/java/src/com/android/inputmethod/compat/InputConnectionCompatUtils.java +++ b/java/src/com/android/inputmethod/compat/InputConnectionCompatUtils.java @@ -21,30 +21,29 @@ import android.view.inputmethod.InputMethodManager; public final class InputConnectionCompatUtils { private static final CompatUtils.ClassWrapper sInputConnectionType; - private static final CompatUtils.ToBooleanMethodWrapper sRequestUpdateCursorAnchorInfoMethod; + private static final CompatUtils.ToBooleanMethodWrapper sRequestCursorUpdatesMethod; static { sInputConnectionType = new CompatUtils.ClassWrapper(InputConnection.class); - sRequestUpdateCursorAnchorInfoMethod = sInputConnectionType.getPrimitiveMethod( - "requestUpdateCursorAnchorInfo", false, int.class); + sRequestCursorUpdatesMethod = sInputConnectionType.getPrimitiveMethod( + "requestCursorUpdates", false, int.class); } - public static boolean isRequestUpdateCursorAnchorInfoAvailable() { - return sRequestUpdateCursorAnchorInfoMethod != null; + public static boolean isRequestCursorUpdatesAvailable() { + return sRequestCursorUpdatesMethod != null; } /** - * Local copies of some constants in CursorAnchorInfoRequest until the SDK becomes publicly - * available. + * Local copies of some constants in InputConnection until the SDK becomes publicly available. */ - private static int REQUEST_UPDATE_CURSOR_UPDATE_IMMEDIATE = 1 << 0; - private static int REQUEST_UPDATE_CURSOR_UPDATE_MONITOR = 1 << 1; + private static int CURSOR_UPDATE_IMMEDIATE = 1 << 0; + private static int CURSOR_UPDATE_MONITOR = 1 << 1; - private static boolean requestUpdateCursorAnchorInfoImpl(final InputConnection inputConnection, + private static boolean requestCursorUpdatesImpl(final InputConnection inputConnection, final int cursorUpdateMode) { - if (!isRequestUpdateCursorAnchorInfoAvailable()) { + if (!isRequestCursorUpdatesAvailable()) { return false; } - return sRequestUpdateCursorAnchorInfoMethod.invoke(inputConnection, cursorUpdateMode); + return sRequestCursorUpdatesMethod.invoke(inputConnection, cursorUpdateMode); } /** @@ -56,11 +55,10 @@ public final class InputConnectionCompatUtils { * as soon as possible to notify the current cursor/anchor position to the input method. * @return {@code false} if the request is not handled. Otherwise returns {@code true}. */ - public static boolean requestUpdateCursorAnchorInfo(final InputConnection inputConnection, + public static boolean requestCursorUpdates(final InputConnection inputConnection, final boolean enableMonitor, final boolean requestImmediateCallback) { - final int cursorUpdateMode = (enableMonitor ? REQUEST_UPDATE_CURSOR_UPDATE_MONITOR : 0) - | (requestImmediateCallback ? REQUEST_UPDATE_CURSOR_UPDATE_IMMEDIATE : 0); - return requestUpdateCursorAnchorInfoImpl(inputConnection, cursorUpdateMode); + final int cursorUpdateMode = (enableMonitor ? CURSOR_UPDATE_MONITOR : 0) + | (requestImmediateCallback ? CURSOR_UPDATE_IMMEDIATE : 0); + return requestCursorUpdatesImpl(inputConnection, cursorUpdateMode); } - } |