[Android] Fix loading state for Audio tab

Nicolas Pomepuy git at videolan.org
Wed Jun 3 06:33:20 CEST 2020


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Tue Jun  2 15:40:17 2020 +0200| [687a28ade0f095bccec3d7b9b0529644b17842b8] | committer: Nicolas Pomepuy

Fix loading state for Audio tab

Fixes #1366

> https://code.videolan.org/videolan/vlc-android/commit/687a28ade0f095bccec3d7b9b0529644b17842b8
---

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

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.kt b/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.kt
index 4e96ead3a..0b5299ff1 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.kt
@@ -204,7 +204,7 @@ class AudioBrowserFragment : BaseAudioBrowser<AudioBrowserViewModel>() {
         provider.loading.observe(viewLifecycleOwner, Observer { loading ->
             if (loading == null || currentTab != index) return at Observer
             setRefreshing(loading) { refresh ->
-                if (refresh) empty_loading.state = EmptyLoadingState.LOADING
+                if (refresh) updateEmptyView()
                 else {
                     swipeRefreshLayout.isEnabled = (getCurrentRV().layoutManager as LinearLayoutManager).findFirstVisibleItemPosition() <= 0
                     songs_fast_scroller.setRecyclerView(getCurrentRV(), viewModel.providers[currentTab])
@@ -281,7 +281,7 @@ class AudioBrowserFragment : BaseAudioBrowser<AudioBrowserViewModel>() {
     override fun enableSearchOption() = true
 
     private fun updateEmptyView() {
-        empty_loading.state = if (viewModel.providers[currentTab].loading.value == true) EmptyLoadingState.LOADING else  if (empty) EmptyLoadingState.EMPTY else EmptyLoadingState.NONE
+        empty_loading.state = if (viewModel.providers[currentTab].loading.value == true && empty) EmptyLoadingState.LOADING else  if (empty) EmptyLoadingState.EMPTY else EmptyLoadingState.NONE
         setFabPlayShuffleAllVisibility()
     }
 



More information about the Android mailing list