Java Code Examples for org.telegram.messenger.LocaleController#getInstance()
The following examples show how to use
org.telegram.messenger.LocaleController#getInstance() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LanguageSelectActivity.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
private void fillLanguages() { sortedLanguages = new ArrayList<>(LocaleController.getInstance().languages); final LocaleController.LocaleInfo currentLocale = LocaleController.getInstance().getCurrentLocaleInfo(); Collections.sort(sortedLanguages, (o, o2) -> { if (o == currentLocale) { return -1; } else if (o2 == currentLocale) { return 1; } return o.name.compareTo(o2.name); }); }
Example 2
Source File: LanguageSelectActivity.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
private void fillLanguages() { sortedLanguages = new ArrayList<>(LocaleController.getInstance().languages); final LocaleController.LocaleInfo currentLocale = LocaleController.getInstance().getCurrentLocaleInfo(); Collections.sort(sortedLanguages, (o, o2) -> { if (o == currentLocale) { return -1; } else if (o2 == currentLocale) { return 1; } return o.name.compareTo(o2.name); }); }
Example 3
Source File: LanguageSelectActivity.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
private void fillLanguages() { final LocaleController.LocaleInfo currentLocale = LocaleController.getInstance().getCurrentLocaleInfo(); Comparator<LocaleController.LocaleInfo> comparator = (o, o2) -> { if (o == currentLocale) { return -1; } else if (o2 == currentLocale) { return 1; } else if (o.serverIndex == o2.serverIndex) { return o.name.compareTo(o2.name); } if (o.serverIndex > o2.serverIndex) { return 1; } else if (o.serverIndex < o2.serverIndex) { return -1; } return 0; }; sortedLanguages = new ArrayList<>(); unofficialLanguages = new ArrayList<>(LocaleController.getInstance().unofficialLanguages); ArrayList<LocaleController.LocaleInfo> arrayList = LocaleController.getInstance().languages; for (int a = 0, size = arrayList.size(); a < size; a++) { LocaleController.LocaleInfo info = arrayList.get(a); if (info.serverIndex != Integer.MAX_VALUE) { sortedLanguages.add(info); } else { unofficialLanguages.add(info); } } Collections.sort(sortedLanguages, comparator); Collections.sort(unofficialLanguages, comparator); }
Example 4
Source File: LanguageSelectActivity.java From Telegram with GNU General Public License v2.0 | 5 votes |
private void fillLanguages() { final LocaleController.LocaleInfo currentLocale = LocaleController.getInstance().getCurrentLocaleInfo(); Comparator<LocaleController.LocaleInfo> comparator = (o, o2) -> { if (o == currentLocale) { return -1; } else if (o2 == currentLocale) { return 1; } else if (o.serverIndex == o2.serverIndex) { return o.name.compareTo(o2.name); } if (o.serverIndex > o2.serverIndex) { return 1; } else if (o.serverIndex < o2.serverIndex) { return -1; } return 0; }; sortedLanguages = new ArrayList<>(); unofficialLanguages = new ArrayList<>(LocaleController.getInstance().unofficialLanguages); ArrayList<LocaleController.LocaleInfo> arrayList = LocaleController.getInstance().languages; for (int a = 0, size = arrayList.size(); a < size; a++) { LocaleController.LocaleInfo info = arrayList.get(a); if (info.serverIndex != Integer.MAX_VALUE) { sortedLanguages.add(info); } else { unofficialLanguages.add(info); } } Collections.sort(sortedLanguages, comparator); Collections.sort(unofficialLanguages, comparator); }