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

Example Usage

  // Using a custom view/layout
    devFun.viewFactories += viewFactoryProvider<MenuHeader, View>(R.layout.dev_fun_menu_header)
  devFun.viewFactories += viewFactoryProvider<MenuHeader, DemoMenuHeaderView>(R.layout.demo_menu_header) {
        setTitle(activityProvider()!!::class.splitSimpleName)
        setCurrentUser(session.user)
    }
  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

parameterViewFactories

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

Example Usage

  // Using a custom view/layout
    devFun.viewFactories += viewFactoryProvider<MenuHeader, View>(R.layout.dev_fun_menu_header)
  devFun.viewFactories += viewFactoryProvider<MenuHeader, DemoMenuHeaderView>(R.layout.demo_menu_header) {
        setTitle(activityProvider()!!::class.splitSimpleName)
        setCurrentUser(session.user)
    }
  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

parameterViewFactories