summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorRoman Birg <roman@cyngn.com>2015-11-30 23:11:10 -0800
committerRoman Birg <roman@cyngn.com>2015-12-02 18:40:43 -0800
commit40fdc4ace9bc69a45a37782b6d394005f917b41a (patch)
tree58c5eb9bc6f724e39f81224a5a9aa2b9619f439c /packages
parent6ec9ea721c33613c1ce94fdbe1e1b94631e6edec (diff)
downloadframeworks_base-40fdc4ace9bc69a45a37782b6d394005f917b41a.zip
frameworks_base-40fdc4ace9bc69a45a37782b6d394005f917b41a.tar.gz
frameworks_base-40fdc4ace9bc69a45a37782b6d394005f917b41a.tar.bz2
SystemUI: various qs tile detail improvements
- Handle top padding inside QSDragPanel, so the detail clipping animation doesn't get cut off by the top padding. - Increase bottom padding of the QSContainer to give some more breathing room for the circle page indicator. - Disable pager overscrolling - Add dual tile carrot indicators to cast, dnd, and mobile data tiles Change-Id: I81f56760140a2d7dd31e25b23f477eb1be0af305 Signed-off-by: Roman Birg <roman@cyngn.com>
Diffstat (limited to 'packages')
-rw-r--r--packages/SystemUI/res/layout/qs_panel.xml3
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/QSContainer.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/QSDetailClipper.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/QSDragPanel.java35
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/QSPage.java5
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/QSPanel.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/QSViewPager.java5
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java10
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java10
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java10
10 files changed, 77 insertions, 11 deletions
diff --git a/packages/SystemUI/res/layout/qs_panel.xml b/packages/SystemUI/res/layout/qs_panel.xml
index c3d3c3e..9df4425 100644
--- a/packages/SystemUI/res/layout/qs_panel.xml
+++ b/packages/SystemUI/res/layout/qs_panel.xml
@@ -19,8 +19,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/qs_background_primary"
- android:paddingTop="8dp"
- android:paddingBottom="8dp"
+ android:paddingBottom="12dp"
android:elevation="2dp">
<com.android.systemui.qs.QSDragPanel
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSContainer.java b/packages/SystemUI/src/com/android/systemui/qs/QSContainer.java
index cfe8d07..74f4cbb 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSContainer.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSContainer.java
@@ -63,7 +63,7 @@ public class QSContainer extends FrameLayout {
*/
public int getDesiredHeight() {
if (mQSPanel.isClosingDetail()) {
- return mQSPanel.getGridHeight() + getPaddingTop() + getPaddingBottom();
+ return mQSPanel.getGridHeight() + getPaddingBottom();
} else {
return getMeasuredHeight();
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSDetailClipper.java b/packages/SystemUI/src/com/android/systemui/qs/QSDetailClipper.java
index a318efc..8b89a65 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSDetailClipper.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSDetailClipper.java
@@ -36,6 +36,10 @@ public class QSDetailClipper {
mBackground = (TransitionDrawable) detail.getBackground();
}
+ public boolean isAnimating() {
+ return mAnimator != null && mAnimator.isRunning();
+ }
+
public void animateCircularClip(int x, int y, boolean in, AnimatorListener listener) {
if (mAnimator != null) {
mAnimator.cancel();
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSDragPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QSDragPanel.java
index 26b6daa..3d0745c 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSDragPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSDragPanel.java
@@ -28,7 +28,6 @@ import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.util.Log;
-import android.util.TypedValue;
import android.view.DragEvent;
import android.view.LayoutInflater;
import android.view.View;
@@ -177,7 +176,6 @@ public class QSDragPanel extends QSPanel implements View.OnDragListener, View.On
}
};
mViewPager.setAdapter(mPagerAdapter);
- mViewPager.setCurrentItem(0);
mPageIndicator.setViewPager(mViewPager);
mPageIndicator.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@@ -212,15 +210,22 @@ public class QSDragPanel extends QSPanel implements View.OnDragListener, View.On
}
});
+ mPageIndicator.setCurrentItem(0);
+ mViewPager.setOverScrollMode(OVER_SCROLL_NEVER);
- setClipChildren(false);
updateResources();
mViewPager.setOnDragListener(this);
+ mPageIndicator.setOnDragListener(this);
mQsPanelTop.getBrightnessView().setOnDragListener(this);
mQsPanelTop.getDropTarget().setOnDragListener(this);
}
+ @Override
+ public boolean hasOverlappingRendering() {
+ return mClipper.isAnimating();
+ }
+
protected void drawTile(TileRecord r, QSTile.State state) {
final int visibility = state.visible || mEditing ? VISIBLE : GONE;
setTileVisibility(r.tileView, visibility);
@@ -474,7 +479,8 @@ public class QSDragPanel extends QSPanel implements View.OnDragListener, View.On
mPageIndicator.measure(exactly(width), MeasureSpec.UNSPECIFIED);
mFooter.getView().measure(exactly(width), MeasureSpec.UNSPECIFIED);
- int h = mQsPanelTop.getMeasuredHeight()
+ int h = mBrightnessPaddingTop
+ + mQsPanelTop.getMeasuredHeight()
+ mViewPager.getMeasuredHeight()
+ mPageIndicator.getMeasuredHeight();
if (mFooter.hasFooter()) {
@@ -502,11 +508,29 @@ public class QSDragPanel extends QSPanel implements View.OnDragListener, View.On
}
@Override
+ protected void handleShowDetailTile(TileRecord r, boolean show) {
+ if (r instanceof DragTileRecord) {
+ if ((mDetailRecord != null) == show && mDetailRecord == r) return;
+
+ if (show) {
+ r.detailAdapter = r.tile.getDetailAdapter();
+ if (r.detailAdapter == null) return;
+ }
+ r.tile.setDetailListening(show);
+ int x = (int) ((DragTileRecord) r).destination.x + r.tileView.getWidth() / 2;
+ int y = mViewPager.getTop() + (int) ((DragTileRecord) r).destination.y + r.tileView.getHeight() / 2;
+ handleShowDetailImpl(r, show, x, y);
+ } else {
+ super.handleShowDetailTile(r, show);
+ }
+ }
+
+ @Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
if (DEBUG_DRAG) Log.d(TAG, "onLayout()");
final int w = getWidth();
- int top = 0;
+ int top = mBrightnessPaddingTop;
mQsPanelTop.layout(0, top, w, top + mQsPanelTop.getMeasuredHeight());
top += mQsPanelTop.getMeasuredHeight();
@@ -517,7 +541,6 @@ public class QSDragPanel extends QSPanel implements View.OnDragListener, View.On
mPageIndicator.layout(0, top, w, top + mPageIndicator.getMeasuredHeight());
// detail takes up whole height
- final int dh = Math.max(mDetail.getMeasuredHeight(), mViewPager.getMeasuredHeight());
mDetail.layout(0, 0, mDetail.getMeasuredWidth(), getMeasuredHeight());
if (mFooter.hasFooter()) {
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPage.java b/packages/SystemUI/src/com/android/systemui/qs/QSPage.java
index 274a431..f3b627c 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSPage.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSPage.java
@@ -33,6 +33,11 @@ public class QSPage extends ViewGroup {
setClipToOutline(false);
}
+ @Override
+ public boolean hasOverlappingRendering() {
+ return false;
+ }
+
public int getPageIndex() {
return mPage;
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
index 4d37553..2a1bef8 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
@@ -390,7 +390,7 @@ public class QSPanel extends ViewGroup {
}
}
- private void handleShowDetailTile(TileRecord r, boolean show) {
+ protected void handleShowDetailTile(TileRecord r, boolean show) {
if ((mDetailRecord != null) == show && mDetailRecord == r) return;
if (show) {
@@ -403,7 +403,7 @@ public class QSPanel extends ViewGroup {
handleShowDetailImpl(r, show, x, y);
}
- private void handleShowDetailImpl(Record r, boolean show, int x, int y) {
+ protected final void handleShowDetailImpl(Record r, boolean show, int x, int y) {
boolean visibleDiff = (mDetailRecord != null) != show;
if (!visibleDiff && mDetailRecord == r) return; // already in right state
DetailAdapter detailAdapter = null;
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSViewPager.java b/packages/SystemUI/src/com/android/systemui/qs/QSViewPager.java
index 36ad954..427fbf4 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSViewPager.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSViewPager.java
@@ -24,6 +24,11 @@ public class QSViewPager extends ViewPager {
}
@Override
+ public boolean hasOverlappingRendering() {
+ return false;
+ }
+
+ @Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int height = 0;
for (int i = 0; i < getChildCount(); i++) {
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java
index 75503f6..4da3cd9 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java
@@ -92,6 +92,11 @@ public class CastTile extends QSTile<QSTile.BooleanState> {
}
@Override
+ protected void handleSecondaryClick() {
+ handleClick();
+ }
+
+ @Override
protected void handleLongClick() {
mHost.startActivityDismissingKeyguard(CAST_SETTINGS);
}
@@ -135,6 +140,11 @@ public class CastTile extends QSTile<QSTile.BooleanState> {
return null;
}
+ @Override
+ public boolean hasDualTargetsDetails() {
+ return true;
+ }
+
private String getDeviceName(CastDevice device) {
return device.name != null ? device.name
: mContext.getString(R.string.quick_settings_cast_device_default_name);
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java
index 91e92c8..c99d70a 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java
@@ -102,6 +102,11 @@ public class CellularTile extends QSTile<QSTile.SignalState> {
}
@Override
+ protected void handleSecondaryClick() {
+ handleClick();
+ }
+
+ @Override
protected void handleLongClick() {
if (mTelephonyManager.getDefault().getPhoneCount() > 1) {
mHost.startActivityDismissingKeyguard(MOBILE_NETWORK_SETTINGS_MSIM);
@@ -153,6 +158,11 @@ public class CellularTile extends QSTile<QSTile.SignalState> {
return MetricsLogger.QS_CELLULAR;
}
+ @Override
+ public boolean hasDualTargetsDetails() {
+ return true;
+ }
+
// Remove the period from the network name
public static String removeTrailingPeriod(String string) {
if (string == null) return null;
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java
index ccf9887..afe42b9 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java
@@ -122,6 +122,11 @@ public class DndTile extends QSTile<QSTile.BooleanState> {
}
@Override
+ protected void handleSecondaryClick() {
+ handleClick();
+ }
+
+ @Override
public void handleLongClick() {
mHost.startActivityDismissingKeyguard(ZEN_SETTINGS);
}
@@ -194,6 +199,11 @@ public class DndTile extends QSTile<QSTile.BooleanState> {
}
}
+ @Override
+ public boolean hasDualTargetsDetails() {
+ return true;
+ }
+
private final OnSharedPreferenceChangeListener mPrefListener
= new OnSharedPreferenceChangeListener() {
@Override