This CL fixes a couple of badge state related issues. First, it prevents the badges created before restoring instance states from being overwritten by the old instance states. Second, it makes badges reload their default style settings everytime when its being recreated so if the environment has been changed, the default values will reflect the environment change.
This CL also fixes that several attributes were not correctly saved/restored or their default values were not correctly loaded.
Resolves https://github.com/material-components/material-components-android/issues/2032
PiperOrigin-RevId: 420096508
Added switch to toggle show/hide edit menu item and added button to increment badge number.
Moved logic to add badgedrawable to onCreateOptionsMenu so that a new badgedrawable is NOT added every time onPrepareOptionsMenu is called (e.g. opening the overflow menu)
Resolves https://github.com/material-components/material-components-android/issues/2129
PiperOrigin-RevId: 365033209
In <API18, BadgeDrawable will dynamically 1) wrap the anchor in a FrameLayout and 2) replace the anchor with the FrameLayout in the anchor' view hierarchy. BadgeDrawable will set itself as foreground on the FrameLayout.
If the user does not want BadgeDrawable to manipulate its view hierarchy, the user can pass in an instance of FrameLayout `customBadgeParent` in #attachBadgeDrawable instead.
Labeled BadgeUtils as experimental and removed the RestrictedTo(Scope.Library) annotation.
Updated TopAppBar main demo to show a badge on a toolbar menu item.
PiperOrigin-RevId: 336306885
TODO:
- update javadocs to provide guidance on how to interact with BottomNavigation + Badging.
- Save badge states.
- Support displaying badges when bottom navigation item doesn't show an icon.
PiperOrigin-RevId: 244197244
TODO:
- update javadocs to provide guidance on how to call Badging API.
- Save badge states.
- Support displaying badges when bottom navigation item doesn't show an icon.
PiperOrigin-RevId: 242675939
For API 18+, the BadgeDrawable will be added as a view overlay.
For pre-API 18, the BadgeDrawable will be set as the foreground of a FrameLayout that is an ancestor of the anchor.
PiperOrigin-RevId: 238661951