Skip to content

Commit

Permalink
[Dialog][DatePicker][TimePicker] Updated enter/exit animation to use …
Browse files Browse the repository at this point in the history
…fade pattern and motion tokens.

Added xml implementations of the Material Fade pattern (https://github.com/material-components/material-components-android/blob/master/docs/theming/Motion.md#fade) and updated all dialogs to use the new animators for enter and exit animations.

PiperOrigin-RevId: 489271559
  • Loading branch information
hunterstich authored and drchen committed Nov 18, 2022
1 parent 4046525 commit 8d8a0d1
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,4 +167,9 @@
<item name="android:gravity">center</item>
<item name="android:textAlignment" tools:ignore="NewApi">gravity</item>
</style>

<style name="MaterialAlertDialog.Material3.Animation">
<item name="android:windowEnterAnimation">@anim/m3_motion_fade_enter</item>
<item name="android:windowExitAnimation">@anim/m3_motion_fade_exit</item>
</style>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@

<style name="Base.ThemeOverlay.Material3.Dialog" parent="Base.ThemeOverlay.MaterialComponents.Dialog">
<item name="materialButtonStyle">@style/Widget.Material3.Button.TextButton.Dialog.Flush</item>
<item name="android:windowAnimationStyle">@style/MaterialAlertDialog.Material3.Animation</item>
</style>

<style name="ThemeOverlay.Material3.Dialog" parent="Base.ThemeOverlay.Material3.Dialog"/>
Expand Down Expand Up @@ -102,6 +103,7 @@
<item name="materialAlertDialogTitleIconStyle">@style/MaterialAlertDialog.Material3.Title.Icon</item>
<item name="materialAlertDialogTitleTextStyle">@style/MaterialAlertDialog.Material3.Title.Text</item>
<item name="materialAlertDialogBodyTextStyle">@style/MaterialAlertDialog.Material3.Body.Text</item>
<item name="android:windowAnimationStyle">@style/MaterialAlertDialog.Material3.Animation</item>
</style>

<!-- A theme overlay for Material3 Alert Dialog panels with a center aligned title text and icon. -->
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?><!-- Copyright (C) 2022 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<!-- An XML implementation of the Material fade pattern -->
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="@integer/m3_sys_motion_duration_medium4"
android:interpolator="@interpolator/m3_sys_motion_easing_emphasized_decelerate"
android:shareInterpolator="true">
<alpha
android:fromAlpha="0.0"
android:toAlpha="1.0" />
<scale
android:fromXScale="0.8"
android:fromYScale="0.8"
android:pivotX="50%"
android:pivotY="50%"
android:toXScale="1"
android:toYScale="1" />
</set>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?><!-- Copyright (C) 2022 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<!-- An XML implementation of the Material fade pattern -->
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="@integer/m3_sys_motion_duration_short3"
android:interpolator="@interpolator/m3_sys_motion_easing_emphasized_accelerate"
android:shareInterpolator="true">
<alpha
android:fromAlpha="1.0"
android:toAlpha="0.0" />
</set>

0 comments on commit 8d8a0d1

Please sign in to comment.