diff options
author | John Spurlock <jspurlock@google.com> | 2014-05-29 17:42:51 -0400 |
---|---|---|
committer | John Spurlock <jspurlock@google.com> | 2014-05-29 19:37:48 -0400 |
commit | 5729d090ab44228ff342a10b4ec0552741371501 (patch) | |
tree | 439af7922bac89e1a9d05f211ac74496cf478463 /packages | |
parent | f71205c1ee3b34801f98af275a281f7d06c50b51 (diff) | |
download | frameworks_base-5729d090ab44228ff342a10b4ec0552741371501.zip frameworks_base-5729d090ab44228ff342a10b4ec0552741371501.tar.gz frameworks_base-5729d090ab44228ff342a10b4ec0552741371501.tar.bz2 |
QuickSettings: Hide the expanded header in detail mode.
When a tile's detail panel is showing, hide the header
panel above - giving it more real estate.
Bug:15315490
Change-Id: I8aac0ec0eae5dad7393e334107b6aeac76f54545
Diffstat (limited to 'packages')
3 files changed, 81 insertions, 9 deletions
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 610b376..d4f0276 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -196,6 +196,9 @@ <dimen name="qs_dual_tile_height">109dp</dimen> <dimen name="qs_dual_tile_padding">12dp</dimen> + <!-- How far the hidden header peeks from the top of the screen when QS is in detail mode. --> + <dimen name="qs_header_peek_height">16dp</dimen> + <!-- How far the expanded QS panel peeks from the header in collapsed state. --> <dimen name="qs_peek_height">8dp</dimen> diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java index 626fc0d..6ce0e48 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java @@ -47,8 +47,10 @@ public class QSPanel extends ViewGroup { private int mCellHeight; private int mLargeCellWidth; private int mLargeCellHeight; + private boolean mExpanded; private TileRecord mDetailRecord; + private Callback mCallback; public QSPanel(Context context) { this(context, null); @@ -66,6 +68,10 @@ public class QSPanel extends ViewGroup { updateResources(); } + public void setCallback(Callback callback) { + mCallback = callback; + } + public void updateResources() { final Resources res = mContext.getResources(); final int columns = Math.max(1, res.getInteger(R.integer.quick_settings_num_columns)); @@ -84,12 +90,14 @@ public class QSPanel extends ViewGroup { } public void setExpanded(boolean expanded) { - if (!expanded) { + if (mExpanded == expanded) return; + mExpanded = expanded; + if (!mExpanded) { showDetail(false /*show*/, mDetailRecord); } for (TileRecord r : mRecords) { - r.tile.setListening(expanded); - if (expanded) { + r.tile.setListening(mExpanded); + if (mExpanded) { r.tile.refreshState(); } } @@ -156,6 +164,7 @@ public class QSPanel extends ViewGroup { if (mDetailRecord == null) return; listener = mTeardownDetailWhenDone; } + fireShowingDetail(show); int x = r.tileView.getLeft() + r.tileView.getWidth() / 2; int y = r.tileView.getTop() + r.tileView.getHeight() / 2; mClipper.animateCircularClip(x, y, show, listener); @@ -239,6 +248,12 @@ public class QSPanel extends ViewGroup { return cols; } + private void fireShowingDetail(boolean showingDetail) { + if (mCallback != null) { + mCallback.onShowingDetail(showingDetail); + } + } + private class H extends Handler { private static final int SHOW_DETAIL = 1; private static final int SET_TILE_VISIBILITY = 2; @@ -265,4 +280,8 @@ public class QSPanel extends ViewGroup { mDetailRecord = null; }; }; + + public interface Callback { + void onShowingDetail(boolean showingDetail); + } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java index 802e5e5..dce5a30 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -34,6 +34,7 @@ import android.view.animation.Interpolator; import android.widget.LinearLayout; import com.android.systemui.R; +import com.android.systemui.qs.QSPanel; import com.android.systemui.statusbar.ExpandableView; import com.android.systemui.statusbar.FlingAnimationUtils; import com.android.systemui.statusbar.GestureRecorder; @@ -51,7 +52,7 @@ public class NotificationPanelView extends PanelView implements PhoneStatusBar mStatusBar; private StatusBarHeaderView mHeader; private View mQsContainer; - private View mQsPanel; + private QSPanel mQsPanel; private View mKeyguardStatusView; private ObservableScrollView mScrollView; private View mStackScrollerContainer; @@ -70,6 +71,7 @@ public class NotificationPanelView extends PanelView implements */ private boolean mIntercepting; private boolean mQsExpanded; + private boolean mQsFullyExpanded; private boolean mKeyguardShowing; private float mInitialHeightOnTouch; private float mInitialTouchX; @@ -81,13 +83,14 @@ public class NotificationPanelView extends PanelView implements private int mQsMaxExpansionHeight; private int mMinStackHeight; private int mQsPeekHeight; + private int mQsHeaderPeekHeight; + private boolean mQsShowingDetail; private float mNotificationTranslation; private int mStackScrollerIntrinsicPadding; private boolean mQsExpansionEnabled = true; private ValueAnimator mQsExpansionAnimator; private FlingAnimationUtils mFlingAnimationUtils; private int mStatusBarMinHeight; - private Interpolator mFastOutSlowInInterpolator; private ObjectAnimator mClockAnimator; private int mClockAnimationTarget = -1; @@ -130,7 +133,8 @@ public class NotificationPanelView extends PanelView implements mKeyguardStatusView = findViewById(R.id.keyguard_status_view); mStackScrollerContainer = findViewById(R.id.notification_container_parent); mQsContainer = findViewById(R.id.quick_settings_container); - mQsPanel = findViewById(R.id.quick_settings_panel); + mQsPanel = (QSPanel) findViewById(R.id.quick_settings_panel); + mQsPanel.setCallback(mQsPanelCallback); mScrollView = (ObservableScrollView) findViewById(R.id.scroll_view); mScrollView.setListener(this); mNotificationStackScroller = (NotificationStackScrollLayout) @@ -154,6 +158,7 @@ public class NotificationPanelView extends PanelView implements mStatusBarMinHeight = getResources().getDimensionPixelSize( com.android.internal.R.dimen.status_bar_height); mQsPeekHeight = getResources().getDimensionPixelSize(R.dimen.qs_peek_height); + mQsHeaderPeekHeight = getResources().getDimensionPixelSize(R.dimen.qs_header_peek_height); mClockPositionAlgorithm.loadDimens(getResources()); } @@ -165,7 +170,9 @@ public class NotificationPanelView extends PanelView implements mQsMinExpansionHeight = mHeader.getCollapsedHeight() + mQsPeekHeight; mQsMaxExpansionHeight = mHeader.getExpandedHeight() + mQsContainer.getHeight(); if (mQsExpanded) { - setQsStackScrollerPadding(mQsMaxExpansionHeight); + if (mQsFullyExpanded) { + setQsStackScrollerPadding(mQsMaxExpansionHeight); + } } else { setQsExpansion(mQsMinExpansionHeight); positionClockAndNotifications(); @@ -518,10 +525,39 @@ public class NotificationPanelView extends PanelView implements ? View.INVISIBLE : View.VISIBLE); mScrollView.setTouchEnabled(mQsExpanded); + if (mQsShowingDetail) { + if (mQsFullyExpanded) { + setQsHeaderPeeking(true); + } + } else { + setQsHeaderPeeking(false); + } + } + + private void setQsHeaderPeeking(boolean peeking) { + final boolean stackIsPeeking = mStackScrollerContainer.getTranslationY() != 0; + final boolean headerIsPeeking = mHeader.getTranslationY() != 0; + final int ty = mQsHeaderPeekHeight - mHeader.getExpandedHeight(); + if (peeking) { + if (!headerIsPeeking) { + mHeader.animate().translationY(ty); + } + if (!stackIsPeeking) { + mStackScrollerContainer.animate().translationY(ty); + } + } else { + if (headerIsPeeking) { + mHeader.animate().translationY(0); + } + if (stackIsPeeking) { + mStackScrollerContainer.animate().translationY(0); + } + } } private void setQsExpansion(float height) { height = Math.min(Math.max(height, mQsMinExpansionHeight), mQsMaxExpansionHeight); + mQsFullyExpanded = height == mQsMaxExpansionHeight; if (height > mQsMinExpansionHeight && !mQsExpanded) { setQsExpanded(true); } else if (height <= mQsMinExpansionHeight && mQsExpanded) { @@ -614,10 +650,16 @@ public class NotificationPanelView extends PanelView implements if (!mQsExpansionEnabled) { return false; } + final float ty = mHeader.getTranslationY(); boolean onHeader = x >= mHeader.getLeft() && x <= mHeader.getRight() - && y >= mHeader.getTop() && y <= mHeader.getBottom(); + && y >= mHeader.getTop() + ty && y <= mHeader.getBottom() + ty; if (mQsExpanded) { - return onHeader || (mScrollView.isScrolledToBottom() && yDiff < 0); + if (mQsShowingDetail && onHeader) { + // bring back the header, crudely + setQsHeaderPeeking(false); + mQsPanel.setExpanded(false); + } + return !mQsShowingDetail && onHeader || (mScrollView.isScrolledToBottom() && yDiff < 0); } else { return onHeader; } @@ -781,4 +823,12 @@ public class NotificationPanelView extends PanelView implements public View getRightIcon() { return mKeyguardBottomArea.getCameraImageView(); } + + private final QSPanel.Callback mQsPanelCallback = new QSPanel.Callback() { + @Override + public void onShowingDetail(boolean showingDetail) { + mQsShowingDetail = showingDetail; + updateQsState(); + } + }; } |