Merge "Fixed a bug where the scrollrange was calculated wrong" into nyc-dev

This commit is contained in:
Selim Cinek
2016-04-06 20:45:17 +00:00
committed by Android (Google) Code Review

View File

@@ -918,7 +918,7 @@ public class NotificationStackScrollLayout extends ViewGroup
int positionInLinearLayout = getPositionInLinearLayout(v); int positionInLinearLayout = getPositionInLinearLayout(v);
int targetScroll = positionInLinearLayout + expandableView.getActualHeight() + int targetScroll = positionInLinearLayout + expandableView.getActualHeight() +
mBottomInset - getHeight() + getTopPadding(); getImeInset() - getHeight() + getTopPadding();
if (mOwnScrollY < targetScroll) { if (mOwnScrollY < targetScroll) {
mScroller.startScroll(mScrollX, mOwnScrollY, 0, targetScroll - mOwnScrollY); mScroller.startScroll(mScrollX, mOwnScrollY, 0, targetScroll - mOwnScrollY);
mDontReportNextOverScroll = true; mDontReportNextOverScroll = true;
@@ -928,8 +928,7 @@ public class NotificationStackScrollLayout extends ViewGroup
@Override @Override
public WindowInsets onApplyWindowInsets(WindowInsets insets) { public WindowInsets onApplyWindowInsets(WindowInsets insets) {
mBottomInset = Math.max(0, insets.getSystemWindowInsetBottom() mBottomInset = insets.getSystemWindowInsetBottom();
- (getRootView().getHeight() - getHeight()));
int range = getScrollRange(); int range = getScrollRange();
if (mOwnScrollY > range) { if (mOwnScrollY > range) {
@@ -1498,23 +1497,17 @@ public class NotificationStackScrollLayout extends ViewGroup
} }
private int getScrollRange() { private int getScrollRange() {
int scrollRange = 0; int contentHeight = getContentHeight();
ExpandableView firstChild = (ExpandableView) getFirstChildNotGone(); int scrollRange = Math.max(0, contentHeight - mMaxLayoutHeight + mBottomStackPeekSize
if (firstChild != null) { + mBottomStackSlowDownHeight);
int contentHeight = getContentHeight(); int imeInset = getImeInset();
scrollRange = Math.max(0, contentHeight - mMaxLayoutHeight + mBottomStackPeekSize scrollRange += Math.min(imeInset, Math.max(0,
+ mBottomStackSlowDownHeight); getContentHeight() - (getHeight() - imeInset)));
if (scrollRange > 0) { return scrollRange;
int firstChildMaxExpandHeight = getMaxExpandHeight(firstChild); }
// We want to at least be able collapse the first item and not ending in a weird
// end state. private int getImeInset() {
scrollRange = Math.max(scrollRange, firstChildMaxExpandHeight return Math.max(0, mBottomInset - (getRootView().getHeight() - getHeight()));
- firstChild.getMinHeight());
}
}
int imeOverlap = Math.max(0,
getContentHeight() - (getHeight() - mBottomInset));
return scrollRange + imeOverlap;
} }
/** /**