Merge "Use bitmap width for bubble icon and app badge to calculate translation" into tm-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
eadf688621
@@ -19,6 +19,7 @@ import android.annotation.DrawableRes;
|
|||||||
import android.annotation.Nullable;
|
import android.annotation.Nullable;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Outline;
|
import android.graphics.Outline;
|
||||||
import android.graphics.Path;
|
import android.graphics.Path;
|
||||||
@@ -350,16 +351,19 @@ public class BadgedImageView extends ConstraintLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void showBadge() {
|
void showBadge() {
|
||||||
if (mBubble.getAppBadge() == null) {
|
Bitmap appBadgeBitmap = mBubble.getAppBadge();
|
||||||
|
if (appBadgeBitmap == null) {
|
||||||
mAppIcon.setVisibility(GONE);
|
mAppIcon.setVisibility(GONE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int translationX;
|
int translationX;
|
||||||
if (mOnLeft) {
|
if (mOnLeft) {
|
||||||
translationX = -(mBubbleIcon.getWidth() - mAppIcon.getWidth());
|
translationX = -(mBubble.getBubbleIcon().getWidth() - appBadgeBitmap.getWidth());
|
||||||
} else {
|
} else {
|
||||||
translationX = 0;
|
translationX = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
mAppIcon.setTranslationX(translationX);
|
mAppIcon.setTranslationX(translationX);
|
||||||
mAppIcon.setVisibility(VISIBLE);
|
mAppIcon.setVisibility(VISIBLE);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user