From e4beff22f5cd365c17a4f966b9a40e94580325e2 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Sat, 26 Nov 2022 08:36:53 +0100 Subject: [PATCH] hide downloads tab if already part of navbar --- .../com/github/libretube/ui/fragments/LibraryFragment.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/src/main/java/com/github/libretube/ui/fragments/LibraryFragment.kt b/app/src/main/java/com/github/libretube/ui/fragments/LibraryFragment.kt index 99051b126..a38494316 100644 --- a/app/src/main/java/com/github/libretube/ui/fragments/LibraryFragment.kt +++ b/app/src/main/java/com/github/libretube/ui/fragments/LibraryFragment.kt @@ -21,6 +21,7 @@ import com.github.libretube.ui.adapters.PlaylistsAdapter import com.github.libretube.ui.base.BaseFragment import com.github.libretube.ui.dialogs.CreatePlaylistDialog import com.github.libretube.ui.models.PlayerViewModel +import com.github.libretube.util.NavBarHelper import com.github.libretube.util.PreferenceHelper class LibraryFragment : BaseFragment() { @@ -68,6 +69,11 @@ class LibraryFragment : BaseFragment() { findNavController().navigate(R.id.downloadsFragment) } + val navBarItems = NavBarHelper.getNavBarItems(requireContext()) + if (navBarItems.filter { it.isVisible }.any { it.itemId == R.id.downloadsFragment }) { + binding.downloads.visibility = View.GONE + } + fetchPlaylists() binding.playlistRefresh.isEnabled = true