Extra ❤️❤️❤️❤️ for Conductor
Provides some basic building block and utility function for Conductor, some of it (like the ChangeHandler
s is taken from Conductor demo itself)
We use Jitpack so you have to add this to your root build.gradle
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
and then add the dependency in your module build.gradle
dependencies {
compile 'com.github.esafirm:conductor-extra:x.y.z'
// For Butterknife view binding
compile 'com.github.esafirm.conductor-extra:conductor-extra-butterknife:x.y.z'
// For Android Data Binding view binding
compile 'com.github.esafirm.conductor-extra:conductor-extra-databinding:x.y.z'
}
Where x.y.z
is the version you want to add. For the latest version you can look in release page or in this badge here
If you prefer code than readme, please go for the sample
Use the view binding module if you don't want to write your own implementation of view binding
Currently there's two option
All of view binding modules have the same component name (e.g AbsController
) and only separated by package name
class MyController: AbsController(){
@Bind(R.id.textview) lateinit var text: TextView
override fun getLayoutResId(): Int = R.layout.your_layout
override fun onViewBound(view: View){
/*
you don't have to call `Butterknife.bind`
or `Unbinder.unbind` again as it handled in `AbsController`
*/
// do something with `text`
text.visibility = View.GONE
}
}
class MyController: AbsController(){
override fun getLayoutResId(): Int = R.layout.your_layout
override fun onViewBound(binding: YourLayoutBinding){
//do something with your `ViewDataBinding`
binding.text.visibility = View.GONE
}
}