[Android] Added Platform specific ripple color#23599
[Android] Added Platform specific ripple color#23599rmarinho merged 6 commits intodotnet:net10.0from
Conversation
cd2974d to
d908f2c
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as off-topic.
This comment was marked as off-topic.
|
@kubaflo could you rebase this one please? Thanks! |
2afa9af to
24c62fb
Compare
|
Azure Pipelines successfully started running 3 pipeline(s). |
mattleibow
left a comment
There was a problem hiding this comment.
Unless someone does not like this feature, I think it is great.
I added a few comments, but it seems like all the bits are there. This will need to all be internal and then made public in net10 or in a SR if we are allowed to.
Alos, no idea how to test this because it is an OS animation... Msybe a device test that sets the ripple then background and/or border (and in reverse) and just read the derawable.
src/Controls/src/Core/PlatformConfiguration/AndroidSpecific/ImageButton.cs
Outdated
Show resolved
Hide resolved
src/Controls/src/Core/PlatformConfiguration/AndroidSpecific/ImageButton.cs
Show resolved
Hide resolved
|
I wonder if this should be targeted at net10.0 instead? |
Hmmm that's a good question |
24c62fb to
402d27c
Compare
|
@mattleibow I think I've resolved comments :) |
402d27c to
ee9df74
Compare
ee9df74 to
d2a109e
Compare
This comment was marked as off-topic.
This comment was marked as off-topic.
d2a109e to
9837377
Compare
c4f77f4 to
be91cea
Compare
|
Azure Pipelines successfully started running 3 pipeline(s). |
jsuarezruiz
left a comment
There was a problem hiding this comment.
Could include some tests in the DeviceTest project just using the Platform Specific and checking the RippleDrawable color?
I'm not quite sure how to do it |
You need to add a test in this class Something like: Define the button with the added Platform Specific: And then, create a method to get the RippleDrawable Color, to compare it using an Finally, just launch the test runner App on an Android device our emulator and run the test. Ok, I let you explore to add it, but just let me know if need help or if want myself adding some tests. |
be91cea to
ebae55e
Compare
|
@jsuarezruiz I've added a test, but I had to modify your solution a bit because this always returned null: |
jsuarezruiz
left a comment
There was a problem hiding this comment.
Requires some small changes to fix the build:
C:\a\_work\1\s\src\Core\src\Platform\Android\ImageButtonExtensions.cs(87,43): error CS0234: The type or namespace name 'Graphics' does not exist in the namespace 'Microsoft.Android' (are you missing an assembly reference?) [C:\a\_work\1\s\src\Core\src\Core.csproj::TargetFramework=net10.0-android36.0]
C:\a\_work\1\s\src\Core\src\Platform\Android\ImageButtonExtensions.cs(91,22): error CS0234: The type or namespace name 'Content' does not exist in the namespace 'Microsoft.Android' (are you missing an assembly reference?) [C:\a\_work\1\s\src\Core\src\Core.csproj::TargetFramework=net10.0-android36.0]
C:\a\_work\1\s\src\Core\src\Platform\Android\ButtonExtensions.cs(94,43): error CS0234: The type or namespace name 'Graphics' does not exist in the namespace 'Microsoft.Android' (are you missing an assembly reference?) [C:\a\_work\1\s\src\Core\src\Core.csproj::TargetFramework=net10.0-android36.0]
C:\a\_work\1\s\src\Core\src\Platform\Android\ButtonExtensions.cs(98,22): error CS0234: The type or namespace name 'Content' does not exist in the namespace 'Microsoft.Android' (are you missing an assembly reference?) [C:\a\_work\1\s\src\Core\src\Core.csproj::TargetFramework=net10.0-android36.0]
4 Error(s)
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
jsuarezruiz
left a comment
There was a problem hiding this comment.
LGTM, just added a comment about a detail in the added device test.
| if (platformButton.Background is global::Android.Graphics.Drawables.RippleDrawable rippleDrawable) | ||
| { | ||
| var constantState = rippleDrawable.GetConstantState(); | ||
| if (constantState is not null) |
There was a problem hiding this comment.
Here can just check constantState:
Assert.NotNull(constantState);
Description of Change
Right now the only way to set a ripple color for buttons is to use custom mappers or platform specific code. But, for image buttons there is currently no way to do anything.
Public API Changes
Fixes #22805
Screen.Recording.2024-07-13.at.19.17.11.mov
Notes
I will remove the pragma warning disable RS0016 if this PR makes sense