Add api 21 check to LocalizationChannel.java (flutter/engine#7967)

This commit is contained in:
Gary Qian
2019-02-26 11:33:07 -08:00
committed by GitHub
parent 6738be784a
commit e89ce5c33f

View File

@@ -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);