Skip to content

[Android] Fixed Button Shadow Color Transparency Not Applied Correctly #29371

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jun 2, 2025

Conversation

NanthiniMahalingam
Copy link
Contributor

@NanthiniMahalingam NanthiniMahalingam commented May 7, 2025

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Root Cause

  • The button's shadow rendering does not account for the color's alpha value in android platform.

Description of Change

  • Handled shadow color transparency and opacity when both color alpha and opacity values are present, ensuring consistent behavior across platforms.
  • If the color has an alpha value, shadow transparency is applied based on that alpha.
  • If the Opacity property is set directly, shadow transparency is applied based on the Opacity value.

Validated the behaviour in the following platforms

  • Android
  • Windows
  • iOS
  • Mac

Issues Fixed

Fixes #29325

Output images

Android

Before After

@dotnet-policy-service dotnet-policy-service bot added community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration labels May 7, 2025
@NanthiniMahalingam NanthiniMahalingam changed the title Fixed Button Shadow Color Transparency Not Applied Correctly Fixed Button Shadow Color Transparency Not Applied Correctly on android platform May 7, 2025
@NanthiniMahalingam NanthiniMahalingam changed the title Fixed Button Shadow Color Transparency Not Applied Correctly on android platform [Android] Fixed Button Shadow Color Transparency Not Applied Correctly May 7, 2025
@jsuarezruiz
Copy link
Contributor

/azp run MAUI-UITests-public

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

var shadowOpacity = Shadow.Opacity;
var paintColorAlpha = shadowPaint.ToColor().Alpha;
// If the color has an alpha value indicating transparency, we can use that; otherwise, we can use the shadow opacity.
var shadowOpacity = paintColorAlpha == 1 ? Shadow.Opacity : paintColorAlpha;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the behavior in other platforms?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the behavior in other platforms?

Hi @jsuarezruiz ,

  • On other platforms, shadow color (with alpha) and shadow opacity are handled separately. When both a color with alpha and an opacity value are provided, they are combined to produce the final shadow effect.
  • The refined code section aligns with this behavior by merging both values to ensure consistent and platform-aligned shadow rendering.

@NanthiniMahalingam NanthiniMahalingam marked this pull request as ready for review May 8, 2025 13:21
@NanthiniMahalingam NanthiniMahalingam requested a review from a team as a code owner May 8, 2025 13:21
@jsuarezruiz
Copy link
Contributor

/azp run MAUI-UITests-public

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jsuarezruiz
Copy link
Contributor

/azp run MAUI-UITests-public

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@PureWeen PureWeen added this to the .NET 9 SR8 milestone May 20, 2025
@PureWeen PureWeen moved this from Todo to Ready To Review in MAUI SDK Ongoing May 20, 2025
Copy link
Member

@mattleibow mattleibow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, but I think may need more tests.

@github-project-automation github-project-automation bot moved this from Ready To Review to Changes Requested in MAUI SDK Ongoing May 23, 2025
@jsuarezruiz
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@PureWeen PureWeen added the p/0 Work that we can't release without label Jun 2, 2025
@PureWeen PureWeen moved this from Changes Requested to Ready To Review in MAUI SDK Ongoing Jun 2, 2025
@PureWeen PureWeen changed the base branch from main to inflight/current June 2, 2025 20:06
@PureWeen PureWeen merged commit a37549a into dotnet:inflight/current Jun 2, 2025
1 check passed
@github-project-automation github-project-automation bot moved this from Ready To Review to Done in MAUI SDK Ongoing Jun 2, 2025
github-actions bot pushed a commit that referenced this pull request Jun 6, 2025
#29371)

* Fixed the shadow transparent issue on android

* Updated the fix.

* Added the test case and updated the fix

* Added the output images.

* Updated the fix.

* Updated the comment.

* Added the output images for mac and Windows

* Updated the test case and added output images.

* Added the output images
github-actions bot pushed a commit that referenced this pull request Jun 6, 2025
#29371)

* Fixed the shadow transparent issue on android

* Updated the fix.

* Added the test case and updated the fix

* Added the output images.

* Updated the fix.

* Updated the comment.

* Added the output images for mac and Windows

* Updated the test case and added output images.

* Added the output images
github-actions bot pushed a commit that referenced this pull request Jun 7, 2025
#29371)

* Fixed the shadow transparent issue on android

* Updated the fix.

* Added the test case and updated the fix

* Added the output images.

* Updated the fix.

* Updated the comment.

* Added the output images for mac and Windows

* Updated the test case and added output images.

* Added the output images
github-actions bot pushed a commit that referenced this pull request Jun 10, 2025
#29371)

* Fixed the shadow transparent issue on android

* Updated the fix.

* Added the test case and updated the fix

* Added the output images.

* Updated the fix.

* Updated the comment.

* Added the output images for mac and Windows

* Updated the test case and added output images.

* Added the output images
github-actions bot pushed a commit that referenced this pull request Jun 10, 2025
#29371)

* Fixed the shadow transparent issue on android

* Updated the fix.

* Added the test case and updated the fix

* Added the output images.

* Updated the fix.

* Updated the comment.

* Added the output images for mac and Windows

* Updated the test case and added output images.

* Added the output images
github-actions bot pushed a commit that referenced this pull request Jun 11, 2025
#29371)

* Fixed the shadow transparent issue on android

* Updated the fix.

* Added the test case and updated the fix

* Added the output images.

* Updated the fix.

* Updated the comment.

* Added the output images for mac and Windows

* Updated the test case and added output images.

* Added the output images
github-actions bot pushed a commit that referenced this pull request Jun 11, 2025
#29371)

* Fixed the shadow transparent issue on android

* Updated the fix.

* Added the test case and updated the fix

* Added the output images.

* Updated the fix.

* Updated the comment.

* Added the output images for mac and Windows

* Updated the test case and added output images.

* Added the output images
github-actions bot pushed a commit that referenced this pull request Jun 16, 2025
#29371)

* Fixed the shadow transparent issue on android

* Updated the fix.

* Added the test case and updated the fix

* Added the output images.

* Updated the fix.

* Updated the comment.

* Added the output images for mac and Windows

* Updated the test case and added output images.

* Added the output images
github-actions bot pushed a commit that referenced this pull request Jun 16, 2025
#29371)

* Fixed the shadow transparent issue on android

* Updated the fix.

* Added the test case and updated the fix

* Added the output images.

* Updated the fix.

* Updated the comment.

* Added the output images for mac and Windows

* Updated the test case and added output images.

* Added the output images
github-actions bot pushed a commit that referenced this pull request Jun 19, 2025
#29371)

* Fixed the shadow transparent issue on android

* Updated the fix.

* Added the test case and updated the fix

* Added the output images.

* Updated the fix.

* Updated the comment.

* Added the output images for mac and Windows

* Updated the test case and added output images.

* Added the output images
PureWeen added a commit that referenced this pull request Jun 21, 2025
For more information about inflight process check
https://github.com/dotnet/maui/wiki/Inflight-Branch-Process

# .NET MAUI Release Notes - inflight/candidate Branch

## MAUI Product Fixes
* [iOS] Fix SwipeView programmatic open when background color is set by
@Shalini-Ashokan in #29765
* [iOS] FormattedText with text color causes stack overflow - fix by
@kubaflo in #29874
* [iOS] Fix AdaptiveTrigger not working as expected by @jsuarezruiz in
#20987
* [iOS] Fix for Flyout title is not broken over multiple lines when you
rotate your screen by @BagavathiPerumal in
#29171
* [Windows] Fix for Assigning null to the SelectedItem of the
CollectionView in the SelectionChanged event does not clear the
selection by @SyedAbdulAzeemSF4852 in
#29288
* Fix TapCoordinates method in Catalyst by @jsuarezruiz in
#29775
* Fixed ItemSpacing on CarouselView resizes items [Android] by
@Dhivya-SF4094 in #29796
* Perf : ButtonContentTypeConverter now using InvariantCulture to parse
double by @antoine-jonathan in #25393
* ToolbarItem behavior with ImageSource iOS - fix by @kubaflo in
#28833
* [Android] Fixed Button Shadow Color Transparency Not Applied Correctly
by @NanthiniMahalingam in #29371
* Don't call NSAttributedString with HTML from a background thread by
@kubaflo in #26153
* [Windows] Implemented the Resize and Downsize functions in the
W2DImage class by @HarishwaranVijayakumar in
#29138
* Templated indicator view - improvements by @kubaflo in
#25642
* Update Issue25946.xaml by @anandhan-rajagopal in
#30025

## Testing
* Fixed Test case failure in PR 26153 - iOS by @kubaflo in
#29906
* Fixed Test case failure in PR 25642 - snapshots by @kubaflo in
#29881
* [Testing] Feature Matrix UITest Cases for RadioButton by
@TamilarasanSF4853 in #29744
* [Testing] Feature Matrix UITest Cases for CollectionView ItemsSource
Feature by @LogishaSelvarajSF4525 in
#29322
* [Testing] Feature Matrix UITest Cases for Stepper by
@nivetha-nagalingam in #29731
* [Testing] Feature Matrix UITest Cases for CheckBox Control by
@anandhan-rajagopal in #29739
* Update the comment for the test properties by @mattleibow in
#27306

## Dependency Updates
* No changes in this category

## Docs
* No changes in this category

## Housekeeping
* [create-pull-request] automated change by @github-actions[bot] in
#29875
* [create-pull-request] automated change by @github-actions[bot] in
#29792
* [create-pull-request] automated change by @github-actions[bot] in
#29760

**Full Changelog**:
origin/main...origin/inflight/candidate
@PureWeen PureWeen modified the milestones: .NET 9 SR8, .NET 9 SR9 Jun 23, 2025
rmarinho pushed a commit that referenced this pull request Jun 24, 2025
#29371)

* Fixed the shadow transparent issue on android

* Updated the fix.

* Added the test case and updated the fix

* Added the output images.

* Updated the fix.

* Updated the comment.

* Added the output images for mac and Windows

* Updated the test case and added output images.

* Added the output images
@github-actions github-actions bot locked and limited conversation to collaborators Jul 24, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
community ✨ Community Contribution p/0 Work that we can't release without partner/syncfusion Issues / PR's with Syncfusion collaboration platform/android
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[Android] Button with shadow broken on Android device
5 participants