android-viewflow
android-viewflow copied to clipboard
Timing of onViewSwitched
I have an interesting issue.
My app has an image gallery that uses ViewFlow to swipe between images. Each image has some comments associated with it. There's a "view comments" button, which hides the ViewFlow and shows a comments layout.
I use the view switch listener to indicate that the comments should update to the comments for the next image.
However, a user can be 95% of the way to a new image, and let go of the touch, and though ViewFlow knows to snap to the next screen, it doesn't call onViewSwitched until it gets all the way there.
This means a user of my app can swipe to a new image, and ViewFlow will acknowledge the swipe gesture by starting to snap to the next screen, and while snapping, if the user press the "view comments" button, they get the comments for the old image. Furthermore, because ViewFlow is hidden when the button is pressed, the callback doesn't actually happen until after they hide the comments again!
We should probably either a) add a new method to the listener for onSnap or b) reconsider the timing of onViewSwitched calls.