mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Add api 21 check to LocalizationChannel.java (#7967)
This commit is contained in:
parent
113b91fe82
commit
4434a39c7d
@ -4,6 +4,7 @@
|
||||
|
||||
package io.flutter.embedding.engine.systemchannels;
|
||||
|
||||
import android.os.Build;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -35,7 +36,8 @@ public class LocalizationChannel {
|
||||
for (Locale locale : locales) {
|
||||
data.add(locale.getLanguage());
|
||||
data.add(locale.getCountry());
|
||||
data.add(locale.getScript());
|
||||
// locale.getScript() was added in API 21.
|
||||
data.add(Build.VERSION.SDK_INT >= 21 ? locale.getScript() : "");
|
||||
data.add(locale.getVariant());
|
||||
}
|
||||
channel.invokeMethod("setLocale", data);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user