material-components / material-components/material-components-android
[BottomAppBar] Replacing menu while changing fab alignment mode causes flickering
@hunterstich is already working on this.
Since Nov 5, 2021.
- Dominant language
- Java
- Stars
- 17.4k
- Forks
- 3.2k
- PR merge metrics
- No merged PRs in 30d
Description
Description: If you change the fab alignment mode and replace the menu in the BottomAppBar the items get replaced 2 times. It looks like the icons are flickering.
Expected behavior: There should be a smooth transition of the items if they change the side in the BottomAppBar. Also the animation should not be affected, if in this time the menu items change.
Source code:
controller.addOnDestinationChangedListener(new NavController.OnDestinationChangedListener(){
@Override
public void onDestinationChanged(@NonNull NavController controller, @NonNull NavDestination destination, @Nullable Bundle arguments){
if (destination.getId() == R.id.homeFragment){
bottomAppBar.setNavigationIcon(R.drawable.ic_menu);
bottomAppBar.setFabAlignmentMode(BottomAppBar.FAB_ALIGNMENT_MODE_CENTER);
bottomAppBar.replaceMenu(R.menu.home_fragment_menu);
}else{
bottomAppBar.setNavigationIcon(null);
bottomAppBar.setFabAlignmentMode(BottomAppBar.FAB_ALIGNMENT_MODE_END);
bottomAppBar.replaceMenu(R.menu.details_fragment_menu);
}
}
});
Android API version: 29
Material Library version: Material Android Library version you are using here (e.g., 1.2.0-alpha03)
Device: Pixel 3 Emulator
To help us triage faster, please check to make sure you are using the latest version of the library.
We also happily accept pull requests.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.