summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Yanting Yang <yantingyang@google.com> 2021-01-15 02:58:10 +0800
committer Yanting Yang <yantingyang@google.com> 2021-01-15 12:14:01 +0800
commit157639fc633ad7f03e4aecf006637ce8d598e356 (patch)
tree921d2c80e3b45921435039878550a1328391b9f6
parente277b9a53d51d099ef171be42cb7db0c9b3166c9 (diff)
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
-rw-r--r--packages/SettingsLib/AdaptiveIcon/src/com/android/settingslib/widget/AdaptiveIcon.java7
1 files 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 fc93650a6b85..723caf2ce0a1 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);
}