diff --git a/app/src/main/java/com/lagradost/cloudstream3/MainActivity.kt b/app/src/main/java/com/lagradost/cloudstream3/MainActivity.kt
index 44f78703..3cf5de18 100644
--- a/app/src/main/java/com/lagradost/cloudstream3/MainActivity.kt
+++ b/app/src/main/java/com/lagradost/cloudstream3/MainActivity.kt
@@ -183,7 +183,7 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
R.id.navigation_settings_updates,
R.id.navigation_settings_ui,
R.id.navigation_settings_account,
- R.id.navigation_settings_lang,
+ R.id.navigation_settings_providers,
R.id.navigation_settings_general,
R.id.navigation_settings_extensions,
R.id.navigation_settings_plugins,
diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsFragment.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsFragment.kt
index 7e26afb5..40c996cc 100644
--- a/app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsFragment.kt
+++ b/app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsFragment.kt
@@ -173,7 +173,7 @@ class SettingsFragment : Fragment() {
Pair(settings_player, R.id.action_navigation_settings_to_navigation_settings_player),
Pair(settings_credits, R.id.action_navigation_settings_to_navigation_settings_account),
Pair(settings_ui, R.id.action_navigation_settings_to_navigation_settings_ui),
- Pair(settings_lang, R.id.action_navigation_settings_to_navigation_settings_lang),
+ Pair(settings_providers, R.id.action_navigation_settings_to_navigation_settings_providers),
Pair(settings_updates, R.id.action_navigation_settings_to_navigation_settings_updates),
Pair(
settings_extensions,
diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsGeneral.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsGeneral.kt
index 389d52c3..0ae7a258 100644
--- a/app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsGeneral.kt
+++ b/app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsGeneral.kt
@@ -1,5 +1,6 @@
package com.lagradost.cloudstream3.ui.settings
+import android.content.Context
import android.content.Intent
import android.net.Uri
import android.os.Build
@@ -17,6 +18,7 @@ import com.lagradost.cloudstream3.APIHolder.allProviders
import com.lagradost.cloudstream3.AcraApplication
import com.lagradost.cloudstream3.AcraApplication.Companion.getKey
import com.lagradost.cloudstream3.AcraApplication.Companion.setKey
+import com.lagradost.cloudstream3.CommonActivity
import com.lagradost.cloudstream3.CommonActivity.showToast
import com.lagradost.cloudstream3.R
import com.lagradost.cloudstream3.app
@@ -30,6 +32,7 @@ import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.setUpTo
import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showBottomDialog
import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showDialog
import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showMultiDialog
+import com.lagradost.cloudstream3.utils.SubtitleHelper
import com.lagradost.cloudstream3.utils.UIHelper.dismissSafe
import com.lagradost.cloudstream3.utils.UIHelper.hideKeyboard
import com.lagradost.cloudstream3.utils.USER_PROVIDER_API
@@ -39,6 +42,44 @@ import kotlinx.android.synthetic.main.add_remove_sites.*
import kotlinx.android.synthetic.main.add_site_input.*
import java.io.File
+fun getCurrentLocale(context: Context): String {
+ val res = context.resources
+ // Change locale settings in the app.
+ // val dm = res.displayMetrics
+ val conf = res.configuration
+ return conf?.locale?.language ?: "en"
+}
+
+// idk, if you find a way of automating this it would be great
+// https://www.iemoji.com/view/emoji/1794/flags/antarctica
+// Emoji Character Encoding Data --> C/C++/Java Src
+// https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes leave blank for auto
+val appLanguages = arrayListOf(
+ Triple("", "Spanish", "es"),
+ Triple("", "English", "en"),
+ Triple("", "Viet Nam", "vi"),
+ Triple("", "Dutch", "nl"),
+ Triple("", "French", "fr"),
+ Triple("", "Greek", "el"),
+ Triple("", "Swedish", "sv"),
+ Triple("", "Tagalog", "tl"),
+ Triple("", "Polish", "pl"),
+ Triple("", "Hindi", "hi"),
+ Triple("", "Malayalam", "ml"),
+ Triple("", "Norsk", "no"),
+ Triple("", "German", "de"),
+ Triple("", "Arabic", "ar"),
+ Triple("", "Turkish", "tr"),
+ Triple("", "Macedonian", "mk"),
+ Triple("\uD83C\uDDF5\uD83C\uDDF9", "Portuguese", "pt"),
+ Triple("\uD83C\uDDE7\uD83C\uDDF7", "Brazilian Portuguese", "bp"),
+ Triple("", "Romanian", "ro"),
+ Triple("", "Italian", "it"),
+ Triple("", "Chinese", "zh"),
+ Triple("\uD83C\uDDEE\uD83C\uDDE9", "Indonesian", "in"),
+ Triple("", "Czech", "cs"),
+).sortedBy { it.second } //ye, we go alphabetical, so ppl don't put their lang on top
+
class SettingsGeneral : PreferenceFragmentCompat() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
@@ -95,6 +136,35 @@ class SettingsGeneral : PreferenceFragmentCompat() {
?: mutableListOf()
}
+ getPref(R.string.locale_key)?.setOnPreferenceClickListener { pref ->
+ val tempLangs = appLanguages.toMutableList()
+ //if (beneneCount > 100) {
+ // tempLangs.add(Triple("\uD83E\uDD8D", "mmmm... monke", "mo"))
+ //}
+ val current = getCurrentLocale(pref.context)
+ val languageCodes = tempLangs.map { (_, _, iso) -> iso }
+ val languageNames = tempLangs.map { (emoji, name, iso) ->
+ val flag = emoji.ifBlank { SubtitleHelper.getFlagFromIso(iso) ?: "ERROR" }
+ "$flag $name"
+ }
+ val index = languageCodes.indexOf(current)
+
+ activity?.showDialog(
+ languageNames, index, getString(R.string.app_language), true, { }
+ ) { languageIndex ->
+ try {
+ val code = languageCodes[languageIndex]
+ CommonActivity.setLocale(activity, code)
+ settingsManager.edit().putString(getString(R.string.locale_key), code).apply()
+ activity?.recreate()
+ } catch (e: Exception) {
+ logError(e)
+ }
+ }
+ return@setOnPreferenceClickListener true
+ }
+
+
fun showAdd() {
val providers = allProviders.distinctBy { it.javaClass }.sortedBy { it.name }
activity?.showDialog(
diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsLang.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsProviders.kt
similarity index 64%
rename from app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsLang.kt
rename to app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsProviders.kt
index b038f21a..7bba9d88 100644
--- a/app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsLang.kt
+++ b/app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsProviders.kt
@@ -20,54 +20,18 @@ import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showMultiDialog
import com.lagradost.cloudstream3.utils.SubtitleHelper
import com.lagradost.cloudstream3.utils.UIHelper.hideKeyboard
-fun getCurrentLocale(context: Context): String {
- val res = context.resources
- // Change locale settings in the app.
- // val dm = res.displayMetrics
- val conf = res.configuration
- return conf?.locale?.language ?: "en"
-}
-// idk, if you find a way of automating this it would be great
-// https://www.iemoji.com/view/emoji/1794/flags/antarctica
-// Emoji Character Encoding Data --> C/C++/Java Src
-// https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes leave blank for auto
-val appLanguages = arrayListOf(
- Triple("", "Spanish", "es"),
- Triple("", "English", "en"),
- Triple("", "Viet Nam", "vi"),
- Triple("", "Dutch", "nl"),
- Triple("", "French", "fr"),
- Triple("", "Greek", "el"),
- Triple("", "Swedish", "sv"),
- Triple("", "Tagalog", "tl"),
- Triple("", "Polish", "pl"),
- Triple("", "Hindi", "hi"),
- Triple("", "Malayalam", "ml"),
- Triple("", "Norsk", "no"),
- Triple("", "German", "de"),
- Triple("", "Arabic", "ar"),
- Triple("", "Turkish", "tr"),
- Triple("", "Macedonian", "mk"),
- Triple("\uD83C\uDDF5\uD83C\uDDF9", "Portuguese", "pt"),
- Triple("\uD83C\uDDE7\uD83C\uDDF7", "Brazilian Portuguese", "bp"),
- Triple("", "Romanian", "ro"),
- Triple("", "Italian", "it"),
- Triple("", "Chinese", "zh"),
- Triple("\uD83C\uDDEE\uD83C\uDDE9", "Indonesian", "in"),
- Triple("", "Czech", "cs"),
-).sortedBy { it.second } //ye, we go alphabetical, so ppl don't put their lang on top
-class SettingsLang : PreferenceFragmentCompat() {
+class SettingsProviders : PreferenceFragmentCompat() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
- setUpToolbar(R.string.category_preferred_media_and_lang)
+ setUpToolbar(R.string.category_providers)
setPaddingBottom()
}
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
hideKeyboard()
- setPreferencesFromResource(R.xml.settings_media_lang, rootKey)
+ setPreferencesFromResource(R.xml.settings_providers, rootKey)
val settingsManager = PreferenceManager.getDefaultSharedPreferences(requireContext())
getPref(R.string.display_sub_key)?.setOnPreferenceClickListener {
@@ -123,34 +87,6 @@ class SettingsLang : PreferenceFragmentCompat() {
return@setOnPreferenceClickListener true
}
- getPref(R.string.locale_key)?.setOnPreferenceClickListener { pref ->
- val tempLangs = appLanguages.toMutableList()
- //if (beneneCount > 100) {
- // tempLangs.add(Triple("\uD83E\uDD8D", "mmmm... monke", "mo"))
- //}
- val current = getCurrentLocale(pref.context)
- val languageCodes = tempLangs.map { (_, _, iso) -> iso }
- val languageNames = tempLangs.map { (emoji, name, iso) ->
- val flag = emoji.ifBlank { SubtitleHelper.getFlagFromIso(iso) ?: "ERROR" }
- "$flag $name"
- }
- val index = languageCodes.indexOf(current)
-
- activity?.showDialog(
- languageNames, index, getString(R.string.app_language), true, { }
- ) { languageIndex ->
- try {
- val code = languageCodes[languageIndex]
- CommonActivity.setLocale(activity, code)
- settingsManager.edit().putString(getString(R.string.locale_key), code).apply()
- activity?.recreate()
- } catch (e: Exception) {
- logError(e)
- }
- }
- return@setOnPreferenceClickListener true
- }
-
getPref(R.string.provider_lang_key)?.setOnPreferenceClickListener {
activity?.getApiProviderLangSettings()?.let { current ->
val langs = APIHolder.apis.map { it.lang }.toSet()
diff --git a/app/src/main/res/layout/main_settings.xml b/app/src/main/res/layout/main_settings.xml
index 11dd7d5c..1527599c 100644
--- a/app/src/main/res/layout/main_settings.xml
+++ b/app/src/main/res/layout/main_settings.xml
@@ -65,22 +65,22 @@
style="@style/SettingsItem"
android:nextFocusUp="@id/settings_general"
- android:nextFocusDown="@id/settings_lang"
+ android:nextFocusDown="@id/settings_providers"
android:text="@string/category_player" />
+ android:text="@string/category_providers" />
diff --git a/app/src/main/res/navigation/mobile_navigation.xml b/app/src/main/res/navigation/mobile_navigation.xml
index 3fd7abb7..3c45ee70 100644
--- a/app/src/main/res/navigation/mobile_navigation.xml
+++ b/app/src/main/res/navigation/mobile_navigation.xml
@@ -205,8 +205,8 @@
tools:layout="@layout/fragment_webview" />
Layout do App
Mídia preferida
Codificação das legendas
- Linguagem
Layout
Auto
diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml
index 1703b5d5..aa840760 100644
--- a/app/src/main/res/values-cs/strings.xml
+++ b/app/src/main/res/values-cs/strings.xml
@@ -342,7 +342,6 @@
Rozložení aplikace
Preferovaná média
Kódování titulků
- Jazyk
Rozložení
Automaticky
diff --git a/app/src/main/res/values-de/strings-de.xml b/app/src/main/res/values-de/strings-de.xml
index cc301da8..435ac9a0 100644
--- a/app/src/main/res/values-de/strings-de.xml
+++ b/app/src/main/res/values-de/strings-de.xml
@@ -344,7 +344,6 @@
App Layout
Bevorzugte Medien
Untertitel-Kodierung
- Sprache
Layout
Auto
diff --git a/app/src/main/res/values-es/strings-es.xml b/app/src/main/res/values-es/strings-es.xml
index d845cf82..9b739b39 100644
--- a/app/src/main/res/values-es/strings-es.xml
+++ b/app/src/main/res/values-es/strings-es.xml
@@ -346,8 +346,7 @@
Idiomas del proveedor
Diseño de la aplicación
Medios preferidos
- Codificación de subtítulos
- Idioma
+ Codificación de subtítulos
Diseño
Automático
diff --git a/app/src/main/res/values-in/strings.xml b/app/src/main/res/values-in/strings.xml
index 4abb6bf9..e8f7e9e9 100644
--- a/app/src/main/res/values-in/strings.xml
+++ b/app/src/main/res/values-in/strings.xml
@@ -337,7 +337,6 @@
Bahasa provider
Tata Letak Aplikasi
Media yang lebih diinginkan
- Media dan bahasa yang lebih diinginkan
Antarmuka pengguna
Otomatis
diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml
index cb6d7bda..b990a7f6 100644
--- a/app/src/main/res/values-it/strings.xml
+++ b/app/src/main/res/values-it/strings.xml
@@ -333,7 +333,6 @@
Layout app
Media preferito
Encoding Sottotitoli
- Media e lingua preferiti
Interfaccia utente
Auto
diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml
index 4a721ce4..c51dbcbb 100644
--- a/app/src/main/res/values-nl/strings.xml
+++ b/app/src/main/res/values-nl/strings.xml
@@ -337,7 +337,6 @@
App Layout
Preferred media
Subtitle encoding
- Language
Layout
Auto
diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml
index 08f01cdb..83b87a20 100644
--- a/app/src/main/res/values-pl/strings.xml
+++ b/app/src/main/res/values-pl/strings.xml
@@ -311,7 +311,6 @@
Preferowane media
Kodowanie napisów
- Język
Układ interfejsu
Automatyczny
Układ dla telewizorów
diff --git a/app/src/main/res/values-pt/strings-pt.xml b/app/src/main/res/values-pt/strings-pt.xml
index 55ad9d0a..9bf52a83 100644
--- a/app/src/main/res/values-pt/strings-pt.xml
+++ b/app/src/main/res/values-pt/strings-pt.xml
@@ -342,7 +342,6 @@
Layout da App
Mídia preferida
Codificação das legendas
- Linguagem
Layout
Auto
diff --git a/app/src/main/res/values-ro/strings.xml b/app/src/main/res/values-ro/strings.xml
index 540e7644..7d1f3458 100644
--- a/app/src/main/res/values-ro/strings.xml
+++ b/app/src/main/res/values-ro/strings.xml
@@ -347,7 +347,6 @@
Aplicație de prezentare
Media preferată
Codificarea subtitrărilor
- Media și limba preferată
Interfața utilizatorului
Auto
diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml
index 513ac315..1e76adc9 100644
--- a/app/src/main/res/values-tr/strings.xml
+++ b/app/src/main/res/values-tr/strings.xml
@@ -350,7 +350,6 @@
Uygulama düzeni
Tercih edilen medya
Alt yazı kodlaması
- Dil
Düzen
Otomatik
diff --git a/app/src/main/res/values-vi/strings.xml b/app/src/main/res/values-vi/strings.xml
index 8454187a..61c9a779 100644
--- a/app/src/main/res/values-vi/strings.xml
+++ b/app/src/main/res/values-vi/strings.xml
@@ -348,7 +348,6 @@
Giao diện App
Thể loại ưu tiên
Mã hoá phụ đề
- Ngôn ngữ
Giao diện
Tự động
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 268d6246..fea0fe83 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -447,7 +447,7 @@
Preferred media
Enable NSFW on supported providers
Subtitle encoding
- Language
+ Providers
Layout
Auto
diff --git a/app/src/main/res/xml/settings_media_lang.xml b/app/src/main/res/xml/settings_providers.xml
similarity index 84%
rename from app/src/main/res/xml/settings_media_lang.xml
rename to app/src/main/res/xml/settings_providers.xml
index 2244eff8..a177865b 100644
--- a/app/src/main/res/xml/settings_media_lang.xml
+++ b/app/src/main/res/xml/settings_providers.xml
@@ -1,10 +1,6 @@
-
+
+