From 4e001d881ccf21cee2c88d01cdf3c5dda4b2c70f Mon Sep 17 00:00:00 2001 From: Bnyro Date: Thu, 22 Jun 2023 15:53:55 +0200 Subject: [PATCH 1/2] Show nothing here indicator if home tab is empty --- .../libretube/ui/fragments/HomeFragment.kt | 15 +++++++++--- app/src/main/res/layout/fragment_home.xml | 23 +++++++++++++++++++ 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/github/libretube/ui/fragments/HomeFragment.kt b/app/src/main/java/com/github/libretube/ui/fragments/HomeFragment.kt index 9983c2262..95f6f621c 100644 --- a/app/src/main/java/com/github/libretube/ui/fragments/HomeFragment.kt +++ b/app/src/main/java/com/github/libretube/ui/fragments/HomeFragment.kt @@ -4,6 +4,8 @@ import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import androidx.core.view.isGone +import androidx.core.view.isVisible import androidx.fragment.app.Fragment import androidx.fragment.app.activityViewModels import androidx.lifecycle.Lifecycle @@ -91,6 +93,13 @@ class HomeFragment : Fragment() { async { if (visibleItems.contains(FEATURED)) loadFeed() }, async { if (visibleItems.contains(PLAYLISTS)) loadPlaylists() }, ) + + val binding = _binding ?: return@repeatOnLifecycle + // No category is shown because they are either empty or disabled + if (binding.progress.isVisible) { + binding.progress.isGone = true + binding.nothingHere.isVisible = true + } } } } @@ -190,11 +199,11 @@ class HomeFragment : Fragment() { private fun makeVisible(vararg views: View) { views.forEach { - it.visibility = View.VISIBLE + it.isVisible = true } val binding = _binding ?: return - binding.progress.visibility = View.GONE - binding.scroll.visibility = View.VISIBLE + binding.progress.isGone = true + binding.scroll.isVisible = true binding.refresh.isRefreshing = false } diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml index ad60d6cc0..67105a1b5 100644 --- a/app/src/main/res/layout/fragment_home.xml +++ b/app/src/main/res/layout/fragment_home.xml @@ -89,4 +89,27 @@ + + + + + + + \ No newline at end of file From fcd2aa7c11aae2ffad77f5ae5a8b639526a98c09 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Thu, 22 Jun 2023 15:57:45 +0200 Subject: [PATCH 2/2] Simplify nothing here indicator in playlists and subscriptions page --- app/src/main/res/layout/fragment_home.xml | 3 ++- app/src/main/res/layout/fragment_library.xml | 13 +++++------- .../res/layout/fragment_subscriptions.xml | 21 ++++++++----------- 3 files changed, 16 insertions(+), 21 deletions(-) diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml index 67105a1b5..5f64b5dc8 100644 --- a/app/src/main/res/layout/fragment_home.xml +++ b/app/src/main/res/layout/fragment_home.xml @@ -101,12 +101,13 @@ android:id="@+id/listIV" android:layout_width="100dp" android:layout_height="100dp" + android:layout_gravity="center" android:src="@drawable/ic_list" /> diff --git a/app/src/main/res/layout/fragment_library.xml b/app/src/main/res/layout/fragment_library.xml index 3264cfdbd..50565897b 100644 --- a/app/src/main/res/layout/fragment_library.xml +++ b/app/src/main/res/layout/fragment_library.xml @@ -87,31 +87,28 @@ android:textSize="18sp" android:textStyle="bold" /> - - + - - + @@ -156,8 +153,8 @@ android:id="@+id/channel_groups" android:layout_width="wrap_content" android:layout_height="wrap_content" - app:checkedChip="@id/chip_all" android:layout_marginStart="5dp" + app:checkedChip="@id/chip_all" app:selectionRequired="true" app:singleLine="true" app:singleSelection="true">