what-the-bank/sources/o/C15562gtw.java

63 lines
2.7 KiB
Java

package o;
import com.airbnb.deeplinkdispatch.base.MatchIndex;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Locale;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
/* JADX INFO: Access modifiers changed from: package-private */
/* renamed from: o.gtw, reason: case insensitive filesystem */
/* loaded from: classes6.dex */
public final class C15562gtw extends AbstractC15551gtl {
private static final ConcurrentMap<String, Object> FORMATTER_CACHE = new ConcurrentHashMap(16, 0.75f, 2);
@Override // o.AbstractC15551gtl
public final Locale[] getAvailableLocales() {
return DateFormat.getAvailableLocales();
}
@Override // o.AbstractC15551gtl
public final C15554gto getFormatter(EnumC15556gtq enumC15556gtq, EnumC15556gtq enumC15556gtq2, gsR gsr, Locale locale) {
DateFormat timeInstance;
if (enumC15556gtq == null && enumC15556gtq2 == null) {
throw new IllegalArgumentException("Date and Time style must not both be null");
}
StringBuilder sb = new StringBuilder();
sb.append(gsr.getId());
sb.append(MatchIndex.ALLOWED_VALUES_SEPARATOR);
sb.append(locale.toString());
sb.append(MatchIndex.ALLOWED_VALUES_SEPARATOR);
sb.append(enumC15556gtq);
sb.append(enumC15556gtq2);
String obj = sb.toString();
ConcurrentMap<String, Object> concurrentMap = FORMATTER_CACHE;
Object obj2 = concurrentMap.get(obj);
if (obj2 != null) {
if (obj2.equals("")) {
throw new IllegalArgumentException("Unable to convert DateFormat to DateTimeFormatter");
}
return (C15554gto) obj2;
}
if (enumC15556gtq == null) {
timeInstance = DateFormat.getTimeInstance(convertStyle(enumC15556gtq2), locale);
} else if (enumC15556gtq2 != null) {
timeInstance = DateFormat.getDateTimeInstance(convertStyle(enumC15556gtq), convertStyle(enumC15556gtq2), locale);
} else {
timeInstance = DateFormat.getDateInstance(convertStyle(enumC15556gtq), locale);
}
if (timeInstance instanceof SimpleDateFormat) {
C15554gto formatter = new C15553gtn().appendPattern(((SimpleDateFormat) timeInstance).toPattern()).toFormatter(locale);
concurrentMap.putIfAbsent(obj, formatter);
return formatter;
}
concurrentMap.putIfAbsent(obj, "");
throw new IllegalArgumentException("Unable to convert DateFormat to DateTimeFormatter");
}
private int convertStyle(EnumC15556gtq enumC15556gtq) {
return enumC15556gtq.ordinal();
}
}