Search in sources :

Example 1 with ItemTouchHelperCallback

use of eu.davidea.flexibleadapter.helpers.ItemTouchHelperCallback in project FlexibleAdapter by davideas.

the class FlexibleAdapter method initializeItemTouchHelper.

/*---------------*/
/* TOUCH METHODS */
/*---------------*/
private void initializeItemTouchHelper() {
    if (mItemTouchHelper == null) {
        if (mRecyclerView == null) {
            throw new IllegalStateException("RecyclerView cannot be null. Enabling LongPressDrag or Swipe must be done after the Adapter is added to the RecyclerView.");
        }
        if (mItemTouchHelperCallback == null) {
            mItemTouchHelperCallback = new ItemTouchHelperCallback(this);
            if (DEBUG)
                Log.i(TAG, "Initialized default ItemTouchHelperCallback");
        }
        mItemTouchHelper = new ItemTouchHelper(mItemTouchHelperCallback);
        mItemTouchHelper.attachToRecyclerView(mRecyclerView);
    }
}
Also used : ItemTouchHelper(android.support.v7.widget.helper.ItemTouchHelper) ItemTouchHelperCallback(eu.davidea.flexibleadapter.helpers.ItemTouchHelperCallback)

Aggregations

ItemTouchHelper (android.support.v7.widget.helper.ItemTouchHelper)1 ItemTouchHelperCallback (eu.davidea.flexibleadapter.helpers.ItemTouchHelperCallback)1