Java Code Examples for android.support.v7.widget.RecyclerView#removeOnScrollListener()

The following examples show how to use android.support.v7.widget.RecyclerView#removeOnScrollListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbsFocusBorder.java    From AndroidTvDemo with Apache License 2.0 6 votes vote down vote up
private void registerScrollListener(RecyclerView recyclerView)
{
    if (null != mWeakRecyclerView && mWeakRecyclerView.get() == recyclerView)
    {
        return;
    }
    
    if (null == mRecyclerViewScrollListener)
    {
        mRecyclerViewScrollListener = new RecyclerViewScrollListener(this);
    }
    
    if (null != mWeakRecyclerView && null != mWeakRecyclerView.get())
    {
        mWeakRecyclerView.get().removeOnScrollListener(mRecyclerViewScrollListener);
        mWeakRecyclerView.clear();
    }
    
    recyclerView.removeOnScrollListener(mRecyclerViewScrollListener);
    recyclerView.addOnScrollListener(mRecyclerViewScrollListener);
    mWeakRecyclerView = new WeakReference<>(recyclerView);
}
 
Example 2
Source File: MyOnScrollListener.java    From TopsalesSellControlTableDemo with MIT License 5 votes vote down vote up
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
    super.onScrollStateChanged(recyclerView, newState);
    if (newState == recyclerView.SCROLL_STATE_IDLE) {
        recyclerView.removeOnScrollListener(this);
    }
}
 
Example 3
Source File: PageDetectorSupport.java    From Tangram-Android with MIT License 5 votes vote down vote up
public void startDetectFastScroll() {
    if (mOnScrollListener != null) {
        RecyclerView recyclerView = mTangramEngine.getContentView();
        if (recyclerView != null) {
            recyclerView.removeOnScrollListener(mOnScrollListener);
            recyclerView.setOnScrollListener(mOnScrollListener);
        }
    }
}
 
Example 4
Source File: PageDetectorSupport.java    From Tangram-Android with MIT License 5 votes vote down vote up
public void startDetectFastScroll() {
    if (mOnScrollListener != null) {
        RecyclerView recyclerView = mTangramEngine.getContentView();
        if (recyclerView != null) {
            recyclerView.removeOnScrollListener(mOnScrollListener);
            recyclerView.setOnScrollListener(mOnScrollListener);
        }
    }
}
 
Example 5
Source File: SmoothScrollEventHelper.java    From Shield with MIT License 5 votes vote down vote up
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
    super.onScrollStateChanged(recyclerView, newState);
    hasStateChanged = (newState == RecyclerView.SCROLL_STATE_SETTLING);
    if (newState != RecyclerView.SCROLL_STATE_SETTLING && hasScrollingStopped) {
        recyclerView.removeOnScrollListener(this);
        resetSignals();
        dispatchStopScrollEvent();
    }
}
 
Example 6
Source File: StaggeredLayoutManagerUtils.java    From RecyclerViewTools with Apache License 2.0 5 votes vote down vote up
@Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) {

         View v1 = recyclerView.getChildAt(0);
         View v2 = recyclerView.getChildAt(recyclerView.getChildCount() - 1);

         int i1 = recyclerView.getChildAdapterPosition(v1);
         int i2 = recyclerView.getChildAdapterPosition(v2);

         if (position >= i1 && position <= i2) {
            ((StaggeredGridLayoutManager) recyclerView.getLayoutManager()).invalidateSpanAssignments();
            recyclerView.invalidateItemDecorations();
            recyclerView.removeOnScrollListener(this);
         }
      }
 
Example 7
Source File: RefreshView.java    From PullRefreshLoadRecyclerView with MIT License 5 votes vote down vote up
public void bindWith(final RecyclerView recyclerView) {
    this.recyclerView = recyclerView;
    recyclerView.removeOnScrollListener(computePositionListener);
    recyclerView.addOnScrollListener(computePositionListener);

    recyclerView.getViewTreeObserver().addOnGlobalLayoutListener(
            new ViewTreeObserver.OnGlobalLayoutListener() {
                @Override
                public void onGlobalLayout() {
                    recyclerView.getViewTreeObserver().removeGlobalOnLayoutListener(this);
                    setTranslationY(-getMeasuredHeight());
                }
            });
}
 
Example 8
Source File: FragmentPageSnapAdapter.java    From RecyclerPager with Apache License 2.0 4 votes vote down vote up
@Override public void onDetachedFromRecyclerView(@NonNull RecyclerView recyclerView) {
    super.onDetachedFromRecyclerView(recyclerView);
    recyclerView.removeOnScrollListener(mScrollListener);
}
 
Example 9
Source File: IndexLayoutManager.java    From Orin with GNU General Public License v3.0 4 votes vote down vote up
public void dettach(RecyclerView pRecyclerView) {
    pRecyclerView.removeOnScrollListener(mScrollListener);
}
 
Example 10
Source File: IndexLayoutManager.java    From Orin with GNU General Public License v3.0 4 votes vote down vote up
public void dettach(RecyclerView pRecyclerView) {
    pRecyclerView.removeOnScrollListener(mScrollListener);
}
 
Example 11
Source File: OnLoadMore.java    From mvvm-template with GNU General Public License v3.0 4 votes vote down vote up
public void unRegisterListener(RecyclerView recyclerView) {
    recyclerView.removeOnScrollListener(this);
    this.listener = null;
}
 
Example 12
Source File: AbstractPagerLLM.java    From MultiView with Apache License 2.0 4 votes vote down vote up
@Override
public void onDetachedFromWindow(RecyclerView view, RecyclerView.Recycler recycler) {
    view.removeOnScrollListener(onScrollListener);
    super.onDetachedFromWindow(view, recycler);
}