- Added realracing3-community.apk (71.57 MB) - Removed 32-bit support (armeabi-v7a) - Only includes arm64-v8a libraries - Decompiled source code included - Added README-community.md with analysis
86 lines
2.4 KiB
Java
86 lines
2.4 KiB
Java
package androidx.core.text;
|
|
|
|
import android.annotation.SuppressLint;
|
|
import android.icu.util.ULocale;
|
|
import android.util.Log;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.Nullable;
|
|
import androidx.annotation.RequiresApi;
|
|
import java.lang.reflect.InvocationTargetException;
|
|
import java.lang.reflect.Method;
|
|
import java.util.Locale;
|
|
|
|
/* loaded from: classes.dex */
|
|
public final class ICUCompat {
|
|
private static final String TAG = "ICUCompat";
|
|
private static Method sAddLikelySubtagsMethod;
|
|
private static Method sGetScriptMethod;
|
|
|
|
@Nullable
|
|
public static String maximizeAndGetScript(@NonNull Locale locale) {
|
|
return Api24Impl.getScript(Api24Impl.addLikelySubtags(Api24Impl.forLocale(locale)));
|
|
}
|
|
|
|
@SuppressLint({"BanUncheckedReflection"})
|
|
private static String getScriptBelowApi21(String str) {
|
|
try {
|
|
Method method = sGetScriptMethod;
|
|
if (method != null) {
|
|
return (String) method.invoke(null, str);
|
|
}
|
|
} catch (IllegalAccessException e) {
|
|
Log.w(TAG, e);
|
|
} catch (InvocationTargetException e2) {
|
|
Log.w(TAG, e2);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
@SuppressLint({"BanUncheckedReflection"})
|
|
private static String addLikelySubtagsBelowApi21(Locale locale) {
|
|
String locale2 = locale.toString();
|
|
try {
|
|
Method method = sAddLikelySubtagsMethod;
|
|
if (method != null) {
|
|
return (String) method.invoke(null, locale2);
|
|
}
|
|
} catch (IllegalAccessException e) {
|
|
Log.w(TAG, e);
|
|
} catch (InvocationTargetException e2) {
|
|
Log.w(TAG, e2);
|
|
}
|
|
return locale2;
|
|
}
|
|
|
|
private ICUCompat() {
|
|
}
|
|
|
|
@RequiresApi(24)
|
|
public static class Api24Impl {
|
|
private Api24Impl() {
|
|
}
|
|
|
|
public static ULocale forLocale(Locale locale) {
|
|
return ULocale.forLocale(locale);
|
|
}
|
|
|
|
public static ULocale addLikelySubtags(Object obj) {
|
|
return ULocale.addLikelySubtags((ULocale) obj);
|
|
}
|
|
|
|
public static String getScript(Object obj) {
|
|
return ((ULocale) obj).getScript();
|
|
}
|
|
}
|
|
|
|
@RequiresApi(21)
|
|
public static class Api21Impl {
|
|
private Api21Impl() {
|
|
}
|
|
|
|
public static String getScript(Locale locale) {
|
|
return locale.getScript();
|
|
}
|
|
}
|
|
}
|