diff --git a/banner/src/main/java/com/donkingliang/banner/BannerPagerAdapter.java b/banner/src/main/java/com/donkingliang/banner/BannerPagerAdapter.java index 39995b0..03e4d44 100644 --- a/banner/src/main/java/com/donkingliang/banner/BannerPagerAdapter.java +++ b/banner/src/main/java/com/donkingliang/banner/BannerPagerAdapter.java @@ -12,21 +12,21 @@ public class BannerPagerAdapter extends PagerAdapter { private Context mContext; - private List mDatas; + private List mData; private CustomBanner.ViewCreator mCreator; private CustomBanner.OnPageClickListener mOnPageClickListener; private SparseArray views = new SparseArray<>(); - public BannerPagerAdapter(Context context, CustomBanner.ViewCreator creator, List datas) { + public BannerPagerAdapter(Context context, CustomBanner.ViewCreator creator, List data) { mContext = context; mCreator = creator; - mDatas = datas; + mData = data; } @Override public int getCount() { - return mDatas == null || mDatas.isEmpty() ? 0 : mDatas.size() + 2; + return mData == null || mData.isEmpty() ? 0 : mData.size() + 2; } @Override @@ -58,9 +58,9 @@ public Object instantiateItem(ViewGroup container, final int position) { } final int item = getActualPosition(position); - final T t = mDatas.get(item); + final T t = mData.get(item); - mCreator.UpdateUI(mContext, view, item, mDatas.get(item)); + mCreator.updateUI(mContext, view, item, t); view.setOnClickListener(new View.OnClickListener() { @Override @@ -77,7 +77,7 @@ public void onClick(View v) { private int getActualPosition(int position) { if (position == 0) { - return mDatas.size() - 1; + return mData.size() - 1; } else if (position == getCount() - 1) { return 0; } else { diff --git a/banner/src/main/java/com/donkingliang/banner/CustomBanner.java b/banner/src/main/java/com/donkingliang/banner/CustomBanner.java index 13d767d..cda4ed9 100644 --- a/banner/src/main/java/com/donkingliang/banner/CustomBanner.java +++ b/banner/src/main/java/com/donkingliang/banner/CustomBanner.java @@ -164,19 +164,19 @@ private boolean isMarginal(int position) { * 设置轮播图数据 * * @param creator 创建和更新轮播图View的接口 - * @param datas 轮播图数据 + * @param data 轮播图数据 * @return */ - public CustomBanner setPages(ViewCreator creator, List datas) { - mAdapter = new BannerPagerAdapter(mContext, creator, datas); + public CustomBanner setPages(ViewCreator creator, List data) { + mAdapter = new BannerPagerAdapter(mContext, creator, data); if (mOnPageClickListener != null) { mAdapter.setOnPageClickListener(mOnPageClickListener); } mBannerViewPager.setAdapter(mAdapter); - if (datas == null) { + if (data == null) { mIndicatorLayout.removeAllViews(); } else { - initIndicator(datas.size()); + initIndicator(data.size()); } setCurrentItem(0); updateIndicator(); @@ -398,6 +398,6 @@ public interface ViewCreator { View createView(Context context, int position); - void UpdateUI(Context context, View view, int position, T data); + void updateUI(Context context, View view, int position, T t); } }