diff options
author | Samuel Fufa <sfufa@google.com> | 2019-09-19 17:28:00 -0700 |
---|---|---|
committer | Samuel Fufa <sfufa@google.com> | 2019-09-24 14:10:03 -0700 |
commit | 4a1d9b12c5de21235287879c8c3e41d7d23d7bc3 (patch) | |
tree | 6ac58ffac63c09f22901684ff6fce1472c7ca27b /src/com/android | |
parent | cdcfd98c0528ce613fcc759c6a69382daa8df19c (diff) | |
download | packages_apps_Trebuchet-4a1d9b12c5de21235287879c8c3e41d7d23d7bc3.tar.gz packages_apps_Trebuchet-4a1d9b12c5de21235287879c8c3e41d7d23d7bc3.tar.bz2 packages_apps_Trebuchet-4a1d9b12c5de21235287879c8c3e41d7d23d7bc3.zip |
Allow LongPress between homescreen icons
approach: Ignore BubbleTextView touches in padding
Test: Manual
Bug:141265063
Change-Id: I579d414293e922e926410d0373f101f9dde9bce0
Diffstat (limited to 'src/com/android')
-rw-r--r-- | src/com/android/launcher3/BubbleTextView.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java index b1132494a..4d177103d 100644 --- a/src/com/android/launcher3/BubbleTextView.java +++ b/src/com/android/launcher3/BubbleTextView.java @@ -133,6 +133,9 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, @ViewDebug.ExportedProperty(category = "launcher") private boolean mDisableRelayout = false; + @ViewDebug.ExportedProperty(category = "launcher") + private final boolean mIgnorePaddingTouch; + private IconLoadRequest mIconLoadRequest; public BubbleTextView(Context context) { @@ -159,19 +162,25 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, setTextSize(TypedValue.COMPLEX_UNIT_PX, grid.iconTextSizePx); setCompoundDrawablePadding(grid.iconDrawablePaddingPx); defaultIconSize = grid.iconSizePx; + mIgnorePaddingTouch = true; } else if (display == DISPLAY_ALL_APPS) { DeviceProfile grid = mActivity.getDeviceProfile(); setTextSize(TypedValue.COMPLEX_UNIT_PX, grid.allAppsIconTextSizePx); setCompoundDrawablePadding(grid.allAppsIconDrawablePaddingPx); defaultIconSize = grid.allAppsIconSizePx; + mIgnorePaddingTouch = true; } else if (display == DISPLAY_FOLDER) { DeviceProfile grid = mActivity.getDeviceProfile(); setTextSize(TypedValue.COMPLEX_UNIT_PX, grid.folderChildTextSizePx); setCompoundDrawablePadding(grid.folderChildDrawablePaddingPx); defaultIconSize = grid.folderChildIconSizePx; + mIgnorePaddingTouch = true; } else { + // widget_selection or shortcut_popup defaultIconSize = mActivity.getDeviceProfile().iconSizePx; + mIgnorePaddingTouch = false; } + mCenterVertically = a.getBoolean(R.styleable.BubbleTextView_centerVertically, false); mIconSize = a.getDimensionPixelSize(R.styleable.BubbleTextView_iconSizeOverride, @@ -319,6 +328,15 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, @Override public boolean onTouchEvent(MotionEvent event) { + // ignore events if they happen in padding area + if (event.getAction() == MotionEvent.ACTION_DOWN && mIgnorePaddingTouch + && (event.getY() < getPaddingTop() + || event.getX() < getPaddingLeft() + || event.getY() > getHeight() - getPaddingBottom() + || event.getX() > getWidth() - getPaddingRight())) { + return false; + } + // Call the superclass onTouchEvent first, because sometimes it changes the state to // isPressed() on an ACTION_UP boolean result = super.onTouchEvent(event); |