summaryrefslogtreecommitdiff
path: root/core/java/android/inputmethodservice/AbstractInputMethodService.java
diff options
context:
space:
mode:
authorVictoria Lease <violets@google.com>2012-08-24 13:46:02 -0700
committerVictoria Lease <violets@google.com>2012-09-10 14:01:42 -0700
commitb38070caa5143ab9fd1883e0c7c879533a480bc7 (patch)
treeffbed34eefd1fd81a028e1a14820d48953252b29 /core/java/android/inputmethodservice/AbstractInputMethodService.java
parent37ee53420ce47860807eb8eaeb454c12fa46797b (diff)
IME support for trackball and generic motion events
Trackball and generic motion events now pass through the IME in case it would like to handle them before passing them on to the view hierarchy. While I was at it, I also... ...fixed the documentation on InputMethodService.onKeyUp() ...added documentation to InputMethodService.onTrackballEvent() ...added trackball and generic motion events to the "input" command ...fixed input consistency verification involving ACTION_OUTSIDE Bug: 7050005 Change-Id: I40ab68df4a9542af6df25de6ec2ec500e4c02902
Diffstat (limited to 'core/java/android/inputmethodservice/AbstractInputMethodService.java')
-rw-r--r--core/java/android/inputmethodservice/AbstractInputMethodService.java29
1 files changed, 29 insertions, 0 deletions
diff --git a/core/java/android/inputmethodservice/AbstractInputMethodService.java b/core/java/android/inputmethodservice/AbstractInputMethodService.java
index 27af0135cc05..3c3182accc8e 100644
--- a/core/java/android/inputmethodservice/AbstractInputMethodService.java
+++ b/core/java/android/inputmethodservice/AbstractInputMethodService.java
@@ -149,6 +149,17 @@ public abstract class AbstractInputMethodService extends Service
callback.finishedEvent(seq, handled);
}
}
+
+ /**
+ * Take care of dispatching incoming generic motion events to the appropriate
+ * callbacks on the service, and tell the client when this is done.
+ */
+ public void dispatchGenericMotionEvent(int seq, MotionEvent event, EventCallback callback) {
+ boolean handled = onGenericMotionEvent(event);
+ if (callback != null) {
+ callback.finishedEvent(seq, handled);
+ }
+ }
}
/**
@@ -189,7 +200,25 @@ public abstract class AbstractInputMethodService extends Service
return new IInputMethodWrapper(this, mInputMethod);
}
+ /**
+ * Implement this to handle trackball events on your input method.
+ *
+ * @param event The motion event being received.
+ * @return True if the event was handled in this function, false otherwise.
+ * @see View#onTrackballEvent
+ */
public boolean onTrackballEvent(MotionEvent event) {
return false;
}
+
+ /**
+ * Implement this to handle generic motion events on your input method.
+ *
+ * @param event The motion event being received.
+ * @return True if the event was handled in this function, false otherwise.
+ * @see View#onGenericMotionEvent
+ */
+ public boolean onGenericMotionEvent(MotionEvent event) {
+ return false;
+ }
}