Builder

class Builder

A builder used to construct a KeylineState.

KeylineState.Builder enforces the following rules:

  1. There must be one or more keylines marked as "focal". These are keylines along the scrolling axis where an item or items are considered fully unmasked and viewable.
  2. Focal keylines must be added adjacent to each other. A non-focal keyline cannot be added between focal keylines.
  3. A keyline's masked item size can only remain the same size or increase in size as it approaches the focal range. A keyline's masked item size before the focal range cannot be larger than a focal keyline's masked item size.
  4. A keyline's masked item size can only remain the same size or decrease in size as it moves away from the focal range. A keyline's masked item size after the focal range cannot be larger than a focal keyline's masked item size.
Typically there should be a keyline for every visible item in the scrolling container.

Constructors

Link copied to clipboard
constructor(itemSize: Float, carouselSize: Int)
Creates a new KeylineState.Builder.

Functions

Link copied to clipboard
@CanIgnoreReturnValue
open fun addAnchorKeyline(offsetLoc: Float, @FloatRange(from = 0.0, to = 1.0) mask: Float, maskedItemSize: Float): KeylineState.Builder
Adds an anchor keyline along the scrolling axis where an object should be masked by the given mask and positioned at offsetLoc.
Link copied to clipboard
@CanIgnoreReturnValue
open fun addKeyline(offsetLoc: Float, @FloatRange(from = 0.0, to = 1.0) mask: Float, maskedItemSize: Float): KeylineState.Builder
@CanIgnoreReturnValue
open fun addKeyline(offsetLoc: Float, @FloatRange(from = 0.0, to = 1.0) mask: Float, maskedItemSize: Float, isFocal: Boolean): KeylineState.Builder
Adds a non-anchor keyline along the scrolling axis where an object should be masked by the given mask and positioned at offsetLoc.
@CanIgnoreReturnValue
open fun addKeyline(offsetLoc: Float, @FloatRange(from = 0.0, to = 1.0) mask: Float, maskedItemSize: Float, isFocal: Boolean, isAnchor: Boolean): KeylineState.Builder
@CanIgnoreReturnValue
open fun addKeyline(offsetLoc: Float, @FloatRange(from = 0.0, to = 1.0) mask: Float, maskedItemSize: Float, isFocal: Boolean, isAnchor: Boolean, cutoff: Float): KeylineState.Builder
@CanIgnoreReturnValue
open fun addKeyline(offsetLoc: Float, @FloatRange(from = 0.0, to = 1.0) mask: Float, maskedItemSize: Float, isFocal: Boolean, isAnchor: Boolean, cutoff: Float, leftOrTopPaddingShift: Float, rightOrBottomPaddingShift: Float): KeylineState.Builder
Adds a keyline along the scrolling axis where an object should be masked by the given mask and positioned at offsetLoc.
Link copied to clipboard
@CanIgnoreReturnValue
open fun addKeylineRange(offsetLoc: Float, @FloatRange(from = 0.0, to = 1.0) mask: Float, maskedItemSize: Float, count: Int): KeylineState.Builder
Adds a range of keylines along the scrolling axis where an item should be masked by mask when its center is between offsetLoc and offsetLoc + (maskedItemSize * count).
@CanIgnoreReturnValue
open fun addKeylineRange(offsetLoc: Float, @FloatRange(from = 0.0, to = 1.0) mask: Float, maskedItemSize: Float, count: Int, isFocal: Boolean): KeylineState.Builder
Adds a range along the scrolling axis where an object should be masked by mask when its center is between offsetLoc and offsetLoc + (maskedItemSize * count).
Link copied to clipboard
Builds and returns a KeylineState.