Search in sources :

Example 1 with OnScrollListener

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);
            }
        }
    }
}
Also used : OnScrollListener(me.henrytao.smoothappbarlayout.base.OnScrollListener) ObservableRecyclerView(me.henrytao.smoothappbarlayout.base.ObservableRecyclerView) RecyclerView(android.support.v7.widget.RecyclerView) ObservableNestedScrollView(me.henrytao.smoothappbarlayout.base.ObservableNestedScrollView) NestedScrollView(android.support.v4.widget.NestedScrollView) ObservableRecyclerView(me.henrytao.smoothappbarlayout.base.ObservableRecyclerView) RecyclerView(android.support.v7.widget.RecyclerView) ObservableNestedScrollView(me.henrytao.smoothappbarlayout.base.ObservableNestedScrollView) View(android.view.View) NestedScrollView(android.support.v4.widget.NestedScrollView)

Aggregations

NestedScrollView (android.support.v4.widget.NestedScrollView)1 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 ObservableNestedScrollView (me.henrytao.smoothappbarlayout.base.ObservableNestedScrollView)1 ObservableRecyclerView (me.henrytao.smoothappbarlayout.base.ObservableRecyclerView)1 OnScrollListener (me.henrytao.smoothappbarlayout.base.OnScrollListener)1