Fix usage of String.toUpperCase()

This commit is contained in:
xynngh 2020-09-11 23:32:09 +04:00
parent ac2360210c
commit 37197065ce
2 changed files with 8 additions and 4 deletions

View File

@ -9,6 +9,8 @@ import androidx.preference.PreferenceManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Locale;
import dummydomain.yetanothercallblocker.data.CountryHelper;
import dummydomain.yetanothercallblocker.sia.model.database.DbManager;
@ -228,14 +230,14 @@ public class Settings extends GenericSettings {
public String getCountryCode() {
String override = getCountryCodeOverride();
if (!TextUtils.isEmpty(override)) return override.toUpperCase();
if (!TextUtils.isEmpty(override)) return override.toUpperCase(Locale.ROOT);
return getCachedAutoDetectedCountryCode();
}
public String getCountryCodeForReviews() {
String override = getCountryCodeForReviewsOverride();
if (!TextUtils.isEmpty(override)) return override.toUpperCase();
if (!TextUtils.isEmpty(override)) return override.toUpperCase(Locale.ROOT);
String code = getCachedAutoDetectedCountryCode();
return !TextUtils.isEmpty(code) ? code : "US";

View File

@ -9,6 +9,8 @@ import androidx.core.os.ConfigurationCompat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Locale;
public class CountryHelper {
private static final Logger LOG = LoggerFactory.getLogger(CountryHelper.class);
@ -20,10 +22,10 @@ public class CountryHelper {
if (tm != null) {
String countryCode = tm.getNetworkCountryIso();
if (!TextUtils.isEmpty(countryCode)) return countryCode.toUpperCase();
if (!TextUtils.isEmpty(countryCode)) return countryCode.toUpperCase(Locale.ROOT);
countryCode = tm.getSimCountryIso();
if (!TextUtils.isEmpty(countryCode)) return countryCode.toUpperCase();
if (!TextUtils.isEmpty(countryCode)) return countryCode.toUpperCase(Locale.ROOT);
}
String countryCode = ConfigurationCompat