Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 66d2aa64 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Bubble badging" into qt-r1-bubbles-dev

parents 9733bc41 4c1731f7
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Parcelable;
import android.os.UserHandle;
import android.provider.Settings;
@@ -55,6 +56,7 @@ class Bubble {
    private final String mKey;
    private final String mGroupId;
    private String mAppName;
    private Drawable mUserBadgedAppIcon;

    private boolean mInflated;
    private BubbleView mIconView;
@@ -105,6 +107,8 @@ class Bubble {
            if (info != null) {
                mAppName = String.valueOf(pm.getApplicationLabel(info));
            }
            Drawable appIcon = pm.getApplicationIcon(mEntry.notification.getPackageName());
            mUserBadgedAppIcon = pm.getUserBadgedIcon(appIcon, mEntry.notification.getUser());
        } catch (PackageManager.NameNotFoundException unused) {
            mAppName = mEntry.notification.getPackageName();
        }
@@ -161,6 +165,7 @@ class Bubble {
        mIconView = (BubbleView) inflater.inflate(
                R.layout.bubble_view, stackView, false /* attachToRoot */);
        mIconView.setBubble(this);
        mIconView.setAppIcon(mUserBadgedAppIcon);

        mExpandedView = (BubbleExpandedView) inflater.inflate(
                R.layout.bubble_expanded_view, stackView, false /* attachToRoot */);
+9 −4
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.systemui.bubbles;
import android.annotation.Nullable;
import android.app.Notification;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Path;
@@ -32,7 +33,6 @@ import android.util.PathParser;
import android.widget.FrameLayout;

import com.android.internal.graphics.ColorUtils;
import com.android.launcher3.icons.BitmapInfo;
import com.android.systemui.Interpolators;
import com.android.systemui.R;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
@@ -53,6 +53,7 @@ public class BubbleView extends FrameLayout {
    private BadgedImageView mBadgedImageView;
    private int mBadgeColor;
    private int mIconInset;
    private Drawable mUserBadgedAppIcon;

    // mBubbleIconFactory cannot be static because it depends on Context.
    private BubbleIconFactory mBubbleIconFactory;
@@ -133,6 +134,9 @@ public class BubbleView extends FrameLayout {
        mBubbleIconFactory = factory;
    }

    public void setAppIcon(Drawable appIcon) {
        mUserBadgedAppIcon = appIcon;
    }
    /**
     * @return the {@link ExpandableNotificationRow} view to display notification content when the
     * bubble is expanded.
@@ -228,10 +232,11 @@ public class BubbleView extends FrameLayout {
        if (needsTint) {
            iconDrawable = buildIconWithTint(iconDrawable, n.color);
        }
        BitmapInfo bitmapInfo = mBubbleIconFactory.createBadgedIconBitmap(iconDrawable,
        Bitmap bubbleIcon = mBubbleIconFactory.createBadgedIconBitmap(iconDrawable,
                null /* user */,
                true /* shrinkNonAdaptiveIcons */);
        mBadgedImageView.setImageBitmap(bitmapInfo.icon);
                true /* shrinkNonAdaptiveIcons */).icon;
        mBubbleIconFactory.badgeWithDrawable(bubbleIcon, mUserBadgedAppIcon);
        mBadgedImageView.setImageBitmap(bubbleIcon);

        // Update badge.
        int badgeColor = determineDominateColor(iconDrawable, n.color);