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

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

Merge "Add a shadow to the app badge" into qt-r1-bubbles-dev

parents 5e9d3ead d20ff41e
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -28,4 +28,9 @@ public class BubbleIconFactory extends BaseIconFactory {
    protected BubbleIconFactory(Context context, int iconBitmapSize) {
        super(context, context.getResources().getConfiguration().densityDpi, iconBitmapSize);
    }

    public int getBadgeSize() {
        return mContext.getResources().getDimensionPixelSize(
                com.android.launcher3.icons.R.dimen.profile_badge_size);
    }
}
+14 −1
Original line number Diff line number Diff line
@@ -20,10 +20,12 @@ import android.annotation.Nullable;
import android.app.Notification;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Path;
import android.graphics.drawable.AdaptiveIconDrawable;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Icon;
@@ -33,6 +35,7 @@ import android.util.PathParser;
import android.widget.FrameLayout;

import com.android.internal.graphics.ColorUtils;
import com.android.launcher3.icons.ShadowGenerator;
import com.android.systemui.Interpolators;
import com.android.systemui.R;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
@@ -235,7 +238,17 @@ public class BubbleView extends FrameLayout {
        Bitmap bubbleIcon = mBubbleIconFactory.createBadgedIconBitmap(iconDrawable,
                null /* user */,
                true /* shrinkNonAdaptiveIcons */).icon;
        mBubbleIconFactory.badgeWithDrawable(bubbleIcon, mUserBadgedAppIcon);

        // Give it a shadow
        Bitmap userBadgedBitmap = mBubbleIconFactory.createIconBitmap(mUserBadgedAppIcon,
                1f, mBubbleIconFactory.getBadgeSize());
        Canvas c = new Canvas();
        ShadowGenerator shadowGenerator = new ShadowGenerator(mBubbleIconFactory.getBadgeSize());
        c.setBitmap(userBadgedBitmap);
        shadowGenerator.recreateIcon(Bitmap.createBitmap(userBadgedBitmap), c);

        mBubbleIconFactory.badgeWithDrawable(bubbleIcon,
                new BitmapDrawable(mContext.getResources(), userBadgedBitmap));
        mBadgedImageView.setImageBitmap(bubbleIcon);

        // Update badge.