hudomju / android-swipe-to-dismiss-undo

Android swipe-to-dismiss-undo library and sample code
MIT License
240 stars 82 forks source link

Workaround for recycler view list item click feedback #16

Open Evige opened 9 years ago

Evige commented 9 years ago

Created dirty workaround in the library for item click feedback. Line : touchListener.setSelectableItemBackgroundOnItemClick(view); <-- needs to be added in onItemClick.

recyclerView.addOnItemTouchListener(new SwipeableItemClickListener(this, new OnItemClickListener() { @Override public void onItemClick(View view, int position) { touchListener.setSelectableItemBackgroundOnItemClick(view); if (view.getId() == R.id.txt_delete) { touchListener.processPendingDismisses(); } else if (view.getId() == R.id.txt_undo) { touchListener.undoPendingDismiss(); } else { // R.id.txt_data Toast.makeText(RecyclerViewActivity.this, "Position " + position, LENGTH_SHORT).show(); } } }));

mrteax commented 8 years ago

Pressed state should be changed, it won't work in case of ripple effect on click