Revert "Remove provider language (#141)"

This reverts commit a43e950a48.
This commit is contained in:
Blatzar 2022-10-31 20:55:33 +01:00
parent 64303eab8d
commit ddae2ddf3c
5 changed files with 13 additions and 36 deletions

View file

@ -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.AppUtils.toJson
import com.lagradost.cloudstream3.utils.Coroutines.threadSafeListOf import com.lagradost.cloudstream3.utils.Coroutines.threadSafeListOf
import com.lagradost.cloudstream3.utils.ExtractorLink 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 okhttp3.Interceptor
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.* import java.util.*
@ -193,26 +194,17 @@ object APIHolder {
return list.filter { names.contains(it) }.map { DubStatus.valueOf(it) }.toHashSet() 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<String> { fun Context.getApiProviderLangSettings(): HashSet<String> {
val langs = apis.map { it.lang }.toSet() val settingsManager = PreferenceManager.getDefaultSharedPreferences(this)
.sortedBy { SubtitleHelper.fromTwoLettersToLanguage(it) } val hashSet = HashSet<String>()
return langs.toHashSet() 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) if (list.isNullOrEmpty()) return hashSet
// val hashSet = HashSet<String>() return list.toHashSet()
// 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()
} }
fun Context.getApiTypeSettings(): HashSet<TvType> { fun Context.getApiTypeSettings(): HashSet<TvType> {

View file

@ -96,7 +96,7 @@ class SetupFragmentExtensions : Fragment() {
next_btt?.setOnClickListener { next_btt?.setOnClickListener {
// Continue setup // Continue setup
if (isSetup) 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 else
findNavController().navigate(R.id.navigation_home) findNavController().navigate(R.id.navigation_home)
} }

View file

@ -85,7 +85,7 @@ class SetupFragmentLanguage : Fragment() {
&& PluginManager.getPluginsLocal().isEmpty() && PluginManager.getPluginsLocal().isEmpty()
//&& PREBUILT_REPOSITORIES.isNotEmpty() //&& PREBUILT_REPOSITORIES.isNotEmpty()
) R.id.action_navigation_global_to_navigation_setup_extensions ) 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( findNavController().navigate(
nextDestination, nextDestination,

View file

@ -522,13 +522,6 @@
app:exitAnim="@anim/exit_anim" app:exitAnim="@anim/exit_anim"
app:popEnterAnim="@anim/enter_anim" app:popEnterAnim="@anim/enter_anim"
app:popExitAnim="@anim/exit_anim" /> app:popExitAnim="@anim/exit_anim" />
<action
android:id="@+id/action_navigation_setup_language_to_navigation_setup_media"
app:destination="@id/navigation_setup_media"
app:enterAnim="@anim/enter_anim"
app:exitAnim="@anim/exit_anim"
app:popEnterAnim="@anim/enter_anim"
app:popExitAnim="@anim/exit_anim" />
</fragment> </fragment>
<action <action
@ -560,13 +553,6 @@
app:exitAnim="@anim/exit_anim" app:exitAnim="@anim/exit_anim"
app:popEnterAnim="@anim/enter_anim" app:popEnterAnim="@anim/enter_anim"
app:popExitAnim="@anim/exit_anim" /> app:popExitAnim="@anim/exit_anim" />
<action
android:id="@+id/action_navigation_setup_extensions_to_navigation_setup_media"
app:destination="@id/navigation_setup_media"
app:enterAnim="@anim/enter_anim"
app:exitAnim="@anim/exit_anim"
app:popEnterAnim="@anim/enter_anim"
app:popExitAnim="@anim/exit_anim" />
</fragment> </fragment>
<fragment <fragment

View file

@ -2,7 +2,6 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<Preference <Preference
app:isPreferenceVisible="false"
android:icon="@drawable/ic_baseline_language_24" android:icon="@drawable/ic_baseline_language_24"
android:key="@string/provider_lang_key" android:key="@string/provider_lang_key"
android:title="@string/provider_lang_settings" /> android:title="@string/provider_lang_settings" />