ViewControllerFactory

In package com.nhaarman.acorn.android.presentation

class com.nhaarman.acorn.android.presentation.ViewControllerFactory

A factory interface that can create ViewController instances for Scenes.

This interface uses the ViewController interface to be able to provide both the attachable Container and the View to be displayed to the user.

Methods

abstract fun supports(scene: Scene): Boolean

Returns true when this ViewControllerFactory can create a ViewController when viewControllerFor is called. If this method returns false for a specific SceneKey, no calls to viewControllerFor with the same SceneKey must be made.

Parameters:
abstract fun viewControllerFor(scene: Scene, parent: ): ViewController

Creates a ViewController for given Scene key.

Parameters:
  • scene: Scene

    The key of the Scene instance for which the corresponding view should be created.

  • parent:

    This is the parent View that the resulting View should be attached to. The implementation must not add the View to the parent itself, but it can use the parent to generate the LayoutParams of the view.