iPaulPro / Android-ItemTouchHelper-Demo

Basic example of using ItemTouchHelper to add drag & drop and swipe-to-dismiss to RecyclerView.
Apache License 2.0
2.51k stars 498 forks source link

Under swipeable button #10

Open PovilasBrazys opened 9 years ago

PovilasBrazys commented 9 years ago

Hi Paul, thanks for the example it's really great. I wanted to ask if is it possible to add button under the swiped item (for removing items). I need extra level of security before removing the item (like delete button under the item and dialog box after the button is pressed before removing item). I've tried to do this by puting relativelayout with button in the same item_main.xml file under framelayout (with handle and textview) and move only framelayout (with handle and textview) while swiping, so after the swipe layout with button is visible. But it didn't work, when I tried to press the button, framelayout (with handle and textview) would pop up back to in to place and button wouldn't register any events.

after swipe after swipe

immediately after delete button was pressed immediately after delete button was pressed

I would be really grateful if you could show an example of under swipeable button. And keep up the great work.

pixelbendr commented 9 years ago

Also looking forward to this. Paul mentioned he will have this feature in part 3 of the medium tutorials.

PovilasBrazys commented 9 years ago

Thanks, good to know

iPaulPro commented 9 years ago

I will not be covering putting buttons behind the item view, as this is not recommended in the Material Guidelines. I will be covering basic "leave behinds," as seen in Gmail, but anything beyond that may be out of the scope of this series.

You may try posting your code on Stack Overflow and linking back here.

pixelbendr commented 9 years ago

I thought it was the same thing?...my bad. In google inbox "leave behind", an event is fired, for instance to confirm a deletion, please if you can note that in the tutorial. am new to android, the reason for me asking for too much. Thanks.

iPaulPro commented 9 years ago

Sorry, my response may be confusing since Gmail does use an Undo button after the item is fully swiped, and the Material Guidelines does mention that an action may be left behind. I don't think I'll have time to work that into part 3, but I'll try.

pixelbendr commented 9 years ago

Oh ok. No pressure even part 4 I will wait. lol

Or just provide guidelines which we can explore ourselves. No biggie.

Thanks for this.

Sent from my iPhone 6

On Aug 3, 2015, at 11:03 AM, Paul Burke notifications@github.com wrote:

Sorry, my response may be confusing since Gmail does use an Undo button after the item is fully swiped, and the Material Guidelines does mention that an action may be left behind. I don't think I'll have time to work that into part 3, but I'll try.

— Reply to this email directly or view it on GitHub.

davideas commented 8 years ago

Please see my comment to this question: http://stackoverflow.com/questions/34747458/partial-and-full-swipe-for-recyclerview-using-touchhelpercallback#comment61272119_34747458.

For me using ItemTouchHelper is impossible to obtain the click. I was successfully to have even partial swipe, but still, click on rear views were not fired, this might be a bug from Android class, to check. Also for partial swipe we don't have the real dX of the front view... Only swipe to dismiss is achievable and working well, nice but not good at all.