[Android] Fix empty view visibility for Audio tabs

Nicolas Pomepuy git at videolan.org
Tue Mar 31 10:29:47 CEST 2020


vlc-android | branch: 3.2.x | Nicolas Pomepuy <nicolas at videolabs.io> | Tue Mar 31 10:19:31 2020 +0200| [64246477086f85fa35ab415cc5233fba4771054f] | committer: Nicolas Pomepuy

Fix empty view visibility for Audio tabs

> https://code.videolan.org/videolan/vlc-android/commit/64246477086f85fa35ab415cc5233fba4771054f
---

 vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.kt | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.kt b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.kt
index 1ed73127d..91d566da8 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.kt
@@ -233,6 +233,7 @@ class AudioBrowserFragment : BaseAudioBrowser<AudioBrowserViewModel>(), SwipeRef
                     handler.sendEmptyMessage(UNSET_REFRESHING)
 
                 (activity as? MainActivity)?.refreshing = loading
+                updateEmptyView()
             })
         }
     }
@@ -299,8 +300,9 @@ class AudioBrowserFragment : BaseAudioBrowser<AudioBrowserViewModel>(), SwipeRef
     }
 
     private fun updateEmptyView() {
-        emptyView.visibility = if (getCurrentAdapter().isEmpty) View.VISIBLE else View.GONE
-        medialibrarySettingsBtn.visibility = if (getCurrentAdapter().isEmpty) View.VISIBLE else View.GONE
+        val emptyVisibility = getViewModel().providers[currentTab].isEmpty() && getViewModel().providers[currentTab].loading.value == false
+        emptyView.visibility = if (emptyVisibility) View.VISIBLE else View.GONE
+        medialibrarySettingsBtn.visibility = if (emptyVisibility) View.VISIBLE else View.GONE
         setFabPlayShuffleAllVisibility()
     }
 



More information about the Android mailing list