diff options
author | John Spurlock <jspurlock@google.com> | 2014-05-17 15:54:40 -0400 |
---|---|---|
committer | John Spurlock <jspurlock@google.com> | 2014-05-17 16:06:12 -0400 |
commit | ccb6b9a90f228cc4e31a9442ed28756ff474c080 (patch) | |
tree | 9131d8141df6ff7a7fde37319ec88b221c23c31e /packages/SystemUI/src/com/android/systemui/qs/QSPanel.java | |
parent | f967a5486a78db244624fde4c105aa5e6fa914b9 (diff) | |
download | frameworks_base-ccb6b9a90f228cc4e31a9442ed28756ff474c080.zip frameworks_base-ccb6b9a90f228cc4e31a9442ed28756ff474c080.tar.gz frameworks_base-ccb6b9a90f228cc4e31a9442ed28756ff474c080.tar.bz2 |
QuickSettings: only listen when expanded.
Register for active state updates only when the quick settings
panel is open.
Don't allow a dual-target tile and single-target tile on the same row.
Bug:14133785
Change-Id: I8a5ad3df9b67b5bc3518210d62b705483a422d8e
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/qs/QSPanel.java')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/qs/QSPanel.java | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java index afb5483..6176eb6 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java @@ -80,7 +80,10 @@ public class QSPanel extends ViewGroup { showDetail(false /*show*/, mDetailRecord); } for (TileRecord r : mRecords) { - r.tile.setShown(expanded); + r.tile.setListening(expanded); + if (expanded) { + r.tile.refreshState(); + } } } @@ -125,6 +128,7 @@ public class QSPanel extends ViewGroup { } }; r.tileView.init(click, clickSecondary); + r.tile.refreshState(); mRecords.add(r); addView(r.tileView); @@ -156,24 +160,29 @@ public class QSPanel extends ViewGroup { mCellHeight = (int)(mCellWidth / TILE_ASPECT); mLargeCellWidth = (int)(mCellWidth * LARGE_TILE_FACTOR); mLargeCellHeight = (int)(mCellHeight * LARGE_TILE_FACTOR); - int r = 0; - int c = 0; + int r = -1; + int c = -1; int rows = 0; + boolean rowIsDual = false; for (TileRecord record : mRecords) { if (record.tileView.getVisibility() == GONE) continue; + // wrap to next column if we've reached the max # of columns + // also don't allow dual + single tiles on the same row + if (r == -1 || c == (mColumns - 1) || rowIsDual != record.tile.supportsDualTargets()) { + r++; + c = 0; + rowIsDual = record.tile.supportsDualTargets(); + } else { + c++; + } record.row = r; record.col = c; rows = r + 1; - c++; - if (c == mColumns /*end of normal column*/ || r == 0 && c == 2 /*end of 1st column*/) { - c = 0; - r++; - } } for (TileRecord record : mRecords) { if (record.tileView.getVisibility() == GONE) continue; - record.tileView.setDual(record.row == 0); + record.tileView.setDual(record.tile.supportsDualTargets()); final int cw = record.row == 0 ? mLargeCellWidth : mCellWidth; final int ch = record.row == 0 ? mLargeCellHeight : mCellHeight; record.tileView.measure(exactly(cw), exactly(ch)); |