Display and edit JGraphT graphs on android
- Save AAR as ${project}/app/libs/andrograph.aar
- project/build.gradle (excerpt):
allprojects {
repositories {
//your repos here
flatDir{
dirs 'libs'
}
}
}
- project/app/build.gradle (excerpt):
dependencies {
//your dependencies here
compile 'org.jgrapht:jgrapht-core:0.9.2'
compile(name:'andrograph', ext:'aar')
}
- Head to "Releases" and grab latest AAR
- Add to Android Studio as "New Module -> Import .JAR/.AAR"
- Edit your apps build.gradle to add compile project(':andrograph-release') as dependency
- Have a JGraphT graph
- Add a GraphView to an Activity
- Build a GraphViewController
- Attach GraphViewController to GraphView
- Enjoy editing
DefaultGraphViewController can be equipped with an EdgeEvent instance. This will be called before edges are updated, i.e. before adding and removing edges. By consuming the event (return true), no further actions will be done. By not consuming the event (return false), the default action will be performed.
This can be used e.g. to catch selection of edges, store it somehow, and paint it differently (via reference to an EdgePaintProvider)
- with support from CaptBlackTea