Skip to content

Repository files navigation

DownloadAndroid Arsenal

NodeFlow

NodeFlow is an Android library that provides a simple way to visualize hierarchical content. Perfect for displaying items that are organized in categories / subcategories.

alt tag

#Requirements Android 4.0+ (Ice Cream Sandwich and later)

#Using NodeFlow

###Step 1 Add the following line to the dependencies section of your build.gradle file

compile 'com.telenav.nodeflow:nodeflow:0.1.2'

###Step 2 Extend NodeFlowLayout class and implement abstract methods

publicclassMyFlowextendsNodeFlowLayout {
...
//define root node and populate it with dataNode<String> root = Node.get("root").addChildren(Arrays.asList("child1", "child2", "child3"));
@OverrideprotectedNode<?> getRootNode() {
returnroot;
}
@OverrideprotectedViewgetContentView(Node<?> node) {
//inflate viewViewGroupv = (ViewGroup) LayoutInflater.from(getContext()).inflate(R.layout.content, this, false);
//populate with content
((TextView) v.findViewById(R.id.content_title)).setText(node.getData());
returnv;
}
@OverrideprotectedViewgetHeaderView(Node<?> node) {
//inflate viewViewGroupv = (ViewGroup) LayoutInflater.from(getContext()).inflate(R.layout.header, this, false);
//populate with content
((TextView) v.findViewById(R.id.list_item_text)).setText(node.getData());
returnv;
}
}

###Step 3 Add extended view to a layout

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent">
<com.yourpackage.MyFlow
android:id="@+id/nodeFlow"android:layout_width="match_parent"android:layout_height="match_parent"/>
</RelativeLayout>

###Step 4 (Optional) Set node change listener & animation duration

MyFlownodeFlow = ((MyFlow) findViewById(R.id.nodeFlow));
nodeFlow.setNodeChangeListener(newOnActiveNodeChangeListener() {...});
nodeFlow.setAnimationDuration(500);

#Sample For a more detailed example check the demoapp module.

#License Apache License, Version 2.0

About

NodeFlow is a library that makes visualizing hierarchical content easier.

Resources

Stars

544 stars

Watchers

23 watching

Forks

Releases

Packages

Contributors

Languages