From 157639fc633ad7f03e4aecf006637ce8d598e356 Mon Sep 17 00:00:00 2001 From: Yanting Yang Date: Fri, 15 Jan 2021 02:58:10 +0800 Subject: [PATCH] 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 --- .../src/com/android/settingslib/widget/AdaptiveIcon.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/SettingsLib/AdaptiveIcon/src/com/android/settingslib/widget/AdaptiveIcon.java b/packages/SettingsLib/AdaptiveIcon/src/com/android/settingslib/widget/AdaptiveIcon.java index fc93650a6b85d..723caf2ce0a1f 100644 --- a/packages/SettingsLib/AdaptiveIcon/src/com/android/settingslib/widget/AdaptiveIcon.java +++ b/packages/SettingsLib/AdaptiveIcon/src/com/android/settingslib/widget/AdaptiveIcon.java @@ -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); }