Skip to content

Commit

Permalink
[Switch] Fix morphing time of switch thumbs
Browse files Browse the repository at this point in the history
The switch thumb position animation time is hard-coded by SwitchCompat and we have no way to override it. Therefore, the morphing time has to follow the position animation time, instead of the design spec.

Resolves #3340

PiperOrigin-RevId: 523415316
  • Loading branch information
drchen committed Apr 12, 2023
1 parent e708d98 commit 23a2b17
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,15 @@
-->

<resources>
<integer name="mtrl_switch_thumb_motion_duration">@integer/m3_sys_motion_duration_medium4</integer>
<integer name="mtrl_switch_thumb_pre_morphing_duration">@integer/m3_sys_motion_duration_short3</integer>
<integer name="mtrl_switch_thumb_post_morphing_duration">@integer/m3_sys_motion_duration_medium1</integer>
<integer name="mtrl_switch_thumb_pressed_duration">@integer/m3_sys_motion_duration_short3</integer>
<!-- Note: The following duration values are different from the design spec,
since the thumb position animation duration is hard-coded in
SwitchCompat and we have no way to override it. Therefore the
following values are set according to the position animation
duration (250ms). -->
<integer name="mtrl_switch_thumb_motion_duration">@integer/m3_sys_motion_duration_medium1</integer>
<integer name="mtrl_switch_thumb_pre_morphing_duration">@integer/m3_sys_motion_duration_short2</integer>
<integer name="mtrl_switch_thumb_post_morphing_duration">@integer/m3_sys_motion_duration_short3</integer>
<integer name="mtrl_switch_thumb_pressed_duration">@integer/m3_sys_motion_duration_short2</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 23a2b17

Please sign in to comment.