Stay organized with collections
Save and categorize content based on your preferences.
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 |
From class
java.lang.Object
Object
|
clone()
|
boolean
|
equals(Object arg0)
|
void
|
finalize()
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
|
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.
|
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# MotionUtils\n\nSummary: [Methods](#pubmethods) \\| [Inherited Methods](#inhmethods) \n\nMotionUtils\n===========\n\n\n`\npublic\n\n\nclass\nMotionUtils\n`\n\n\n`\n\nextends Object\n\n\n`\n\n`\n\n\n`\n\n|---|------------------------------------------------|\n| java.lang.Object ||\n| ↳ | com.google.android.material.motion.MotionUtils |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nA utility class for motion system functions.\n\nSummary\n-------\n\n| ### Public methods ||\n|----------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` static int` | ` `[resolveThemeDuration](/reference/com/google/android/material/motion/MotionUtils#resolveThemeDuration(android.content.Context,%20int,%20int))`(Context context, int attrResId, int defaultDuration) ` Resolve a duration from a material duration theme attribute. |\n| ` static TimeInterpolator` | ` `[resolveThemeInterpolator](/reference/com/google/android/material/motion/MotionUtils#resolveThemeInterpolator(android.content.Context,%20int,%20android.animation.TimeInterpolator))`(Context context, int attrResId, TimeInterpolator defaultInterpolator) ` Load an interpolator from a material easing theme attribute. |\n\n| ### Inherited methods |\n|-----------------------|---|\n| From class ` java.lang.Object ` |-------------------|-------------------------------| | ` Object` | ` clone() ` | | ` boolean` | ` equals(Object arg0) ` | | ` void` | ` finalize() ` | | ` final Class\u003c?\u003e` | ` getClass() ` | | ` int` | ` hashCode() ` | | ` final void` | ` notify() ` | | ` final void` | ` notifyAll() ` | | ` String` | ` toString() ` | | ` final void` | ` wait(long arg0, int arg1) ` | | ` final void` | ` wait(long arg0) ` | | ` final void` | ` wait() ` | ||\n\nPublic methods\n--------------\n\n### resolveThemeDuration\n\n```\npublic static int resolveThemeDuration (Context context, \n int attrResId, \n int defaultDuration)\n```\n\nResolve a duration from a material duration theme attribute.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-------------------|--------------------------------------------------------------------------------|\n| `context` | `Context`: the context from where the theme attribute will be resolved. \u003cbr /\u003e |\n| `attrResId` | `int`: the `motionDuration*` theme attribute to resolve \u003cbr /\u003e |\n| `defaultDuration` | `int`: the duration to be returned if unable to resolve `attrResId` \u003cbr /\u003e |\n\n| Returns ||\n|-------|-------------------------------------------------------------------------------------------------------------------------|\n| `int` | the resolved `int` duration which `attrResId` points to or the `defaultDuration` if resolution was unsuccessful. \u003cbr /\u003e |\n\n### resolveThemeInterpolator\n\n```\npublic static TimeInterpolator resolveThemeInterpolator (Context context, \n int attrResId, \n TimeInterpolator defaultInterpolator)\n```\n\nLoad an interpolator from a material easing theme attribute.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-----------------------|----------------------------------------------------------------------------------------------|\n| `context` | `Context`: context from where the theme attribute will be resolved \u003cbr /\u003e |\n| `attrResId` | `int`: the `motionEasing*` theme attribute to resolve \u003cbr /\u003e |\n| `defaultInterpolator` | `TimeInterpolator`: the interpolator to be returned if unable to resolve `attrResId`. \u003cbr /\u003e |\n\n| Returns ||\n|--------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `TimeInterpolator` | the resolved [TimeInterpolator](/reference/android/animation/TimeInterpolator) which `attrResId` points to or the `defaultInterpolator` if resolution was unsuccessful. \u003cbr /\u003e |"]]