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) {
|
||||
setQsExpansion(mQsMinExpansionHeight + mLastOverscroll);
|
||||
}
|
||||
updateStackHeight(getExpandedHeight());
|
||||
updateExpandedHeight(getExpandedHeight());
|
||||
updateHeader();
|
||||
|
||||
// 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();
|
||||
int stackScrollerPadding;
|
||||
if (mStatusBarState != StatusBarState.KEYGUARD) {
|
||||
int bottom = mQsContainer.getHeader().getHeight();
|
||||
stackScrollerPadding = mStatusBarState == StatusBarState.SHADE
|
||||
? bottom + mQsPeekHeight
|
||||
: mKeyguardStatusBar.getHeight();
|
||||
stackScrollerPadding = mQsContainer.getHeader().getHeight() + mQsPeekHeight;
|
||||
mTopPaddingAdjustment = 0;
|
||||
} else {
|
||||
mClockPositionAlgorithm.setup(
|
||||
@@ -1166,6 +1163,7 @@ public class NotificationPanelView extends PanelView implements
|
||||
|
||||
private void updateQsState() {
|
||||
mQsContainer.setExpanded(mQsExpanded);
|
||||
mNotificationStackScroller.setQsExpanded(mQsExpanded);
|
||||
mNotificationStackScroller.setScrollingEnabled(
|
||||
mStatusBarState != StatusBarState.KEYGUARD && (!mQsExpanded
|
||||
|| mQsExpansionFromOverscroll));
|
||||
@@ -1427,7 +1425,7 @@ public class NotificationPanelView extends PanelView implements
|
||||
setQsExpansion(mQsMinExpansionHeight
|
||||
+ t * (getTempQsMaxExpansion() - mQsMinExpansionHeight));
|
||||
}
|
||||
updateStackHeight(expandedHeight);
|
||||
updateExpandedHeight(expandedHeight);
|
||||
updateHeader();
|
||||
updateUnlockIcon();
|
||||
updateNotificationTranslucency();
|
||||
@@ -1487,7 +1485,7 @@ public class NotificationPanelView extends PanelView implements
|
||||
maxQsHeight, mStatusBarState == StatusBarState.KEYGUARD
|
||||
? mClockPositionResult.stackScrollerPadding - mTopPaddingAdjustment
|
||||
: 0)
|
||||
+ notificationHeight;
|
||||
+ notificationHeight + mNotificationStackScroller.getTopPaddingOverflow();
|
||||
if (totalHeight > mNotificationStackScroller.getHeight()) {
|
||||
float fullyCollapsedHeight = maxQsHeight
|
||||
+ mNotificationStackScroller.getLayoutMinHeight();
|
||||
@@ -1730,6 +1728,14 @@ public class NotificationPanelView extends PanelView implements
|
||||
if (view == null && mQsExpanded) {
|
||||
return;
|
||||
}
|
||||
ExpandableView firstChildNotGone = mNotificationStackScroller.getFirstChildNotGone();
|
||||
ExpandableNotificationRow firstRow = firstChildNotGone instanceof ExpandableNotificationRow
|
||||
? (ExpandableNotificationRow) firstChildNotGone
|
||||
: null;
|
||||
if (firstRow != null
|
||||
&& (view == firstRow || (firstRow.getNotificationParent() == firstRow))) {
|
||||
requestScrollerTopPaddingUpdate(false);
|
||||
}
|
||||
requestPanelHeightUpdate();
|
||||
}
|
||||
|
||||
@@ -2249,8 +2255,8 @@ public class NotificationPanelView extends PanelView implements
|
||||
mQsAutoReinflateContainer.setTranslationX(translation);
|
||||
}
|
||||
|
||||
protected void updateStackHeight(float stackHeight) {
|
||||
mNotificationStackScroller.setStackHeight(stackHeight);
|
||||
protected void updateExpandedHeight(float expandedHeight) {
|
||||
mNotificationStackScroller.setExpandedHeight(expandedHeight);
|
||||
updateKeyguardBottomAreaAlpha();
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ public class AmbientState {
|
||||
private boolean mShadeExpanded;
|
||||
private float mMaxHeadsUpTranslation;
|
||||
private boolean mDismissAllInProgress;
|
||||
private int mLayoutMinHeight;
|
||||
|
||||
public int getScrollY() {
|
||||
return mScrollY;
|
||||
@@ -137,10 +138,6 @@ public class AmbientState {
|
||||
mStackTranslation = stackTranslation;
|
||||
}
|
||||
|
||||
public int getLayoutHeight() {
|
||||
return mLayoutHeight;
|
||||
}
|
||||
|
||||
public void setLayoutHeight(int layoutHeight) {
|
||||
mLayoutHeight = layoutHeight;
|
||||
}
|
||||
@@ -154,7 +151,7 @@ public class AmbientState {
|
||||
}
|
||||
|
||||
public int getInnerHeight() {
|
||||
return mLayoutHeight - mTopPadding;
|
||||
return Math.max(mLayoutHeight - mTopPadding, mLayoutMinHeight);
|
||||
}
|
||||
|
||||
public boolean isShadeExpanded() {
|
||||
@@ -180,4 +177,8 @@ public class AmbientState {
|
||||
public boolean isDismissAllInProgress() {
|
||||
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 final Paint mBackgroundPaint = new Paint();
|
||||
|
||||
/**
|
||||
* mCurrentStackHeight is the actual stack height, mLastSetStackHeight is the stack height set
|
||||
* externally from {@link #setStackHeight}
|
||||
*/
|
||||
private float mLastSetStackHeight;
|
||||
private float mExpandedHeight;
|
||||
private int mOwnScrollY;
|
||||
private int mMaxLayoutHeight;
|
||||
|
||||
@@ -354,6 +350,7 @@ public class NotificationStackScrollLayout extends ViewGroup
|
||||
return object.getBackgroundFadeAmount();
|
||||
}
|
||||
};
|
||||
private boolean mQsExpanded;
|
||||
|
||||
public NotificationStackScrollLayout(Context context) {
|
||||
this(context, null);
|
||||
@@ -519,6 +516,7 @@ public class NotificationStackScrollLayout extends ViewGroup
|
||||
clampScrollPosition();
|
||||
requestChildrenUpdate();
|
||||
updateFirstAndLastBackgroundViews();
|
||||
updateAlgorithmLayoutMinHeight();
|
||||
}
|
||||
|
||||
private void requestAnimationOnViewResize(ExpandableNotificationRow row) {
|
||||
@@ -560,9 +558,14 @@ public class NotificationStackScrollLayout extends ViewGroup
|
||||
|
||||
private void updateAlgorithmHeightAndPadding() {
|
||||
mAmbientState.setLayoutHeight(getLayoutHeight());
|
||||
updateAlgorithmLayoutMinHeight();
|
||||
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
|
||||
* 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) {
|
||||
mLastSetStackHeight = height;
|
||||
public void setExpandedHeight(float height) {
|
||||
mExpandedHeight = height;
|
||||
setIsExpanded(height > 0.0f);
|
||||
int stackHeight;
|
||||
float translationY;
|
||||
float appearEndPosition = getAppearEndPosition();
|
||||
float appearStartPosition = getAppearStartPosition();
|
||||
if (height >= appearEndPosition) {
|
||||
translationY = mTopPaddingOverflow;
|
||||
translationY = 0;
|
||||
stackHeight = (int) height;
|
||||
} else {
|
||||
float appearFraction = getAppearFraction(height);
|
||||
@@ -698,8 +701,12 @@ public class NotificationStackScrollLayout extends ViewGroup
|
||||
* Measured relative to the resting position.
|
||||
*/
|
||||
private float getExpandTranslationStart() {
|
||||
int startPosition = mTrackingHeadsUp || mHeadsUpManager.hasPinnedHeadsUp()
|
||||
? 0 : -getFirstChildIntrinsicHeight();
|
||||
int startPosition = 0;
|
||||
if (!mTrackingHeadsUp && !mHeadsUpManager.hasPinnedHeadsUp()) {
|
||||
startPosition = - Math.min(getFirstChildIntrinsicHeight(),
|
||||
mMaxLayoutHeight - mIntrinsicPadding - mBottomStackSlowDownHeight
|
||||
- mBottomStackPeekSize);
|
||||
}
|
||||
return startPosition - mTopPadding;
|
||||
}
|
||||
|
||||
@@ -722,7 +729,7 @@ public class NotificationStackScrollLayout extends ViewGroup
|
||||
? mHeadsUpManager.getTopHeadsUpPinnedHeight() + mBottomStackPeekSize
|
||||
+ mBottomStackSlowDownHeight
|
||||
: getLayoutMinHeight();
|
||||
return firstItemHeight + mTopPadding + mTopPaddingOverflow;
|
||||
return firstItemHeight + (onKeyguard() ? mTopPadding : mIntrinsicPadding);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1152,6 +1159,10 @@ public class NotificationStackScrollLayout extends ViewGroup
|
||||
|
||||
@Override
|
||||
public boolean isAntiFalsingNeeded() {
|
||||
return onKeyguard();
|
||||
}
|
||||
|
||||
private boolean onKeyguard() {
|
||||
return mPhoneStatusBar.getBarState() == StatusBarState.KEYGUARD;
|
||||
}
|
||||
|
||||
@@ -2122,26 +2133,22 @@ public class NotificationStackScrollLayout extends ViewGroup
|
||||
*/
|
||||
public void updateTopPadding(float qsHeight, boolean animate,
|
||||
boolean ignoreIntrinsicPadding) {
|
||||
float start = qsHeight;
|
||||
float stackHeight = getHeight() - start;
|
||||
int topPadding = (int) qsHeight;
|
||||
int minStackHeight = getLayoutMinHeight();
|
||||
if (stackHeight <= minStackHeight) {
|
||||
float overflow = minStackHeight - stackHeight;
|
||||
stackHeight = minStackHeight;
|
||||
start = getHeight() - stackHeight;
|
||||
mTopPaddingOverflow = overflow;
|
||||
if (topPadding + minStackHeight > getHeight()) {
|
||||
mTopPaddingOverflow = topPadding + minStackHeight - getHeight();
|
||||
} else {
|
||||
mTopPaddingOverflow = 0;
|
||||
}
|
||||
setTopPadding(ignoreIntrinsicPadding ? (int) start : clampPadding((int) start),
|
||||
setTopPadding(ignoreIntrinsicPadding ? topPadding : clampPadding(topPadding),
|
||||
animate);
|
||||
setStackHeight(mLastSetStackHeight);
|
||||
setExpandedHeight(mExpandedHeight);
|
||||
}
|
||||
|
||||
public int getLayoutMinHeight() {
|
||||
int firstChildMinHeight = getFirstChildIntrinsicHeight();
|
||||
return Math.min(firstChildMinHeight + mBottomStackPeekSize + mBottomStackSlowDownHeight,
|
||||
mMaxLayoutHeight - mTopPadding);
|
||||
mMaxLayoutHeight - mIntrinsicPadding);
|
||||
}
|
||||
|
||||
public int getFirstChildIntrinsicHeight() {
|
||||
@@ -3088,10 +3095,14 @@ public class NotificationStackScrollLayout extends ViewGroup
|
||||
updateScrollPositionOnExpandInBottom(view);
|
||||
clampScrollPosition();
|
||||
notifyHeightChangeListener(view);
|
||||
ExpandableNotificationRow row = view instanceof ExpandableNotificationRow
|
||||
? (ExpandableNotificationRow) view
|
||||
: null;
|
||||
if (row != null && (row == mFirstVisibleBackgroundChild
|
||||
|| row.getNotificationParent() == mFirstVisibleBackgroundChild)) {
|
||||
updateAlgorithmLayoutMinHeight();
|
||||
}
|
||||
if (needsAnimation) {
|
||||
ExpandableNotificationRow row = view instanceof ExpandableNotificationRow
|
||||
? (ExpandableNotificationRow) view
|
||||
: null;
|
||||
requestAnimationOnViewResize(row);
|
||||
}
|
||||
requestChildrenUpdate();
|
||||
@@ -3374,7 +3385,7 @@ public class NotificationStackScrollLayout extends ViewGroup
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
if (screenLocation.y > getBottomMostNotificationBottom()) {
|
||||
@@ -3858,6 +3869,11 @@ public class NotificationStackScrollLayout extends ViewGroup
|
||||
mCurrentStackScrollState.removeViewStateForView(view);
|
||||
}
|
||||
|
||||
public void setQsExpanded(boolean qsExpanded) {
|
||||
mQsExpanded = qsExpanded;
|
||||
updateAlgorithmLayoutMinHeight();
|
||||
}
|
||||
|
||||
/**
|
||||
* A listener that is notified when some child locations might have changed.
|
||||
*/
|
||||
@@ -4081,7 +4097,7 @@ public class NotificationStackScrollLayout extends ViewGroup
|
||||
onDragCancelled(animView);
|
||||
|
||||
// If we're on the lockscreen we want to false this.
|
||||
if (mPhoneStatusBar.getBarState() == StatusBarState.KEYGUARD) {
|
||||
if (isAntiFalsingNeeded()) {
|
||||
mHandler.removeCallbacks(mFalsingCheck);
|
||||
mHandler.postDelayed(mFalsingCheck, COVER_GEAR_DELAY);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user