material-components / material-components/material-components-android
[BadgeDrawable] Please remove anchorView requirement
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 17.4k
- Forks
- 3.2k
- PR merge metrics
- No merged PRs in 30d
Description
**Is your feature request related to a problem? Please describe.**
Recently support for showing a badge on toolbar action items was introduced but it's error prone. Please see my question at Stack Overflow: https://stackoverflow.com/questions/65597372/livedata-update-of-badgedrawable-in-toolbar-menuitem.
**Describe the solution you'd like**
BadgeDrawable relies on being attached to an anchor view. I would like to use it just as a plain Drawable. I don't have direct access to the views that deal with the BadgeDrawable and I don't undersand why that would even be necessary.
Please make `updateCenterAndBounds()` and related methods fall back to the drawable bounds if no anchor view is available to support plain usage in an `ImageView` or `LayerDrawable`.
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.
Research direction
Start by locating BadgeDrawable and its updateCenterAndBounds() and related methods. Read how they use the anchor view, then inspect the plain ImageView and LayerDrawable usage described in the issue. Done means BadgeDrawable can operate without an anchor view while retaining its existing anchored behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- mobile
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100