117 lines
3.5 KiB
Java
117 lines
3.5 KiB
Java
|
package com.google.android.libraries.places.api;
|
||
|
|
||
|
import android.content.Context;
|
||
|
import com.google.android.libraries.places.api.net.PlacesClient;
|
||
|
import com.google.android.libraries.places.internal.zzfo;
|
||
|
import com.google.android.libraries.places.internal.zzfp;
|
||
|
import com.google.android.libraries.places.internal.zzfq;
|
||
|
import com.google.android.libraries.places.internal.zzfs;
|
||
|
import com.google.android.libraries.places.internal.zzfz;
|
||
|
import com.google.android.libraries.places.internal.zzgb;
|
||
|
import com.google.android.libraries.places.internal.zzig;
|
||
|
import java.util.Locale;
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
public final class Places {
|
||
|
private static final zzfs zza = new zzfs();
|
||
|
private static volatile zzfq zzb;
|
||
|
|
||
|
public static PlacesClient createClient(Context context) {
|
||
|
PlacesClient zza2;
|
||
|
synchronized (Places.class) {
|
||
|
try {
|
||
|
zzig.zzc(context, "Context must not be null.");
|
||
|
zza2 = zza(context, zzfz.zzd(context).zze());
|
||
|
} catch (Error | RuntimeException e) {
|
||
|
zzgb.zzb(e);
|
||
|
throw e;
|
||
|
}
|
||
|
}
|
||
|
return zza2;
|
||
|
}
|
||
|
|
||
|
public static void deinitialize() {
|
||
|
synchronized (Places.class) {
|
||
|
zza.zzc();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public static void initialize(Context context, String str) {
|
||
|
try {
|
||
|
zzb(context, str, null, false);
|
||
|
} catch (Error | RuntimeException e) {
|
||
|
zzgb.zzb(e);
|
||
|
throw e;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public static boolean isInitialized() {
|
||
|
boolean zzf;
|
||
|
synchronized (Places.class) {
|
||
|
try {
|
||
|
zzf = zza.zzf();
|
||
|
} catch (Error | RuntimeException e) {
|
||
|
zzgb.zzb(e);
|
||
|
throw e;
|
||
|
}
|
||
|
}
|
||
|
return zzf;
|
||
|
}
|
||
|
|
||
|
public static PlacesClient zza(Context context, zzfz zzfzVar) {
|
||
|
PlacesClient zza2;
|
||
|
synchronized (Places.class) {
|
||
|
try {
|
||
|
zzig.zzc(context, "Context must not be null.");
|
||
|
zzig.zzi(isInitialized(), "Places must be initialized first.");
|
||
|
zzfp zza3 = zzfo.zza();
|
||
|
zza3.zzc(context);
|
||
|
zza3.zza(zza);
|
||
|
zza3.zzb(zzfzVar);
|
||
|
zza2 = zza3.zzd().zza();
|
||
|
} catch (Error | RuntimeException e) {
|
||
|
zzgb.zzb(e);
|
||
|
throw e;
|
||
|
}
|
||
|
}
|
||
|
return zza2;
|
||
|
}
|
||
|
|
||
|
public static void zzb(Context context, String str, Locale locale, boolean z) {
|
||
|
synchronized (Places.class) {
|
||
|
try {
|
||
|
zzig.zzc(context, "Application context must not be null.");
|
||
|
zzig.zzc(str, "API Key must not be null.");
|
||
|
zzig.zze(!str.isEmpty(), "API Key must not be empty.");
|
||
|
zzgb.zza(context.getApplicationContext(), false);
|
||
|
zza.zzd(str, locale, false);
|
||
|
} catch (Error | RuntimeException e) {
|
||
|
zzgb.zzb(e);
|
||
|
throw e;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public static void initialize(Context context, String str, Locale locale) {
|
||
|
synchronized (Places.class) {
|
||
|
try {
|
||
|
zzb(context, str, locale, false);
|
||
|
} catch (Error | RuntimeException e) {
|
||
|
zzgb.zzb(e);
|
||
|
throw e;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public static zzfs zzc() {
|
||
|
zzfs zzfsVar;
|
||
|
synchronized (Places.class) {
|
||
|
zzfsVar = zza;
|
||
|
}
|
||
|
return zzfsVar;
|
||
|
}
|
||
|
|
||
|
private Places() {
|
||
|
}
|
||
|
}
|