Make AdaptiveIcon support different inset
Settings used AdpativeIcon for injection icons of homepage and the rainbow icons of connected devices. In the past, the default inset was 6dp which is to generate the 36dp icon. Based on the Android S design, we would like to apply different size to the homepage icon. Therefore, make the AdaptiveIcon to support different insets. Fixes: 177213699 Test: robotest & visual with turning on/off silky home Change-Id: I1739eeb58e362f24719ef2476c442c867d0ecb3a
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user