diff --git a/README.md b/README.md index 3d1d46f..31e3933 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ allprojects { **Step 2.** Add the dependency ``` gradle dependencies { - compile 'com.github.EvilBT:SherlockAdapter:v1.0.3' + compile 'com.github.EvilBT:SherlockAdapter:v1.0.4' } ``` diff --git a/adapter/src/main/java/xyz/zpayh/adapter/BaseAdapter.java b/adapter/src/main/java/xyz/zpayh/adapter/BaseAdapter.java index 0029a71..cf1360b 100644 --- a/adapter/src/main/java/xyz/zpayh/adapter/BaseAdapter.java +++ b/adapter/src/main/java/xyz/zpayh/adapter/BaseAdapter.java @@ -86,7 +86,7 @@ public abstract class BaseAdapter extends RecyclerView.Adapter data){ + public void setData(@Nullable List data){ mData.clear(); if (data != null){ mData.addAll(data); @@ -123,7 +123,7 @@ public void addData(T data){ * 添加新数据,并有可能重置加载更多状态 * @param data 数据集合 */ - public void addData(List data){ + public void addData(List data){ if (data == null){ return; } diff --git a/adapter/src/main/java/xyz/zpayh/adapter/BaseViewHolder.java b/adapter/src/main/java/xyz/zpayh/adapter/BaseViewHolder.java index 622de75..7a97f20 100644 --- a/adapter/src/main/java/xyz/zpayh/adapter/BaseViewHolder.java +++ b/adapter/src/main/java/xyz/zpayh/adapter/BaseViewHolder.java @@ -124,9 +124,9 @@ public BaseViewHolder setLongClickable(@IdRes int id, boolean longClickable){ View view = find(id); if (view != null){ if (longClickable){ - view.setOnClickListener(mOnClickListener); + view.setOnLongClickListener(mOnLongClickListener); }else{ - view.setOnClickListener(null); + view.setOnLongClickListener(null); } } return this; diff --git a/adapter/src/main/java/xyz/zpayh/adapter/ExpandableAdapter.java b/adapter/src/main/java/xyz/zpayh/adapter/ExpandableAdapter.java index 2f80a63..d98bf93 100644 --- a/adapter/src/main/java/xyz/zpayh/adapter/ExpandableAdapter.java +++ b/adapter/src/main/java/xyz/zpayh/adapter/ExpandableAdapter.java @@ -89,7 +89,7 @@ public abstract class ExpandableAdapter extends RecyclerView.Adapter data){ + public void setData(@Nullable List data){ mData.clear(); if (data != null){ mData.addAll(data); @@ -130,7 +130,7 @@ public void addData(IMultiItem data){ * 添加新数据,并有可能重置加载更多状态 * @param data 数据集合 */ - public void addData(List data){ + public void addData(List data){ if (data == null){ return; } @@ -157,7 +157,7 @@ public void removeData(IMultiItem data){ } } - private int findData(List list, IMultiItem data) { + private int findData(List list, IMultiItem data) { int showSubSize = 0; for (int i = 0; i < list.size(); i++) { @@ -203,7 +203,7 @@ public void removeData(int adapterPosition){ } - private int removeData(List list, int index){ + private int removeData(List list, int index){ for (IMultiItem item : list) { if (index == 0){ int removeSize = 1; @@ -470,7 +470,7 @@ private int getDataSize() { return getShowSize(mData); } - private int getShowSize(List data) { + private int getShowSize(List data) { if (data == null || data.isEmpty()){ return 0; } @@ -484,7 +484,7 @@ private int getShowSize(List data) { return size; } - private IMultiItem getData(List list, int index){ + private IMultiItem getData(List list, int index){ for (IMultiItem item : list) { if (index == 0){ diff --git a/app/src/main/java/xyz/zpayh/myadapter/data/Text.java b/app/src/main/java/xyz/zpayh/myadapter/data/Text.java index 60af452..43e36e3 100644 --- a/app/src/main/java/xyz/zpayh/myadapter/data/Text.java +++ b/app/src/main/java/xyz/zpayh/myadapter/data/Text.java @@ -30,7 +30,7 @@ public int getLayoutRes() { @Override public void convert(BaseViewHolder holder) { - + holder.setText(R.id.text,mText); } @Override