RecyclerView.SmoothScroller.Action


class RecyclerView.SmoothScroller.Action


Holds information about a smooth scroll request by a SmoothScroller.

Summary

Constants

const Int
UNDEFINED_DURATION = -2147483648

Public constructors

Action(dx: @Px Int, dy: @Px Int)
Action(dx: @Px Int, dy: @Px Int, duration: Int)
Action(dx: @Px Int, dy: @Px Int, duration: Int, interpolator: Interpolator?)

Public functions

Int
@Px Int
@Px Int
Interpolator?
Unit
jumpTo(targetPosition: Int)

Instead of specifying pixels to scroll, use the target position to jump using scrollToPosition.

Unit
setDuration(duration: Int)
Unit
setDx(dx: @Px Int)
Unit
setDy(dy: @Px Int)
Unit
setInterpolator(interpolator: Interpolator?)

Sets the interpolator to calculate scroll steps

Unit
update(dx: @Px Int, dy: @Px Int, duration: Int, interpolator: Interpolator?)

Updates the action with given parameters.

Constants

UNDEFINED_DURATION

Added in 1.0.0
const val UNDEFINED_DURATION = -2147483648: Int

Public constructors

Action

Added in 1.0.0
Action(dx: @Px Int, dy: @Px Int)
Parameters
dx: @Px Int

Pixels to scroll horizontally

dy: @Px Int

Pixels to scroll vertically

Action

Added in 1.0.0
Action(dx: @Px Int, dy: @Px Int, duration: Int)
Parameters
dx: @Px Int

Pixels to scroll horizontally

dy: @Px Int

Pixels to scroll vertically

duration: Int

Duration of the animation in milliseconds

Action

Added in 1.0.0
Action(dx: @Px Int, dy: @Px Int, duration: Int, interpolator: Interpolator?)
Parameters
dx: @Px Int

Pixels to scroll horizontally

dy: @Px Int

Pixels to scroll vertically

duration: Int

Duration of the animation in milliseconds

interpolator: Interpolator?

Interpolator to be used when calculating scroll position in each animation step

Public functions

getDuration

Added in 1.0.0
fun getDuration(): Int

getDx

Added in 1.0.0
fun getDx(): @Px Int

getDy

Added in 1.0.0
fun getDy(): @Px Int

getInterpolator

Added in 1.0.0
fun getInterpolator(): Interpolator?

jumpTo

Added in 1.0.0
fun jumpTo(targetPosition: Int): Unit

Instead of specifying pixels to scroll, use the target position to jump using scrollToPosition.

You may prefer using this method if scroll target is really far away and you prefer to jump to a location and smooth scroll afterwards.

Note that calling this method takes priority over other update methods such as update, setX, setY and #setInterpolator. If you call jumpTo, the other changes will not be considered for this animation frame.

Parameters
targetPosition: Int

The target item position to scroll to using instant scrolling.

setDuration

Added in 1.0.0
fun setDuration(duration: Int): Unit

setDx

Added in 1.0.0
fun setDx(dx: @Px Int): Unit

setDy

Added in 1.0.0
fun setDy(dy: @Px Int): Unit

setInterpolator

Added in 1.0.0
fun setInterpolator(interpolator: Interpolator?): Unit

Sets the interpolator to calculate scroll steps

Parameters
interpolator: Interpolator?

The interpolator to use. If you specify an interpolator, you must also set the duration.

See also
setDuration

update

Added in 1.0.0
fun update(dx: @Px Int, dy: @Px Int, duration: Int, interpolator: Interpolator?): Unit

Updates the action with given parameters.

Parameters
dx: @Px Int

Pixels to scroll horizontally

dy: @Px Int

Pixels to scroll vertically

duration: Int

Duration of the animation in milliseconds

interpolator: Interpolator?

Interpolator to be used when calculating scroll position in each animation step