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
How to transport information for OnClickWrappers? #24
Comments
Olaf, I added a second setOnClickWrapper() method in which I have added a Parcelable parameter. This new parameter will be used as follows: Bundle bundle = new Bundle(); superActivityToast.setOnClickWrapper(onClickWrapper, bundle); I made an interface class which is basically another OnClickListener class except that it spits out the Parcelable object along with a View. The new onClick() method will be as follows: @OverRide
} So the new OnClickListener will support a Parcelable object that will be saved on orientation change and can be accessed via the onClick() method. What do you think of that solution? Keep the suggestions coming!
|
John, that is exactly what I had in mind, prefect. :) |
Excellent, let me polish it up and test it over the next few days and I'll push it to the master branch. Thanks for the suggestion!
|
Olaf, I pushed the commit to the develop branch. The ExampleUndoBar class has also been updated. Check it out when you get a chance and let me know if that's the best way to do it. Thanks,
|
Hey John, I just checked the new changes - works as expected and I like |
This has been addressed in the develop branch. Thanks! |
Hi John!
Well, now I see how you want to "restore" OnClickListeners for Buttons in Toasts - using the Wrapper classes and a tag. But your example case is too simple: how should I transport information to my potentially restored OnClickListener between orientation changes? In your demo it is clear that the "potentially destructive action" which gives a toast with a button cannot use any context data, like what should restored when the button is clicked!
...that is one reason why I do not like the restoring of toasts at all!
In my use cases, I create an OnClickListener class that inherently "knows" which data is to be worked on, just because I use inner classes. That cannot be done using your model at all. What is needed is a way to maybe also give a bundle to the Wrapper for each use of the toast - and that will have to be restored on orientation change as well...
See what I mean?
Thanks!
Olaf
The text was updated successfully, but these errors were encountered: