path: root/WallpaperPicker
diff options
authorMady Mellor <>2015-06-02 15:35:07 -0700
committerMady Mellor <>2015-06-02 15:35:07 -0700
commitef044dd380ac3abf354027750efdc16d5d48ac70 (patch)
tree4e1e94f011c84d407395617315504b6ae3d67c7e /WallpaperPicker
parent585b764ae24c7869704c428d1739e151e989674d (diff)
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')
1 files changed, 10 insertions, 0 deletions
diff --git a/WallpaperPicker/src/com/android/launcher3/ b/WallpaperPicker/src/com/android/launcher3/
index 3f90203ed..96238717e 100644
--- a/WallpaperPicker/src/com/android/launcher3/
+++ b/WallpaperPicker/src/com/android/launcher3/
@@ -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) {
+ // 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() {