android10 / Android-CleanArchitecture-Kotlin

This is a movies sample app in Kotlin, which is part of a serie of blog posts I have written about architecting android application using different approaches.
https://fernandocejas.com/2018/05/07/architecting-android-reloaded/
4.69k stars 934 forks source link

info query about binding format in the view #49

Open giuliohome opened 6 years ago

giuliohome commented 6 years ago

For me this project is interesting because it is based on viewmodel pattern I see it uses livedata, observe: very cool! But I would have expected to see the binding like

    android:layout_height="wrap_content"
    android:text="@{user.firstName, default=my_default}"/>

(from https://developer.android.com/topic/libraries/data-binding/expressions) where are they in such project? Thanks in advance for your hint!

giuliohome commented 6 years ago

Do you think it makes sense to introduce (from this other [post] ) a gradle dependency for databinding?(http://www.albertgao.xyz/2018/04/13/minimal-android-mvvm-databinding-setup-with-kotlin/))

apply plugin: 'kotlin-kapt'
android {
  dataBinding {
      enabled = true
  }
}
dependencies {
    implementation "android.arch.lifecycle:extensions:1.1.1"
    annotationProcessor "android.arch.lifecycle:compiler:1.1.1"
    kapt "com.android.databinding:compiler:3.1.1"
}

so that one can simply write android:text="@{viewModel.name}"?

Or see the paragraph Layout, DataBinding and BindingAdapters of a longer article about MVVM kith Kotlin.

I come from the world of MVVM in dotnet (C# and F# with WPF) so I'd appreciate very much the {...} curly parentheses format for data binding :-)