Fixed a few bugs regarding big notification groups
am: bc243a9627
Change-Id: Id93f4777b6dc9b91a8148ad8ae341258ab7e3dfc
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);
|
||||||
|
ExpandableNotificationRow row = view instanceof ExpandableNotificationRow
|
||||||
|
? (ExpandableNotificationRow) view
|
||||||
|
: null;
|
||||||
|
if (row != null && (row == mFirstVisibleBackgroundChild
|
||||||
|
|| row.getNotificationParent() == mFirstVisibleBackgroundChild)) {
|
||||||
|
updateAlgorithmLayoutMinHeight();
|
||||||
|
}
|
||||||
if (needsAnimation) {
|
if (needsAnimation) {
|
||||||
ExpandableNotificationRow row = view instanceof ExpandableNotificationRow
|
|
||||||
? (ExpandableNotificationRow) view
|
|
||||||
: null;
|
|
||||||
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