y20k / transistor

Transistor - Simple Radio App for Android
http://y20k.org/transistor/
MIT License
433 stars 121 forks source link

Starting from v4.0.11, station images in notifications are missing #385

Open heldderarbeit opened 2 years ago

heldderarbeit commented 2 years ago

Describe the bug Hi, I'm not sure whether this is a bug or deliberate feature.

On F-Droid and Play Store, the following image is used to promote the app:

01-lockscreen-active-oneplus5

I'm on LineageOS 17.1 (Android 10) and can't get to display the radio image right next to the stop icon. That happens with both F-Droid and Play Store versions, and all radio stations I tried, not just some of them. It doesn't matter whether the images are automatically downloaded or manually set with the file browser, either. The color styling of the notification is absent, too. It just appears in a bland, barren manner. Only thing that seems to style is the background of the lockscreen.

Expected Lockscreen:

1

Actual Lockscreen:

2

Expected Notification: 3

Actual Notification:

4

Expected Lockscreen:

5

Actual Lockscreen:

6

Expected Notification: 7

Actual Notification:

8

I tried older versions of the app and it seems like this is an issue since version 4.0.11. Versions 4.0.10 and older show the notifications correctly. The commit that introduces that change is most probably https://github.com/y20k/transistor/commit/7ea39179ef06400ff5db38062264b7d1c266467f (Implement PlayerNotificationManager and MediaSessionConnector) on Feb 19, 2021. Therefore the oldest working version must be https://github.com/y20k/transistor/commit/7e032eaf42a775257606722bac8762f3c26d5d2a (Translated using Weblate (Esperanto)) on Feb 15, 2021.

Seems like the problem is that currentIconUri is always null every time I enter getCurrentLargeIcon of DescriptionAdapter in NotificationHelper.kt in my case.

Quick and Dirty Hack

There is a fix by adding a single line (setIconUri) in the CollectionHelper:

fun buildStationMediaDescription(context: Context, station: Station, metadata: String): MediaDescriptionCompat {
...
    return MediaDescriptionCompat.Builder().apply {
...
       setIconUri(Uri.parse("file:///storage/emulated/0/Android/data/org.y20k.transistor/files/images/" + station.uuid + "/station-image-small.jpg"))
...
}

That makes the station images visible for me.

y20k commented 2 years ago

Hi @heldderarbeit. I will have a look at this. Thanks.

y20k commented 2 years ago

Hi @heldderarbeit

I think your suggested solution to add setIconUri to CollectionHelper.kt is okay. I agree that having both setIconUri and setIconBitmap seems wasteful. But it seems like both are needed.