[Android] Remove favorite line if there is no favorite

Nicolas Pomepuy git at videolan.org
Tue Apr 28 16:00:34 CEST 2020


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Tue Apr 28 15:18:19 2020 +0200| [e06e7d8543be13974ab41e5f58a6d90806e14fa0] | committer: Geoffrey Métais

Remove favorite line if there is no favorite

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

 .../src/org/videolan/vlc/gui/browser/MainBrowserFragment.kt            | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/browser/MainBrowserFragment.kt b/application/vlc-android/src/org/videolan/vlc/gui/browser/MainBrowserFragment.kt
index 7cab78e37..13ea136dc 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/browser/MainBrowserFragment.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/browser/MainBrowserFragment.kt
@@ -37,6 +37,8 @@ import org.videolan.medialibrary.media.MediaLibraryItem
 import org.videolan.resources.*
 import org.videolan.tools.NetworkMonitor
 import org.videolan.tools.isStarted
+import org.videolan.tools.setGone
+import org.videolan.tools.setVisible
 import org.videolan.vlc.R
 import org.videolan.vlc.gui.BaseFragment
 import org.videolan.vlc.gui.SecondaryActivity
@@ -153,6 +155,7 @@ class MainBrowserFragment : BaseFragment(), View.OnClickListener, CtxActionRecei
         containerAdapterAssociation[favoritesBrowserContainer] = Pair(favoritesAdapter, favoritesViewModel)
         favoritesViewModel.favorites.observe(viewLifecycleOwner, Observer { list ->
             list?.let {
+                if (list.isEmpty()) favoritesEntry.setGone() else   favoritesEntry.setVisible()
                 favoritesAdapter.update(it)
                 favoritesEntry.loading.state = if (list.isEmpty()) EmptyLoadingState.EMPTY else EmptyLoadingState.NONE
             }



More information about the Android mailing list