Commit 22b90ab6 authored by Hussein El Feky's avatar Hussein El Feky

Simplified code

parent 44d923bb
......@@ -190,9 +190,13 @@ class SettingsFragment : Fragment(), SettingsView, AppLanguageView {
locales.forEachIndexed { index, locale ->
// If country is specified, then return the respective locale, else return the
// first locale found if the language is as specified regardless of the country.
if (locale.first == selectedLanguage && (localeIndex == -1 || locale.second == selectedCountry)) {
localeIndex = index
if (locale.second == selectedCountry) return@forEachIndexed
if (locale.first == selectedLanguage) {
if (locale.second == selectedCountry) {
localeIndex = index
return@forEachIndexed
} else if (localeIndex == -1) {
localeIndex = index
}
}
}
// This is needed if none of the device locales is implemented in the app.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment