Move update popup header out of BubbleTextView

Now we update from Launcher, which is both more efficient (only run it
when badges update, not whenever BubbleTextView applies an ItemInfo) and
more logical/cleaner.

Change-Id: Ib77433d9489c29e9781b3a48de37de0e07b5ba07
This commit is contained in:
Tony Wickham
2017-04-25 12:46:04 -07:00
parent 0fa96ea2f6
commit 2fe09f24eb
3 changed files with 23 additions and 25 deletions

View File

@@ -49,7 +49,6 @@ import com.android.launcher3.graphics.HolographicOutlineHelper;
import com.android.launcher3.graphics.IconPalette;
import com.android.launcher3.graphics.PreloadIconDrawable;
import com.android.launcher3.model.PackageItemInfo;
import com.android.launcher3.popup.PopupContainerWithArrow;
import java.text.NumberFormat;
@@ -573,18 +572,11 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver {
public void applyBadgeState(ItemInfo itemInfo, boolean animate) {
if (mIcon instanceof FastBitmapDrawable) {
BadgeInfo badgeInfo = mLauncher.getPopupDataProvider().getBadgeInfoForItem(itemInfo);
BadgeRenderer badgeRenderer = mLauncher.getDeviceProfile().mBadgeRenderer;
PopupContainerWithArrow popup = PopupContainerWithArrow.getOpen(mLauncher);
if (popup != null) {
popup.updateNotificationHeader(badgeInfo, itemInfo);
}
boolean wasBadged = mBadgeInfo != null;
boolean isBadged = badgeInfo != null;
mBadgeInfo = mLauncher.getPopupDataProvider().getBadgeInfoForItem(itemInfo);
boolean isBadged = mBadgeInfo != null;
float newBadgeScale = isBadged ? 1f : 0;
mBadgeInfo = badgeInfo;
mBadgeRenderer = badgeRenderer;
mBadgeRenderer = mLauncher.getDeviceProfile().mBadgeRenderer;
if (wasBadged || isBadged) {
mIconPalette = ((FastBitmapDrawable) mIcon).getIconPalette();
// Animate when a badge is first added or when it is removed.