Include app badge without markings in bubble data
Sometimes we need to show the app badge without any markings for priority conversations. For example in case of the manage menu. As we include the priority ring in the app badge icon itself, add another app badge icon to bubble data that does not include the priority ring - raw app badge. Change-Id: Ib472519d9bec5cdd09d7559e4dad2ee5e5f71b50 Test: verified that priority conversation bubble has ring around app badge and no ring in manage menu Bug: 189173831 Change-Id: I276e110ece40bf394f58da9acc3d0ecd09cf5afc
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -141,6 +141,10 @@ class BubbleOverflow(
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getRawAppBadge(): Bitmap? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getBubbleIcon(): Bitmap {
|
||||
return bitmap
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user