Bind view in arbitrary class
sargunv opened this issue · 2 comments
sargunv commented
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.
mustafin commented
What is the advantage of having that if you can just do
class Sample {
val textView = something.bindView<TextView>(R.id.foo)
}
eugenio-caicedo commented
@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<*>
?