Skip to content

Fix getOpacity() for drawables#47103

Closed
jorge-cab wants to merge 2 commits into
facebook:mainfrom
jorge-cab:export-D64273014
Closed

Fix getOpacity() for drawables#47103
jorge-cab wants to merge 2 commits into
facebook:mainfrom
jorge-cab:export-D64273014

Conversation

@jorge-cab
Copy link
Copy Markdown
Contributor

Summary:
getOpacity() is supposed to return a PixelFormat enum instead of a value between 0..255.
https://developer.android.com/reference/android/graphics/drawable/Drawable#getOpacity()

Also, I'm taking the value from the paint instead of the color's alpha since the paint might've been modified by setAlpha by this point and otherwise the paint will hold the alpha set by the color anyway since setAlpha() on Paints is just a helper for setColor() (https://developer.android.com/reference/android/graphics/Paint#setAlpha(int))

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D64273014

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 17, 2024
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D64273014

@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D64273014

@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D64273014

…acebook#46819)

Summary:

Just some preparation to implement the new `BackgroundDrawable` and `BorderDrawable`.

This makes shadows and outline rely on `CompositeBackgroundDrawable` to set the state of `BorderRadiusStyle` and also makes them have a nullable borderRadius variable and initialize it only if we have it set saving a bit of overhead and performance

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D63798853
Summary:

`getOpacity()` is supposed to return a PixelFormat enum instead of a value between 0..255. 
https://developer.android.com/reference/android/graphics/drawable/Drawable#getOpacity()

Also, I'm taking the value from the paint instead of the color's alpha since the paint might've been modified by setAlpha by this point and otherwise the paint will hold the alpha set by the color anyway since setAlpha() on Paints is just a helper for setColor() (https://developer.android.com/reference/android/graphics/Paint#setAlpha(int)) 




Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D64273014
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D64273014

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Oct 18, 2024
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request has been merged in 398512a.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants