enhancementhelp wanted
Description
Due to the asynchronous handling when dismissing/showing the view it is impossible to have listeners set after re-showing.
First time:
- add state change listener
- show view -> listener gets called
Second time:
- add listener
- show view (it is already showing) -> calls dismiss and returns
- gets dismissed -> removes all listeners (including new ones)
- runnable shows view again -> no listeners
Adding the listeners after calling show also doesn't work (because the runnable to show again is asynchronously called from the dismiss animation callback)
My idea would be to store a local copy of the listeners in the dismiss method and clean the global fields. Then from the animation listener:
- When it wasn't cancelled call the local listeners.
- If it was cancelled put the local listeners back into the global fields. (To remain the state before the dismiss)