I have the following recycler view code that that allows the user to swipe right (deleting card from view and also deleting data from SQLite db) and also allowing the user to move tags to rearrange. It works. I'm happy.
ItemTouchHelper.SimpleCallback simpleItemTouchCallback = new ItemTouchHelper.SimpleCallback(ItemTouchHelper.UP | ItemTouchHelper.DOWN, ItemTouchHelper.RIGHT) {
@Override
public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder target) {
//awesome code when user grabs recycler card to reorder
}
@Override
public void clearView(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
super.clearView(recyclerView, viewHolder);
//awesome code to run when user drops card and completes reorder
}
@Override
public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) {
//awesome code when swiping right to remove recycler card and delete SQLite data
}
};
ItemTouchHelper itemTouchHelper = new ItemTouchHelper(simpleItemTouchCallback);
itemTouchHelper.attachToRecyclerView(recyclerView);
Now, I want to add the ability to swipe LEFT and perform something different from swiping RIGHT. All the solutions I've found so far would require a rewrite of my code. Any suggestions to add SWIPE LEFT to my existing code?