mirror of
https://github.com/home-assistant/android
synced 2024-09-06 17:23:32 +00:00
Show media player artist/album more often (#2493)
- Also show media player artist if there is only an album artist - Also show media player album if there is no artist known
This commit is contained in:
parent
a4fc7b0a3f
commit
d6add75168
|
@ -159,18 +159,19 @@ class MediaPlayerControlsWidget : BaseWidgetProvider() {
|
|||
)
|
||||
}
|
||||
|
||||
var artist = entity?.attributes?.get("media_artist")?.toString()
|
||||
val artist = (entity?.attributes?.get("media_artist") ?: entity?.attributes?.get("media_album_artist"))?.toString()
|
||||
val title = entity?.attributes?.get("media_title")?.toString()
|
||||
val album = entity?.attributes?.get("media_album_name")?.toString()
|
||||
val icon = entity?.attributes?.get("icon")?.toString()
|
||||
|
||||
if (artist != null && title != null) {
|
||||
if (album != null) {
|
||||
artist = "$artist - $album"
|
||||
}
|
||||
if ((artist != null || album != null) && title != null) {
|
||||
setTextViewText(
|
||||
R.id.widgetMediaInfoArtist,
|
||||
artist
|
||||
when {
|
||||
artist != null && album != null -> "$artist - $album"
|
||||
album != null -> album
|
||||
else -> artist
|
||||
}
|
||||
)
|
||||
setTextViewText(
|
||||
R.id.widgetMediaInfoTitle,
|
||||
|
|
Loading…
Reference in a new issue