Merge "Make AdaptiveIcon support different inset"

This commit is contained in:
Yanting Yang
2021-01-15 07:20:50 +00:00
committed by Android (Google) Code Review

View File

@@ -45,12 +45,15 @@ public class AdaptiveIcon extends LayerDrawable {
private AdaptiveConstantState mAdaptiveConstantState;
public AdaptiveIcon(Context context, Drawable foreground) {
this(context, foreground, R.dimen.dashboard_tile_foreground_image_inset);
}
public AdaptiveIcon(Context context, Drawable foreground, int insetResId) {
super(new Drawable[]{
new AdaptiveIconShapeDrawable(context.getResources()),
foreground
});
final int insetPx = context.getResources()
.getDimensionPixelSize(R.dimen.dashboard_tile_foreground_image_inset);
final int insetPx = context.getResources().getDimensionPixelSize(insetResId);
setLayerInset(1 /* index */, insetPx, insetPx, insetPx, insetPx);
mAdaptiveConstantState = new AdaptiveConstantState(context, foreground);
}