From 2e43cc9bfdaf8e766b0dfba807e2b5f3a8941c99 Mon Sep 17 00:00:00 2001 From: MikeAfc Date: Wed, 2 May 2018 11:27:03 +0800 Subject: [PATCH] Add method to get wrap adapter and refresh data. Fix #34 #36 #37 #84 #90 #87 --- .../java/com/tmall/ultraviewpager/UltraViewPager.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ultraviewpager/src/main/java/com/tmall/ultraviewpager/UltraViewPager.java b/ultraviewpager/src/main/java/com/tmall/ultraviewpager/UltraViewPager.java index a1a2abb..70f4674 100644 --- a/ultraviewpager/src/main/java/com/tmall/ultraviewpager/UltraViewPager.java +++ b/ultraviewpager/src/main/java/com/tmall/ultraviewpager/UltraViewPager.java @@ -448,6 +448,16 @@ public PagerAdapter getAdapter() { return viewPager.getAdapter() == null ? null : ((UltraViewPagerAdapter) viewPager.getAdapter()).getAdapter(); } + public PagerAdapter getWrapAdapter() { + return viewPager.getAdapter(); + } + + public void refresh() { + if (viewPager.getAdapter() != null) { + viewPager.getAdapter().notifyDataSetChanged(); + } + } + public void setOnPageChangeListener(ViewPager.OnPageChangeListener listener) { if (pagerIndicator == null) { //avoid registering the same listener twice