diff options
author | Selim Cinek <cinek@google.com> | 2015-04-10 14:37:46 -0700 |
---|---|---|
committer | Selim Cinek <cinek@google.com> | 2015-04-15 12:58:39 -0700 |
commit | d2281151ee18f5fd530bc062c59b3f77082317bf (patch) | |
tree | 5df65dc15c30112f453aba218c2cbd0cc8c8a031 /packages/SystemUI/src/com/android/systemui/statusbar | |
parent | a7840af09d808ecd3f7547bbdea58d4422bd4d8f (diff) | |
download | frameworks_base-d2281151ee18f5fd530bc062c59b3f77082317bf.zip frameworks_base-d2281151ee18f5fd530bc062c59b3f77082317bf.tar.gz frameworks_base-d2281151ee18f5fd530bc062c59b3f77082317bf.tar.bz2 |
More Heads Up bug fixes
Heads-up now has the correct height while expanding
and collapsing the shade.
Fading out while collapsing the shade was restored.
Fixed a bug where translation was not correctly replaced
with paddingOffset.
Change-Id: I9f1b28856b3ca52543460e7ddde84a1a7eb79cf2
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/statusbar')
3 files changed, 53 insertions, 28 deletions
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 eacc436..f0e8b20 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -185,6 +185,7 @@ public class NotificationPanelView extends PanelView implements private boolean mPinnedHeadsUpExist; private boolean mExpansionIsFromHeadsUp; private int mBottomBarHeight; + private boolean mExpandingFromHeadsUp; private Runnable mHeadsUpExistenceChangedRunnable = new Runnable() { @Override public void run() { @@ -1515,16 +1516,21 @@ public class NotificationPanelView extends PanelView implements } } private void updateNotificationTranslucency() { - float alpha = (getNotificationsTopY() + mNotificationStackScroller.getItemHeight()) - / (mQsMinExpansionHeight + mNotificationStackScroller.getBottomStackPeekSize() - - mNotificationStackScroller.getCollapseSecondCardPadding()); - alpha = Math.max(0, Math.min(alpha, 1)); - alpha = (float) Math.pow(alpha, 0.75); - if (alpha != 1f && mNotificationStackScroller.getLayerType() != LAYER_TYPE_HARDWARE) { - mNotificationStackScroller.setLayerType(LAYER_TYPE_HARDWARE, null); - } else if (alpha == 1f - && mNotificationStackScroller.getLayerType() == LAYER_TYPE_HARDWARE) { - mNotificationStackScroller.setLayerType(LAYER_TYPE_NONE, null); + float alpha; + if (mExpandingFromHeadsUp || mHeadsUpManager.hasPinnedHeadsUp()) { + alpha = 1f; + } else { + alpha = (getNotificationsTopY() + mNotificationStackScroller.getItemHeight()) + / (mQsMinExpansionHeight + mNotificationStackScroller.getBottomStackPeekSize() + - mNotificationStackScroller.getCollapseSecondCardPadding()); + alpha = Math.max(0, Math.min(alpha, 1)); + alpha = (float) Math.pow(alpha, 0.75); + if (alpha != 1f && mNotificationStackScroller.getLayerType() != LAYER_TYPE_HARDWARE) { + mNotificationStackScroller.setLayerType(LAYER_TYPE_HARDWARE, null); + } else if (alpha == 1f + && mNotificationStackScroller.getLayerType() == LAYER_TYPE_HARDWARE) { + mNotificationStackScroller.setLayerType(LAYER_TYPE_NONE, null); + } } mNotificationStackScroller.setAlpha(alpha); } @@ -1588,11 +1594,10 @@ public class NotificationPanelView extends PanelView implements return mExpandedHeight / HEADER_RUBBERBAND_FACTOR - mQsMinExpansionHeight; } } - float paddingOffset = mNotificationStackScroller.getPaddingOffset(); - float translation = paddingOffset / HEADER_RUBBERBAND_FACTOR; + float stackTranslation = mNotificationStackScroller.getStackTranslation(); + float translation = stackTranslation / HEADER_RUBBERBAND_FACTOR; if (mHeadsUpManager.hasPinnedHeadsUp() || mExpansionIsFromHeadsUp) { - translation = mNotificationStackScroller.getTopPadding() - + mNotificationStackScroller.getPaddingOffset() + translation = mNotificationStackScroller.getTopPadding() + stackTranslation - mNotificationTopPadding - mQsMinExpansionHeight; } return Math.min(0, translation); @@ -1669,6 +1674,7 @@ public class NotificationPanelView extends PanelView implements mTwoFingerQsExpandPossible = false; mExpansionIsFromHeadsUp = false; mNotificationStackScroller.setTrackingHeadsUp(mHeadsUpTouchHelper.isTrackingHeadsUp()); + mExpandingFromHeadsUp = mHeadsUpTouchHelper.isTrackingHeadsUp(); } private void setListening(boolean listening) { @@ -2137,11 +2143,12 @@ public class NotificationPanelView extends PanelView implements public void OnPinnedHeadsUpExistChanged(final boolean exist, boolean changeImmediatly) { if (exist != mPinnedHeadsUpExist) { mPinnedHeadsUpExist = exist; - if (!exist) { + if (exist) { + mHeadsUpExistenceChangedRunnable.run(); + updateNotificationTranslucency(); + } else { mNotificationStackScroller.performOnAnimationFinished( mHeadsUpExistenceChangedRunnable); - } else { - mHeadsUpExistenceChangedRunnable.run(); } } } @@ -2166,6 +2173,7 @@ public class NotificationPanelView extends PanelView implements if (tracking) { // otherwise we update the state when the expansion is finished mNotificationStackScroller.setTrackingHeadsUp(true); + mExpandingFromHeadsUp = true; } } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java index 57bbcfe..da4cc7e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java @@ -179,7 +179,7 @@ public class NotificationStackScrollLayout extends ViewGroup private float mMinTopOverScrollToEscape; private int mIntrinsicPadding; private int mNotificationTopPadding; - private float mPaddingOffset; + private float mStackTranslation; private float mTopPaddingOverflow; private boolean mDontReportNextOverScroll; private boolean mRequestViewResizeAnimationOnLayout; @@ -516,17 +516,17 @@ public class NotificationStackScrollLayout extends ViewGroup updateAlgorithmHeightAndPadding(); requestChildrenUpdate(); } - setPaddingOffset(paddingOffset); + setStackTranslation(paddingOffset); } - public float getPaddingOffset() { - return mPaddingOffset; + public float getStackTranslation() { + return mStackTranslation; } - private void setPaddingOffset(float paddingOffset) { - if (paddingOffset != mPaddingOffset) { - mPaddingOffset = paddingOffset; - mAmbientState.setStackTranslation(paddingOffset); + private void setStackTranslation(float stackTranslation) { + if (stackTranslation != mStackTranslation) { + mStackTranslation = stackTranslation; + mAmbientState.setStackTranslation(stackTranslation); requestChildrenUpdate(); } } @@ -2381,7 +2381,7 @@ public class NotificationStackScrollLayout extends ViewGroup * @return the y position of the first notification */ public float getNotificationsTopY() { - return mTopPadding + getTranslationY(); + return mTopPadding + getStackTranslation(); } @Override @@ -2568,7 +2568,7 @@ public class NotificationStackScrollLayout extends ViewGroup max = bottom; } } - return max + getTranslationY(); + return max + getStackTranslation(); } /** @@ -2684,6 +2684,7 @@ public class NotificationStackScrollLayout extends ViewGroup public void setHeadsUpManager(HeadsUpManager headsUpManager) { mHeadsUpManager = headsUpManager; mAmbientState.setHeadsUpManager(headsUpManager); + mStackScrollAlgorithm.setHeadsUpManager(headsUpManager); } public void generateHeadsUpAnimation(ExpandableNotificationRow row, boolean isHeadsUp) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java index 1e3d6e6..5dbcce8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java @@ -71,6 +71,7 @@ public class StackScrollAlgorithm { private boolean mIsSmallScreen; private int mMaxNotificationHeight; private boolean mScaleDimmed; + private HeadsUpManager mHeadsUpManager; public StackScrollAlgorithm(Context context) { initConstants(context); @@ -570,7 +571,8 @@ public class StackScrollAlgorithm { private int getMaxAllowedChildHeight(View child, AmbientState ambientState) { if (child instanceof ExpandableNotificationRow) { ExpandableNotificationRow row = (ExpandableNotificationRow) child; - if (ambientState != null && ambientState.getTopHeadsUpEntry() == child) { + if (ambientState == null && row.isHeadsUp() + || ambientState != null && ambientState.getTopHeadsUpEntry() == child) { int extraSize = row.getIntrinsicHeight() - row.getHeadsUpHeight(); return mCollapsedSize + extraSize; } @@ -834,6 +836,13 @@ public class StackScrollAlgorithm { // current height or the end value of the animation. mFirstChildMaxHeight = StackStateAnimator.getFinalActualHeight( mFirstChildWhileExpanding); + if (mFirstChildWhileExpanding instanceof ExpandableNotificationRow) { + ExpandableNotificationRow row = + (ExpandableNotificationRow) mFirstChildWhileExpanding; + if (row.isHeadsUp()) { + mFirstChildMaxHeight += mCollapsedSize - row.getHeadsUpHeight(); + } + } } else { updateFirstChildMaxSizeToMaxHeight(); } @@ -876,6 +885,9 @@ public class StackScrollAlgorithm { } private View findFirstVisibleChild(ViewGroup container) { + if (mHeadsUpManager != null && mHeadsUpManager.getTopEntry() != null) { + return mHeadsUpManager.getTopEntry().entry.row; + } int childCount = container.getChildCount(); for (int i = 0; i < childCount; i++) { View child = container.getChildAt(i); @@ -916,6 +928,10 @@ public class StackScrollAlgorithm { } } + public void setHeadsUpManager(HeadsUpManager headsUpManager) { + mHeadsUpManager = headsUpManager; + } + class StackScrollAlgorithmState { /** |