项目作者: wada811

项目描述 :
DataBinding-ktx make easy declaring DataBinding.
高级语言: Kotlin
项目地址: git://github.com/wada811/DataBinding-ktx.git
创建时间: 2019-03-17T14:38:20Z
项目社区:https://github.com/wada811/DataBinding-ktx

开源协议:Apache License 2.0

下载


DataBinding-ktx

DataBinding-ktx makes it easy to use DataBinding.

ViewBinding-ktx is here.

Overview

  • DataBinding-ktx is automatically calling setLifecycleOwner.
  • DataBinding-ktx provides the withBinding method accessing the binding variable by lambda.
  • DataBinding-ktx provides the dataBinding method accessing the binding variable by delegated property.

Usage

  1. withBinding<DataBindingActivityBinding> { binding ->
  2. }

Delegated Property

  1. private val binding: DataBindingActivityBinding by dataBinding()

Note:
In Fragment, When the fragment’s view is destroyed, an IllegalStateException is thrown on accessing the binding property.
If you access the binding property when the fragment’s view may be destroyed, you must use the Lambda way above.

Gradle

Maven Central

  1. android {
  2. buildFeatures {
  3. dataBinding = true
  4. }
  5. }
  6. repositories {
  7. mavenCentral()
  8. }
  9. dependencies {
  10. implementation 'com.wada811.databindingktx:databindingktx:x.y.z'
  11. }

Migrations

7.0.0

dependencies

  1. - implementation 'com.github.wada811:DataBinding-ktx:x.y.z'
  2. + implementation 'com.wada811.databindingktx:databindingktx:x.y.z'

package

  1. -import com.wada811.databinding
  2. +import com.wada811.databindingktx

License

Copyright (C) 2020 wada811

Licensed under the Apache License, Version 2.0