Skip to content

Commit

Permalink
"Auto"
Browse files Browse the repository at this point in the history
  • Loading branch information
Beppi Menozzi authored and Beppi Menozzi committed Feb 5, 2017
1 parent ec32f1f commit 434734a
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,15 +201,18 @@ void findViewPager() {
View view = activity.findViewById(viewPagerRes); // FALLISCE

if (view != null && view instanceof ViewPager) {
releaseViewPager();
viewPager = (ViewPager) view;
viewPager.addOnPageChangeListener(this);
pagerAdapter = viewPager.getAdapter();
currentPosition = viewPager.getCurrentItem();
configureViewPager((ViewPager) view);
}
}
}
void configureViewPager(ViewPager viewPager) {
releaseViewPager();
this.viewPager = viewPager;
viewPager.addOnPageChangeListener(this);
pagerAdapter = viewPager.getAdapter();
currentPosition = viewPager.getCurrentItem();

}

public void releaseViewPager() {
if (viewPager != null) {
Expand Down Expand Up @@ -753,7 +756,7 @@ public void setViewPagerRes(int viewPagerRes) {
}

public void setViewPager(ViewPager viewPager) { // useful when the view pager is created dynamically and there is no res
this.viewPager = viewPager;
configureViewPager(viewPager);
invalidate();
}

Expand Down

0 comments on commit 434734a

Please sign in to comment.