diff options
| -rw-r--r-- | packages/SystemUI/res/values/dimens.xml | 1 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileBaseView.java | 26 |
2 files changed, 22 insertions, 5 deletions
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index b6c9b8c8cee8..cb860ae0b8b4 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -361,6 +361,7 @@ <!-- The height of the qs customize header. Should be (28dp - qs_tile_margin_top_bottom). --> <dimen name="qs_customize_header_min_height">40dp</dimen> <dimen name="qs_tile_margin_top">18dp</dimen> + <dimen name="qs_tile_background_size">40dp</dimen> <dimen name="qs_quick_tile_size">48dp</dimen> <!-- Maximum width of quick quick settings panel. Defaults to MATCH_PARENT--> <dimen name="qs_quick_layout_width">-1px</dimen> diff --git a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileBaseView.java b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileBaseView.java index 3a96595dee06..32fd2dcedd0e 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileBaseView.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileBaseView.java @@ -19,14 +19,19 @@ import android.animation.ValueAnimator; import android.content.Context; import android.content.res.ColorStateList; import android.content.res.TypedArray; +import android.graphics.Path; +import android.graphics.drawable.AdaptiveIconDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.RippleDrawable; +import android.graphics.drawable.ShapeDrawable; +import android.graphics.drawable.shapes.PathShape; import android.os.Handler; import android.os.Looper; import android.os.Message; import android.service.quicksettings.Tile; import android.text.TextUtils; import android.util.Log; +import android.util.PathParser; import android.view.Gravity; import android.view.View; import android.view.ViewGroup; @@ -46,6 +51,7 @@ import com.android.systemui.plugins.qs.QSTile.BooleanState; public class QSTileBaseView extends com.android.systemui.plugins.qs.QSTileView { private static final String TAG = "QSTileBaseView"; + private static final int ICON_MASK_ID = com.android.internal.R.string.config_icon_mask; private final H mHandler = new H(); private final int[] mLocInScreen = new int[2]; private final FrameLayout mIconFrame; @@ -62,6 +68,7 @@ public class QSTileBaseView extends com.android.systemui.plugins.qs.QSTileView { private final int mColorInactive; private final int mColorDisabled; private int mCircleColor; + private int mBgSize; public QSTileBaseView(Context context, QSIconView icon) { this(context, icon, false); @@ -71,15 +78,23 @@ public class QSTileBaseView extends com.android.systemui.plugins.qs.QSTileView { super(context); // Default to Quick Tile padding, and QSTileView will specify its own padding. int padding = context.getResources().getDimensionPixelSize(R.dimen.qs_quick_tile_padding); - mIconFrame = new FrameLayout(context); mIconFrame.setForegroundGravity(Gravity.CENTER); int size = context.getResources().getDimensionPixelSize(R.dimen.qs_quick_tile_size); addView(mIconFrame, new LayoutParams(size, size)); mBg = new ImageView(getContext()); + Path path = new Path(PathParser.createPathFromPathData( + context.getResources().getString(ICON_MASK_ID))); + float pathSize = AdaptiveIconDrawable.MASK_SIZE; + PathShape p = new PathShape(path, pathSize, pathSize); + ShapeDrawable d = new ShapeDrawable(p); + int bgSize = context.getResources().getDimensionPixelSize(R.dimen.qs_tile_background_size); + d.setIntrinsicHeight(bgSize); + d.setIntrinsicWidth(bgSize); mBg.setScaleType(ScaleType.FIT_CENTER); - mBg.setImageResource(R.drawable.ic_qs_circle); - mIconFrame.addView(mBg); + mBg.setImageDrawable(d); + mIconFrame.addView(mBg, ViewGroup.LayoutParams.MATCH_PARENT, + ViewGroup.LayoutParams.MATCH_PARENT); mIcon = icon; FrameLayout.LayoutParams params = new FrameLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); @@ -107,7 +122,7 @@ public class QSTileBaseView extends com.android.systemui.plugins.qs.QSTileView { setFocusable(true); } - public View getBgCicle() { + public View getBgCircle() { return mBg; } @@ -303,6 +318,7 @@ public class QSTileBaseView extends com.android.systemui.plugins.qs.QSTileView { private class H extends Handler { private static final int STATE_CHANGED = 1; + public H() { super(Looper.getMainLooper()); } @@ -314,4 +330,4 @@ public class QSTileBaseView extends com.android.systemui.plugins.qs.QSTileView { } } } -} +}
\ No newline at end of file |