material-components / material-components/material-components-android

[BottomAppBar] Replacing menu while changing fab alignment mode causes flickering

Open
#922 6 comments 7 reactions 1 assignee View on GitHub

@hunterstich is already working on this.

Since Nov 5, 2021.

bug Widget: BottomAppBar
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.