siralam / LoopingViewPager

A ViewPager and PagerAdapter combination that support auto scroll, infinite loop and page indicators.
532 stars 64 forks source link

Add support for item resizing #17

Closed dfbarone closed 4 years ago

dfbarone commented 5 years ago

I want to be able to resize viewpager items when aspect ratio is enabled and clipToPadding is true. For example if an item maintains an aspect ratio (4:3) of its own it should resize to fit into the viewpager (16:9) in this case.

I have included a diff with changes. This is somewhat similar to my last PR for wrap_content, but instead of an item resizing to take padding into account, the item will simply be increasing the viewpager padding so that it will fit fully into the viewpager.

https://github.com/siralam/LoopingViewPager/compare/master...dfbarone:loopingviewpager_onmeasure_aspectratio_padding?expand=1

screenshot_1543720442

siralam commented 4 years ago

Implemented in v1.2.0. Thanks again @dfbarone !