Fixed a few bugs regarding big notification groups
The overscrolling was listening to the paddingOverflow which didn't make sense. Also, we need to update the top padding if the height of the first element changes. This also fixes several cases where the notification size was wrong when the quick settings panel was expanded. It also fixes some flickering regarding the TopPaddingoverflow which was going rogue in a few cases. The transition from the locked shade is thereby also improved. Change-Id: I703ea27879b325c02a15fdacee3b58f5ef78fd20 Fixes: 30801139
This commit is contained in:
@@ -328,7 +328,7 @@ public class NotificationPanelView extends PanelView implements
|
|||||||
} else if (!mQsExpanded) {
|
} else if (!mQsExpanded) {
|
||||||
setQsExpansion(mQsMinExpansionHeight + mLastOverscroll);
|
setQsExpansion(mQsMinExpansionHeight + mLastOverscroll);
|
||||||
}
|
}
|
||||||
updateStackHeight(getExpandedHeight());
|
updateExpandedHeight(getExpandedHeight());
|
||||||
updateHeader();
|
updateHeader();
|
||||||
|
|
||||||
// If we are running a size change animation, the animation takes care of the height of
|
// If we are running a size change animation, the animation takes care of the height of
|
||||||
@@ -376,10 +376,7 @@ public class NotificationPanelView extends PanelView implements
|
|||||||
boolean animate = mNotificationStackScroller.isAddOrRemoveAnimationPending();
|
boolean animate = mNotificationStackScroller.isAddOrRemoveAnimationPending();
|
||||||
int stackScrollerPadding;
|
int stackScrollerPadding;
|
||||||
if (mStatusBarState != StatusBarState.KEYGUARD) {
|
if (mStatusBarState != StatusBarState.KEYGUARD) {
|
||||||
int bottom = mQsContainer.getHeader().getHeight();
|
stackScrollerPadding = mQsContainer.getHeader().getHeight() + mQsPeekHeight;
|
||||||
stackScrollerPadding = mStatusBarState == StatusBarState.SHADE
|
|
||||||
? bottom + mQsPeekHeight
|
|
||||||
: mKeyguardStatusBar.getHeight();
|
|
||||||
mTopPaddingAdjustment = 0;
|
mTopPaddingAdjustment = 0;
|
||||||
} else {
|
} else {
|
||||||
mClockPositionAlgorithm.setup(
|
mClockPositionAlgorithm.setup(
|
||||||
@@ -1166,6 +1163,7 @@ public class NotificationPanelView extends PanelView implements
|
|||||||
|
|
||||||
private void updateQsState() {
|
private void updateQsState() {
|
||||||
mQsContainer.setExpanded(mQsExpanded);
|
mQsContainer.setExpanded(mQsExpanded);
|
||||||
|
mNotificationStackScroller.setQsExpanded(mQsExpanded);
|
||||||
mNotificationStackScroller.setScrollingEnabled(
|
mNotificationStackScroller.setScrollingEnabled(
|
||||||
mStatusBarState != StatusBarState.KEYGUARD && (!mQsExpanded
|
mStatusBarState != StatusBarState.KEYGUARD && (!mQsExpanded
|
||||||
|| mQsExpansionFromOverscroll));
|
|| mQsExpansionFromOverscroll));
|
||||||
@@ -1427,7 +1425,7 @@ public class NotificationPanelView extends PanelView implements
|
|||||||
setQsExpansion(mQsMinExpansionHeight
|
setQsExpansion(mQsMinExpansionHeight
|
||||||
+ t * (getTempQsMaxExpansion() - mQsMinExpansionHeight));
|
+ t * (getTempQsMaxExpansion() - mQsMinExpansionHeight));
|
||||||
}
|
}
|
||||||
updateStackHeight(expandedHeight);
|
updateExpandedHeight(expandedHeight);
|
||||||
updateHeader();
|
updateHeader();
|
||||||
updateUnlockIcon();
|
updateUnlockIcon();
|
||||||
updateNotificationTranslucency();
|
updateNotificationTranslucency();
|
||||||
@@ -1487,7 +1485,7 @@ public class NotificationPanelView extends PanelView implements
|
|||||||
maxQsHeight, mStatusBarState == StatusBarState.KEYGUARD
|
maxQsHeight, mStatusBarState == StatusBarState.KEYGUARD
|
||||||
? mClockPositionResult.stackScrollerPadding - mTopPaddingAdjustment
|
? mClockPositionResult.stackScrollerPadding - mTopPaddingAdjustment
|
||||||
: 0)
|
: 0)
|
||||||
+ notificationHeight;
|
+ notificationHeight + mNotificationStackScroller.getTopPaddingOverflow();
|
||||||
if (totalHeight > mNotificationStackScroller.getHeight()) {
|
if (totalHeight > mNotificationStackScroller.getHeight()) {
|
||||||
float fullyCollapsedHeight = maxQsHeight
|
float fullyCollapsedHeight = maxQsHeight
|
||||||
+ mNotificationStackScroller.getLayoutMinHeight();
|
+ mNotificationStackScroller.getLayoutMinHeight();
|
||||||
@@ -1730,6 +1728,14 @@ public class NotificationPanelView extends PanelView implements
|
|||||||
if (view == null && mQsExpanded) {
|
if (view == null && mQsExpanded) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
ExpandableView firstChildNotGone = mNotificationStackScroller.getFirstChildNotGone();
|
||||||
|
ExpandableNotificationRow firstRow = firstChildNotGone instanceof ExpandableNotificationRow
|
||||||
|
? (ExpandableNotificationRow) firstChildNotGone
|
||||||
|
: null;
|
||||||
|
if (firstRow != null
|
||||||
|
&& (view == firstRow || (firstRow.getNotificationParent() == firstRow))) {
|
||||||
|
requestScrollerTopPaddingUpdate(false);
|
||||||
|
}
|
||||||
requestPanelHeightUpdate();
|
requestPanelHeightUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2249,8 +2255,8 @@ public class NotificationPanelView extends PanelView implements
|
|||||||
mQsAutoReinflateContainer.setTranslationX(translation);
|
mQsAutoReinflateContainer.setTranslationX(translation);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateStackHeight(float stackHeight) {
|
protected void updateExpandedHeight(float expandedHeight) {
|
||||||
mNotificationStackScroller.setStackHeight(stackHeight);
|
mNotificationStackScroller.setExpandedHeight(expandedHeight);
|
||||||
updateKeyguardBottomAreaAlpha();
|
updateKeyguardBottomAreaAlpha();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ public class AmbientState {
|
|||||||
private boolean mShadeExpanded;
|
private boolean mShadeExpanded;
|
||||||
private float mMaxHeadsUpTranslation;
|
private float mMaxHeadsUpTranslation;
|
||||||
private boolean mDismissAllInProgress;
|
private boolean mDismissAllInProgress;
|
||||||
|
private int mLayoutMinHeight;
|
||||||
|
|
||||||
public int getScrollY() {
|
public int getScrollY() {
|
||||||
return mScrollY;
|
return mScrollY;
|
||||||
@@ -137,10 +138,6 @@ public class AmbientState {
|
|||||||
mStackTranslation = stackTranslation;
|
mStackTranslation = stackTranslation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getLayoutHeight() {
|
|
||||||
return mLayoutHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLayoutHeight(int layoutHeight) {
|
public void setLayoutHeight(int layoutHeight) {
|
||||||
mLayoutHeight = layoutHeight;
|
mLayoutHeight = layoutHeight;
|
||||||
}
|
}
|
||||||
@@ -154,7 +151,7 @@ public class AmbientState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getInnerHeight() {
|
public int getInnerHeight() {
|
||||||
return mLayoutHeight - mTopPadding;
|
return Math.max(mLayoutHeight - mTopPadding, mLayoutMinHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isShadeExpanded() {
|
public boolean isShadeExpanded() {
|
||||||
@@ -180,4 +177,8 @@ public class AmbientState {
|
|||||||
public boolean isDismissAllInProgress() {
|
public boolean isDismissAllInProgress() {
|
||||||
return mDismissAllInProgress;
|
return mDismissAllInProgress;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setLayoutMinHeight(int layoutMinHeight) {
|
||||||
|
mLayoutMinHeight = layoutMinHeight;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,11 +111,7 @@ public class NotificationStackScrollLayout extends ViewGroup
|
|||||||
private int mCurrentStackHeight = Integer.MAX_VALUE;
|
private int mCurrentStackHeight = Integer.MAX_VALUE;
|
||||||
private final Paint mBackgroundPaint = new Paint();
|
private final Paint mBackgroundPaint = new Paint();
|
||||||
|
|
||||||
/**
|
private float mExpandedHeight;
|
||||||
* mCurrentStackHeight is the actual stack height, mLastSetStackHeight is the stack height set
|
|
||||||
* externally from {@link #setStackHeight}
|
|
||||||
*/
|
|
||||||
private float mLastSetStackHeight;
|
|
||||||
private int mOwnScrollY;
|
private int mOwnScrollY;
|
||||||
private int mMaxLayoutHeight;
|
private int mMaxLayoutHeight;
|
||||||
|
|
||||||
@@ -354,6 +350,7 @@ public class NotificationStackScrollLayout extends ViewGroup
|
|||||||
return object.getBackgroundFadeAmount();
|
return object.getBackgroundFadeAmount();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
private boolean mQsExpanded;
|
||||||
|
|
||||||
public NotificationStackScrollLayout(Context context) {
|
public NotificationStackScrollLayout(Context context) {
|
||||||
this(context, null);
|
this(context, null);
|
||||||
@@ -519,6 +516,7 @@ public class NotificationStackScrollLayout extends ViewGroup
|
|||||||
clampScrollPosition();
|
clampScrollPosition();
|
||||||
requestChildrenUpdate();
|
requestChildrenUpdate();
|
||||||
updateFirstAndLastBackgroundViews();
|
updateFirstAndLastBackgroundViews();
|
||||||
|
updateAlgorithmLayoutMinHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void requestAnimationOnViewResize(ExpandableNotificationRow row) {
|
private void requestAnimationOnViewResize(ExpandableNotificationRow row) {
|
||||||
@@ -560,9 +558,14 @@ public class NotificationStackScrollLayout extends ViewGroup
|
|||||||
|
|
||||||
private void updateAlgorithmHeightAndPadding() {
|
private void updateAlgorithmHeightAndPadding() {
|
||||||
mAmbientState.setLayoutHeight(getLayoutHeight());
|
mAmbientState.setLayoutHeight(getLayoutHeight());
|
||||||
|
updateAlgorithmLayoutMinHeight();
|
||||||
mAmbientState.setTopPadding(mTopPadding);
|
mAmbientState.setTopPadding(mTopPadding);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateAlgorithmLayoutMinHeight() {
|
||||||
|
mAmbientState.setLayoutMinHeight(mQsExpanded && !onKeyguard() ? getLayoutMinHeight() : 0);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the children views according to the stack scroll algorithm. Call this whenever
|
* Updates the children views according to the stack scroll algorithm. Call this whenever
|
||||||
* modifications to {@link #mOwnScrollY} are performed to reflect it in the view layout.
|
* modifications to {@link #mOwnScrollY} are performed to reflect it in the view layout.
|
||||||
@@ -659,19 +662,19 @@ public class NotificationStackScrollLayout extends ViewGroup
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the height of the stack to a new height.
|
* Update the height of the panel.
|
||||||
*
|
*
|
||||||
* @param height the new height of the stack
|
* @param height the expanded height of the panel
|
||||||
*/
|
*/
|
||||||
public void setStackHeight(float height) {
|
public void setExpandedHeight(float height) {
|
||||||
mLastSetStackHeight = height;
|
mExpandedHeight = height;
|
||||||
setIsExpanded(height > 0.0f);
|
setIsExpanded(height > 0.0f);
|
||||||
int stackHeight;
|
int stackHeight;
|
||||||
float translationY;
|
float translationY;
|
||||||
float appearEndPosition = getAppearEndPosition();
|
float appearEndPosition = getAppearEndPosition();
|
||||||
float appearStartPosition = getAppearStartPosition();
|
float appearStartPosition = getAppearStartPosition();
|
||||||
if (height >= appearEndPosition) {
|
if (height >= appearEndPosition) {
|
||||||
translationY = mTopPaddingOverflow;
|
translationY = 0;
|
||||||
stackHeight = (int) height;
|
stackHeight = (int) height;
|
||||||
} else {
|
} else {
|
||||||
float appearFraction = getAppearFraction(height);
|
float appearFraction = getAppearFraction(height);
|
||||||
@@ -698,8 +701,12 @@ public class NotificationStackScrollLayout extends ViewGroup
|
|||||||
* Measured relative to the resting position.
|
* Measured relative to the resting position.
|
||||||
*/
|
*/
|
||||||
private float getExpandTranslationStart() {
|
private float getExpandTranslationStart() {
|
||||||
int startPosition = mTrackingHeadsUp || mHeadsUpManager.hasPinnedHeadsUp()
|
int startPosition = 0;
|
||||||
? 0 : -getFirstChildIntrinsicHeight();
|
if (!mTrackingHeadsUp && !mHeadsUpManager.hasPinnedHeadsUp()) {
|
||||||
|
startPosition = - Math.min(getFirstChildIntrinsicHeight(),
|
||||||
|
mMaxLayoutHeight - mIntrinsicPadding - mBottomStackSlowDownHeight
|
||||||
|
- mBottomStackPeekSize);
|
||||||
|
}
|
||||||
return startPosition - mTopPadding;
|
return startPosition - mTopPadding;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -722,7 +729,7 @@ public class NotificationStackScrollLayout extends ViewGroup
|
|||||||
? mHeadsUpManager.getTopHeadsUpPinnedHeight() + mBottomStackPeekSize
|
? mHeadsUpManager.getTopHeadsUpPinnedHeight() + mBottomStackPeekSize
|
||||||
+ mBottomStackSlowDownHeight
|
+ mBottomStackSlowDownHeight
|
||||||
: getLayoutMinHeight();
|
: getLayoutMinHeight();
|
||||||
return firstItemHeight + mTopPadding + mTopPaddingOverflow;
|
return firstItemHeight + (onKeyguard() ? mTopPadding : mIntrinsicPadding);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1152,6 +1159,10 @@ public class NotificationStackScrollLayout extends ViewGroup
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAntiFalsingNeeded() {
|
public boolean isAntiFalsingNeeded() {
|
||||||
|
return onKeyguard();
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean onKeyguard() {
|
||||||
return mPhoneStatusBar.getBarState() == StatusBarState.KEYGUARD;
|
return mPhoneStatusBar.getBarState() == StatusBarState.KEYGUARD;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2122,26 +2133,22 @@ public class NotificationStackScrollLayout extends ViewGroup
|
|||||||
*/
|
*/
|
||||||
public void updateTopPadding(float qsHeight, boolean animate,
|
public void updateTopPadding(float qsHeight, boolean animate,
|
||||||
boolean ignoreIntrinsicPadding) {
|
boolean ignoreIntrinsicPadding) {
|
||||||
float start = qsHeight;
|
int topPadding = (int) qsHeight;
|
||||||
float stackHeight = getHeight() - start;
|
|
||||||
int minStackHeight = getLayoutMinHeight();
|
int minStackHeight = getLayoutMinHeight();
|
||||||
if (stackHeight <= minStackHeight) {
|
if (topPadding + minStackHeight > getHeight()) {
|
||||||
float overflow = minStackHeight - stackHeight;
|
mTopPaddingOverflow = topPadding + minStackHeight - getHeight();
|
||||||
stackHeight = minStackHeight;
|
|
||||||
start = getHeight() - stackHeight;
|
|
||||||
mTopPaddingOverflow = overflow;
|
|
||||||
} else {
|
} else {
|
||||||
mTopPaddingOverflow = 0;
|
mTopPaddingOverflow = 0;
|
||||||
}
|
}
|
||||||
setTopPadding(ignoreIntrinsicPadding ? (int) start : clampPadding((int) start),
|
setTopPadding(ignoreIntrinsicPadding ? topPadding : clampPadding(topPadding),
|
||||||
animate);
|
animate);
|
||||||
setStackHeight(mLastSetStackHeight);
|
setExpandedHeight(mExpandedHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getLayoutMinHeight() {
|
public int getLayoutMinHeight() {
|
||||||
int firstChildMinHeight = getFirstChildIntrinsicHeight();
|
int firstChildMinHeight = getFirstChildIntrinsicHeight();
|
||||||
return Math.min(firstChildMinHeight + mBottomStackPeekSize + mBottomStackSlowDownHeight,
|
return Math.min(firstChildMinHeight + mBottomStackPeekSize + mBottomStackSlowDownHeight,
|
||||||
mMaxLayoutHeight - mTopPadding);
|
mMaxLayoutHeight - mIntrinsicPadding);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getFirstChildIntrinsicHeight() {
|
public int getFirstChildIntrinsicHeight() {
|
||||||
@@ -3088,10 +3095,14 @@ public class NotificationStackScrollLayout extends ViewGroup
|
|||||||
updateScrollPositionOnExpandInBottom(view);
|
updateScrollPositionOnExpandInBottom(view);
|
||||||
clampScrollPosition();
|
clampScrollPosition();
|
||||||
notifyHeightChangeListener(view);
|
notifyHeightChangeListener(view);
|
||||||
if (needsAnimation) {
|
|
||||||
ExpandableNotificationRow row = view instanceof ExpandableNotificationRow
|
ExpandableNotificationRow row = view instanceof ExpandableNotificationRow
|
||||||
? (ExpandableNotificationRow) view
|
? (ExpandableNotificationRow) view
|
||||||
: null;
|
: null;
|
||||||
|
if (row != null && (row == mFirstVisibleBackgroundChild
|
||||||
|
|| row.getNotificationParent() == mFirstVisibleBackgroundChild)) {
|
||||||
|
updateAlgorithmLayoutMinHeight();
|
||||||
|
}
|
||||||
|
if (needsAnimation) {
|
||||||
requestAnimationOnViewResize(row);
|
requestAnimationOnViewResize(row);
|
||||||
}
|
}
|
||||||
requestChildrenUpdate();
|
requestChildrenUpdate();
|
||||||
@@ -3374,7 +3385,7 @@ public class NotificationStackScrollLayout extends ViewGroup
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int findDarkAnimationOriginIndex(@Nullable PointF screenLocation) {
|
private int findDarkAnimationOriginIndex(@Nullable PointF screenLocation) {
|
||||||
if (screenLocation == null || screenLocation.y < mTopPadding + mTopPaddingOverflow) {
|
if (screenLocation == null || screenLocation.y < mTopPadding) {
|
||||||
return AnimationEvent.DARK_ANIMATION_ORIGIN_INDEX_ABOVE;
|
return AnimationEvent.DARK_ANIMATION_ORIGIN_INDEX_ABOVE;
|
||||||
}
|
}
|
||||||
if (screenLocation.y > getBottomMostNotificationBottom()) {
|
if (screenLocation.y > getBottomMostNotificationBottom()) {
|
||||||
@@ -3858,6 +3869,11 @@ public class NotificationStackScrollLayout extends ViewGroup
|
|||||||
mCurrentStackScrollState.removeViewStateForView(view);
|
mCurrentStackScrollState.removeViewStateForView(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setQsExpanded(boolean qsExpanded) {
|
||||||
|
mQsExpanded = qsExpanded;
|
||||||
|
updateAlgorithmLayoutMinHeight();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A listener that is notified when some child locations might have changed.
|
* A listener that is notified when some child locations might have changed.
|
||||||
*/
|
*/
|
||||||
@@ -4081,7 +4097,7 @@ public class NotificationStackScrollLayout extends ViewGroup
|
|||||||
onDragCancelled(animView);
|
onDragCancelled(animView);
|
||||||
|
|
||||||
// If we're on the lockscreen we want to false this.
|
// If we're on the lockscreen we want to false this.
|
||||||
if (mPhoneStatusBar.getBarState() == StatusBarState.KEYGUARD) {
|
if (isAntiFalsingNeeded()) {
|
||||||
mHandler.removeCallbacks(mFalsingCheck);
|
mHandler.removeCallbacks(mFalsingCheck);
|
||||||
mHandler.postDelayed(mFalsingCheck, COVER_GEAR_DELAY);
|
mHandler.postDelayed(mFalsingCheck, COVER_GEAR_DELAY);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user