コード例 #1
0
 @Override
 public boolean onMove(
     RecyclerView recyclerView,
     RecyclerView.ViewHolder viewHolder,
     RecyclerView.ViewHolder target) {
   int start = viewHolder.getAdapterPosition();
   int finish = target.getAdapterPosition();
   return mAdapter.move(start, finish);
 }
コード例 #2
0
 @Override
 public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) {
   int position = viewHolder.getAdapterPosition();
   if (direction == ItemTouchHelper.LEFT) mAdapter.swipeLeft(position);
   else mAdapter.swipeRight(position);
 }