A Small, Kotlin Android Databinding Library
KBinding is a Kotlin databinding library best used with Anko to enable databinding in a fluent, easy to understand syntax.
We can represent our UI in ways such as:
verticalLayout {
textView {
bindSelf { it.name }.toText(this)
}
editText {
hint = "Email"
bindSelf { it.emailInput }
.toText(this)
.twoWay(
.toFieldFromText()
}.lparams {
width = MATCH_PARENT
}
textView {
bindSelf { it.emailInput } // mirrors input for example
.toText(this)
}
}
buildscript {
ext {
kbinding_version = "1.0.0"
}
}
allProjects {
repositories {
// required to find the project's artifacts
maven { url "https://www.jitpack.io" }
}
}
compile "com.github.agrosner.kbinding:kbinding:$kbinding_version"
// to use with Anko, separate artifact.
compile 'org.jetbrains.anko:anko-sdk15:0.10.3' // current version of anko used
compile "com.github.agrosner.KBinding:kbinding-anko:$kbinding_version"
We support three kind of bindings:
Read more in the docs below:
I welcome and encourage all pull requests. Here are some basic rules to follow to ensure timely addition of your request:
develop
branch. Any other branch (unless specified by the maintainers) will get rejected.