forked from recloudstream/cloudstream
Remove provider language (#141)
This commit is contained in:
parent
98ef6a3f16
commit
a43e950a48
5 changed files with 36 additions and 13 deletions
|
@ -17,8 +17,7 @@ import com.lagradost.cloudstream3.ui.player.SubtitleData
|
|||
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.isTvSettings
|
||||
import com.lagradost.cloudstream3.utils.AppUtils.toJson
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
import com.lagradost.cloudstream3.utils.Qualities
|
||||
import com.lagradost.cloudstream3.utils.loadExtractor
|
||||
import com.lagradost.cloudstream3.utils.SubtitleHelper
|
||||
import okhttp3.Interceptor
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
|
@ -191,17 +190,26 @@ 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<String> {
|
||||
val settingsManager = PreferenceManager.getDefaultSharedPreferences(this)
|
||||
val hashSet = HashSet<String>()
|
||||
hashSet.add("en") // def is only en
|
||||
val list = settingsManager.getStringSet(
|
||||
this.getString(R.string.provider_lang_key),
|
||||
hashSet.toMutableSet()
|
||||
)
|
||||
val langs = apis.map { it.lang }.toSet()
|
||||
.sortedBy { SubtitleHelper.fromTwoLettersToLanguage(it) }
|
||||
return langs.toHashSet()
|
||||
|
||||
if (list.isNullOrEmpty()) return hashSet
|
||||
return list.toHashSet()
|
||||
// val settingsManager = PreferenceManager.getDefaultSharedPreferences(this)
|
||||
// val hashSet = HashSet<String>()
|
||||
// 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> {
|
||||
|
|
|
@ -100,7 +100,7 @@ class SetupFragmentExtensions : Fragment() {
|
|||
next_btt?.setOnClickListener {
|
||||
// Continue setup
|
||||
if (isSetup)
|
||||
findNavController().navigate(R.id.action_navigation_setup_extensions_to_navigation_setup_provider_languages)
|
||||
findNavController().navigate(R.id.action_navigation_setup_extensions_to_navigation_setup_media)
|
||||
else
|
||||
findNavController().navigate(R.id.navigation_home)
|
||||
}
|
||||
|
|
|
@ -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_provider_languages
|
||||
else R.id.action_navigation_setup_language_to_navigation_setup_media
|
||||
|
||||
findNavController().navigate(
|
||||
nextDestination,
|
||||
|
|
|
@ -522,6 +522,13 @@
|
|||
app:exitAnim="@anim/exit_anim"
|
||||
app:popEnterAnim="@anim/enter_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>
|
||||
|
||||
<action
|
||||
|
@ -553,6 +560,13 @@
|
|||
app:exitAnim="@anim/exit_anim"
|
||||
app:popEnterAnim="@anim/enter_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
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<Preference
|
||||
app:isPreferenceVisible="false"
|
||||
android:icon="@drawable/ic_baseline_language_24"
|
||||
android:key="@string/provider_lang_key"
|
||||
android:title="@string/provider_lang_settings" />
|
||||
|
|
Loading…
Reference in a new issue