-
Notifications
You must be signed in to change notification settings - Fork 400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Close Swipe Row when just touching another Row like IPhone list handler. #100
Comments
Never mind on my question. Using these links with some additional changes to the code I was able to make swipe on Android work exactly like Apple IPhone swipe using Apple Mail app as the model for how I wanted Android app swipe to work. This allows the two platforms UI (Android and IPhone) to look and work the same the same for either environment. https://android-pratap.blogspot.com/2015/07/swipe-recyclerview-using.html?m=1 |
Hi Roy, could you give me some hints what changes you have made to the AndroidSwipeLayout? I have the same problem at the moment. Thanks and best regards Marcel |
Marcel, I was a bit surprised to get your email through github. I am surprised that I went back and commented my original github comment, a comment to myself. I never received a reply from the original author or anyone else on the changes necessary to my original question, which was how to make an Android ListView/RecyclerView work exactly like an view iPhone for swipe to reveal buttons and row handlers to handle the opening and closing of list rows on touch or swipe. My goal was to make an Android app and its IPhone twin UI work exactly the same. The Android purists will probably say that you should not try to do this, but I ignore the purists. Like many developers , I am/was somewhat careless in how I documented the changes I made to get this code to work like I wanted it to work , but I happily give the changed project to you (as a zip file) so that hopefully you can unzip it, load it into Android Studio , review it and get it running , and use it of pieces of it to include in whatever you are doing in your project. So here are the details (the changed project) , and if you get this to work for your codebase, all I ask in return is that you let me know that you got this zip file of the project and if you also get the code to work. This is the code project I originally made changes to, before I moved this into my real code base. So just consider this to be a test project to get the swipe working like I wanted it to work. The main details are this I changed the xml source for the row to display 2 buttons instead of 3 buttons. Look at the file for details. (file – swipe_row_item.xml I changed and added code to keep track of row swiping in SwipeRecyclerViewAdapter.java (see to close the rows on scrolling up or down , or touching a row to close and open row (this was months ago and of course I did not put enough comments in to understand the changes that I made, but if you get it running you will see that in fact, it works) See/Review/Search For in SwipeRecyclerViewAdapter.java for these items and handler changes I made int swipedCountTotal = 0; I also use Toast for the button click handlers after you swipe (More and Delete Button handlers) I also used a toast for a click event on the surface of a row (not the buttons after swipe) but the top row surface, uncomment the toast in method viewHolder.swipeLayout.getSurfaceView().setOnClickListener( to see the click handler. I probably will go back and make some additional comments to myself so I can follow my own code changes for this. SwipeRecyclerViewNewBase050319.zip Happy coding and I hope this helps you, please do let me know that you got this zip and do let me know if you get it to work for your code base . Roy/rgc/cottonmega From: MarcelBreska [mailto:[email protected]] Hi Roy, |
Wow, that this so much more than I had expected! To be honest I wasn’t expecting an answer at all because your topic is already a few months old.
The last few months I was spending time to rebuild my iOS-App from the ground up and now after I finished it, I want to improve the Androidversion too. It would be nice to have the same functionality in both apps so that the users don’t have to adapt to each version when they switch the system.
I just downloaded your file and will look up your changes. You saved my so much time with that, thanks a lot!
Is your app in the App or Play store available? Im interested to take a look at your work ;)
Best regards
Marcel
… On 30. Nov 2019, at 15:52, cottonmega ***@***.***> wrote:
Marcel, I was a bit surprised to get your email through github. I am surprised that I went back and commented my original github comment, a comment to myself. I never received a reply from the original author or anyone else on the changes necessary to my original question, which was how to make an Android ListView/RecyclerView work exactly like an view iPhone for swipe to reveal buttons and row handlers to handle the opening and closing of list rows on touch or swipe. My goal was to make an Android app and its IPhone twin UI work exactly the same. The Android purists will probably say that you should not try to do this, but I ignore the purists. Like many developers , I am/was somewhat careless in how I documented the changes I made to get this code to work like I wanted it to work , but I happily give the changed project to you (as a zip file) so that hopefully you can unzip it, load it into Android Studio , review it and get it running , and use it of pieces of it to include in whatever you are doing in your project.
So here are the details (the changed project) , and if you get this to work for your codebase, all I ask in return is that you let me know that you got this zip file of the project and if you also get the code to work. This is the code project I originally made changes to, before I moved this into my real code base. So just consider this to be a test project to get the swipe working like I wanted it to work.
The main details are this
I changed the xml source for the row to display 2 buttons instead of 3 buttons. Look at the file for details. (file – swipe_row_item.xml
I changed and added code to keep track of row swiping in SwipeRecyclerViewAdapter.java (see to close the rows on scrolling up or down , or touching a row to close and open row (this was months ago and of course I did not put enough comments in to understand the changes that I made, but if you get it running you will see that in fact, it works)
See/Review/Search For in SwipeRecyclerViewAdapter.java for these items and handler changes I made
int swipedCountTotal = 0;
boolean swipedCountOpenedBefore = false;
boolean swipedCountClosedBefore = false;
I also use Toast for the button click handlers after you swipe (More and Delete Button handlers)
I also used a toast for a click event on the surface of a row (not the buttons after swipe) but the top row surface, uncomment the toast in method viewHolder.swipeLayout.getSurfaceView().setOnClickListener( to see the click handler.
I probably will go back and make some additional comments to myself so I can follow my own code changes for this.
SwipeRecyclerViewNewBase050319.zip <https://github.com/chthai64/SwipeRevealLayout/files/3907204/SwipeRecyclerViewNewBase050319.zip>
Happy coding and I hope this helps you, please do let me know that you got this zip and do let me know if you get it to work for your code base . Roy/rgc/cottonmega
From: MarcelBreska ***@***.*** ***@***.***>]
Sent: Saturday, November 30, 2019 5:21 AM
To: chthai64/SwipeRevealLayout
Cc: cottonmega; Author
Subject: Re: [chthai64/SwipeRevealLayout] Add Close Swipe Row when just touching another Row like IPhone list handler. (#100 <#100>)
Hi Roy,
could you give me some hints what changes you have made to the AndroidSwipeLayout? I have the same problem at the moment.
Thanks and best regards
Marcel
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#100?email_source=notifications&email_token=ACYOELCFTGOQJYWDZHYC4FDQWJ42JA5CNFSM4G5WUWDKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEFQJMBY#issuecomment-559977991>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ACYOELA76LFTA7S7J7PBDU3QWJ42JANCNFSM4G5WUWDA>.
|
Thank you for providing your SwipeRevealLayout library. I have integrated your library into my existing ListView application replacing my Listviews with RecyclerViews and your library. But I have a question, I want the swipe library to work the same way on Android as it does on swipe on Apple IOS lists like mail . I want/need to learn how to detect and record when a row has been swiped open (e.g. myrow.IsCurrentlySwipedOpen = “true”) and use that condition later on, so that when the user just touches a row somewhere else in the list , the row that is swiped open will close (with no other action, just close) . I have already implemented the “only one row swiped at a time” feature which works just fine , but I am having a bit of trouble figuring out the best way to handle closing the swiped open row when I just touch another row (like on my Apple IPhone). If this could be conditional (e.g. xml - app:swipeCloseOnTouch=”true”) like the swipe edge from left, right, top or bottom currently is now (e.g. xml - app:dragEdge=”right”) , that would satisfy the developers who may not want the swiped row closed when someone simply touches another row. Thanks for any assistance for this close on touch feature and how to implement it currently or adding it as a new feature to the library. Thanks Roy Cotton
The text was updated successfully, but these errors were encountered: