Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BadgedImageView.java +9 −8 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ */ package com.android.wm.shell.bubbles; import static android.graphics.Paint.ANTI_ALIAS_FLAG; import static android.graphics.Paint.DITHER_FLAG; import static android.graphics.Paint.FILTER_BITMAP_FLAG; Loading @@ -22,10 +23,10 @@ import android.annotation.Nullable; import android.content.Context; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.PaintFlagsDrawFilter; import android.graphics.Path; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.util.PathParser; import android.widget.ImageView; Loading Loading @@ -75,13 +76,13 @@ public class BadgedImageView extends ImageView { private BubbleViewProvider mBubble; private BubblePositioner mPositioner; private boolean mOnLeft; private DotRenderer mDotRenderer; private DotRenderer.DrawParams mDrawParams; private boolean mOnLeft; private int mDotColor; private Paint mPaint = new Paint(ANTI_ALIAS_FLAG); private Rect mTempBounds = new Rect(); public BadgedImageView(Context context) { Loading Loading @@ -305,7 +306,7 @@ public class BadgedImageView extends ImageView { } void showBadge() { Drawable badge = mBubble.getAppBadge(); Bitmap badge = mBubble.getAppBadge(); if (badge == null) { setImageBitmap(mBubble.getBubbleIcon()); return; Loading @@ -318,13 +319,13 @@ public class BadgedImageView extends ImageView { bubbleCanvas.setBitmap(bubble); final int bubbleSize = bubble.getWidth(); final int badgeSize = (int) (ICON_BADGE_SCALE * bubbleSize); Rect dest = new Rect(); if (mOnLeft) { badge.setBounds(0, bubbleSize - badgeSize, badgeSize, bubbleSize); dest.set(0, bubbleSize - badgeSize, badgeSize, bubbleSize); } else { badge.setBounds(bubbleSize - badgeSize, bubbleSize - badgeSize, bubbleSize, bubbleSize); dest.set(bubbleSize - badgeSize, bubbleSize - badgeSize, bubbleSize, bubbleSize); } badge.draw(bubbleCanvas); bubbleCanvas.drawBitmap(badge, null /* src */, dest, mPaint); bubbleCanvas.setBitmap(null); setImageBitmap(bubble); } Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/Bubble.java +6 −5 Original line number Diff line number Diff line Loading @@ -104,9 +104,10 @@ public class Bubble implements BubbleViewProvider { } private FlyoutMessage mFlyoutMessage; private Drawable mBadgeDrawable; // Bitmap with no badge, no dot // The developer provided image for the bubble private Bitmap mBubbleBitmap; // The app badge for the bubble private Bitmap mBadgeBitmap; private int mDotColor; private Path mDotPath; private int mFlags; Loading Loading @@ -242,8 +243,8 @@ public class Bubble implements BubbleViewProvider { } @Override public Drawable getAppBadge() { return mBadgeDrawable; public Bitmap getAppBadge() { return mBadgeBitmap; } @Override Loading Loading @@ -398,7 +399,7 @@ public class Bubble implements BubbleViewProvider { mAppName = info.appName; mFlyoutMessage = info.flyoutMessage; mBadgeDrawable = info.badgeDrawable; mBadgeBitmap = info.badgeBitmap; mBubbleBitmap = info.bubbleBitmap; mDotColor = info.dotColor; Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleIconFactory.java +6 −8 Original line number Diff line number Diff line Loading @@ -101,6 +101,12 @@ public class BubbleIconFactory extends BaseIconFactory { userBadgedBitmap.getHeight(), userBadgedBitmap.getConfig()); Canvas c = new Canvas(badgeAndRing); Paint ringPaint = new Paint(); ringPaint.setStyle(Paint.Style.FILL); ringPaint.setColor(importantConversationColor); ringPaint.setAntiAlias(true); c.drawCircle(c.getWidth() / 2, c.getHeight() / 2, c.getWidth() / 2, ringPaint); final int bitmapTop = (int) ringStrokeWidth; final int bitmapLeft = (int) ringStrokeWidth; final int bitmapWidth = c.getWidth() - 2 * (int) ringStrokeWidth; Loading @@ -110,14 +116,6 @@ public class BubbleIconFactory extends BaseIconFactory { bitmapHeight, /* filter */ true); c.drawBitmap(scaledBitmap, bitmapTop, bitmapLeft, /* paint */null); Paint ringPaint = new Paint(); ringPaint.setStyle(Paint.Style.STROKE); ringPaint.setColor(importantConversationColor); ringPaint.setAntiAlias(true); ringPaint.setStrokeWidth(ringStrokeWidth); c.drawCircle(c.getWidth() / 2, c.getHeight() / 2, c.getWidth() / 2 - ringStrokeWidth, ringPaint); shadowGenerator.recreateIcon(Bitmap.createBitmap(badgeAndRing), c); return createIconBitmap(badgeAndRing); } else { Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleOverflow.kt +1 −2 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ import android.graphics.Matrix import android.graphics.Path import android.graphics.drawable.AdaptiveIconDrawable import android.graphics.drawable.ColorDrawable import android.graphics.drawable.Drawable import android.graphics.drawable.InsetDrawable import android.util.PathParser import android.util.TypedValue Loading Loading @@ -151,7 +150,7 @@ class BubbleOverflow( return dotColor } override fun getAppBadge(): Drawable? { override fun getAppBadge(): Bitmap? { return null } Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java +1 −1 Original line number Diff line number Diff line Loading @@ -2487,7 +2487,7 @@ public class BubbleStackView extends FrameLayout // name and icon. if (show && mBubbleData.hasBubbleInStackWithKey(mExpandedBubble.getKey())) { final Bubble bubble = mBubbleData.getBubbleInStackWithKey(mExpandedBubble.getKey()); mManageSettingsIcon.setImageDrawable(bubble.getAppBadge()); mManageSettingsIcon.setImageBitmap(bubble.getAppBadge()); mManageSettingsText.setText(getResources().getString( R.string.bubbles_app_settings, bubble.getAppName())); } Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BadgedImageView.java +9 −8 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ */ package com.android.wm.shell.bubbles; import static android.graphics.Paint.ANTI_ALIAS_FLAG; import static android.graphics.Paint.DITHER_FLAG; import static android.graphics.Paint.FILTER_BITMAP_FLAG; Loading @@ -22,10 +23,10 @@ import android.annotation.Nullable; import android.content.Context; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.PaintFlagsDrawFilter; import android.graphics.Path; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.util.PathParser; import android.widget.ImageView; Loading Loading @@ -75,13 +76,13 @@ public class BadgedImageView extends ImageView { private BubbleViewProvider mBubble; private BubblePositioner mPositioner; private boolean mOnLeft; private DotRenderer mDotRenderer; private DotRenderer.DrawParams mDrawParams; private boolean mOnLeft; private int mDotColor; private Paint mPaint = new Paint(ANTI_ALIAS_FLAG); private Rect mTempBounds = new Rect(); public BadgedImageView(Context context) { Loading Loading @@ -305,7 +306,7 @@ public class BadgedImageView extends ImageView { } void showBadge() { Drawable badge = mBubble.getAppBadge(); Bitmap badge = mBubble.getAppBadge(); if (badge == null) { setImageBitmap(mBubble.getBubbleIcon()); return; Loading @@ -318,13 +319,13 @@ public class BadgedImageView extends ImageView { bubbleCanvas.setBitmap(bubble); final int bubbleSize = bubble.getWidth(); final int badgeSize = (int) (ICON_BADGE_SCALE * bubbleSize); Rect dest = new Rect(); if (mOnLeft) { badge.setBounds(0, bubbleSize - badgeSize, badgeSize, bubbleSize); dest.set(0, bubbleSize - badgeSize, badgeSize, bubbleSize); } else { badge.setBounds(bubbleSize - badgeSize, bubbleSize - badgeSize, bubbleSize, bubbleSize); dest.set(bubbleSize - badgeSize, bubbleSize - badgeSize, bubbleSize, bubbleSize); } badge.draw(bubbleCanvas); bubbleCanvas.drawBitmap(badge, null /* src */, dest, mPaint); bubbleCanvas.setBitmap(null); setImageBitmap(bubble); } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/Bubble.java +6 −5 Original line number Diff line number Diff line Loading @@ -104,9 +104,10 @@ public class Bubble implements BubbleViewProvider { } private FlyoutMessage mFlyoutMessage; private Drawable mBadgeDrawable; // Bitmap with no badge, no dot // The developer provided image for the bubble private Bitmap mBubbleBitmap; // The app badge for the bubble private Bitmap mBadgeBitmap; private int mDotColor; private Path mDotPath; private int mFlags; Loading Loading @@ -242,8 +243,8 @@ public class Bubble implements BubbleViewProvider { } @Override public Drawable getAppBadge() { return mBadgeDrawable; public Bitmap getAppBadge() { return mBadgeBitmap; } @Override Loading Loading @@ -398,7 +399,7 @@ public class Bubble implements BubbleViewProvider { mAppName = info.appName; mFlyoutMessage = info.flyoutMessage; mBadgeDrawable = info.badgeDrawable; mBadgeBitmap = info.badgeBitmap; mBubbleBitmap = info.bubbleBitmap; mDotColor = info.dotColor; Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleIconFactory.java +6 −8 Original line number Diff line number Diff line Loading @@ -101,6 +101,12 @@ public class BubbleIconFactory extends BaseIconFactory { userBadgedBitmap.getHeight(), userBadgedBitmap.getConfig()); Canvas c = new Canvas(badgeAndRing); Paint ringPaint = new Paint(); ringPaint.setStyle(Paint.Style.FILL); ringPaint.setColor(importantConversationColor); ringPaint.setAntiAlias(true); c.drawCircle(c.getWidth() / 2, c.getHeight() / 2, c.getWidth() / 2, ringPaint); final int bitmapTop = (int) ringStrokeWidth; final int bitmapLeft = (int) ringStrokeWidth; final int bitmapWidth = c.getWidth() - 2 * (int) ringStrokeWidth; Loading @@ -110,14 +116,6 @@ public class BubbleIconFactory extends BaseIconFactory { bitmapHeight, /* filter */ true); c.drawBitmap(scaledBitmap, bitmapTop, bitmapLeft, /* paint */null); Paint ringPaint = new Paint(); ringPaint.setStyle(Paint.Style.STROKE); ringPaint.setColor(importantConversationColor); ringPaint.setAntiAlias(true); ringPaint.setStrokeWidth(ringStrokeWidth); c.drawCircle(c.getWidth() / 2, c.getHeight() / 2, c.getWidth() / 2 - ringStrokeWidth, ringPaint); shadowGenerator.recreateIcon(Bitmap.createBitmap(badgeAndRing), c); return createIconBitmap(badgeAndRing); } else { Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleOverflow.kt +1 −2 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ import android.graphics.Matrix import android.graphics.Path import android.graphics.drawable.AdaptiveIconDrawable import android.graphics.drawable.ColorDrawable import android.graphics.drawable.Drawable import android.graphics.drawable.InsetDrawable import android.util.PathParser import android.util.TypedValue Loading Loading @@ -151,7 +150,7 @@ class BubbleOverflow( return dotColor } override fun getAppBadge(): Drawable? { override fun getAppBadge(): Bitmap? { return null } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java +1 −1 Original line number Diff line number Diff line Loading @@ -2487,7 +2487,7 @@ public class BubbleStackView extends FrameLayout // name and icon. if (show && mBubbleData.hasBubbleInStackWithKey(mExpandedBubble.getKey())) { final Bubble bubble = mBubbleData.getBubbleInStackWithKey(mExpandedBubble.getKey()); mManageSettingsIcon.setImageDrawable(bubble.getAppBadge()); mManageSettingsIcon.setImageBitmap(bubble.getAppBadge()); mManageSettingsText.setText(getResources().getString( R.string.bubbles_app_settings, bubble.getAppName())); } Loading