Skip to content

Commit

Permalink
[BottomSheet] Update motion attributes for bottom sheet dialog animation
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 487605720
  • Loading branch information
imhappi authored and drchen committed Nov 18, 2022
1 parent 0b72e3a commit 1cdb371
Show file tree
Hide file tree
Showing 6 changed files with 124 additions and 3 deletions.
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2018 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.
-->
<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">

<translate
android:fromYDelta="20%p"
android:toYDelta="0"/>

<alpha
android:fromAlpha="0.0"
android:toAlpha="1.0"/>

</set>
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2018 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.
-->
<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">

<translate
android:fromYDelta="0"
android:toYDelta="20%p"/>

<alpha
android:fromAlpha="1.0"
android:toAlpha="0.0"/>

</set>
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2018 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.
-->
<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">

<translate
android:fromYDelta="20%p"
android:toYDelta="0"/>

<alpha
android:fromAlpha="0.0"
android:toAlpha="1.0"/>

</set>
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2018 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.
-->
<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">

<translate
android:fromYDelta="0"
android:toYDelta="20%p"/>

<alpha
android:fromAlpha="1.0"
android:toAlpha="0.0"/>

</set>
Expand Up @@ -83,6 +83,11 @@
<item name="android:elevation" tools:ignore="NewApi">@dimen/m3_bottom_sheet_modal_elevation</item>
</style>

<style name="Animation.Material3.BottomSheetDialog" parent="Animation.AppCompat.Dialog">
<item name="android:windowEnterAnimation">@anim/m3_bottom_sheet_slide_in</item>
<item name="android:windowExitAnimation">@anim/m3_bottom_sheet_slide_out</item>
</style>

<!-- The default M3 style of BottomSheetDragHandleView -->
<style name="Widget.Material3.BottomSheet.DragHandle" parent="">
<item name="android:scaleType">center</item>
Expand Down
Expand Up @@ -18,21 +18,21 @@
<style name="Base.V14.Theme.Material3.Light.BottomSheetDialog" parent="Theme.Material3.Light.Dialog">
<item name="android:windowIsFloating">false</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowAnimationStyle">@style/Animation.MaterialComponents.BottomSheetDialog</item>
<item name="android:windowAnimationStyle">@style/Animation.Material3.BottomSheetDialog</item>
<item name="bottomSheetStyle">@style/Widget.Material3.BottomSheet.Modal</item>
</style>

<style name="Base.V14.Theme.Material3.Dark.BottomSheetDialog" parent="Theme.Material3.Dark.Dialog">
<item name="android:windowIsFloating">false</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowAnimationStyle">@style/Animation.MaterialComponents.BottomSheetDialog</item>
<item name="android:windowAnimationStyle">@style/Animation.Material3.BottomSheetDialog</item>
<item name="bottomSheetStyle">@style/Widget.Material3.BottomSheet.Modal</item>
</style>

<style name="Base.V14.ThemeOverlay.Material3.BottomSheetDialog" parent="Base.ThemeOverlay.Material3.Dialog">
<item name="android:windowIsFloating">false</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowAnimationStyle">@style/Animation.MaterialComponents.BottomSheetDialog</item>
<item name="android:windowAnimationStyle">@style/Animation.Material3.BottomSheetDialog</item>
<item name="bottomSheetStyle">@style/Widget.Material3.BottomSheet.Modal</item>
<item name="enableEdgeToEdge">true</item>
</style>
Expand Down

0 comments on commit 1cdb371

Please sign in to comment.