KBinding
A Small, Kotlin Android Databinding Library
Install / Use
/learn @agrosner/KBindingREADME
KBinding
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)
}
}
Including in your project
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"
Documentation
We support three kind of bindings:
- One Way (ViewModel to View)
- Two Way (ViewModel <-> View)
- One Way to Source (View to ViewModel)
Read more in the docs below:
Pull Requests
I welcome and encourage all pull requests. Here are some basic rules to follow to ensure timely addition of your request:
- Match coding style (braces, spacing, etc.) This is best achieved using CMD+Option+L (Reformat code) on Mac (not sure for Windows) with Android Studio defaults.
- If its a feature, bugfix, or anything please only change code to what you specify.
- Please keep PR titles easy to read and descriptive of changes, this will make them easier to merge :)
- Pull requests must be made against
developbranch. Any other branch (unless specified by the maintainers) will get rejected. - Have fun!
Maintained By
Related Skills
node-connect
349.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.5kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
349.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
349.2kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
