Skip to content
This repository has been archived by the owner on Nov 26, 2022. It is now read-only.

Commit

Permalink
update setOnViewBind
Browse files Browse the repository at this point in the history
  • Loading branch information
deckyfx committed Aug 9, 2017
1 parent 9ada42e commit 69a1c64
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Add the dependency
```gradle
dependencies {
compile 'com.google.code.gson:gson:2.8.1'
compile 'com.github.deckyfx:simpleadapter:0.22@aar'
compile 'com.github.deckyfx:simpleadapter:0.23@aar'
}
```

Expand Down
2 changes: 1 addition & 1 deletion simpleadapter/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
versionName=0.0.22
versionName=0.0.23
versionCode=1
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ public View getGroupView(int groupPosition, boolean isExpanded, View convertView
AdapterItem item = this.getGroup(groupPosition);
if (viewHolder != null && item != null) {
viewHolder.setupView(this.mCtx, groupPosition, item);
this.mViewBindListener.onViewBind(groupPosition, -1);
this.mViewBindListener.onViewBind(this, groupPosition, -1);
}
}
if (this.mGroupScrollAnimation != null) {
Expand Down Expand Up @@ -247,7 +247,7 @@ public View getChildView(int groupPosition, int childPosition, boolean isLastChi
BaseItem item = this.getChild(groupPosition, childPosition);
if (viewHolder != null && item != null) {
viewHolder.setupView(this.mCtx, groupPosition, childPosition, item);
this.mViewBindListener.onViewBind(groupPosition, childPosition);
this.mViewBindListener.onViewBind(this, groupPosition, childPosition);
}
}
if (this.mChildScrollAnimation != null) {
Expand Down Expand Up @@ -295,7 +295,7 @@ public void setOnViewBindListener(ViewBindListener listener) {
}

public interface ViewBindListener {
public boolean onViewBind(int groupPosition, int childPosition);
public boolean onViewBind(ExpandableAdapter adapter, int groupPosition, int childPosition);
}

private class ExpandableAdapterFilter extends Filter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class RecycleAdapter<E extends BaseItem> extends RecyclerView.Adapter<Ada
private Class<? extends AdapterItem.RecycleViewHolder> mViewHolderClass;
private SimpleAdapter.ClickListener mClickListener;
private SimpleAdapter.TouchListener mTouchListener;
private SimpleAdapter.ViewBindListener mViewBindListener;
private ViewBindListener mViewBindListener;
private Filter mFilter;
private AnimationSet mScrollAnimation;
private int mCountMargin;
Expand Down Expand Up @@ -77,7 +77,7 @@ public void setOnTouchListener(SimpleAdapter.TouchListener listener) {
this.mTouchListener = listener;
}

public void setOnViewBindListener(SimpleAdapter.ViewBindListener listener) {
public void setOnViewBindListener(ViewBindListener listener) {
this.mViewBindListener = listener;
}

Expand Down Expand Up @@ -120,7 +120,7 @@ public void onBindViewHolder(AdapterItem.RecycleViewHolder viewHolder, int posit
BaseItem item = this.mItemsList.get(position);
if (viewHolder != null && item != null) {
viewHolder.setupView(this.mCtx, position, item);
this.mViewBindListener.onViewBind(position);
this.mViewBindListener.onViewBind(this, position);
}
}
}
Expand Down Expand Up @@ -155,6 +155,10 @@ public void backupList() {
this.mBackupList.addAll(this.mItemsList);
}

public interface ViewBindListener {
public boolean onViewBind(RecycleAdapter adapter, int position);
}

@Override
public Filter getFilter() {
if (this.mFilter == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public View getView(int position, View convertView, ViewGroup parent) {
BaseItem item = this.mItemsList.get(position);
if (viewHolder != null && item != null) {
viewHolder.setupView(this.mCtx, position, item);
this.mViewBindListener.onViewBind(position);
this.mViewBindListener.onViewBind(this, position);
}
}
if (this.mScrollAnimation != null) {
Expand Down Expand Up @@ -205,7 +205,7 @@ public interface TouchListener extends AdapterItem.ViewHolder.TouchListener {
}

public interface ViewBindListener {
public boolean onViewBind(int position);
public boolean onViewBind(SimpleAdapter adapter, int position);
}

public static final class DEFAULT_LIST_VIEW {
Expand Down

0 comments on commit 69a1c64

Please sign in to comment.