Commit ebaf1ebae2e18da781404e3768bbde01e70e563b
1 parent
dd88abe6
Click add id return
Showing
3 changed files
with
4 additions
and
4 deletions
app/src/main/java/com/cnlive/libs/demo/mvptest/ui/activity/LaunchActivity.java
| @@ -30,7 +30,7 @@ public class LaunchActivity extends MvpViewStateBindingActivity<LaunchView, Laun | @@ -30,7 +30,7 @@ public class LaunchActivity extends MvpViewStateBindingActivity<LaunchView, Laun | ||
| 30 | @Override | 30 | @Override |
| 31 | protected void onPostCreate(Bundle savedInstanceState) { | 31 | protected void onPostCreate(Bundle savedInstanceState) { |
| 32 | super.onPostCreate(savedInstanceState); | 32 | super.onPostCreate(savedInstanceState); |
| 33 | - getViewData().getAdapter().setItemClickListener(item -> { | 33 | + getViewData().getAdapter().setItemClickListener((id,item) -> { |
| 34 | Log.e("DemoView", "Click " + item.getName()); | 34 | Log.e("DemoView", "Click " + item.getName()); |
| 35 | }); | 35 | }); |
| 36 | } | 36 | } |
cnlive/build.gradle
| @@ -78,7 +78,7 @@ ext { | @@ -78,7 +78,7 @@ ext { | ||
| 78 | siteUrl = 'http://bj.gitlab.cnlive.com/cnlive-team/CNVideoDemo' | 78 | siteUrl = 'http://bj.gitlab.cnlive.com/cnlive-team/CNVideoDemo' |
| 79 | gitUrl = 'http://bj.gitlab.cnlive.com/cnlive-team/CNVideoDemo.git' | 79 | gitUrl = 'http://bj.gitlab.cnlive.com/cnlive-team/CNVideoDemo.git' |
| 80 | 80 | ||
| 81 | - libraryVersion = '0.2.9' | 81 | + libraryVersion = '0.3.0' |
| 82 | 82 | ||
| 83 | developerId = 'CNlive' | 83 | developerId = 'CNlive' |
| 84 | developerName = 'Granzon' | 84 | developerName = 'Granzon' |
cnlive/src/main/java/com/cnlive/libs/base/frame/adapter/DataBindingRecyclerAdapter.java
| @@ -44,7 +44,7 @@ public abstract class DataBindingRecyclerAdapter<D, T extends ViewDataBinding> e | @@ -44,7 +44,7 @@ public abstract class DataBindingRecyclerAdapter<D, T extends ViewDataBinding> e | ||
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | public interface OnItemClickListener<D> { | 46 | public interface OnItemClickListener<D> { |
| 47 | - void onItemClick(D item); | 47 | + void onItemClick(int id, D item); |
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | public abstract int getLayoutId(); | 50 | public abstract int getLayoutId(); |
| @@ -67,7 +67,7 @@ public abstract class DataBindingRecyclerAdapter<D, T extends ViewDataBinding> e | @@ -67,7 +67,7 @@ public abstract class DataBindingRecyclerAdapter<D, T extends ViewDataBinding> e | ||
| 67 | ReflectUtil.invoke(holder.binding, "setClick", new Click(position) { | 67 | ReflectUtil.invoke(holder.binding, "setClick", new Click(position) { |
| 68 | @Override | 68 | @Override |
| 69 | public void onClick(View v) { | 69 | public void onClick(View v) { |
| 70 | - if (listener != null) listener.onItemClick(getList().get(position)); | 70 | + if (listener != null) listener.onItemClick(v.getId(), getList().get(position)); |
| 71 | } | 71 | } |
| 72 | }, View.OnClickListener.class); | 72 | }, View.OnClickListener.class); |
| 73 | holder.binding.executePendingBindings(); | 73 | holder.binding.executePendingBindings(); |