Merge "Include app badge without markings in bubble data"

This commit is contained in:
TreeHugger Robot
2022-01-06 21:26:26 +00:00
committed by Android (Google) Code Review
5 changed files with 24 additions and 4 deletions

View File

@@ -108,6 +108,8 @@ public class Bubble implements BubbleViewProvider {
private Bitmap mBubbleBitmap;
// The app badge for the bubble
private Bitmap mBadgeBitmap;
// App badge without any markings for important conversations
private Bitmap mRawBadgeBitmap;
private int mDotColor;
private Path mDotPath;
private int mFlags;
@@ -247,6 +249,11 @@ public class Bubble implements BubbleViewProvider {
return mBadgeBitmap;
}
@Override
public Bitmap getRawAppBadge() {
return mRawBadgeBitmap;
}
@Override
public int getDotColor() {
return mDotColor;
@@ -409,6 +416,7 @@ public class Bubble implements BubbleViewProvider {
mFlyoutMessage = info.flyoutMessage;
mBadgeBitmap = info.badgeBitmap;
mRawBadgeBitmap = info.mRawBadgeBitmap;
mBubbleBitmap = info.bubbleBitmap;
mDotColor = info.dotColor;

View File

@@ -141,6 +141,10 @@ class BubbleOverflow(
return null
}
override fun getRawAppBadge(): Bitmap? {
return null
}
override fun getBubbleIcon(): Bitmap {
return bitmap
}

View File

@@ -2615,11 +2615,13 @@ public class BubbleStackView extends FrameLayout
// If available, update the manage menu's settings option with the expanded bubble's app
// name and icon.
if (show && mBubbleData.hasBubbleInStackWithKey(mExpandedBubble.getKey())) {
if (show) {
final Bubble bubble = mBubbleData.getBubbleInStackWithKey(mExpandedBubble.getKey());
mManageSettingsIcon.setImageBitmap(bubble.getAppBadge());
mManageSettingsText.setText(getResources().getString(
R.string.bubbles_app_settings, bubble.getAppName()));
if (bubble != null) {
mManageSettingsIcon.setImageBitmap(bubble.getRawAppBadge());
mManageSettingsText.setText(getResources().getString(
R.string.bubbles_app_settings, bubble.getAppName()));
}
}
if (mExpandedBubble.getExpandedView().getTaskView() != null) {

View File

@@ -127,6 +127,7 @@ public class BubbleViewInfoTask extends AsyncTask<Void, Void, BubbleViewInfoTask
String appName;
Bitmap bubbleBitmap;
Bitmap badgeBitmap;
Bitmap mRawBadgeBitmap;
int dotColor;
Path dotPath;
Bubble.FlyoutMessage flyoutMessage;
@@ -189,6 +190,8 @@ public class BubbleViewInfoTask extends AsyncTask<Void, Void, BubbleViewInfoTask
BitmapInfo badgeBitmapInfo = iconFactory.getBadgeBitmap(badgedIcon,
b.isImportantConversation());
info.badgeBitmap = badgeBitmapInfo.icon;
// Raw badge bitmap never includes the important conversation ring
info.mRawBadgeBitmap = iconFactory.getBadgeBitmap(badgedIcon, false).icon;
info.bubbleBitmap = iconFactory.createBadgedIconBitmap(bubbleDrawable).icon;
// Dot color & placement

View File

@@ -43,6 +43,9 @@ public interface BubbleViewProvider {
/** App badge drawable to draw above bubble icon. */
@Nullable Bitmap getAppBadge();
/** Base app badge drawable without any markings. */
@Nullable Bitmap getRawAppBadge();
/** Path of normalized bubble icon to draw dot on. */
Path getDotPath();