From 39c94fe1e9805f8ca8a1288cebb4c722a9a71fa8 Mon Sep 17 00:00:00 2001 From: James Wells Date: Tue, 13 Apr 2021 22:35:06 -0400 Subject: [PATCH] Clean empty text view Signed-off-by: James Wells --- .../moire/ultrasonic/fragment/SelectAlbumFragment.kt | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/fragment/SelectAlbumFragment.kt b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/fragment/SelectAlbumFragment.kt index 063ec87b..413875f0 100644 --- a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/fragment/SelectAlbumFragment.kt +++ b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/fragment/SelectAlbumFragment.kt @@ -74,7 +74,7 @@ class SelectAlbumFragment : Fragment() { private var header: View? = null private var selectFolderHeader: SelectMusicFolderView? = null private var albumButtons: View? = null - private var emptyView: View? = null + private var emptyView: TextView? = null private var selectButton: ImageView? = null private var playNowButton: ImageView? = null private var playNextButton: ImageView? = null @@ -217,7 +217,7 @@ class SelectAlbumFragment : Fragment() { downloadButton = view.findViewById(R.id.select_album_download) deleteButton = view.findViewById(R.id.select_album_delete) moreButton = view.findViewById(R.id.select_album_more) - emptyView = view.findViewById(R.id.select_album_empty) + emptyView = TextView(requireContext()) selectButton!!.setOnClickListener( View.OnClickListener @@ -1118,7 +1118,13 @@ class SelectAlbumFragment : Fragment() { playAllButtonVisible = !(isAlbumList || entries.isEmpty()) && !allVideos shareButtonVisible = !isOffline(context) && songCount > 0 - emptyView!!.visibility = if (entries.isEmpty()) View.VISIBLE else View.GONE + if (entries.isEmpty()) { + emptyView!!.text = "No Media Found" + emptyView!!.setPadding(10, 10, 10, 10) + albumListView!!.addHeaderView(emptyView, null, false) + } else { + albumListView!!.removeHeaderView(emptyView!!) + } if (playAllButton != null) { playAllButton!!.isVisible = playAllButtonVisible