gh-pages / com.nextfaze.devfun.view / viewFactoryProvider
viewFactoryProvider
inline fun <reified K :
Any
, reified V :
View
> viewFactoryProvider(@LayoutRes layoutId:
Int
, crossinline apply:
V
.() ->
Unit
= {}):
ViewFactoryProvider
(source)
Convenience method to create a view factory provider for a single type key.
Example usage from demo (~line 64 demoMenuHeaderFactory
in com.nextfaze.devfun.demo.devfun.DevFun.kt
):
// MenuHeader is the "key" (used by DevMenu to inflate the menu header)
// DemoMenuHeaderView is the custom view type
devFun.viewFactories += viewFactoryProvider<MenuHeader, DemoMenuHeaderView>(R.layout.demo_menu_header) {
setTitle(activityProvider()!!::class.splitSimpleName)
setCurrentUser(session.user)
}
Be aware that this creates a ViewFactoryProvider that returns a ViewFactory - thus inflation code could be executed at any time in any context.
If you only need to create a ViewFactory then use convenience method viewFactory.
See Also