Skip to content

Commit

Permalink
bugfix: boundary protection
Browse files Browse the repository at this point in the history
  • Loading branch information
cgspine committed Jun 6, 2019
1 parent 8554bf6 commit 5bfd8f5
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,11 @@ public void checkLayout() {
int topRange = mTopView.getScrollOffsetRange();
int offsetCurrent = -mTopAreaBehavior.getTopAndBottomOffset();
int offsetRange = getOffsetRange();

if(offsetRange <= 0){
return;
}

if (offsetCurrent >= offsetRange || (offsetCurrent > 0 && mKeepBottomAreaStableWhenCheckLayout)) {
mTopView.consumeScroll(Integer.MAX_VALUE);
return;
Expand Down Expand Up @@ -388,9 +393,9 @@ public int getOffsetRange() {
}
int contentHeight = mBottomView.getContentHeight();
if (contentHeight != IQMUIContinuousNestedBottomView.HEIGHT_IS_ENOUGH_TO_SCROLL) {
return ((View) mTopView).getHeight() - (getHeight() - contentHeight);
return Math.max(0, ((View) mTopView).getHeight() + contentHeight - getHeight());
}
return ((View) mTopView).getHeight() - (getHeight() - ((View) mBottomView).getHeight());
return Math.max(0, ((View) mTopView).getHeight() + ((View) mBottomView).getHeight() - getHeight());
}

@Override
Expand Down

0 comments on commit 5bfd8f5

Please sign in to comment.