Skip to content

Commit

Permalink
bugfix: scroll
Browse files Browse the repository at this point in the history
  • Loading branch information
cgspine committed Jan 5, 2020
1 parent 3a9d937 commit 627d7df
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ private void dispatchScroll(int topCurrent, int topRange,

}
for (OnScrollListener onScrollListener : mOnScrollListeners) {
onScrollListener.onScroll(topCurrent, topRange, offsetCurrent, offsetRange,
onScrollListener.onScroll(this, topCurrent, topRange, offsetCurrent, offsetRange,
bottomCurrent, bottomRange);
}
}
Expand All @@ -366,13 +366,13 @@ public void onNestedScroll(View target, int dxConsumed, int dyConsumed, int dxUn

private void dispatchScrollStateChange(int newScrollState, boolean fromTopBehavior) {
for (OnScrollListener onScrollListener : mOnScrollListeners) {
onScrollListener.onScrollStateChange(newScrollState, fromTopBehavior);
onScrollListener.onScrollStateChange(this, newScrollState, fromTopBehavior);
}
mCurrentScrollState = newScrollState;
}

public void scrollBy(int dy) {
if (dy > 0 && mTopAreaBehavior != null) {
if ((dy > 0 || mBottomView == null) && mTopAreaBehavior != null) {
mTopAreaBehavior.scroll(this, ((View) mTopView), dy);
} else if (dy != 0 && mBottomView != null) {
mBottomView.consumeScroll(dy);
Expand All @@ -383,7 +383,7 @@ public void smoothScrollBy(int dy, int duration) {
if (dy == 0) {
return;
}
if (dy > 0 && mTopAreaBehavior != null) {
if ((dy > 0 || mBottomView == null) && mTopAreaBehavior != null) {
mTopAreaBehavior.smoothScrollBy(this, ((View) mTopView), dy, duration);
} else if (mBottomView != null) {
mBottomView.smoothScrollYBy(dy, duration);
Expand Down Expand Up @@ -553,10 +553,10 @@ public void restoreScrollInfo(@Nullable Bundle bundle) {

public interface OnScrollListener {

void onScroll(int topCurrent, int topRange,
void onScroll(QMUIContinuousNestedScrollLayout scrollLayout, int topCurrent, int topRange,
int offsetCurrent, int offsetRange,
int bottomCurrent, int bottomRange);

void onScrollStateChange(int newScrollState, boolean fromTopBehavior);
void onScrollStateChange(QMUIContinuousNestedScrollLayout scrollLayout, int newScrollState, boolean fromTopBehavior);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ protected void initCoordinatorLayout() {
mCoordinatorLayout.addOnScrollListener(new QMUIContinuousNestedScrollLayout.OnScrollListener() {

@Override
public void onScroll(int topCurrent, int topRange, int offsetCurrent,
public void onScroll(QMUIContinuousNestedScrollLayout scrollLayout, int topCurrent, int topRange, int offsetCurrent,
int offsetRange, int bottomCurrent, int bottomRange) {
Log.i(TAG, String.format("topCurrent = %d; topRange = %d; " +
"offsetCurrent = %d; offsetRange = %d; " +
Expand All @@ -65,7 +65,7 @@ public void onScroll(int topCurrent, int topRange, int offsetCurrent,
}

@Override
public void onScrollStateChange(int newScrollState, boolean fromTopBehavior) {
public void onScrollStateChange(QMUIContinuousNestedScrollLayout scrollLayout, int newScrollState, boolean fromTopBehavior) {

}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {

mCoordinatorLayout.addOnScrollListener(new QMUIContinuousNestedScrollLayout.OnScrollListener() {
@Override
public void onScroll(int topCurrent, int topRange, int offsetCurrent,
public void onScroll(QMUIContinuousNestedScrollLayout scrollLayout, int topCurrent, int topRange, int offsetCurrent,
int offsetRange, int bottomCurrent, int bottomRange) {
Log.i(TAG, String.format("topCurrent = %d; topRange = %d; " +
"offsetCurrent = %d; offsetRange = %d; " +
Expand All @@ -104,7 +104,7 @@ public void onScroll(int topCurrent, int topRange, int offsetCurrent,
}

@Override
public void onScrollStateChange(int newScrollState, boolean fromTopBehavior) {
public void onScrollStateChange(QMUIContinuousNestedScrollLayout scrollLayout, int newScrollState, boolean fromTopBehavior) {
Log.i(TAG, String.format("newScrollState = %d; fromTopBehavior = %b",
newScrollState, fromTopBehavior));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public RecyclerView.LayoutParams generateDefaultLayoutParams() {

mCoordinatorLayout.addOnScrollListener(new QMUIContinuousNestedScrollLayout.OnScrollListener() {
@Override
public void onScroll(int topCurrent, int topRange, int offsetCurrent,
public void onScroll(QMUIContinuousNestedScrollLayout scrollLayout, int topCurrent, int topRange, int offsetCurrent,
int offsetRange, int bottomCurrent, int bottomRange) {
Log.i(TAG, String.format("topCurrent = %d; topRange = %d; " +
"offsetCurrent = %d; offsetRange = %d; " +
Expand All @@ -122,7 +122,7 @@ public void onScroll(int topCurrent, int topRange, int offsetCurrent,
}

@Override
public void onScrollStateChange(int newScrollState, boolean fromTopBehavior) {
public void onScrollStateChange(QMUIContinuousNestedScrollLayout scrollLayout, int newScrollState, boolean fromTopBehavior) {

}
});
Expand Down

0 comments on commit 627d7df

Please sign in to comment.