diff options
author | John Spurlock <jspurlock@google.com> | 2014-11-04 09:41:32 -0500 |
---|---|---|
committer | John Spurlock <jspurlock@google.com> | 2014-11-04 09:41:32 -0500 |
commit | 31798f17b1fc45383ab4301c843f7245a6e706c0 (patch) | |
tree | 63488bf6be9150410040363fe1fce85baa9cd24c | |
parent | d94017b0c26471461f668badb2584df0026da1a8 (diff) | |
download | frameworks_base-31798f17b1fc45383ab4301c843f7245a6e706c0.zip frameworks_base-31798f17b1fc45383ab4301c843f7245a6e706c0.tar.gz frameworks_base-31798f17b1fc45383ab4301c843f7245a6e706c0.tar.bz2 |
QS: Create the tile background once per tile.
Bug: 18219320
Change-Id: I15cbb7623c3e81b724fb0c4e830ae4e6615552dc
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/qs/QSTileView.java | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSTileView.java b/packages/SystemUI/src/com/android/systemui/qs/QSTileView.java index 6b7bdd6..3d0f47c 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSTileView.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSTileView.java @@ -63,6 +63,7 @@ public class QSTileView extends ViewGroup { private boolean mDual; private OnClickListener mClickPrimary; private OnClickListener mClickSecondary; + private Drawable mTileBackground; private RippleDrawable mRipple; public QSTileView(Context context) { @@ -75,6 +76,7 @@ public class QSTileView extends ViewGroup { mTilePaddingBelowIconPx = res.getDimensionPixelSize(R.dimen.qs_tile_padding_below_icon); mDualTileVerticalPaddingPx = res.getDimensionPixelSize(R.dimen.qs_dual_tile_padding_vertical); + mTileBackground = newTileBackground(); recreateLabel(); setClipChildren(false); @@ -175,22 +177,21 @@ public class QSTileView extends ViewGroup { if (changed) { recreateLabel(); } - Drawable tileBackground = getTileBackground(); - if (tileBackground instanceof RippleDrawable) { - setRipple((RippleDrawable) tileBackground); + if (mTileBackground instanceof RippleDrawable) { + setRipple((RippleDrawable) mTileBackground); } if (dual) { mTopBackgroundView.setOnClickListener(mClickPrimary); setOnClickListener(null); setClickable(false); setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO); - mTopBackgroundView.setBackground(tileBackground); + mTopBackgroundView.setBackground(mTileBackground); } else { mTopBackgroundView.setOnClickListener(null); mTopBackgroundView.setClickable(false); setOnClickListener(mClickPrimary); setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES); - setBackground(tileBackground); + setBackground(mTileBackground); } mTopBackgroundView.setFocusable(dual); setFocusable(!dual); @@ -217,7 +218,7 @@ public class QSTileView extends ViewGroup { return icon; } - private Drawable getTileBackground() { + private Drawable newTileBackground() { final int[] attrs = new int[] { android.R.attr.selectableItemBackgroundBorderless }; final TypedArray ta = mContext.obtainStyledAttributes(attrs); final Drawable d = ta.getDrawable(0); |