From 65ddf07558cc70ae8ce9395634f6a92efaed4a6d Mon Sep 17 00:00:00 2001 From: achroid Date: Tue, 6 Sep 2022 08:08:45 +0430 Subject: [PATCH] Fixed Iran region has no videos in feed --- .../com/github/libretube/fragments/HomeFragment.kt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/github/libretube/fragments/HomeFragment.kt b/app/src/main/java/com/github/libretube/fragments/HomeFragment.kt index 6312f9dbe..62ca0322b 100644 --- a/app/src/main/java/com/github/libretube/fragments/HomeFragment.kt +++ b/app/src/main/java/com/github/libretube/fragments/HomeFragment.kt @@ -53,10 +53,16 @@ class HomeFragment : BaseFragment() { LocaleHelper .getDetectedCountry(requireContext(), "UK") .uppercase() - } else { + } + else { regionPref } + // Iran has no trending videos to show! + if (region == "IR"){ + region = "US" + } + binding.recview.layoutManager = GridLayoutManager(view.context, grid.toInt()) fetchJson() binding.homeRefresh.isEnabled = true @@ -85,6 +91,9 @@ class HomeFragment : BaseFragment() { runOnUiThread { binding.progressBar.visibility = View.GONE binding.recview.adapter = TrendingAdapter(response, childFragmentManager) + if (response.isEmpty()){ + Toast.makeText(context, "No videos found! Change your region and try again!", Toast.LENGTH_SHORT).show() + } } } }