Commit 83886b1
committed
Fix and enhance IconDrawable
This commit adds lots of enhancements and fixes to IconDrawable:
- Adds spin animation functionality.
- Adds constant state in order to work around bugs in the framework and
support library where this is expected.
- Handle the case where the width of the icon is not the same as it's
height by returning the correct intrinsic width, and changing the
drawing logic to always fit the icon within it's bounds.
- Adds support for color state lists.
- Adds support for tint, and sets the default to implement the half
translucency on disabled state, and removed the custom logic to do it
by changing the alpha.
- Modulates the existing alpha from the color instead of replacing it.
- Removes the changing of the bounds upon size change, as that should
only be done by the view.
- Adds a public method to get the icon.
- Adds missing implementations of base methods.
Note that because we need to be able to generate the drawable without a
Context from the constant state, the methods that resolved resources
(i.e. colors, dimensions) now have to take a Context as a parameter.
This unfortunately makes the change backwards-incompatible.
The spin animation logic is also slightly changed in CustomTypefaceSpan
to initialize the start time upon first draw instead of upon
instantiation, since that is the actual start time of the animation.
This matches it with the implementation in IconDrawable.1 parent ce3e73a commit 83886b1
2 files changed
Lines changed: 380 additions & 82 deletions
File tree
- android-iconify/src/main/java/com/joanzapata/iconify
- internal
0 commit comments