kotterknife
kotterknife copied to clipboard
Bind view in arbitrary class
It would be nice to be able to do something like this:
class Sample : KotterKnifeTarget {
override val rootView = something
val textView = bindView<TextView>(R.id.foo) /* finds the view from rootView */
}
The view binding extension methods would be on KotterKnifeTarget
. This way we could use KotterKnife with Renderers or anywhere else.
What is the advantage of having that if you can just do
class Sample {
val textView = something.bindView<TextView>(R.id.foo)
}
@mustafin but I am not sure about this:
class Sample {
val textView = something.bindView<TextView>(R.id.foo)
}
That view method returns an object of type ReadOnlyProperty
and not an object of type TextView
. I can use the getValue method but which is the value for the parameter property: KProperty<*>
?