Working towards a better QS
Some work (mostly on the new QS only) to make things more like they
will be.
- Remove Quick Tiles
- Remove Dual Tiles
- All tiles are the same, with slightly different UI in the header
- QS tiles in the header match the beginning of QS
- handleClick is a click from QS, handleSecondaryClick is a click
from the header, but defaults to normal behavior.
- Opening a detail panel from the header opens QS and the detail
selected
- Fix onStartListening bug in CustomTile
- UI updates towards how QS will look
Change-Id: Id820586ccdaa258a5bcb72cadbeb14941fc5f935
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanel.java
index 6a053be..a5c8d91 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanel.java
@@ -19,7 +19,6 @@
import android.content.Context;
import android.content.res.ColorStateList;
import android.util.AttributeSet;
-import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.widget.ImageView;
@@ -30,10 +29,14 @@
import java.util.Collection;
/**
- * Version of QSPanel that only shows 4 Quick Tiles in the QS Header.
+ * Version of QSPanel that only shows N Quick Tiles in the QS Header.
*/
public class QuickQSPanel extends QSPanel {
+ private int mMaxTiles;
+ private QSPanel mFullPanel;
+ private View mHeader;
+
public QuickQSPanel(Context context, AttributeSet attrs) {
super(context, attrs);
if (mTileLayout != null) {
@@ -46,6 +49,36 @@
mQsContainer.addView((View) mTileLayout, 1 /* Between brightness and footer */);
}
+ public void setQSPanelAndHeader(QSPanel fullPanel, View header) {
+ mFullPanel = fullPanel;
+ mHeader = header;
+ }
+
+ @Override
+ protected void handleShowDetail(QSPanel.Record r, boolean show) {
+ if (show) {
+ mHeader.performClick();
+ mFullPanel.showDetail(show, r);
+ } else {
+ // Not sure how we would end up here...
+ super.handleShowDetail(r, show);
+ }
+ }
+
+ @Override
+ protected QSTileBaseView createTileView(QSTile<?> tile) {
+ return new QSTileBaseView(mContext, tile.createTileView(mContext));
+ }
+
+ public void setMaxTiles(int maxTiles) {
+ mMaxTiles = maxTiles;
+ }
+
+ @Override
+ protected void onTileClick(QSTile<?> tile) {
+ tile.secondaryClick();
+ }
+
@Override
public void onTuningChanged(String key, String newValue) {
// No tunings for you.
@@ -59,11 +92,8 @@
public void setTiles(Collection<QSTile<?>> tiles) {
ArrayList<QSTile<?>> quickTiles = new ArrayList<>();
for (QSTile<?> tile : tiles) {
- if (tile.getTileType() == QSTileView.QS_TYPE_QUICK) {
- Log.d("QSPanel", "Adding " + tile.getTileSpec());
- quickTiles.add(tile);
- }
- if (quickTiles.size() == 2) {
+ quickTiles.add(tile);
+ if (quickTiles.size() == mMaxTiles) {
break;
}
}
@@ -74,6 +104,8 @@
public HeaderTileLayout(Context context) {
super(context);
+ setClipChildren(false);
+ setClipToPadding(false);
setGravity(Gravity.CENTER_VERTICAL);
setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
@@ -92,17 +124,13 @@
@Override
public void addTile(TileRecord tile) {
tile.tileView.setLayoutParams(generateLayoutParams());
- // These shouldn't be normal tiles, but they will be for now so that the circles don't
- // show up.
- tile.tileView.setType(QSTileView.QS_TYPE_NORMAL);
addView(tile.tileView, getChildCount() - 1 /* Leave icon at end */);
}
private LayoutParams generateLayoutParams() {
int size =
mContext.getResources().getDimensionPixelSize(R.dimen.qs_quick_tile_size);
- LayoutParams lp = new LayoutParams(0, size);
- lp.weight = 1;
+ LayoutParams lp = new LayoutParams(size, size);
return lp;
}