Android: Add custom window animation to alert dialogs

This commit is contained in:
Charles Lombardo 2022-09-10 17:01:24 -04:00
parent 84507ec420
commit 9fcc3e2e92
6 changed files with 51 additions and 5 deletions

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<alpha
android:duration="@android:integer/config_shortAnimTime"
android:interpolator="@android:anim/decelerate_interpolator"
android:fromAlpha="0"
android:toAlpha="1" />
<scale
android:duration="@android:integer/config_shortAnimTime"
android:interpolator="@android:anim/decelerate_interpolator"
android:fromXScale="0.95"
android:fromYScale="0.95"
android:pivotX="50%"
android:pivotY="50%"
android:toXScale="1.0"
android:toYScale="1.0" />
</set>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<alpha
android:duration="@android:integer/config_shortAnimTime"
android:interpolator="@android:anim/decelerate_interpolator"
android:fromAlpha="1"
android:toAlpha="0" />
<scale
android:duration="@android:integer/config_shortAnimTime"
android:interpolator="@android:anim/decelerate_interpolator"
android:fromXScale="1.0"
android:fromYScale="1.0"
android:pivotX="50%"
android:pivotY="50%"
android:toXScale="0.95"
android:toYScale="0.95" />
</set>

View File

@ -27,7 +27,7 @@
<item name="android:colorControlHighlight">@color/m3_sys_color_dynamic_dark_on_surface_variant</item>
<item name="android:colorEdgeEffect">@color/m3_sys_color_dynamic_dark_secondary</item>
<item name="materialAlertDialogTheme">@style/ThemeOverlay.Material3.MaterialAlertDialog</item>
<item name="materialAlertDialogTheme">@style/MaterialDialog</item>
<item name="popupTheme">@style/ThemeOverlay.Material3</item>
</style>
</resources>

View File

@ -27,7 +27,7 @@
<item name="android:colorControlHighlight">@color/m3_sys_color_dynamic_light_on_surface_variant</item>
<item name="android:colorEdgeEffect">@color/m3_sys_color_dynamic_light_secondary</item>
<item name="materialAlertDialogTheme">@style/ThemeOverlay.Material3.MaterialAlertDialog</item>
<item name="materialAlertDialogTheme">@style/MaterialDialog</item>
<item name="popupTheme">@style/ThemeOverlay.Material3</item>
</style>
</resources>

View File

@ -32,6 +32,16 @@
<item name="buttonBarPositiveButtonStyle">@style/DolphinButton</item>
<item name="buttonBarNegativeButtonStyle">@style/DolphinButton</item>
<item name="buttonBarNeutralButtonStyle">@style/DolphinButton</item>
<item name="android:windowAnimationStyle">@style/DialogAnimation</item>
</style>
<style name="MaterialDialog" parent="ThemeOverlay.Material3.MaterialAlertDialog">
<item name="android:windowAnimationStyle">@style/DialogAnimation</item>
</style>
<style name="DialogAnimation">
<item name="android:windowEnterAnimation">@anim/fade_in</item>
<item name="android:windowExitAnimation">@anim/fade_out</item>
</style>
<style name="DolphinTVDialog" parent="Theme.Material3.DayNight.Dialog.Alert">

View File

@ -63,7 +63,7 @@
<item name="colorPrimaryContainer">@color/dolphin_primaryContainer</item>
<item name="colorOnPrimaryContainer">@color/dolphin_onPrimaryContainer</item>
<item name="materialAlertDialogTheme">@style/ThemeOverlay.Material3.MaterialAlertDialog</item>
<item name="materialAlertDialogTheme">@style/MaterialDialog</item>
<item name="popupTheme">@style/ThemeOverlay.Material3</item>
</style>
@ -97,7 +97,7 @@
<item name="android:colorControlHighlight">@color/green_onSurfaceVariant</item>
<item name="android:colorEdgeEffect">@color/green_secondary</item>
<item name="materialAlertDialogTheme">@style/ThemeOverlay.Material3.MaterialAlertDialog</item>
<item name="materialAlertDialogTheme">@style/MaterialDialog</item>
<item name="popupTheme">@style/ThemeOverlay.Material3</item>
</style>
@ -131,7 +131,7 @@
<item name="android:colorControlHighlight">@color/pink_onSurfaceVariant</item>
<item name="android:colorEdgeEffect">@color/pink_secondary</item>
<item name="materialAlertDialogTheme">@style/ThemeOverlay.Material3.MaterialAlertDialog</item>
<item name="materialAlertDialogTheme">@style/MaterialDialog</item>
<item name="popupTheme">@style/ThemeOverlay.Material3</item>
</style>