use of me.henrytao.smoothappbarlayout.base.OnScrollListener in project smooth-app-bar-layout by henrytao-me.
the class BaseBehavior method initScrollTarget.
private void initScrollTarget(final CoordinatorLayout coordinatorLayout, final AppBarLayout child) {
Utils.log("initScrollTarget | %b", vScrollTarget != null);
if (vScrollTarget != null) {
long tag = getViewTag(vScrollTarget, true);
if (!mScrollTargets.contains(tag)) {
mScrollTargets.add(tag);
OnScrollListener listener = new OnScrollListener() {
@Override
public void onScrollChanged(View view, int x, int y, int dx, int dy, boolean accuracy) {
if (view == vScrollTarget) {
BaseBehavior.this.onScrollChanged(coordinatorLayout, child, view, y, dy, accuracy);
}
}
};
if (vScrollTarget instanceof NestedScrollView) {
ObservableNestedScrollView.newInstance((NestedScrollView) vScrollTarget, mOverrideOnScrollListener, listener);
} else if (vScrollTarget instanceof RecyclerView) {
ObservableRecyclerView.newInstance((RecyclerView) vScrollTarget, listener);
}
}
}
}
Aggregations