summaryrefslogtreecommitdiffstats
path: root/WallpaperPicker/src/com
diff options
context:
space:
mode:
authorMady Mellor <madym@google.com>2015-06-02 15:35:07 -0700
committerMady Mellor <madym@google.com>2015-06-02 15:35:07 -0700
commitef044dd380ac3abf354027750efdc16d5d48ac70 (patch)
tree4e1e94f011c84d407395617315504b6ae3d67c7e /WallpaperPicker/src/com
parent585b764ae24c7869704c428d1739e151e989674d (diff)
downloadandroid_packages_apps_Trebuchet-ef044dd380ac3abf354027750efdc16d5d48ac70.tar.gz
android_packages_apps_Trebuchet-ef044dd380ac3abf354027750efdc16d5d48ac70.tar.bz2
android_packages_apps_Trebuchet-ef044dd380ac3abf354027750efdc16d5d48ac70.zip
Stylus support: creating and setting listeners for stylus button press
This updates almost(*) all locations that use a long press listener to also set a custom touch listener that recognizes the stylus button press action. The stylus button press action is: when a stylus touches a view while the primary stylus button is pressed which may occur on a DOWN or MOVE event. *The location this is *not* enabled for is: Longpress to enter "overview" mode -- this isn't really a selection or drag n drop action; it is also easy to accidentally do this while using the stylus gesture to drag n drop items which is not an ideal interaction. Also not set for the "cling" that demonstrates this. Bug: 20430722 Change-Id: I9343f143261a7b4fada9afca28b8a11a60dbecca
Diffstat (limited to 'WallpaperPicker/src/com')
-rw-r--r--WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java
index 3f90203ed..96238717e 100644
--- a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java
+++ b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java
@@ -49,6 +49,7 @@ import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
+import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnLayoutChangeListener;
@@ -891,6 +892,15 @@ public class WallpaperPickerActivity extends WallpaperCropActivity {
private void addLongPressHandler(View v) {
v.setOnLongClickListener(mLongClickListener);
+
+ // Enable stylus button to also trigger long click.
+ final StylusEventHelper stylusEventHelper = new StylusEventHelper(v);
+ v.setOnTouchListener(new View.OnTouchListener() {
+ @Override
+ public boolean onTouch(View view, MotionEvent event) {
+ return stylusEventHelper.checkAndPerformStylusEvent(event);
+ }
+ });
}
private ArrayList<WallpaperTileInfo> findBundledWallpapers() {