114 lines
4.3 KiB
Java
114 lines
4.3 KiB
Java
package com.google.android.libraries.places.internal;
|
|
|
|
import android.graphics.Bitmap;
|
|
import android.widget.ImageView;
|
|
import com.android.volley.VolleyError;
|
|
import com.google.android.gms.common.api.ApiException;
|
|
import com.google.android.gms.common.api.Status;
|
|
import com.google.android.gms.tasks.CancellationToken;
|
|
import com.google.android.gms.tasks.OnTokenCanceledListener;
|
|
import com.google.android.gms.tasks.Task;
|
|
import com.google.android.gms.tasks.TaskCompletionSource;
|
|
import com.google.android.libraries.places.api.net.PlacesStatusCodes;
|
|
import java.util.Map;
|
|
import o.C1117VzR;
|
|
import o.C15788ibz;
|
|
import o.LcE;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public final class zzdd {
|
|
private final C1117VzR zza;
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public static /* synthetic */ void zza(TaskCompletionSource taskCompletionSource, VolleyError volleyError) {
|
|
ApiException zza;
|
|
try {
|
|
if (volleyError.e != null) {
|
|
int i = volleyError.e.d;
|
|
if (i == 400) {
|
|
zza = new ApiException(new Status(PlacesStatusCodes.INVALID_REQUEST, "The provided parameters are invalid (did you include a max width or height?)."));
|
|
} else if (i == 403) {
|
|
zza = new ApiException(new Status(PlacesStatusCodes.REQUEST_DENIED, "The provided API key is invalid."));
|
|
}
|
|
taskCompletionSource.trySetException(zza);
|
|
}
|
|
zza = zzcr.zza(volleyError);
|
|
taskCompletionSource.trySetException(zza);
|
|
} catch (Error | RuntimeException e) {
|
|
zzgb.zzb(e);
|
|
throw e;
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public static /* synthetic */ void zzc(zzds zzdsVar, TaskCompletionSource taskCompletionSource, Bitmap bitmap) {
|
|
try {
|
|
zzdsVar.zzb(bitmap);
|
|
taskCompletionSource.trySetResult(zzdsVar.zza());
|
|
} catch (Error | RuntimeException e) {
|
|
zzgb.zzb(e);
|
|
throw e;
|
|
}
|
|
}
|
|
|
|
public final Task zzb(zzdf zzdfVar, final zzds zzdsVar) {
|
|
TaskCompletionSource taskCompletionSource;
|
|
String zzc = zzdfVar.zzc();
|
|
Map zzd = zzdfVar.zzd();
|
|
CancellationToken zza = zzdfVar.zza();
|
|
if (zza != null) {
|
|
taskCompletionSource = new TaskCompletionSource(zza);
|
|
} else {
|
|
taskCompletionSource = new TaskCompletionSource();
|
|
}
|
|
final TaskCompletionSource taskCompletionSource2 = taskCompletionSource;
|
|
final byte[] bArr = null;
|
|
final zzdc zzdcVar = new zzdc(this, zzc, new C15788ibz.LWm(zzdsVar, taskCompletionSource2, bArr) { // from class: com.google.android.libraries.places.internal.zzcz
|
|
public final TaskCompletionSource zza;
|
|
public final zzds zzb;
|
|
|
|
@Override // o.C15788ibz.LWm
|
|
public final void onResponse(Object obj) {
|
|
zzdd.zzc(this.zzb, this.zza, (Bitmap) obj);
|
|
}
|
|
|
|
{
|
|
this.zzb = zzdsVar;
|
|
this.zza = taskCompletionSource2;
|
|
}
|
|
}, 0, 0, ImageView.ScaleType.CENTER, Bitmap.Config.ARGB_8888, new C15788ibz.HBt(taskCompletionSource2) { // from class: com.google.android.libraries.places.internal.zzda
|
|
public final TaskCompletionSource zza;
|
|
|
|
@Override // o.C15788ibz.HBt
|
|
public final void onErrorResponse(VolleyError volleyError) {
|
|
zzdd.zza(this.zza, volleyError);
|
|
}
|
|
|
|
{
|
|
this.zza = taskCompletionSource2;
|
|
}
|
|
}, zzd);
|
|
if (zza != null) {
|
|
zza.onCanceledRequested(new OnTokenCanceledListener(zzdcVar) { // from class: com.google.android.libraries.places.internal.zzdb
|
|
public final LcE zza;
|
|
|
|
@Override // com.google.android.gms.tasks.OnTokenCanceledListener
|
|
public final void onCanceled() {
|
|
this.zza.cancel();
|
|
}
|
|
|
|
{
|
|
this.zza = zzdcVar;
|
|
}
|
|
});
|
|
}
|
|
this.zza.d(zzdcVar);
|
|
return taskCompletionSource2.getTask();
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public zzdd(C1117VzR c1117VzR) {
|
|
this.zza = c1117VzR;
|
|
}
|
|
}
|