what-the-bank/sources/com/google/android/libraries/places/api/model/zzbe.java

133 lines
5.7 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.google.android.libraries.places.api.model;
import com.google.android.libraries.places.api.model.Period;
import com.google.android.libraries.places.api.model.Place;
import com.google.android.libraries.places.internal.zzja;
import com.google.android.libraries.places.internal.zzjb;
import com.google.android.libraries.places.internal.zzjk;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.EnumMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.TimeZone;
import java.util.concurrent.TimeUnit;
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes2.dex */
public final class zzbe {
private static final zzjb zza;
private static final LocalTime zzb;
static {
zzja zzjaVar = new zzja();
zzjaVar.zza(1, DayOfWeek.SUNDAY);
zzjaVar.zza(2, DayOfWeek.MONDAY);
zzjaVar.zza(3, DayOfWeek.TUESDAY);
zzjaVar.zza(4, DayOfWeek.WEDNESDAY);
zzjaVar.zza(5, DayOfWeek.THURSDAY);
zzjaVar.zza(6, DayOfWeek.FRIDAY);
zzjaVar.zza(7, DayOfWeek.SATURDAY);
zza = zzjaVar.zzb();
zzb = LocalTime.newInstance(23, 59);
}
/* JADX INFO: Access modifiers changed from: package-private */
public static Boolean zza(Place place, long j) {
TimeZone timeZone;
Place.BusinessStatus businessStatus = place.getBusinessStatus();
OpeningHours openingHours = place.getOpeningHours();
Integer utcOffsetMinutes = place.getUtcOffsetMinutes();
Boolean bool = Boolean.FALSE;
if (businessStatus != null && businessStatus != Place.BusinessStatus.OPERATIONAL) {
return bool;
}
if (openingHours == null || utcOffsetMinutes == null) {
return null;
}
List<Period> periods = openingHours.getPeriods();
if (!periods.isEmpty()) {
if (periods.size() == 1) {
Period period = periods.get(0);
TimeOfWeek open = period.getOpen();
if (period.getClose() == null && open != null && open.getDay() == DayOfWeek.SUNDAY && open.getTime().getHours() == 0 && open.getTime().getMinutes() == 0) {
return Boolean.TRUE;
}
}
for (Period period2 : periods) {
if (period2.getOpen() == null || period2.getClose() == null) {
return null;
}
}
int intValue = utcOffsetMinutes.intValue();
String[] availableIDs = TimeZone.getAvailableIDs((int) TimeUnit.MINUTES.toMillis(intValue));
if (availableIDs == null || availableIDs.length <= 0) {
new Object[]{Integer.valueOf(intValue)};
timeZone = null;
} else {
timeZone = TimeZone.getTimeZone(availableIDs[0]);
}
if (timeZone == null) {
return null;
}
Calendar calendar = Calendar.getInstance(timeZone);
calendar.setTimeInMillis(j);
DayOfWeek dayOfWeek = (DayOfWeek) zza.get(Integer.valueOf(calendar.get(7)));
LocalTime newInstance = LocalTime.newInstance(calendar.get(11), calendar.get(12));
EnumMap enumMap = new EnumMap(DayOfWeek.class);
if (!periods.isEmpty()) {
Period period3 = periods.get(0);
int i = 0;
while (period3 != null) {
TimeOfWeek open2 = period3.getOpen();
TimeOfWeek close = period3.getClose();
if (open2 == null || close == null) {
i++;
period3 = i >= periods.size() ? null : periods.get(i);
} else {
DayOfWeek day = open2.getDay();
LocalTime time = open2.getTime();
if (open2.getDay() == close.getDay()) {
LocalTime time2 = close.getTime();
List list = (List) zzb(enumMap, day, new ArrayList());
list.add(zzjk.zzd(time, time2));
enumMap.put((EnumMap) day, (DayOfWeek) list);
i++;
if (i < periods.size()) {
period3 = periods.get(i);
}
} else {
LocalTime localTime = zzb;
List list2 = (List) zzb(enumMap, day, new ArrayList());
list2.add(zzjk.zzc(time, localTime));
enumMap.put((EnumMap) day, (DayOfWeek) list2);
TimeOfWeek newInstance2 = TimeOfWeek.newInstance(DayOfWeek.values()[(day.ordinal() + 1) % 7], LocalTime.newInstance(0, 0));
TimeOfWeek close2 = period3.getClose();
Period.Builder builder = Period.builder();
builder.setOpen(newInstance2);
builder.setClose(close2);
period3 = builder.build();
}
}
}
}
List list3 = (List) enumMap.get(dayOfWeek);
if (list3 == null) {
return bool;
}
Iterator it = list3.iterator();
while (it.hasNext()) {
if (((zzjk) it.next()).zze(newInstance)) {
return Boolean.TRUE;
}
}
}
return bool;
}
private static Object zzb(Map map, Object obj, Object obj2) {
return map.containsKey(obj) ? map.get(obj) : obj2;
}
}