Log.v(“ThreeTips”, “#16”)

1 — @BindingAdapter and Kotlin

public class BindingTextUtils {

@BindingAdapter({"imageUrl"})
public static void loadImage(ImageView v, String url) {
Picasso.with(view.getContext()).load(url).into(view)
}
}
class BindingAdapterUtils {

companion object {

@BindingAdapter(value = "imageUrl")
fun load(view: ImageView, url: String) = Picasso.with(view.context).load(url).into(view)
}
}
@BindingAdapter(value = "imageUrl")
fun load(view: ImageView, url: String) = Picasso.with(view.context).load(url).into(view)

2 — Dagger 2 + Kotlin = Be Aware of Wildcards

3 — Where do those attributes belong?

You put the layout attributes in the layout, and everything else in the styles!

Software Engineer at Storytel

Software Engineer at Storytel