diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2018-03-14 12:30:11 -0700 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2018-03-15 17:29:43 -0700 |
commit | 0b0847b272a37ed115504956be5ce44a96b5784c (patch) | |
tree | 03014c8d93aca5eadcdb1838808a3a035f41619a /src/com/android/launcher3/BubbleTextView.java | |
parent | 39b5534b96a889393b3bafd84dda6333ea8eb157 (diff) | |
download | android_packages_apps_Trebuchet-0b0847b272a37ed115504956be5ce44a96b5784c.tar.gz android_packages_apps_Trebuchet-0b0847b272a37ed115504956be5ce44a96b5784c.tar.bz2 android_packages_apps_Trebuchet-0b0847b272a37ed115504956be5ce44a96b5784c.zip |
Fixing taskMenu and taskView clicks in fallback activity
> Extracting common methods from Launcher & DragLauncher to base classes
> Remoting some dependencies on Launcher and using the base class instead
Change-Id: I121cacf8a14190b4703cda60bdeb4f79eee69ded
Diffstat (limited to 'src/com/android/launcher3/BubbleTextView.java')
-rw-r--r-- | src/com/android/launcher3/BubbleTextView.java | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java index 8b6d9f825..fc61155d3 100644 --- a/src/com/android/launcher3/BubbleTextView.java +++ b/src/com/android/launcher3/BubbleTextView.java @@ -44,7 +44,6 @@ import com.android.launcher3.Launcher.OnResumeCallback; import com.android.launcher3.badge.BadgeInfo; import com.android.launcher3.badge.BadgeRenderer; import com.android.launcher3.folder.FolderIcon; -import com.android.launcher3.folder.FolderIconPreviewVerifier; import com.android.launcher3.graphics.DrawableFactory; import com.android.launcher3.graphics.IconPalette; import com.android.launcher3.graphics.PreloadIconDrawable; @@ -65,7 +64,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, private static final int[] STATE_PRESSED = new int[] {android.R.attr.state_pressed}; - private final Launcher mLauncher; + private final BaseDraggingActivity mActivity; private Drawable mIcon; private final boolean mCenterVertically; @@ -133,8 +132,8 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, public BubbleTextView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); - mLauncher = Launcher.getLauncher(context); - DeviceProfile grid = mLauncher.getDeviceProfile(); + mActivity = BaseDraggingActivity.fromContext(context); + DeviceProfile grid = mActivity.getDeviceProfile(); mSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop(); TypedArray a = context.obtainStyledAttributes(attrs, @@ -164,7 +163,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, mLongPressHelper = new CheckLongPressHelper(this); mStylusEventHelper = new StylusEventHelper(new SimpleOnStylusPressListener(this), this); - setAccessibilityDelegate(mLauncher.getAccessibilityDelegate()); + setAccessibilityDelegate(mActivity.getAccessibilityDelegate()); } @@ -493,10 +492,10 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, public void applyBadgeState(ItemInfo itemInfo, boolean animate) { if (mIcon instanceof FastBitmapDrawable) { boolean wasBadged = mBadgeInfo != null; - mBadgeInfo = mLauncher.getPopupDataProvider().getBadgeInfoForItem(itemInfo); + mBadgeInfo = mActivity.getBadgeInfoForItem(itemInfo); boolean isBadged = mBadgeInfo != null; float newBadgeScale = isBadged ? 1f : 0; - mBadgeRenderer = mLauncher.getDeviceProfile().mBadgeRenderer; + mBadgeRenderer = mActivity.getDeviceProfile().mBadgeRenderer; if (wasBadged || isBadged) { // Animate when a badge is first added or when it is removed. if (animate && (wasBadged ^ isBadged) && isShown()) { @@ -572,15 +571,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, applyFromApplicationInfo((AppInfo) info); } else if (info instanceof ShortcutInfo) { applyFromShortcutInfo((ShortcutInfo) info); - FolderIconPreviewVerifier verifier = - new FolderIconPreviewVerifier(mLauncher.getDeviceProfile().inv); - if (verifier.isItemInPreview(info.rank) && (info.container >= 0)) { - View folderIcon = - mLauncher.getWorkspace().getHomescreenIconByItemId(info.container); - if (folderIcon != null) { - folderIcon.invalidate(); - } - } + mActivity.invalidateParent(info); } else if (info instanceof PackageItemInfo) { applyFromPackageItemInfo((PackageItemInfo) info); } |