In package com.nhaarman.acorn.android.presentation
class com.nhaarman.acorn.android.presentation.ProvidesView
A convenience interface that can be used to make Scene instances provide their own ViewControllers. It implements ViewControllerFactory and takes away some of the boilerplate code when working with Scenes.
This interface must only be used in conjunction with Scenes.
Methods
open 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.
-
scene: Scene
open fun viewControllerFor(scene: Scene, parent: ): ViewController
Creates a ViewController for given Scene key.
-
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.
abstract fun createViewController(parent: ): ViewController
Creates the ViewController.
This method can be called zero or multiple times in a Scene's lifetime, for example when the device is rotated. Do not keep a reference to the result yourself, use Scene.attach and Scene.detach to obtain references.
-
parent: