From ddae2ddf3c228bf2177697708ad7dadc9a1a3257 Mon Sep 17 00:00:00 2001 From: Blatzar <46196380+Blatzar@users.noreply.github.com> Date: Mon, 31 Oct 2022 20:55:33 +0100 Subject: [PATCH] Revert "Remove provider language (#141)" This reverts commit a43e950a488637873553d4a46f49a8bb80a86542. --- .../com/lagradost/cloudstream3/MainAPI.kt | 30 +++++++------------ .../ui/setup/SetupFragmentExtensions.kt | 2 +- .../ui/setup/SetupFragmentLanguage.kt | 2 +- .../main/res/navigation/mobile_navigation.xml | 14 --------- app/src/main/res/xml/settings_providers.xml | 1 - 5 files changed, 13 insertions(+), 36 deletions(-) diff --git a/app/src/main/java/com/lagradost/cloudstream3/MainAPI.kt b/app/src/main/java/com/lagradost/cloudstream3/MainAPI.kt index da257d69..f6ecaae8 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/MainAPI.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/MainAPI.kt @@ -18,7 +18,8 @@ import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.isTvSet import com.lagradost.cloudstream3.utils.AppUtils.toJson import com.lagradost.cloudstream3.utils.Coroutines.threadSafeListOf import com.lagradost.cloudstream3.utils.ExtractorLink -import com.lagradost.cloudstream3.utils.SubtitleHelper +import com.lagradost.cloudstream3.utils.Qualities +import com.lagradost.cloudstream3.utils.loadExtractor import okhttp3.Interceptor import java.text.SimpleDateFormat import java.util.* @@ -193,26 +194,17 @@ object APIHolder { return list.filter { names.contains(it) }.map { DubStatus.valueOf(it) }.toHashSet() } - /** - * Gets all the activated provider languages - * Used to obey the preference provider_lang_key - * but it turned out too complicated and unnecessary with extensions. - **/ fun Context.getApiProviderLangSettings(): HashSet { - val langs = apis.map { it.lang }.toSet() - .sortedBy { SubtitleHelper.fromTwoLettersToLanguage(it) } - return langs.toHashSet() + val settingsManager = PreferenceManager.getDefaultSharedPreferences(this) + val hashSet = HashSet() + hashSet.add("en") // def is only en + val list = settingsManager.getStringSet( + this.getString(R.string.provider_lang_key), + hashSet.toMutableSet() + ) -// val settingsManager = PreferenceManager.getDefaultSharedPreferences(this) -// val hashSet = HashSet() -// hashSet.add("en") // def is only en -// val list = settingsManager.getStringSet( -// this.getString(R.string.provider_lang_key), -// hashSet.toMutableSet() -// ) -// -// if (list.isNullOrEmpty()) return hashSet -// return list.toHashSet() + if (list.isNullOrEmpty()) return hashSet + return list.toHashSet() } fun Context.getApiTypeSettings(): HashSet { diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/setup/SetupFragmentExtensions.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/setup/SetupFragmentExtensions.kt index c4bf7580..7b7e5458 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/setup/SetupFragmentExtensions.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/setup/SetupFragmentExtensions.kt @@ -96,7 +96,7 @@ class SetupFragmentExtensions : Fragment() { next_btt?.setOnClickListener { // Continue setup if (isSetup) - findNavController().navigate(R.id.action_navigation_setup_extensions_to_navigation_setup_media) + findNavController().navigate(R.id.action_navigation_setup_extensions_to_navigation_setup_provider_languages) else findNavController().navigate(R.id.navigation_home) } diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/setup/SetupFragmentLanguage.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/setup/SetupFragmentLanguage.kt index f9268d77..71472328 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/setup/SetupFragmentLanguage.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/setup/SetupFragmentLanguage.kt @@ -85,7 +85,7 @@ class SetupFragmentLanguage : Fragment() { && PluginManager.getPluginsLocal().isEmpty() //&& PREBUILT_REPOSITORIES.isNotEmpty() ) R.id.action_navigation_global_to_navigation_setup_extensions - else R.id.action_navigation_setup_language_to_navigation_setup_media + else R.id.action_navigation_setup_language_to_navigation_setup_provider_languages findNavController().navigate( nextDestination, diff --git a/app/src/main/res/navigation/mobile_navigation.xml b/app/src/main/res/navigation/mobile_navigation.xml index 94d489fd..3c45ee70 100644 --- a/app/src/main/res/navigation/mobile_navigation.xml +++ b/app/src/main/res/navigation/mobile_navigation.xml @@ -522,13 +522,6 @@ app:exitAnim="@anim/exit_anim" app:popEnterAnim="@anim/enter_anim" app:popExitAnim="@anim/exit_anim" /> - -