Category : itemtouchhelper

I am using object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.UP) to swipe a horizontal RecyclerView up (there is only one item in the list per screen width) in theory, user drags the view partially up, and it does something. Up until here everything is fine. However, if the user drops the view instead of dragging it back down, ..

Read more

I am trying to attach an ItemTouchHelper to my recyclerView to implement swipe-to-read functionality, I have this code for ItemTouchHelper.Callback: public class MessageCommentSwipeCallback extends ItemTouchHelper.Callback { private static final String TAG="MessageSwipeCallback"; private final MessageCommentAdapter adapter; public MessageCommentSwipeCallback(MessageCommentAdapter adapter) { this.adapter = adapter; Log.i(TAG, "MessageCommentSwipeCallback: "); } @Override public int getMovementFlags(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder) ..

Read more

Here is my SwipeHelper code where I can swipe the list from Right to Left as of now. public abstract class SwipeHelper extends ItemTouchHelper.SimpleCallback { int BUTTON_WIDTH = 200; private RecyclerView recyclerView; private List<UnderlayButton> buttonList; private GestureDetector gestureDetector; private int swipedPos = -1; private float swipeThreshold = 0.5f; private Map<Integer, List<UnderlayButton>> buttonsBuffer; private Queue<Integer> recoverQueue; ..

Read more

I have an Adapter, Recyclerview and ItemTouchHelper. I want to make placeholders on which, as a result of moving, it will be possible to place items. Placeholders are now made as empty elements. But I don’t know how I can put the element directly on this one. My adapter: public class DateTimeAdapter extends RecyclerView.Adapter<MainHolder> implements ..

Read more

I am using ItemTouchHelper with AlertDialog. The problem is when user swipe the element to the right side. AlertDialog with EditText is show at the screen. Now I want to do something like that: -When user press "save" button the element disappears not removed, only "go out" from whole RecyclerView list. -When "cancel" button is ..

Read more

1.itemTouchHelper works well at first. Kotlin code as followed val itemTouchHelper = ItemTouchHelper(object: ItemTouchHelper.Callback(){ override fun getMovementFlags(recyclerView: RecyclerView, viewHolder:RecyclerView.ViewHolder): Int{ val dragFlag = ItemTouchHelper.UP | ItemTouchHelper.Down val swipeFlags = 0 return makeMovementFlags(dragFlags, swipeFlags) } override fun onMove(recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder){ val fromPosition = viewHolder.adapterPosition val toPosition = target.adapterPosition Collections.swap(mList, fromPosition, toPosition) mAdapter.notifyItemMoved(fromPosition, toPosition) ..

Read more

Following this question RecyclerView ItemTouchHelper Buttons on Swipe (NOT THE SAME). I would like to add buttons on each side. The official answer from that link is for ONE side only. What I have tried: public abstract class SwipeHelper extends ItemTouchHelper.SimpleCallback { public static final int BUTTON_WIDTH = 125; private RecyclerView recyclerView; private List<UnderlayButton> buttons; ..

Read more