gh-pages / com.nextfaze.devfun.view / viewFactory
viewFactory
inline fun <reified V : View> viewFactory(@LayoutRes layoutId: Int, crossinline apply: V.() -> Unit = {}): ViewFactory<V> (source)
Convenience method to create a view factory via standard inflation.
In the simplest case, you can simply use: inflate(R.layout.my_layout)
If you also wish to adjust it after inflation:
viewFactory<TextInputLayout>(R.layout.my_text_input_layout) {
editText!!.apply {
inputType = TYPE_CLASS_TEXT
text = "Default Text"
...
}
...
}
Be aware that this creates a ViewFactory so inflation code could be executed at any time in any context.
If you want to create a single-typed/keyed provider then use convenience method viewFactoryProvider.
See Also