Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
add item chlid click
  • Loading branch information
CymChad committed Apr 28, 2016
1 parent 155902a commit 4f378e8
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Please feel free to use this.(Love can be a **Star**)
- **easily create section headers**
- **custom item view type**
- **add setEmptyView methods**
- **add item chlid click**

![demo](https://github.com/CymChad/BaseRecyclerViewAdapterHelper/blob/master/demo_res/demo.gif)
# Get it
Expand All @@ -25,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.5.5'
compile 'com.github.CymChad:BaseRecyclerViewAdapterHelper:v1.6'
}
```

Expand Down Expand Up @@ -158,5 +159,33 @@ public class SectionAdapter extends BaseSectionQuickAdapter<MySection> {
```
mQuickAdapter.setEmptyView(getView());
```
#Use it item chlid click
Adapter
```
protected void convert(BaseViewHolder helper, Status item) {
helper.setOnClickListener(R.id.tweetAvatar, new OnItemChildClickListener())
.setOnClickListener(R.id.tweetName, new OnItemChildClickListener());
}
```
Activity
```
mQuickAdapter.setOnRecyclerViewItemChildClickListener(new BaseQuickAdapter.OnRecyclerViewItemChildClickListener() {
@Override
public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
String content = null;
Status status = (Status) adapter.getItem(position);
switch (view.getId()) {
case R.id.tweetAvatar:
content = "img:" + status.getUserAvatar();
break;
case R.id.tweetName:
content = "name:" + status.getUserName();
break;
}
Toast.makeText(AnimationUseActivity.this, content, Toast.LENGTH_LONG).show();
}
});
```

#Thanks
[JoanZapata / base-adapter-helper](https://github.com/JoanZapata/base-adapter-helper)

0 comments on commit 4f378e8

Please sign in to comment.