Skip to content

Commit

Permalink
Properly gate android API < 21 and remove extraneous data array. (flu…
Browse files Browse the repository at this point in the history
  • Loading branch information
GaryQian authored Oct 19, 2018
1 parent 2091c0d commit 8cb3965
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions shell/platform/android/io/flutter/view/FlutterView.java
Original file line number Diff line number Diff line change
Expand Up @@ -342,16 +342,8 @@ private void setLocales(Configuration config) {
}
// Fallback single locale passing for android API < 24. Should work always.
Locale locale = config.locale;
List<String> data = new ArrayList<String>();
data.add(locale.getLanguage());
data.add(locale.getCountry());
if (Build.VERSION.SDK_INT >= 21) {
data.add(locale.getScript());
} else {
data.add("");
}
data.add(locale.getVariant());
mFlutterLocalizationChannel.invokeMethod("setLocale", Arrays.asList(locale.getLanguage(), locale.getCountry(), locale.getScript(), locale.getVariant()));
// getScript() is gated because it is added in API 21.
mFlutterLocalizationChannel.invokeMethod("setLocale", Arrays.asList(locale.getLanguage(), locale.getCountry(), Build.VERSION.SDK_INT >= 21 ? locale.getScript() : "", locale.getVariant()));

}

Expand Down

0 comments on commit 8cb3965

Please sign in to comment.