Loading packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +45 −2 Original line number Diff line number Diff line Loading @@ -237,6 +237,25 @@ public class NotificationStackScrollLayout extends ViewGroup mStackScrollAlgorithm.setTopPadding(mTopPadding); } /** * @return whether the height of the layout needs to be adapted, in order to ensure that the * last child is not in the bottom stack. */ private boolean needsHeightAdaption() { View lastChild = getLastChildNotGone(); View firstChild = getFirstChildNotGone(); boolean isLastChildExpanded = isViewExpanded(lastChild); return isLastChildExpanded && lastChild != firstChild; } private boolean isViewExpanded(View view) { if (view != null) { ExpandableView expandView = (ExpandableView) view; return expandView.getActualHeight() > mCollapsedSize; } return false; } /** * 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. Loading Loading @@ -682,7 +701,13 @@ public class NotificationStackScrollLayout extends ViewGroup int firstChildMaxExpandHeight = getMaxExpandHeight(firstChild); scrollRange = Math.max(0, contentHeight - mMaxLayoutHeight + mBottomStackPeekSize); if (scrollRange > 0 && getChildCount() > 0) { if (scrollRange > 0) { View lastChild = getLastChildNotGone(); if (isViewExpanded(lastChild)) { // last child is expanded, so we have to ensure that it can exit the // bottom stack scrollRange += mCollapsedSize + mPaddingBetweenElements; } // We want to at least be able collapse the first item and not ending in a weird // end state. scrollRange = Math.max(scrollRange, firstChildMaxExpandHeight - mCollapsedSize); Loading @@ -705,6 +730,20 @@ public class NotificationStackScrollLayout extends ViewGroup return null; } /** * @return the last child which has visibility unequal to GONE */ private View getLastChildNotGone() { int childCount = getChildCount(); for (int i = childCount - 1; i >= 0; i--) { View child = getChildAt(i); if (child.getVisibility() != View.GONE) { return child; } } return null; } private int getMaxExpandHeight(View view) { if (view instanceof ExpandableNotificationRow) { ExpandableNotificationRow row = (ExpandableNotificationRow) view; Loading Loading @@ -1040,7 +1079,11 @@ public class NotificationStackScrollLayout extends ViewGroup } public int getEmptyBottomMargin() { return Math.max(getHeight() - mContentHeight, 0); int emptyMargin = mMaxLayoutHeight - mContentHeight; if (needsHeightAdaption()) { emptyMargin = emptyMargin - mCollapsedSize - mBottomStackPeekSize; } return Math.max(emptyMargin, 0); } public void onExpansionStarted() { Loading packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java +1 −1 Original line number Diff line number Diff line Loading @@ -192,7 +192,7 @@ public class StackScrollAlgorithm { clampYTranslation(childViewState, childHeight); // check if we are overlapping with the bottom stack if (childViewState.yTranslation + childHeight + mPaddingBetweenElements >= bottomStackStart && !mIsExpansionChanging) { >= bottomStackStart && !mIsExpansionChanging && i != 0) { // TODO: handle overlapping sizes with end stack better // we just collapse this element childViewState.height = mCollapsedSize; Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +45 −2 Original line number Diff line number Diff line Loading @@ -237,6 +237,25 @@ public class NotificationStackScrollLayout extends ViewGroup mStackScrollAlgorithm.setTopPadding(mTopPadding); } /** * @return whether the height of the layout needs to be adapted, in order to ensure that the * last child is not in the bottom stack. */ private boolean needsHeightAdaption() { View lastChild = getLastChildNotGone(); View firstChild = getFirstChildNotGone(); boolean isLastChildExpanded = isViewExpanded(lastChild); return isLastChildExpanded && lastChild != firstChild; } private boolean isViewExpanded(View view) { if (view != null) { ExpandableView expandView = (ExpandableView) view; return expandView.getActualHeight() > mCollapsedSize; } return false; } /** * 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. Loading Loading @@ -682,7 +701,13 @@ public class NotificationStackScrollLayout extends ViewGroup int firstChildMaxExpandHeight = getMaxExpandHeight(firstChild); scrollRange = Math.max(0, contentHeight - mMaxLayoutHeight + mBottomStackPeekSize); if (scrollRange > 0 && getChildCount() > 0) { if (scrollRange > 0) { View lastChild = getLastChildNotGone(); if (isViewExpanded(lastChild)) { // last child is expanded, so we have to ensure that it can exit the // bottom stack scrollRange += mCollapsedSize + mPaddingBetweenElements; } // We want to at least be able collapse the first item and not ending in a weird // end state. scrollRange = Math.max(scrollRange, firstChildMaxExpandHeight - mCollapsedSize); Loading @@ -705,6 +730,20 @@ public class NotificationStackScrollLayout extends ViewGroup return null; } /** * @return the last child which has visibility unequal to GONE */ private View getLastChildNotGone() { int childCount = getChildCount(); for (int i = childCount - 1; i >= 0; i--) { View child = getChildAt(i); if (child.getVisibility() != View.GONE) { return child; } } return null; } private int getMaxExpandHeight(View view) { if (view instanceof ExpandableNotificationRow) { ExpandableNotificationRow row = (ExpandableNotificationRow) view; Loading Loading @@ -1040,7 +1079,11 @@ public class NotificationStackScrollLayout extends ViewGroup } public int getEmptyBottomMargin() { return Math.max(getHeight() - mContentHeight, 0); int emptyMargin = mMaxLayoutHeight - mContentHeight; if (needsHeightAdaption()) { emptyMargin = emptyMargin - mCollapsedSize - mBottomStackPeekSize; } return Math.max(emptyMargin, 0); } public void onExpansionStarted() { Loading
packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java +1 −1 Original line number Diff line number Diff line Loading @@ -192,7 +192,7 @@ public class StackScrollAlgorithm { clampYTranslation(childViewState, childHeight); // check if we are overlapping with the bottom stack if (childViewState.yTranslation + childHeight + mPaddingBetweenElements >= bottomStackStart && !mIsExpansionChanging) { >= bottomStackStart && !mIsExpansionChanging && i != 0) { // TODO: handle overlapping sizes with end stack better // we just collapse this element childViewState.height = mCollapsedSize; Loading