InterpolateOnScrollPositionChangeHelper

public class InterpolateOnScrollPositionChangeHelper
extends Object

java.lang.Object
   ↳ com.google.android.material.shape.InterpolateOnScrollPositionChangeHelper


Helper class to handle shape interpolation when shaped views enter or exit the window.

Summary

Public constructors

InterpolateOnScrollPositionChangeHelper(View shapedView, MaterialShapeDrawable materialShapeDrawable, ScrollView containingScrollView)

Instantiate a scroll position helper.

Public methods

void setContainingScrollView(ScrollView containingScrollView)

Set the ScrollView which contains the View being interpolated.

void setMaterialShapeDrawable(MaterialShapeDrawable materialShapeDrawable)

Set the MaterialShapeDrawable which will be interpolated.

void startListeningForScrollChanges(ViewTreeObserver viewTreeObserver)

Start listening for scroll changes and interpolating based on position.

void stopListeningForScrollChanges(ViewTreeObserver viewTreeObserver)

Stop listening for scroll changes and interpolating based on position.

void updateInterpolationForScreenPosition()

Updates the MaterialShapeDrawable's interpolation based on the View's position in the containing ScrollView.

Inherited methods

From class java.lang.Object

Public constructors

InterpolateOnScrollPositionChangeHelper

InterpolateOnScrollPositionChangeHelper (View shapedView, 
                MaterialShapeDrawable materialShapeDrawable, 
                ScrollView containingScrollView)

Instantiate a scroll position helper.

Parameters
shapedView View: the View whose background is a MaterialShapeDrawable and which is scrolled in and out of view.

materialShapeDrawable MaterialShapeDrawable: the MaterialShapeDrawable which will be interpolated.

containingScrollView ScrollView: the ScrollView that contains shapedView.

Public methods

setContainingScrollView

void setContainingScrollView (ScrollView containingScrollView)

Set the ScrollView which contains the View being interpolated.

setMaterialShapeDrawable

void setMaterialShapeDrawable (MaterialShapeDrawable materialShapeDrawable)

Set the MaterialShapeDrawable which will be interpolated.

Parameters
materialShapeDrawable MaterialShapeDrawable: the desired drawable.

startListeningForScrollChanges

void startListeningForScrollChanges (ViewTreeObserver viewTreeObserver)

Start listening for scroll changes and interpolating based on position.

Parameters
viewTreeObserver ViewTreeObserver: {@link ViewTreeObserver belonging to the {@link View} being interpolated.

stopListeningForScrollChanges

void stopListeningForScrollChanges (ViewTreeObserver viewTreeObserver)

Stop listening for scroll changes and interpolating based on position.

Parameters
viewTreeObserver ViewTreeObserver: {@link ViewTreeObserver belonging to the {@link View} being interpolated.

updateInterpolationForScreenPosition

void updateInterpolationForScreenPosition ()

Updates the MaterialShapeDrawable's interpolation based on the View's position in the containing ScrollView.