smol tweaks to the previous commit

This commit is contained in:
Cloudburst 2022-11-27 10:37:36 +01:00 committed by GitHub
parent 9be50eb28b
commit c513708d74
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 16 deletions

View file

@ -8,7 +8,6 @@ import androidx.appcompat.widget.SearchView
import androidx.core.view.isVisible import androidx.core.view.isVisible
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels import androidx.fragment.app.activityViewModels
import androidx.preference.PreferenceManager
import com.lagradost.cloudstream3.APIHolder.getApiProviderLangSettings import com.lagradost.cloudstream3.APIHolder.getApiProviderLangSettings
import com.lagradost.cloudstream3.AllLanguagesName import com.lagradost.cloudstream3.AllLanguagesName
import com.lagradost.cloudstream3.R import com.lagradost.cloudstream3.R
@ -50,14 +49,10 @@ class PluginsFragment : Fragment() {
// Filter by language set on preferred media // Filter by language set on preferred media
activity?.let { activity?.let {
val settingsManager = PreferenceManager.getDefaultSharedPreferences(it) val providerLangs = it.getApiProviderLangSettings().toList()
val filter = settingsManager.getBoolean(getString(R.string.pref_filter_ext_by_lang_key), false) if (!providerLangs.contains(AllLanguagesName)) {
if (filter) { pluginViewModel.languages = mutableListOf("none") + providerLangs
val providerLangs = it.getApiProviderLangSettings().toList() //Log.i("DevDebug", "providerLang => ${pluginViewModel.languages.toJson()}")
if (!providerLangs.contains(AllLanguagesName)) {
pluginViewModel.languages = providerLangs
//Log.i("DevDebug", "providerLang => ${pluginViewModel.languages.toJson()}")
}
} }
} }

View file

@ -58,7 +58,6 @@
<string name="pref_filter_search_quality_key" translatable="false">pref_filter_search_quality_key</string> <string name="pref_filter_search_quality_key" translatable="false">pref_filter_search_quality_key</string>
<string name="enable_nsfw_on_providers_key" translatable="false">enable_nsfw_on_providers_key</string> <string name="enable_nsfw_on_providers_key" translatable="false">enable_nsfw_on_providers_key</string>
<string name="enable_skip_op_from_database" translatable="false">enable_skip_op_from_database</string> <string name="enable_skip_op_from_database" translatable="false">enable_skip_op_from_database</string>
<string name="pref_filter_ext_by_lang_key" translatable="false">pref_filter_ext_by_lang_key</string>
<!-- FORMAT MIGHT TRANSLATE, WILL CAUSE CRASH IF APPLIED WRONG --> <!-- FORMAT MIGHT TRANSLATE, WILL CAUSE CRASH IF APPLIED WRONG -->
<string name="extra_info_format" formatted="true" translatable="false">%d %s | %s</string> <string name="extra_info_format" formatted="true" translatable="false">%d %s | %s</string>
@ -449,7 +448,6 @@
<string name="app_layout">App Layout</string> <string name="app_layout">App Layout</string>
<string name="preferred_media_settings">Preferred media</string> <string name="preferred_media_settings">Preferred media</string>
<string name="enable_nsfw_on_providers">Enable NSFW on supported providers</string> <string name="enable_nsfw_on_providers">Enable NSFW on supported providers</string>
<string name="filter_ext_by_preferred_lang">Filter Extension list by Preferred Language</string>
<string name="subtitles_encoding">Subtitle encoding</string> <string name="subtitles_encoding">Subtitle encoding</string>
<string name="category_providers">Providers</string> <string name="category_providers">Providers</string>
<string name="category_ui">Layout</string> <string name="category_ui">Layout</string>

View file

@ -21,9 +21,4 @@
android:icon="@drawable/ic_baseline_extension_24" android:icon="@drawable/ic_baseline_extension_24"
android:summary="@string/apply_on_restart" android:summary="@string/apply_on_restart"
app:defaultValue="false"/> app:defaultValue="false"/>
<SwitchPreference
android:key="@string/pref_filter_ext_by_lang_key"
android:title="@string/filter_ext_by_preferred_lang"
android:icon="@drawable/ic_baseline_extension_24"
app:defaultValue="false"/>
</PreferenceScreen> </PreferenceScreen>