maui icon indicating copy to clipboard operation
maui copied to clipboard

ImageButton RippleEffect not working in some cases

Open AlleSchonWeg opened this issue 1 year ago • 2 comments

Description

This PR (https://github.com/dotnet/maui/pull/22298) should fix the ripple effect on android. It works in almost every case but there are some cases which don't work.

Steps to Reproduce

Open repro app. The first three image buttons are not working.

image

MauiApp9.zip

Link to public reproduction project repository

No response

Version with bug

Nightly / CI build (Please specify exact version)

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

No response

Did you find any workaround?

No response

Relevant log output

No response

AlleSchonWeg avatar May 23 '24 12:05 AlleSchonWeg

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

github-actions[bot] avatar May 23 '24 12:05 github-actions[bot]

Can repro this issue at android platform on the latest 17.11.0 Preview 1.0(8.0.60-ci.net8.24273.1/8.0.40).

kevinxufei avatar May 24 '24 01:05 kevinxufei

The standard buttons also have this behaviour. The problem could be the background color from the button or from the parent element. If the color is white, transparent or not set no ripple is not working.

AlleSchonWeg avatar May 29 '24 12:05 AlleSchonWeg

Looking at this some more, I see the following with each of the buttons:

  • no background => "use default OS background" - so for image buttons, the OS does not have a ripple
  • transparent => this has a ripple, but it is not visible since the ripple is white and appears under the image
  • white => this has a ripple but it is not visible since the ripple is white and appears under the image
  • color => the white ripple is visible and under the image.

mattleibow avatar May 29 '24 14:05 mattleibow

Since ImageButton has no ripple so it feels wrong, I will make sure it gets a ripple if no background is set.

mattleibow avatar May 29 '24 14:05 mattleibow

Perhaps it makes sense -if possible- to set a colour for the ripple. If the ripple is always white and is sometimes not visible the user has not the android typical feedback.

AlleSchonWeg avatar May 29 '24 18:05 AlleSchonWeg

For normal Button, there is a RippleColor property, but for the ImageButton, it is all fake as an image button is not a thing supported by Android and we are using a fancy image control.

But, changing the ripple color sounds like a feature request and we could see about adding that if people want it.

mattleibow avatar May 30 '24 12:05 mattleibow

For normal Button, there is a RippleColor property

Interesting. I didn't know that. Is this accessable via platform specific code: On<Android>() or via handler?

Thank you

AlleSchonWeg avatar May 30 '24 13:05 AlleSchonWeg

This is not really a xplat feature, so we don't have an api for it. But, if you want you can add your own mapper for Android. And maybe even your own attached property - or even an effect to not have to do anything.

PlatformView.RippleColor = color.ToPlatform();

That in an effect is all that is needed.

mattleibow avatar May 31 '24 07:05 mattleibow