android icon indicating copy to clipboard operation
android copied to clipboard

Background missing for Android shortcuts

Open vlaraort opened this issue 9 months ago • 19 comments

The current shortcuts in the android app work really fine, but there are some UI flaws

Screenshot_20250510_223059_One UI Home.jpg

The icons does not follow the Google design guidelines (not positioned in a circle live area) and they float freely

https://developer.android.com/develop/ui/views/launch/shortcuts/best-practices

Screenshot_20250510_223136_One UI Home.jpg

This also impacts to the pinned shortcuts, that are inconsistent with the android layouts (we can't even change the color)

Screenshot_20250510_223757_One UI Home.jpg

Could be possible to wrap them in a circle to improve the UI? And maybe allow to select the color?

vlaraort avatar May 10 '25 20:05 vlaraort

What device is this? My shortcuts look like this. Are you using a custom launcher?

Screenshot_20250510-111659.png

dshokouhi avatar May 10 '25 21:05 dshokouhi

It's a Samsung Galaxy S23+ with OneUI 7 and the stock samsung launcher

vlaraort avatar May 11 '25 10:05 vlaraort

I just tried removing the custom icons, and I have the same behavior as you, really weird

Screenshot_20250511_120622_One UI Home.jpg

Curious why the other apps shortcuts have the proper format, but the home assistant don't 🤔

The icon pack was generated with icon pack studio

vlaraort avatar May 11 '25 10:05 vlaraort

This really looks like some weird manufacturer specific issue. What do you mean by remove custom icons? Is that a launcher setting on that device?

dshokouhi avatar May 17 '25 17:05 dshokouhi

All samsung phones has an app called theme park, there you can set icon packs to the samsung oneui launcher, or set them to the default icons of the apps.

If I set a custom icon pack from there (I have tested like 4 different), there is the issue. If I leave the default icons without icon packs, works fine

I have not tested other launchers tbh, but this one is the samsung default, so has a really big user pool

vlaraort avatar May 18 '25 11:05 vlaraort

I am not really sure what we need to provide for the icon packs as the icons look fine without them and we are not doing anything different there, this may be difficult for us developers to look into as none of us have samsung devices.

dshokouhi avatar May 18 '25 22:05 dshokouhi

Can you check other third party apps (not from Samsung and Google) to see if their shortcut backgrounds look correct when changing the icon pack?

jpelgrom avatar May 20 '25 13:05 jpelgrom

I have tested with other third party launchers and works fine. Also with the oneui launcher, some apps have the background, and other not. So looks that is some device specific and a small issue. If you want I can make more tests, but would be fine if you just simply mark this as "won't do"

vlaraort avatar May 22 '25 05:05 vlaraort

Out of curiosity I've asked ChatGPT, and it said that we should use AdaptiveIcons with a clear distinction between background and foreground so that the system knows how to manipulate them.

https://developer.android.com/reference/androidx/core/graphics/drawable/IconCompat#createWithAdaptiveBitmap(android.graphics.Bitmap)

TimoPtr avatar May 22 '25 07:05 TimoPtr

If you provide a debug apk I can test it if you want

vlaraort avatar May 22 '25 19:05 vlaraort

I've been playing a bit more with the API and I managed to reproduce the issue on my Pixel too when I set the Icon theming, the icon are not themed like with the one from the application. The bad news at least on Pixel is that it is also the case for all the other apps (the Play Store for instance or Google Photos).

The good news is that on static shortcut I managed partially to make it work (like with the DevPlayground)

Image It doesn't work in the shortcut menu but it does once it is on the home screen.

I've tried to use IconCompat.createWithAdaptiveBitmap with an icon that respect the specification in terms of size like (108dp) but it doesn't work on the Pixel... What worked was IconCompat.createWithResource (you can see it in the screenshot). But it is not suitable for us unfortunately since we don't have all the icons already in resources in an adaptive form.

I suspect that based on how the API is made we cannot really fix this issue, because createWithAdaptiveBitmap only creates a Bitmap with a Flag saying it's adaptive where the other one seems to directly gives the xml of the system.

I'll make a PR so that you can test my changes it might work on Samsung or make it a bit better but I don't have a lot of hope to be honest.

TimoPtr avatar Jun 20 '25 12:06 TimoPtr

@vlaraort once the build is done in Github Action could you test the APK on your Samsung?

TimoPtr avatar Jun 20 '25 14:06 TimoPtr

Sure!

vlaraort avatar Jun 20 '25 14:06 vlaraort

Can you provide link to the pipeline or apk?

vlaraort avatar Jun 20 '25 17:06 vlaraort

Can you provide link to the pipeline or apk?

download and extract the artifact from: https://github.com/home-assistant/android/actions/runs/15781339843

you can use either full or minimal version of the app

dshokouhi avatar Jun 20 '25 17:06 dshokouhi

Working fantastic! Also, the color in the default shortcuts look sick! Would be a cool improvement foe the future, instead of the stock blueScreenshot_20250620_195739_One UI Home.jpg

vlaraort avatar Jun 20 '25 17:06 vlaraort

So Samsung implemented correctly versus google partially 😂

TimoPtr avatar Jun 20 '25 18:06 TimoPtr

Could you try to drag and drop a shortcut to see how it behaves in your launcher? @vlaraort

TimoPtr avatar Jun 20 '25 18:06 TimoPtr

Top ones the debug apk Bottom the Google play app

Screenshot_20250620_200353_One UI Home.jpg

vlaraort avatar Jun 20 '25 18:06 vlaraort

I'm closing the issue since the PR is merged. For anyone finding this issue, we've done our best to at least replicate what Google is doing on their own app. We won't be able to do more until Google offer a way to properly exposes Adaptive Icons without relying on XML resources.

TimoPtr avatar Jun 23 '25 08:06 TimoPtr