diff options
Diffstat (limited to 'src/com/android/launcher3/BubbleTextView.java')
-rw-r--r-- | src/com/android/launcher3/BubbleTextView.java | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java index dfb7a1c86..5e73880a8 100644 --- a/src/com/android/launcher3/BubbleTextView.java +++ b/src/com/android/launcher3/BubbleTextView.java @@ -106,6 +106,8 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, private Drawable mIcon; private final boolean mCenterVertically; + private final int mDisplay; + private final CheckLongPressHelper mLongPressHelper; private final StylusEventHelper mStylusEventHelper; private final float mSlop; @@ -134,6 +136,8 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, private boolean mIgnorePressedStateChange; @ViewDebug.ExportedProperty(category = "launcher") private boolean mDisableRelayout = false; + @ViewDebug.ExportedProperty(category = "launcher") + private final boolean mIgnorePaddingTouch; private boolean mShouldShowLabel; @@ -158,30 +162,36 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, SharedPreferences prefs = Utilities.getPrefs(context.getApplicationContext()); - int display = a.getInteger(R.styleable.BubbleTextView_iconDisplay, DISPLAY_WORKSPACE); + mDisplay = a.getInteger(R.styleable.BubbleTextView_iconDisplay, DISPLAY_WORKSPACE); final int defaultIconSize; - if (display == DISPLAY_WORKSPACE) { + if (mDisplay == DISPLAY_WORKSPACE) { DeviceProfile grid = mActivity.getWallpaperDeviceProfile(); setTextSize(TypedValue.COMPLEX_UNIT_PX, grid.iconTextSizePx); setCompoundDrawablePadding(grid.iconDrawablePaddingPx); defaultIconSize = grid.iconSizePx; mShouldShowLabel = prefs.getBoolean(KEY_SHOW_DESKTOP_LABELS, true); - } else if (display == DISPLAY_ALL_APPS) { + mIgnorePaddingTouch = true; + } else if (mDisplay == DISPLAY_ALL_APPS) { DeviceProfile grid = mActivity.getDeviceProfile(); setTextSize(TypedValue.COMPLEX_UNIT_PX, grid.allAppsIconTextSizePx); setCompoundDrawablePadding(grid.allAppsIconDrawablePaddingPx); defaultIconSize = grid.allAppsIconSizePx; mShouldShowLabel = prefs.getBoolean(KEY_SHOW_DRAWER_LABELS, true); - } else if (display == DISPLAY_FOLDER) { + mIgnorePaddingTouch = true; + } else if (mDisplay == DISPLAY_FOLDER) { DeviceProfile grid = mActivity.getDeviceProfile(); setTextSize(TypedValue.COMPLEX_UNIT_PX, grid.folderChildTextSizePx); setCompoundDrawablePadding(grid.folderChildDrawablePaddingPx); defaultIconSize = grid.folderChildIconSizePx; + mIgnorePaddingTouch = true; mShouldShowLabel = prefs.getBoolean(KEY_SHOW_DESKTOP_LABELS, true); } else { + // widget_selection or shortcut_popup defaultIconSize = mActivity.getDeviceProfile().iconSizePx; + mIgnorePaddingTouch = false; mShouldShowLabel = prefs.getBoolean(KEY_SHOW_DESKTOP_LABELS, true); } + mCenterVertically = a.getBoolean(R.styleable.BubbleTextView_centerVertically, false); mIconSize = a.getDimensionPixelSize(R.styleable.BubbleTextView_iconSizeOverride, @@ -331,6 +341,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); @@ -576,7 +595,11 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, mDotInfo = mActivity.getDotInfoForItem(itemInfo); boolean isDotted = mDotInfo != null; float newDotScale = isDotted ? 1f : 0; - mDotRenderer = mActivity.getDeviceProfile().mDotRenderer; + if (mDisplay == DISPLAY_ALL_APPS) { + mDotRenderer = mActivity.getDeviceProfile().mDotRendererAllApps; + } else { + mDotRenderer = mActivity.getDeviceProfile().mDotRendererWorkSpace; + } if (wasDotted || isDotted) { // Animate when a dot is first added or when it is removed. if (animate && (wasDotted ^ isDotted) && isShown()) { |