diff --git a/app/build.gradle b/app/build.gradle index 41a942e0..0edf32a5 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -28,7 +28,7 @@ android { } lintOptions { warning 'MissingTranslation' - disable 'GoogleAppIndexingWarning','GoogleAppIndexingApiWarning','TrulyRandom','BadHostnameVerifier','IconMissingDensityFolder','IconLocation','UnusedAttribute' + disable 'GoogleAppIndexingWarning','GoogleAppIndexingApiWarning','TrulyRandom','BadHostnameVerifier','IconMissingDensityFolder','IconLocation','UnusedAttribute','GetLocales' } } diff --git a/app/src/main/java/com/github/yeriomin/yalpstore/NativeDeviceInfoProvider.java b/app/src/main/java/com/github/yeriomin/yalpstore/NativeDeviceInfoProvider.java index 3e33eae0..4a797042 100644 --- a/app/src/main/java/com/github/yeriomin/yalpstore/NativeDeviceInfoProvider.java +++ b/app/src/main/java/com/github/yeriomin/yalpstore/NativeDeviceInfoProvider.java @@ -21,6 +21,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; +import java.util.Locale; import java.util.TimeZone; public class NativeDeviceInfoProvider implements DeviceInfoProvider { @@ -198,8 +199,16 @@ static public List getFeatures(Context context) { } static public List getLocales(Context context) { + List rawLocales = new ArrayList<>(); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + rawLocales.addAll(Arrays.asList(context.getAssets().getLocales())); + } else { + for (Locale locale: Locale.getAvailableLocales()) { + rawLocales.add(locale.toString()); + } + } List locales = new ArrayList<>(); - for (String locale: context.getAssets().getLocales()) { + for (String locale: rawLocales) { if (TextUtils.isEmpty(locale)) { continue; }