alexvasilkov / GestureViews

ImageView and FrameLayout with gestures control and position animation
Apache License 2.0
2.37k stars 384 forks source link

RecyclePagerAdapter bug: Cannot exit from ViewPager when using GestureFrameLayout #147

Closed ParticleCore closed 3 years ago

ParticleCore commented 4 years ago

I'm trying to use GestureFrameLayout instead of GestureImageView in a ViewPager and everything works so far except for thet the swipe to exit feature. I've tried setting the exit type to one type and all types and set exit enabled, but nothing works.

Is this not possible or is there something else that needs to be set up differently when compared to the GestureImageView?

ParticleCore commented 4 years ago

Seems like this is a bug with the RecyclePagerAdapter where it keeps the state or something like that when the paging element contains a GestureFrameLayout. Creating a new adapter and attaching it to the view pager works around this issue, but ideally the behavior should be fixed at the source.

To test this create a sample app where one of the ViewPager items is a GestureFrameLayout insteaad of a GestureImageView, then open the app, click on any image to open the view pager, swipe until you reach the GestureFrameLayout then swipe up to close, it will work for the first time. Repeat the previous steps and it will no longer be able to swipe up to close. Additionally, the back button at the top stops working, but if you swipe to a GestureImageView after pressing that button, it will automatically close, as if the action was queued somehow.

alexvasilkov commented 3 years ago

Sorry, seems like I missed this issue.

GestureFrameLayout is not supposed to animate from list to pager so it does not really support exit gesture and I'm not planning to implement such a feature (I simply don't undersrand how it should work).