Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin1/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
ChadCym committed May 12, 2016
2 parents 7ccf2f1 + 64369eb commit cf38a76
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 34 deletions.
31 changes: 15 additions & 16 deletions README-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
一个强大并且灵活的RecyclerViewAdapter,欢迎使用。(喜欢的可以**Star**一下)
#它能做什么?([下载 apk](https://github.com/CymChad/BaseRecyclerViewAdapterHelper/raw/master/demo_res/demo.apk)
- **优化Adapter代码(减少百分之70%代码)**
- **添加点击item点击事件、以及item子控件的点击事件**
- **添加点击item点击、长按事件、以及item子控件的点击事件**
- **添加加载动画(一行代码轻松切换5种默认动画)**
- **添加头部、尾部、下拉刷新、上拉加载(感觉又回到ListView时代)**
- **添加分组(随心定义分组头部)**
Expand All @@ -31,12 +31,12 @@
然后在dependencies添加:
```
dependencies {
compile 'com.github.CymChad:BaseRecyclerViewAdapterHelper:v1.6.3'
compile 'com.github.CymChad:BaseRecyclerViewAdapterHelper:v1.6.4'
}
```

#如何使用它来创建Adapter?

![demo](http://upload-images.jianshu.io/upload_images/972352-54bd17d3680a4cf9.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
```
public class QuickAdapter extends BaseQuickAdapter<Status> {
public QuickAdapter(Context context) {
Expand All @@ -54,7 +54,6 @@ public class QuickAdapter extends BaseQuickAdapter<Status> {
}
}
```
**这么复杂的布局只需要15行代码即可!**
#如何添加item点击事件
```
mQuickAdapter.setOnRecyclerViewItemClickListener(new BaseQuickAdapter.OnRecyclerViewItemClickListener() {
Expand Down Expand Up @@ -122,21 +121,21 @@ mQuickAdapter.addFooterView(getView());
```
#使用它加载更多
```
mQuickAdapter.setOnLoadMoreListener(PAGE_SIZE, new BaseQuickAdapter.RequestLoadMoreListener() {
mQuickAdapter.setOnLoadMoreListener(new BaseQuickAdapter.RequestLoadMoreListener() {
@Override
public void onLoadMoreRequested() {
if (mCurrentCounter >= TOTAL_COUNTER) {
mRecyclerView.post(new Runnable() {
@Override
public void run() {
mQuickAdapter.isNextLoad(false);
mRecyclerView.post(new Runnable() {
@Override
public void run() {
if (mCurrentCounter >= TOTAL_COUNTER) {
mQuickAdapter.notifyDataChangedAfterLoadMore(false);
} else {
mQuickAdapter.notifyDataChangedAfterLoadMore(DataServer.getSampleData(PAGE_SIZE), true);
mCurrentCounter = mQuickAdapter.getItemCount();
}
});
} else {
// reqData
mCurrentCounter = mQuickAdapter.getItemCount();
mQuickAdapter.isNextLoad(true);
}
}
});
}
});
```
Expand Down
37 changes: 19 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Powerful and flexible RecyclerAdapter
Please feel free to use this.(Love can be a **Star**)
#Features([download apk](https://github.com/CymChad/BaseRecyclerViewAdapterHelper/raw/master/demo_res/demo.apk)
- **Reduce lot of code.easily create RecyclerAdapter**
- **add item click**
- **add item click and add item long click**
- **easily add RecyclerAdapter animations**
- **add HeadView and add FooterView**
- **add The drop-down refresh, load more**
Expand All @@ -26,7 +26,7 @@ Add it in your root build.gradle at the end of repositories:
Add the dependency
```
dependencies {
compile 'com.github.CymChad:BaseRecyclerViewAdapterHelper:v1.6.3'
compile 'com.github.CymChad:BaseRecyclerViewAdapterHelper:v1.6.4'
}
```

Expand Down Expand Up @@ -113,24 +113,25 @@ mQuickAdapter.addHeaderView(getView());
mQuickAdapter.addFooterView(getView());
```
#Use it load more
setOnLoadMoreListener
```
mQuickAdapter.setOnLoadMoreListener(PAGE_SIZE, new BaseQuickAdapter.RequestLoadMoreListener() {
@Override
public void onLoadMoreRequested() {
if (mCurrentCounter >= TOTAL_COUNTER) {
mRecyclerView.post(new Runnable() {
@Override
public void run() {
mQuickAdapter.isNextLoad(false);
}
});
} else {
// reqData
mCurrentCounter = mQuickAdapter.getItemCount();
mQuickAdapter.isNextLoad(true);
mQuickAdapter.setOnLoadMoreListener(this);
```
Override onLoadMoreRequested()
```
@Override
public void onLoadMoreRequested() {
mRecyclerView.post(new Runnable() {
@Override
public void run() {
if (mCurrentCounter >= TOTAL_COUNTER) {
mQuickAdapter.notifyDataChangedAfterLoadMore(false);
}
}
});
} else {
mQuickAdapter.notifyDataChangedAfterLoadMore(DataServer.getSampleData(PAGE_SIZE),true);
mCurrentCounter = mQuickAdapter.getItemCount();
}});
}
```
#Use it create section headers
```
Expand Down

0 comments on commit cf38a76

Please sign in to comment.