Skip to content

Commit

Permalink
[Switch] Update animations to use motion themeing.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 487228839
  • Loading branch information
hunterstich authored and raajkumars committed Nov 10, 2022
1 parent 1653055 commit 3fc3ec1
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
<target android:name="@string/mtrl_switch_thumb_path_name">
<aapt:attr name="android:animation">
<objectAnimator
android:duration="@integer/mtrl_switch_thumb_pressed_duration"
android:interpolator="@android:interpolator/accelerate_decelerate"
android:duration="?attr/motionDurationShort3"
android:interpolator="?attr/motionEasingStandardInterpolator"
android:propertyName="pathData"
android:valueFrom="@string/mtrl_switch_thumb_path_checked"
android:valueTo="@string/mtrl_switch_thumb_path_pressed"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,29 @@
android:drawable="@drawable/mtrl_switch_thumb_checked"
tools:ignore="NewApi">

<target android:name="@string/mtrl_switch_thumb_path_name">
<aapt:attr name="android:animation">
<objectAnimator
android:duration="@integer/mtrl_switch_thumb_pre_morphing_duration"
android:interpolator="@android:interpolator/accelerate_decelerate"
android:propertyName="pathData"
android:valueFrom="@string/mtrl_switch_thumb_path_checked"
android:valueTo="@string/mtrl_switch_thumb_path_morphing"
android:valueType="pathType" />
</aapt:attr>
</target>
<target android:name="@string/mtrl_switch_thumb_path_name">
<aapt:attr name="android:animation">
<objectAnimator
android:startOffset="@integer/mtrl_switch_thumb_pre_morphing_duration"
android:duration="@integer/mtrl_switch_thumb_post_morphing_duration"
android:interpolator="@android:interpolator/accelerate_decelerate"
android:propertyName="pathData"
android:valueFrom="@string/mtrl_switch_thumb_path_morphing"
android:valueTo="@string/mtrl_switch_thumb_path_unchecked"
android:valueType="pathType" />
</aapt:attr>
</target>
<set
android:interpolator="?attr/motionEasingEmphasizedInterpolator"
android:shareInterpolator="true">
<target android:name="@string/mtrl_switch_thumb_path_name">
<aapt:attr name="android:animation">
<objectAnimator
android:duration="?attr/motionDurationShort3"
android:propertyName="pathData"
android:valueFrom="@string/mtrl_switch_thumb_path_checked"
android:valueTo="@string/mtrl_switch_thumb_path_morphing"
android:valueType="pathType" />
</aapt:attr>
</target>
<target android:name="@string/mtrl_switch_thumb_path_name">
<aapt:attr name="android:animation">
<objectAnimator
android:duration="?attr/motionDurationMedium1"
android:propertyName="pathData"
android:startOffset="?attr/motionDurationShort3"
android:valueFrom="@string/mtrl_switch_thumb_path_morphing"
android:valueTo="@string/mtrl_switch_thumb_path_unchecked"
android:valueType="pathType" />
</aapt:attr>
</target>
</set>
</animated-vector>
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
<target android:name="@string/mtrl_switch_thumb_path_name">
<aapt:attr name="android:animation">
<objectAnimator
android:duration="@integer/mtrl_switch_thumb_pressed_duration"
android:interpolator="@android:interpolator/accelerate_decelerate"
android:duration="?attr/motionDurationShort3"
android:interpolator="?attr/motionEasingStandardInterpolator"
android:propertyName="pathData"
android:valueFrom="@string/mtrl_switch_thumb_path_pressed"
android:valueTo="@string/mtrl_switch_thumb_path_checked"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
<target android:name="@string/mtrl_switch_thumb_path_name">
<aapt:attr name="android:animation">
<objectAnimator
android:duration="@integer/mtrl_switch_thumb_pressed_duration"
android:interpolator="@android:interpolator/accelerate_decelerate"
android:duration="?attr/motionDurationShort3"
android:interpolator="?attr/motionEasingEmphasizedInterpolator"
android:propertyName="pathData"
android:valueFrom="@string/mtrl_switch_thumb_path_pressed"
android:valueTo="@string/mtrl_switch_thumb_path_unchecked"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,29 @@
android:drawable="@drawable/mtrl_switch_thumb_unchecked"
tools:ignore="NewApi">

<target android:name="@string/mtrl_switch_thumb_path_name">
<aapt:attr name="android:animation">
<objectAnimator
android:duration="@integer/mtrl_switch_thumb_post_morphing_duration"
android:interpolator="@android:interpolator/accelerate_decelerate"
android:propertyName="pathData"
android:valueFrom="@string/mtrl_switch_thumb_path_unchecked"
android:valueTo="@string/mtrl_switch_thumb_path_morphing"
android:valueType="pathType" />
</aapt:attr>
</target>
<target android:name="@string/mtrl_switch_thumb_path_name">
<aapt:attr name="android:animation">
<objectAnimator
android:startOffset="@integer/mtrl_switch_thumb_post_morphing_duration"
android:duration="@integer/mtrl_switch_thumb_pre_morphing_duration"
android:interpolator="@android:interpolator/accelerate_decelerate"
android:propertyName="pathData"
android:valueFrom="@string/mtrl_switch_thumb_path_morphing"
android:valueTo="@string/mtrl_switch_thumb_path_checked"
android:valueType="pathType" />
</aapt:attr>
</target>
<set
android:interpolator="?attr/motionEasingEmphasizedInterpolator"
android:shareInterpolator="true">
<target android:name="@string/mtrl_switch_thumb_path_name">
<aapt:attr name="android:animation">
<objectAnimator
android:duration="?attr/motionDurationMedium1"
android:propertyName="pathData"
android:valueFrom="@string/mtrl_switch_thumb_path_unchecked"
android:valueTo="@string/mtrl_switch_thumb_path_morphing"
android:valueType="pathType" />
</aapt:attr>
</target>
<target android:name="@string/mtrl_switch_thumb_path_name">
<aapt:attr name="android:animation">
<objectAnimator
android:duration="?attr/motionDurationShort3"
android:propertyName="pathData"
android:startOffset="?attr/motionDurationMedium1"
android:valueFrom="@string/mtrl_switch_thumb_path_morphing"
android:valueTo="@string/mtrl_switch_thumb_path_checked"
android:valueType="pathType" />
</aapt:attr>
</target>
</set>
</animated-vector>
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
<target android:name="@string/mtrl_switch_thumb_path_name">
<aapt:attr name="android:animation">
<objectAnimator
android:duration="@integer/mtrl_switch_thumb_pressed_duration"
android:interpolator="@android:interpolator/accelerate_decelerate"
android:duration="?attr/motionDurationShort3"
android:interpolator="?attr/motionEasingStandardInterpolator"
android:propertyName="pathData"
android:valueFrom="@string/mtrl_switch_thumb_path_unchecked"
android:valueTo="@string/mtrl_switch_thumb_path_pressed"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@
-->

<resources>
<integer name="mtrl_switch_thumb_motion_duration">250</integer>
<integer name="mtrl_switch_thumb_pre_morphing_duration">100</integer>
<integer name="mtrl_switch_thumb_post_morphing_duration">150</integer>
<integer name="mtrl_switch_thumb_pressed_duration">100</integer>

<integer name="mtrl_switch_thumb_viewport_size">32</integer>
<integer name="mtrl_switch_thumb_viewport_center_coordinate">16</integer>

Expand Down

0 comments on commit 3fc3ec1

Please sign in to comment.