Presenter

abstract class Presenter<T>(source)

Presenters own the core logic that determines what a Carousel shows at any given moment. They control which items from a Carousel's internal data are visible, how they are positioned, sized, transformed, etc. based on the Carousel's current state. Presenters can also add supplemental Views to a Carousel that aid in the presentation they provide.

Inheritors

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
class Distance(val direction: Vector2D, val magnitude: Double)
Link copied to clipboard

Provides an abstract current position of the Carousel that lets the manager "iterate" back and forward.

Link copied to clipboard
data class Presentation(val items: List<Carousel.PresentedItem>, val supplementalViews: List<View> = emptyList())

Defines the list of data items to display in a Carousel as well as a list of supplemental Views the Carousel should present.

Functions

Link copied to clipboard

A Carousel will call this method when trying to do manual movement. This is a fundamentally different problem than it needs to solve when skipping through items (interpolate between indexes). This requires mapping pixel offsets to indexes. Only a Carousel's Presenter knows how items are laid out and can provide any information about "distance" between them. Hence, this API.

Link copied to clipboard

Called by Carousel to update the Presentation it should display.

Link copied to clipboard
fun Carousel<T, *>.update()

Indicate that the stage is outdated and suggest the Carousel invoke present.