summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/SimpleOnStylusPressListener.java
diff options
context:
space:
mode:
authorMady Mellor <madym@google.com>2015-07-15 16:34:34 -0700
committerMady Mellor <madym@google.com>2015-08-21 11:18:14 -0700
commitbb83520a620919a8f19472ba4426585d007d1aba (patch)
treea04345fb269ef3061564622f95343051dc04ab69 /src/com/android/launcher3/SimpleOnStylusPressListener.java
parent6f326e95a0033eecbb7370c95ce14fa508a57448 (diff)
downloadandroid_packages_apps_Trebuchet-bb83520a620919a8f19472ba4426585d007d1aba.tar.gz
android_packages_apps_Trebuchet-bb83520a620919a8f19472ba4426585d007d1aba.tar.bz2
android_packages_apps_Trebuchet-bb83520a620919a8f19472ba4426585d007d1aba.zip
Refactor StylusEventHelper to provide onButtonPress/Release methods
This will enable an easier migration to the new M APIs for identifying button presses from stylus / other tools. Bug: 20430722 Change-Id: I41cfa6eff8d76bb83cf1bdaf6623ec1092ed554c
Diffstat (limited to 'src/com/android/launcher3/SimpleOnStylusPressListener.java')
-rw-r--r--src/com/android/launcher3/SimpleOnStylusPressListener.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/com/android/launcher3/SimpleOnStylusPressListener.java b/src/com/android/launcher3/SimpleOnStylusPressListener.java
new file mode 100644
index 000000000..6b97dcee6
--- /dev/null
+++ b/src/com/android/launcher3/SimpleOnStylusPressListener.java
@@ -0,0 +1,25 @@
+package com.android.launcher3;
+
+import android.view.MotionEvent;
+import android.view.View;
+
+import com.android.launcher3.StylusEventHelper.StylusButtonListener;
+
+/**
+ * Simple listener that performs a long click on the view after a stylus button press.
+ */
+public class SimpleOnStylusPressListener implements StylusButtonListener {
+ private View mView;
+
+ public SimpleOnStylusPressListener(View view) {
+ mView = view;
+ }
+
+ public boolean onPressed(MotionEvent event) {
+ return mView.isLongClickable() && mView.performLongClick();
+ }
+
+ public boolean onReleased(MotionEvent event) {
+ return false;
+ }
+} \ No newline at end of file