diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/home/HomeFragment.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/home/HomeFragment.kt index e8daa4eb49..b997ab7dd2 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/home/HomeFragment.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/home/HomeFragment.kt @@ -45,6 +45,7 @@ import com.lagradost.cloudstream3.ui.settings.Globals.TV import com.lagradost.cloudstream3.ui.settings.Globals.isLayout import com.lagradost.cloudstream3.utils.AppContextUtils.filterProviderByPreferredMedia import com.lagradost.cloudstream3.utils.AppContextUtils.getApiProviderLangSettings +import com.lagradost.cloudstream3.utils.AppContextUtils.isNetworkAvailable import com.lagradost.cloudstream3.utils.AppContextUtils.isRecyclerScrollable import com.lagradost.cloudstream3.utils.AppContextUtils.loadSearchResult import com.lagradost.cloudstream3.utils.AppContextUtils.ownHide @@ -56,6 +57,7 @@ import com.lagradost.cloudstream3.utils.Event import com.lagradost.cloudstream3.utils.SubtitleHelper.getFlagFromIso import com.lagradost.cloudstream3.utils.UIHelper.dismissSafe import com.lagradost.cloudstream3.utils.UIHelper.getSpanCount +import com.lagradost.cloudstream3.utils.UIHelper.navigate import com.lagradost.cloudstream3.utils.UIHelper.popupMenuNoIconsAndNoStringRes import java.util.* @@ -590,7 +592,16 @@ class HomeFragment : Fragment() { is Resource.Failure -> { homeLoadingShimmer.stopShimmer() - resultErrorText.text = data.errorString + var errorString = data.errorString + if (context?.isNetworkAvailable() == false) { + errorString = getString(R.string.no_internet_connection) + homeReloadConnectionOpenInBrowser.isVisible = false + homeReloadConnectionGoToDownloads.isVisible = true + homeReloadConnectionGoToDownloads.setOnClickListener { + activity.navigate(R.id.navigation_downloads) + } + } + resultErrorText.text = errorString homeReloadConnectionerror.setOnClickListener(apiChangeClickListener) homeReloadConnectionOpenInBrowser.setOnClickListener { view -> val validAPIs = apis//.filter { api -> api.hasMainPage } @@ -677,4 +688,4 @@ class HomeFragment : Fragment() { } }*/ } -} +} \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml index 36cb5f4264..df483f4b49 100644 --- a/app/src/main/res/layout/fragment_home.xml +++ b/app/src/main/res/layout/fragment_home.xml @@ -177,6 +177,19 @@ android:text="@string/result_open_in_browser" app:icon="@drawable/ic_baseline_public_24" /> + + Show Don\'t Show Edge Size - - + Go to Downloads + + No internet connection. + \n\nPlease connect to the internet and try again or watch your downloads while you are offline. + + \ No newline at end of file