public void attachToRecyclerView(@Nullable RecyclerView recyclerView) {
        if (mRecyclerView == recyclerView) {
            return; // nothing to do
        }
        if (mRecyclerView != null) {
            destroyCallbacks();
        }
        mRecyclerView = recyclerView;
        if (mRecyclerView != null) {
            final Resources resources = recyclerView.getResources();
            mSwipeEscapeVelocity = resources
                    .getDimension(R.dimen.item_touch_helper_swipe_escape_velocity);
            mMaxSwipeVelocity = resources
                    .getDimension(R.dimen.item_touch_helper_swipe_escape_max_velocity);
            setupCallbacks();
        }
    }
public void attachToRecyclerView ( @ Nullable RecyclerView recyclerView ) { if ( mRecyclerView == recyclerView ) { return ; } if ( mRecyclerView != null ) { destroyCallbacks ( ) ; } mRecyclerView = recyclerView ; if ( mRecyclerView != null ) { final Resources resources = recyclerView . getResources ( ) ; mSwipeEscapeVelocity = resources . getDimension ( R . dimen . item_touch_helper_swipe_escape_velocity ) ; mMaxSwipeVelocity = resources . getDimension ( R . dimen . item_touch_helper_swipe_escape_max_velocity ) ; setupCallbacks ( ) ; } }
Attaches the ItemTouchHelper to the provided RecyclerView. If TouchHelper is already attached
to a RecyclerView, it will first detach from the previous one. You can call this method with
{@code null} to detach it from the current RecyclerView.

@param recyclerView The RecyclerView instance to which you want to add this helper or {@code
null} if you want to remove ItemTouchHelper from the current
RecyclerView.