Commit 90f4d8a6 authored by gaodapeng's avatar gaodapeng

增加了replaceData返回是否有变化的值

parent d42d7239
...@@ -85,8 +85,8 @@ public class ImageVideoBanner extends FrameLayout implements ViewPager.OnPageCha ...@@ -85,8 +85,8 @@ public class ImageVideoBanner extends FrameLayout implements ViewPager.OnPageCha
} }
public void replaceData(List<BannerBean> listBean) { public boolean replaceData(List<BannerBean> listBean) {
mAdapter.replaceData(listBean); return mAdapter.replaceData(listBean);
} }
public void addData(List<BannerBean> listBean) { public void addData(List<BannerBean> listBean) {
...@@ -292,13 +292,12 @@ public class ImageVideoBanner extends FrameLayout implements ViewPager.OnPageCha ...@@ -292,13 +292,12 @@ public class ImageVideoBanner extends FrameLayout implements ViewPager.OnPageCha
return super.getItemPosition(object); return super.getItemPosition(object);
} }
public void replaceData(List<BannerBean> listBean) { public boolean replaceData(List<BannerBean> listBean) {
// 新数据和原来数据对比,不一致才去刷新 // 新数据和原来数据对比,不一致才去刷新
boolean change = compareData(listBean); boolean change = compareData(listBean);
if (!change) { if (!change) {
notifyDataSetChanged(); notifyDataSetChanged();
// startBanner(); // startBanner();
return;
} }
if (null != listBean) { if (null != listBean) {
mList.clear(); mList.clear();
...@@ -310,6 +309,7 @@ public class ImageVideoBanner extends FrameLayout implements ViewPager.OnPageCha ...@@ -310,6 +309,7 @@ public class ImageVideoBanner extends FrameLayout implements ViewPager.OnPageCha
autoCurrIndex = 0; autoCurrIndex = 0;
// startBanner(); // startBanner();
} }
return change;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment