MotionUtils

public class MotionUtils
extends Object

java.lang.Object
   ↳ com.google.android.material.motion.MotionUtils


A utility class for motion system functions.

Summary

Public methods

static int resolveThemeDuration(Context context, int attrResId, int defaultDuration)

Resolve a duration from a material duration theme attribute.

static TimeInterpolator resolveThemeInterpolator(Context context, int attrResId, TimeInterpolator defaultInterpolator)

Load an interpolator from a material easing theme attribute.

Inherited methods

Public methods

resolveThemeDuration

public static int resolveThemeDuration (Context context, 
                int attrResId, 
                int defaultDuration)

Resolve a duration from a material duration theme attribute.

Parameters
context Context: the context from where the theme attribute will be resolved.

attrResId int: the motionDuration* theme attribute to resolve

defaultDuration int: the duration to be returned if unable to resolve attrResId

Returns
int the resolved int duration which attrResId points to or the defaultDuration if resolution was unsuccessful.

resolveThemeInterpolator

public static TimeInterpolator resolveThemeInterpolator (Context context, 
                int attrResId, 
                TimeInterpolator defaultInterpolator)

Load an interpolator from a material easing theme attribute.

Parameters
context Context: context from where the theme attribute will be resolved

attrResId int: the motionEasing* theme attribute to resolve

defaultInterpolator TimeInterpolator: the interpolator to be returned if unable to resolve attrResId.

Returns
TimeInterpolator the resolved TimeInterpolator which attrResId points to or the defaultInterpolator if resolution was unsuccessful.