LoopingViewPager icon indicating copy to clipboard operation
LoopingViewPager copied to clipboard

First and last Views getting destroyed even after using DEFAULT_BOUNDARY_CASHING true

Open summers314 opened this issue 9 years ago • 3 comments

summers314 avatar Feb 10 '16 01:02 summers314

Just call setOffscreenPageLimit() with you pager size.

kyze8439690 avatar May 11 '16 07:05 kyze8439690

setOffscreenPageLimit() should set adapter wrapper's count or real adapter's count ?

galihuotui avatar Jul 25 '17 03:07 galihuotui

LoopPagerAdapterWrapper.destroyItem() has a bug: realPosition can be less than realFirst, which appears to be an unexpected situation. Changing if (mBoundaryCaching && (position == realFirst || position == realLast)) to if (mBoundaryCaching && (position <= realFirst || position >= realLast)) significantly improves the behaviour around destroying views.

A bug remains: when swiping backwards from the start, the last item is still recreated. This only happens the first time, however.

I was considering making a PR for the change, but given it's still buggy I thought I'd just contribute a suggestion, as I don't have the time to delve deeper now.

Ninjars avatar Jul 24 '18 10:07 Ninjars