Skip to content

Commit 05fab56

Browse files
committed
Merge pull request #25 from makovkastar/master
Fix wrapping pages with outlines.
2 parents 4441da7 + c3f5e17 commit 05fab56

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

lib/src/com/jfeinstein/jazzyviewpager/JazzyViewPager.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ public void setObjectForPosition(Object obj, int position) {
560560
mObjs.put(Integer.valueOf(position), obj);
561561
}
562562

563-
private View findViewFromObject(int position) {
563+
public View findViewFromObject(int position) {
564564
Object o = mObjs.get(Integer.valueOf(position));
565565
if (o == null) {
566566
return null;

lib/src/com/jfeinstein/jazzyviewpager/MainActivity.java

+7-4
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,19 @@ public Object instantiateItem(ViewGroup container, final int position) {
7171
}
7272
@Override
7373
public void destroyItem(ViewGroup container, int position, Object obj) {
74-
container.removeView((View) obj);
74+
container.removeView(mJazzy.findViewFromObject(position));
7575
}
7676
@Override
7777
public int getCount() {
7878
return 10;
7979
}
8080
@Override
81-
public boolean isViewFromObject(View arg0, Object arg1) {
82-
return arg0 == arg1;
81+
public boolean isViewFromObject(View view, Object obj) {
82+
if (view instanceof OutlineContainer) {
83+
return ((OutlineContainer) view).getChildAt(0) == obj;
84+
} else {
85+
return view == obj;
86+
}
8387
}
8488
}
85-
8689
}

0 commit comments

Comments
 (0)