Show languages of providers in alphabetical order to make it consistent with app language selector (#1357)

Co-authored-by: Paweł <pawelmaczalowski@gmail.com>
This commit is contained in:
Bambarini 2022-07-28 15:30:29 +02:00 committed by GitHub
parent e54c951bb6
commit 4ac7e0c967
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -52,7 +52,7 @@ class SettingsLang : PreferenceFragmentCompat() {
private fun getCurrentLocale(): String {
val res = requireContext().resources
// Change locale settings in the app.
// Change locale settings in the app.
// val dm = res.displayMetrics
val conf = res.configuration
return conf?.locale?.language ?: "en"
@ -149,10 +149,11 @@ class SettingsLang : PreferenceFragmentCompat() {
getPref(R.string.provider_lang_key)?.setOnPreferenceClickListener {
activity?.getApiProviderLangSettings()?.let { current ->
val allLangs = HashSet<String>()
var allLangs: MutableSet<String> = mutableSetOf()
for (api in APIHolder.apis) {
allLangs.add(api.lang)
}
allLangs = allLangs.sortedBy { SubtitleHelper.fromTwoLettersToLanguage(it) }.toMutableSet()
val currentList = ArrayList<Int>()
for (i in current) {