-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Drag and Drop
世外桃源 edited this page May 21, 2015
·
2 revisions
dragDropTouchListener = new DragDropTouchListener(ultimateRecyclerView.mRecyclerView, this) {
@Override
protected void onItemSwitch(RecyclerView recyclerView, int from, int to) {
simpleRecyclerViewAdapter.swapPositions(from, to);
simpleRecyclerViewAdapter.clearSelection(from);
simpleRecyclerViewAdapter.notifyItemChanged(to);
if (actionMode != null) actionMode.finish();
Logs.d("switch----");
}
@Override
protected void onItemDrop(RecyclerView recyclerView, int position) {
Logs.d("drop----");
ultimateRecyclerView.enableSwipeRefresh(true);
}
};
dragDropTouchListener.setCustomDragHighlight(getResources().getDrawable(R.drawable.custom_drag_frame));
ultimateRecyclerView.mRecyclerView.addOnItemTouchListener(dragDropTouchListener);