gh-pages / com.nextfaze.devfun.core / DevFun / viewFactories
viewFactories
val viewFactories:
CompositeViewFactoryProvider
(source)
Composite list of all ViewFactoryProviders.
Various DevFun modules will use these factories for rendering custom views (by providing their own initially and/or allowing user defined implementations).
Add view factory providers using Composite.plusAssign; devFun.viewFactories += MyViewFactoryProvider()
.
Providers are checked in reverse order. i.e. Most recently added are checked first.
Utility Functions
- viewFactoryProvider to create a ViewFactoryProvider that returns a ViewFactory for some layout
- viewFactory in your custom ViewFactoryProvider to create/inflate just some layout
Example Usage
- Simple layout inflation (e.g. to change DevMenu header view):
// Using a custom view/layout
devFun.viewFactories += viewFactoryProvider<MenuHeader, View>(R.layout.dev_fun_menu_header)
- From demo using/configuring a custom view type:
devFun.viewFactories += viewFactoryProvider<MenuHeader, DemoMenuHeaderView>(R.layout.demo_menu_header) {
setTitle(activityProvider()!!::class.splitSimpleName)
setCurrentUser(session.user)
}
- Using a concrete ViewFactoryProvider (from DevFun core):
private class DevFunSimpleInvokeViewsFactory : ViewFactoryProvider {
override fun get(clazz: KClass<*>): ViewFactory<View>? =
when (clazz) {
InjectedParameterView::class -> inflate(R.layout.df_devfun_injected)
ErrorParameterView::class -> inflate(R.layout.df_devfun_type_error)
else -> null
}
}
}
devFun.viewFactories += DevFunSimpleInvokeViewsFactory()
See Also
Getter
Composite list of all ViewFactoryProviders.
Various DevFun modules will use these factories for rendering custom views (by providing their own initially and/or allowing user defined implementations).
Add view factory providers using Composite.plusAssign; devFun.viewFactories += MyViewFactoryProvider()
.
Providers are checked in reverse order. i.e. Most recently added are checked first.
Utility Functions
- viewFactoryProvider to create a ViewFactoryProvider that returns a ViewFactory for some layout
- viewFactory in your custom ViewFactoryProvider to create/inflate just some layout
Example Usage
- Simple layout inflation (e.g. to change DevMenu header view):
// Using a custom view/layout
devFun.viewFactories += viewFactoryProvider<MenuHeader, View>(R.layout.dev_fun_menu_header)
- From demo using/configuring a custom view type:
devFun.viewFactories += viewFactoryProvider<MenuHeader, DemoMenuHeaderView>(R.layout.demo_menu_header) {
setTitle(activityProvider()!!::class.splitSimpleName)
setCurrentUser(session.user)
}
- Using a concrete ViewFactoryProvider (from DevFun core):
private class DevFunSimpleInvokeViewsFactory : ViewFactoryProvider {
override fun get(clazz: KClass<*>): ViewFactory<View>? =
when (clazz) {
InjectedParameterView::class -> inflate(R.layout.df_devfun_injected)
ErrorParameterView::class -> inflate(R.layout.df_devfun_type_error)
else -> null
}
}
}
devFun.viewFactories += DevFunSimpleInvokeViewsFactory()
Getter See Also