Skip to content

Commit 3829bee

Browse files
committed
代码修改
1 parent 3a2eede commit 3829bee

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

banner/src/main/java/com/donkingliang/banner/BannerPagerAdapter.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,21 @@
1212
public class BannerPagerAdapter<T> extends PagerAdapter {
1313

1414
private Context mContext;
15-
private List<T> mDatas;
15+
private List<T> mData;
1616
private CustomBanner.ViewCreator mCreator;
1717
private CustomBanner.OnPageClickListener mOnPageClickListener;
1818

1919
private SparseArray<View> views = new SparseArray<>();
2020

21-
public BannerPagerAdapter(Context context, CustomBanner.ViewCreator<T> creator, List datas) {
21+
public BannerPagerAdapter(Context context, CustomBanner.ViewCreator<T> creator, List data) {
2222
mContext = context;
2323
mCreator = creator;
24-
mDatas = datas;
24+
mData = data;
2525
}
2626

2727
@Override
2828
public int getCount() {
29-
return mDatas == null || mDatas.isEmpty() ? 0 : mDatas.size() + 2;
29+
return mData == null || mData.isEmpty() ? 0 : mData.size() + 2;
3030
}
3131

3232
@Override
@@ -58,9 +58,9 @@ public Object instantiateItem(ViewGroup container, final int position) {
5858
}
5959

6060
final int item = getActualPosition(position);
61-
final T t = mDatas.get(item);
61+
final T t = mData.get(item);
6262

63-
mCreator.UpdateUI(mContext, view, item, mDatas.get(item));
63+
mCreator.updateUI(mContext, view, item, t);
6464

6565
view.setOnClickListener(new View.OnClickListener() {
6666
@Override
@@ -77,7 +77,7 @@ public void onClick(View v) {
7777

7878
private int getActualPosition(int position) {
7979
if (position == 0) {
80-
return mDatas.size() - 1;
80+
return mData.size() - 1;
8181
} else if (position == getCount() - 1) {
8282
return 0;
8383
} else {

banner/src/main/java/com/donkingliang/banner/CustomBanner.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,19 +164,19 @@ private boolean isMarginal(int position) {
164164
* 设置轮播图数据
165165
*
166166
* @param creator 创建和更新轮播图View的接口
167-
* @param datas 轮播图数据
167+
* @param data 轮播图数据
168168
* @return
169169
*/
170-
public CustomBanner<T> setPages(ViewCreator<T> creator, List<T> datas) {
171-
mAdapter = new BannerPagerAdapter<T>(mContext, creator, datas);
170+
public CustomBanner<T> setPages(ViewCreator<T> creator, List<T> data) {
171+
mAdapter = new BannerPagerAdapter<T>(mContext, creator, data);
172172
if (mOnPageClickListener != null) {
173173
mAdapter.setOnPageClickListener(mOnPageClickListener);
174174
}
175175
mBannerViewPager.setAdapter(mAdapter);
176-
if (datas == null) {
176+
if (data == null) {
177177
mIndicatorLayout.removeAllViews();
178178
} else {
179-
initIndicator(datas.size());
179+
initIndicator(data.size());
180180
}
181181
setCurrentItem(0);
182182
updateIndicator();
@@ -398,6 +398,6 @@ public interface ViewCreator<T> {
398398

399399
View createView(Context context, int position);
400400

401-
void UpdateUI(Context context, View view, int position, T data);
401+
void updateUI(Context context, View view, int position, T t);
402402
}
403403
}

0 commit comments

Comments
 (0)