Commit 53931274 authored by Torsten Grote's avatar Torsten Grote

Merge branch 'show-blocked-country-names' into 'master'

Show names of countries where Tor is blocked

See merge request !886
parents 52efbcac 0e6c374d
......@@ -300,8 +300,26 @@ public class SettingsFragment extends PreferenceFragmentCompat
}
private void setBlockedCountries() {
List<String> countries = new ArrayList<>(asList(BLOCKED));
countries.removeAll(asList(BRIDGES));
List<String> countryCodes = new ArrayList<>(asList(BLOCKED));
countryCodes.removeAll(asList(BRIDGES));
// Look up country names in the user's chosen language if available
Locale[] locales = Locale.getAvailableLocales();
List<String> countries = new ArrayList<>(countryCodes.size());
for (String countryCode : countryCodes) {
boolean found = false;
for (Locale locale : locales) {
if (locale.getCountry().equalsIgnoreCase(countryCode)) {
countries.add(locale.getDisplayCountry());
found = true;
break;
}
}
if (!found) {
if (LOG.isLoggable(INFO))
LOG.info("No locale for " + countryCode);
countries.add(countryCode);
}
}
Collections.sort(countries);
String format = getString(R.string.tor_location_setting_hint_format);
torBlocked.setSummary(String.format(format, join(countries, ", ")));
......
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