From 0aaf701b7555ee8dbef09cb72fb746748d447ac1 Mon Sep 17 00:00:00 2001 From: matrad Date: Tue, 31 Mar 2015 16:24:23 +0200 Subject: [PATCH] fixes #60 When removing all slides from that view, then the slide remains and is overlapping the new ones. When setting the Adapter again it forces the regeneration of the ViewPager Views. --- .../src/main/java/com/daimajia/slider/library/SliderLayout.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/library/src/main/java/com/daimajia/slider/library/SliderLayout.java b/library/src/main/java/com/daimajia/slider/library/SliderLayout.java index 149f36b..c201e79 100644 --- a/library/src/main/java/com/daimajia/slider/library/SliderLayout.java +++ b/library/src/main/java/com/daimajia/slider/library/SliderLayout.java @@ -625,6 +625,7 @@ public void removeSliderAt(int position){ if(getRealAdapter()!=null){ getRealAdapter().removeSliderAt(position); mViewPager.setCurrentItem(mViewPager.getCurrentItem(),false); + mViewPager.setAdapter(getWrapperAdapter()); } } @@ -638,6 +639,7 @@ public void removeAllSliders(){ //a small bug, but fixed by this trick. //bug: when remove adapter's all the sliders.some caching slider still alive. mViewPager.setCurrentItem(mViewPager.getCurrentItem() + count,false); + mViewPager.setAdapter(getWrapperAdapter()); } }