Skip to content

Commit

Permalink
add refresh tree nodes int TreeViewAdapter.
Browse files Browse the repository at this point in the history
  • Loading branch information
TellH committed Oct 3, 2016
1 parent 9bc164c commit a3986fb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ dependencies {
compile 'com.android.support:recyclerview-v7:24.2.1'
testCompile 'junit:junit:4.12'
// compile project(path: ':recyclertreeview-lib')
compile 'com.github.TellH:RecyclerTreeView:1.1.1'
compile 'com.github.TellH:RecyclerTreeView:1.1.2'
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,14 @@ public class TreeViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
private OnTreeNodeClickListener onTreeNodeClickListener;
private boolean toCollapseChild;

public TreeViewAdapter(List<? extends TreeViewBinder> viewBinders) {
this(null, viewBinders);
}

public TreeViewAdapter(List<TreeNode> nodes, List<? extends TreeViewBinder> viewBinders) {
displayNodes = new ArrayList<>();
findDisplayNodes(nodes);
if (nodes != null)
findDisplayNodes(nodes);
this.viewBinders = viewBinders;
}

Expand Down Expand Up @@ -126,4 +131,10 @@ public interface OnTreeNodeClickListener {
*/
boolean onClick(TreeNode node, RecyclerView.ViewHolder holder);
}

public void refresh(List<TreeNode> treeNodes) {
displayNodes.clear();
findDisplayNodes(treeNodes);
notifyDataSetChanged();
}
}

0 comments on commit a3986fb

Please sign in to comment.