未验证 提交 8cb3965a 编写于 作者: G Gary Qian 提交者: GitHub

Properly gate android API < 21 and remove extraneous data array. (#6619)

上级 2091c0db
...@@ -342,16 +342,8 @@ public class FlutterView extends SurfaceView ...@@ -342,16 +342,8 @@ public class FlutterView extends SurfaceView
} }
// Fallback single locale passing for android API < 24. Should work always. // Fallback single locale passing for android API < 24. Should work always.
Locale locale = config.locale; Locale locale = config.locale;
List<String> data = new ArrayList<String>(); // getScript() is gated because it is added in API 21.
data.add(locale.getLanguage()); mFlutterLocalizationChannel.invokeMethod("setLocale", Arrays.asList(locale.getLanguage(), locale.getCountry(), Build.VERSION.SDK_INT >= 21 ? locale.getScript() : "", locale.getVariant()));
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()));
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册