Merge "Correcting sort order of languages for non en-us locales"
This commit is contained in:
committed by
Android (Google) Code Review
commit
3a117e6771
@@ -53,6 +53,7 @@ import com.android.settings.widget.SeekBarPreference;
|
|||||||
import com.android.settingslib.search.SearchIndexable;
|
import com.android.settingslib.search.SearchIndexable;
|
||||||
import com.android.settingslib.widget.ActionButtonsPreference;
|
import com.android.settingslib.widget.ActionButtonsPreference;
|
||||||
|
|
||||||
|
import java.text.Collator;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@@ -521,8 +522,12 @@ public class TextToSpeechSettings extends SettingsPreferenceFragment
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort it
|
// Get the primary locale and create a Collator to sort the strings
|
||||||
Collections.sort(entryPairs, (lhs, rhs) -> lhs.first.compareToIgnoreCase(rhs.first));
|
Locale userLocale = getResources().getConfiguration().getLocales().get(0);
|
||||||
|
Collator collator = Collator.getInstance(userLocale);
|
||||||
|
|
||||||
|
// Sort the list
|
||||||
|
Collections.sort(entryPairs, (lhs, rhs) -> collator.compare(lhs.first, rhs.first));
|
||||||
|
|
||||||
// Get two arrays out of one of pairs
|
// Get two arrays out of one of pairs
|
||||||
mSelectedLocaleIndex = 0; // Will point to the R.string.tts_lang_use_system value
|
mSelectedLocaleIndex = 0; // Will point to the R.string.tts_lang_use_system value
|
||||||
|
Reference in New Issue
Block a user