itemtouchhelper

Why is the drag animation being repeated in RecyclerView?

可紊 提交于 2021-01-29 05:16:03
问题 The bounty expires in 6 days . Answers to this question are eligible for a +50 reputation bounty. gig6 wants to draw more attention to this question. I am using the ItemTouchHelper class to support drag and drop in my RecyclerView. While I am dragging an item around it visually updates (swaps rows) as expected. Once I drop the item, another **visual** drag occurs. For example (see diagram below) if I drag item "a" from index 0 to index 3, the correct list shows that item "b" is now at index 0

ItemTouchHelper - The drop is forced after the first jumped line

让人想犯罪 __ 提交于 2020-01-14 09:42:08
问题 I am using ItemTouchHelper and ItemTouchHelper.SimpleCallback to allow the user to reorder a vertical list Recycler View. The drag and drop works but the drop is forced after the first jumped line even though I don't leave up my finger from the dragged cell. Please find below the SimpleCallback : private void initSwipeAndDrap() { ItemTouchHelper.SimpleCallback simpleItemTouchCallback = new ItemTouchHelper.SimpleCallback( ItemTouchHelper.UP | ItemTouchHelper.DOWN, 0) { //========== Swipe (Not

How to have swipe to delete and swipe to archive in two colours in Recyclerview Android

天大地大妈咪最大 提交于 2020-01-04 05:12:22
问题 Right now I have a funtional swipe left to delete in recyclerview with two layouts(foreground and background). I use itemtouchhelper in the code. However, I would like to have BOTH swipe left and swipe right showing different colors and icons, like in Google Inbox. How can I implement that? What I want is: swipe rightswipe left what I have is: only swipe right the code is just the standard itemtouchhelper.simplecallback with 2 layouts in the xml. And I googled everywhere and only found single

correct way to implement item touch helper on recyclerview in android

心不动则不痛 提交于 2019-12-23 04:44:04
问题 i followed a tutorial here on how to implement onItemTouchHelper and callback methods when i run my code it works to the point that i can long press and pick up the item but the moment i move it past one of the other items in the list my app will force close with an index out of bounds exception can anybody here help me? here is my code but it is identical to the code in the tutorial, Simple Item Touch Helper Callback public class SimpleItemTouchHelperCallback extends ItemTouchHelper.Callback

How to cancel dragging of items in RecyclerView when using ItemTouchHelper, as you drag?

假装没事ソ 提交于 2019-12-07 14:57:22
问题 Background I'm trying to have a RecyclerView that has different view types, and yet has the ability for drag&drop, together with single click and long click operations. It's similar to what you have on Phone app, where you can change the order of your favorites items. On the Phone app, when you long touch an item, a context menu appears right away, and if you continue to drag, the context menu is gone. However, in this case, I'm required to do the opposite. Upon long pressing, if the user

RecyclerView ItemTouchHelper Buttons on Swipe

情到浓时终转凉″ 提交于 2019-11-27 06:19:40
I am trying to port some iOS functionality to Android. I intent to create a table where on swipe to the left shows 2 button: Edit and Delete. I have been playing with it and I know I am very close. The secret really lies on the method OnChildDraw. I would like to Draw a Rect that fits the text Delete then draw the Edit text besides it with their respective background color. The remaining white space when clicked should restore the row to its initial position. I have managed to paint the background while the user is swiping to the sides but I don't know how to add the listeners and once it is

RecyclerView ItemTouchHelper Buttons on Swipe

流过昼夜 提交于 2019-11-26 17:56:52
问题 I am trying to port some iOS functionality to Android. I intent to create a table where on swipe to the left shows 2 button: Edit and Delete. I have been playing with it and I know I am very close. The secret really lies on the method OnChildDraw. I would like to Draw a Rect that fits the text Delete then draw the Edit text besides it with their respective background color. The remaining white space when clicked should restore the row to its initial position. I have managed to paint the