what-the-bank/sources/com/google/android/libraries/places/widget/Autocomplete.java

114 lines
3.7 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.google.android.libraries.places.widget;
import android.R;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.util.TypedValue;
import com.google.android.gms.common.api.Status;
import com.google.android.libraries.places.api.model.LocationBias;
import com.google.android.libraries.places.api.model.LocationRestriction;
import com.google.android.libraries.places.api.model.Place;
import com.google.android.libraries.places.api.model.TypeFilter;
import com.google.android.libraries.places.internal.zzgb;
import com.google.android.libraries.places.internal.zzgp;
import com.google.android.libraries.places.internal.zzgq;
import com.google.android.libraries.places.internal.zzgr;
import com.google.android.libraries.places.internal.zzgu;
import com.google.android.libraries.places.widget.model.AutocompleteActivityMode;
import java.util.List;
/* loaded from: classes2.dex */
public final class Autocomplete {
public static Place getPlaceFromIntent(Intent intent) {
return zzgu.zzb(intent);
}
public static Status getStatusFromIntent(Intent intent) {
return zzgu.zza(intent);
}
/* loaded from: classes2.dex */
public static class IntentBuilder {
private final zzgq zza;
public IntentBuilder(AutocompleteActivityMode autocompleteActivityMode, List<Place.Field> list) {
this.zza = zzgr.zzn(autocompleteActivityMode, list, zzgp.INTENT);
}
public Intent build(Context context) {
try {
Intent intent = new Intent(context, (Class<?>) AutocompleteActivity.class);
zzgq zzgqVar = this.zza;
Resources.Theme theme = context.getTheme();
TypedValue typedValue = new TypedValue();
if (theme.resolveAttribute(R.attr.colorPrimary, typedValue, true)) {
zzgqVar.zzi(typedValue.data);
}
TypedValue typedValue2 = new TypedValue();
if (theme.resolveAttribute(R.attr.colorPrimaryDark, typedValue2, true)) {
zzgqVar.zzj(typedValue2.data);
}
intent.putExtra("places/AutocompleteOptions", this.zza.zzm());
return intent;
} catch (Error | RuntimeException e) {
zzgb.zzb(e);
throw e;
}
}
public IntentBuilder setCountries(List<String> list) {
this.zza.zza(list);
return this;
}
public IntentBuilder setCountry(String str) {
this.zza.zzn(str);
return this;
}
public IntentBuilder setHint(String str) {
this.zza.zzb(str);
return this;
}
public IntentBuilder setInitialQuery(String str) {
this.zza.zzc(str);
return this;
}
public IntentBuilder setLocationBias(LocationBias locationBias) {
this.zza.zzd(locationBias);
return this;
}
public IntentBuilder setLocationRestriction(LocationRestriction locationRestriction) {
this.zza.zze(locationRestriction);
return this;
}
@Deprecated
public IntentBuilder setTypeFilter(TypeFilter typeFilter) {
this.zza.zzk(typeFilter);
return this;
}
public IntentBuilder setTypesFilter(List<String> list) {
this.zza.zzl(list);
return this;
}
public final IntentBuilder zza(zzgp zzgpVar) {
this.zza.zzg(zzgpVar);
return this;
}
public IntentBuilder(zzgr zzgrVar) {
this.zza = zzgrVar.zzg();
}
}
private Autocomplete() {
}
}