Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 157639fc authored by Yanting Yang's avatar Yanting Yang
Browse files

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
parent e277b9a5
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -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);
    }