[Android] Album screen: make the artist clickable

Nicolas Pomepuy git at videolan.org
Wed Nov 16 09:09:52 UTC 2022


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Mon Nov 14 08:04:02 2022 +0100| [2736dba1b512772ecae422db0f0d9640488d9e1a] | committer: Nicolas Pomepuy

Album screen: make the artist clickable

Fixes #2756

> https://code.videolan.org/videolan/vlc-android/commit/2736dba1b512772ecae422db0f0d9640488d9e1a
---

 .../vlc-android/res/layout/header_media_list_activity.xml    |  1 +
 .../src/org/videolan/vlc/gui/HeaderMediaListActivity.kt      | 12 ++++++++++++
 2 files changed, 13 insertions(+)

diff --git a/application/vlc-android/res/layout/header_media_list_activity.xml b/application/vlc-android/res/layout/header_media_list_activity.xml
index 5bd3c96220..d0f1d07b77 100644
--- a/application/vlc-android/res/layout/header_media_list_activity.xml
+++ b/application/vlc-android/res/layout/header_media_list_activity.xml
@@ -116,6 +116,7 @@
                             android:layout_marginEnd="@dimen/default_margin"
                             android:ellipsize="end"
                             android:maxLines="2"
+                            android:background="?attr/selectableItemBackground"
                             android:text="@{playlist.description}"
                             android:textColor="?attr/font_default"
                             android:contentDescription="@{TalkbackUtil.INSTANCE.getArtist(context, playlist.description)}"
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/HeaderMediaListActivity.kt b/application/vlc-android/src/org/videolan/vlc/gui/HeaderMediaListActivity.kt
index d36bdf33ce..16c6dc20b4 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/HeaderMediaListActivity.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/HeaderMediaListActivity.kt
@@ -154,6 +154,18 @@ open class HeaderMediaListActivity : AudioPlayerContainerActivity(), IEventsHand
             addToPlaylist(viewModel.playlist.tracks.toList())
         }
 
+        binding.headerListArtist.setOnClickListener {
+            lifecycleScope.launch {
+                withContext(Dispatchers.IO) {
+                    val artist = (viewModel.playlist as Album).retrieveAlbumArtist()
+                    val i = Intent(this at HeaderMediaListActivity, SecondaryActivity::class.java)
+                    i.putExtra(SecondaryActivity.KEY_FRAGMENT, SecondaryActivity.ALBUMS_SONGS)
+                    i.putExtra(AudioBrowserFragment.TAG_ITEM, artist)
+                    startActivity(i)
+                }
+            }
+        }
+
         binding.songs.layoutManager = LinearLayoutManager(this)
         binding.songs.adapter = audioBrowserAdapter
 



More information about the Android mailing list