-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BottomAppBar] Update menu replacement animation to coordinate with f…
…ab alignment animation. When calling both setFabAlignmentMode and replaceMenu, the fab alignment animation and menu animation were not properly coordinating. replaceMenu causes a call to onLayout, which immediately updates the menu's translationX, causeing the menu to jump to its final position. This adds a condition to skip the menu position update if a menu animatior is running. Additionally, the menu's contents were immediately being swapped making the animation look jumpy. This CL also as a method to update the fab alignment and menu resource at the same time so a coordinated animation of: fab scale out/slide start - > menu fade out -> menu replaced -> menu fade in -> fab scale/slide finish, can be run. PiperOrigin-RevId: 316860005
- Loading branch information
1 parent
ba9c2e6
commit d4a5702
Showing
6 changed files
with
122 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
catalog/java/io/material/catalog/bottomappbar/res/menu/demo_primary_alternate.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
Copyright 2020 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. | ||
--> | ||
|
||
<menu xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto"> | ||
<item | ||
android:icon="@drawable/ic_accelerator_24px" | ||
android:title="@string/cat_bottomappbar_accelerator" | ||
app:showAsAction="ifRoom"/> | ||
<item | ||
android:icon="@drawable/ic_3d_rotation_24px" | ||
android:title="@string/cat_bottomappbar_3d" | ||
app:showAsAction="ifRoom"/> | ||
<item | ||
android:icon="@drawable/ic_dashboard_24px" | ||
android:title="@string/cat_bottomappbar_dashboard" | ||
app:showAsAction="ifRoom"/> | ||
</menu> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters