mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-12-03 03:00:23 +01:00
39 lines
1.7 KiB
Java
39 lines
1.7 KiB
Java
package androidx.appcompat.app;
|
|
|
|
import android.os.LocaleList;
|
|
import androidx.annotation.RequiresApi;
|
|
import androidx.core.os.LocaleListCompat;
|
|
import java.util.LinkedHashSet;
|
|
import java.util.Locale;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
@RequiresApi(24)
|
|
/* loaded from: classes.dex */
|
|
final class LocaleOverlayHelper {
|
|
private LocaleOverlayHelper() {
|
|
}
|
|
|
|
private static LocaleListCompat combineLocales(LocaleListCompat localeListCompat, LocaleListCompat localeListCompat2) {
|
|
LinkedHashSet linkedHashSet = new LinkedHashSet();
|
|
int i = 0;
|
|
while (i < localeListCompat2.size() + localeListCompat.size()) {
|
|
Locale locale = i < localeListCompat.size() ? localeListCompat.get(i) : localeListCompat2.get(i - localeListCompat.size());
|
|
if (locale != null) {
|
|
linkedHashSet.add(locale);
|
|
}
|
|
i++;
|
|
}
|
|
return LocaleListCompat.create((Locale[]) linkedHashSet.toArray(new Locale[linkedHashSet.size()]));
|
|
}
|
|
|
|
public static LocaleListCompat combineLocalesIfOverlayExists(LocaleList localeList, LocaleList localeList2) {
|
|
return (localeList == null || localeList.isEmpty()) ? LocaleListCompat.getEmptyLocaleList() : combineLocales(LocaleListCompat.wrap(localeList), LocaleListCompat.wrap(localeList2));
|
|
}
|
|
|
|
public static LocaleListCompat combineLocalesIfOverlayExists(LocaleListCompat localeListCompat, LocaleListCompat localeListCompat2) {
|
|
if (localeListCompat != null && !localeListCompat.isEmpty()) {
|
|
return combineLocales(localeListCompat, localeListCompat2);
|
|
}
|
|
return LocaleListCompat.getEmptyLocaleList();
|
|
}
|
|
}
|