302 lines
11 KiB
Java
302 lines
11 KiB
Java
package com.google.android.gms.maps;
|
|
|
|
import android.app.Activity;
|
|
import android.content.Context;
|
|
import android.os.Bundle;
|
|
import android.os.RemoteException;
|
|
import android.os.StrictMode;
|
|
import android.util.AttributeSet;
|
|
import android.view.LayoutInflater;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.widget.FrameLayout;
|
|
import com.google.android.gms.common.GooglePlayServicesNotAvailableException;
|
|
import com.google.android.gms.common.internal.Preconditions;
|
|
import com.google.android.gms.dynamic.DeferredLifecycleHelper;
|
|
import com.google.android.gms.dynamic.ObjectWrapper;
|
|
import com.google.android.gms.dynamic.OnDelegateCreatedListener;
|
|
import com.google.android.gms.maps.internal.IMapViewDelegate;
|
|
import com.google.android.gms.maps.internal.MapLifecycleDelegate;
|
|
import com.google.android.gms.maps.internal.zzby;
|
|
import com.google.android.gms.maps.internal.zzbz;
|
|
import com.google.android.gms.maps.model.RuntimeRemoteException;
|
|
import java.util.ArrayList;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class MapView extends FrameLayout {
|
|
private final zzb zzbg;
|
|
|
|
public MapView(Context context) {
|
|
super(context);
|
|
this.zzbg = new zzb(this, context, null);
|
|
setClickable(true);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes2.dex */
|
|
public static final class zza implements MapLifecycleDelegate {
|
|
private final ViewGroup parent;
|
|
private final IMapViewDelegate zzbh;
|
|
private View zzbi;
|
|
|
|
public zza(ViewGroup viewGroup, IMapViewDelegate iMapViewDelegate) {
|
|
this.zzbh = (IMapViewDelegate) Preconditions.checkNotNull(iMapViewDelegate);
|
|
this.parent = (ViewGroup) Preconditions.checkNotNull(viewGroup);
|
|
}
|
|
|
|
@Override // com.google.android.gms.dynamic.LifecycleDelegate
|
|
public final void onInflate(Activity activity, Bundle bundle, Bundle bundle2) {
|
|
throw new UnsupportedOperationException("onInflate not allowed on MapViewDelegate");
|
|
}
|
|
|
|
@Override // com.google.android.gms.dynamic.LifecycleDelegate
|
|
public final void onCreate(Bundle bundle) {
|
|
try {
|
|
Bundle bundle2 = new Bundle();
|
|
zzby.zza(bundle, bundle2);
|
|
this.zzbh.onCreate(bundle2);
|
|
zzby.zza(bundle2, bundle);
|
|
this.zzbi = (View) ObjectWrapper.unwrap(this.zzbh.getView());
|
|
this.parent.removeAllViews();
|
|
this.parent.addView(this.zzbi);
|
|
} catch (RemoteException e) {
|
|
throw new RuntimeRemoteException(e);
|
|
}
|
|
}
|
|
|
|
@Override // com.google.android.gms.dynamic.LifecycleDelegate
|
|
public final View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
|
|
throw new UnsupportedOperationException("onCreateView not allowed on MapViewDelegate");
|
|
}
|
|
|
|
@Override // com.google.android.gms.dynamic.LifecycleDelegate
|
|
public final void onStart() {
|
|
try {
|
|
this.zzbh.onStart();
|
|
} catch (RemoteException e) {
|
|
throw new RuntimeRemoteException(e);
|
|
}
|
|
}
|
|
|
|
@Override // com.google.android.gms.dynamic.LifecycleDelegate
|
|
public final void onResume() {
|
|
try {
|
|
this.zzbh.onResume();
|
|
} catch (RemoteException e) {
|
|
throw new RuntimeRemoteException(e);
|
|
}
|
|
}
|
|
|
|
@Override // com.google.android.gms.dynamic.LifecycleDelegate
|
|
public final void onPause() {
|
|
try {
|
|
this.zzbh.onPause();
|
|
} catch (RemoteException e) {
|
|
throw new RuntimeRemoteException(e);
|
|
}
|
|
}
|
|
|
|
@Override // com.google.android.gms.dynamic.LifecycleDelegate
|
|
public final void onStop() {
|
|
try {
|
|
this.zzbh.onStop();
|
|
} catch (RemoteException e) {
|
|
throw new RuntimeRemoteException(e);
|
|
}
|
|
}
|
|
|
|
@Override // com.google.android.gms.dynamic.LifecycleDelegate
|
|
public final void onDestroyView() {
|
|
throw new UnsupportedOperationException("onDestroyView not allowed on MapViewDelegate");
|
|
}
|
|
|
|
@Override // com.google.android.gms.dynamic.LifecycleDelegate
|
|
public final void onDestroy() {
|
|
try {
|
|
this.zzbh.onDestroy();
|
|
} catch (RemoteException e) {
|
|
throw new RuntimeRemoteException(e);
|
|
}
|
|
}
|
|
|
|
@Override // com.google.android.gms.dynamic.LifecycleDelegate
|
|
public final void onLowMemory() {
|
|
try {
|
|
this.zzbh.onLowMemory();
|
|
} catch (RemoteException e) {
|
|
throw new RuntimeRemoteException(e);
|
|
}
|
|
}
|
|
|
|
@Override // com.google.android.gms.dynamic.LifecycleDelegate
|
|
public final void onSaveInstanceState(Bundle bundle) {
|
|
try {
|
|
Bundle bundle2 = new Bundle();
|
|
zzby.zza(bundle, bundle2);
|
|
this.zzbh.onSaveInstanceState(bundle2);
|
|
zzby.zza(bundle2, bundle);
|
|
} catch (RemoteException e) {
|
|
throw new RuntimeRemoteException(e);
|
|
}
|
|
}
|
|
|
|
@Override // com.google.android.gms.maps.internal.MapLifecycleDelegate
|
|
public final void getMapAsync(OnMapReadyCallback onMapReadyCallback) {
|
|
try {
|
|
this.zzbh.getMapAsync(new zzac(this, onMapReadyCallback));
|
|
} catch (RemoteException e) {
|
|
throw new RuntimeRemoteException(e);
|
|
}
|
|
}
|
|
|
|
public final void onEnterAmbient(Bundle bundle) {
|
|
try {
|
|
Bundle bundle2 = new Bundle();
|
|
zzby.zza(bundle, bundle2);
|
|
this.zzbh.onEnterAmbient(bundle2);
|
|
zzby.zza(bundle2, bundle);
|
|
} catch (RemoteException e) {
|
|
throw new RuntimeRemoteException(e);
|
|
}
|
|
}
|
|
|
|
public final void onExitAmbient() {
|
|
try {
|
|
this.zzbh.onExitAmbient();
|
|
} catch (RemoteException e) {
|
|
throw new RuntimeRemoteException(e);
|
|
}
|
|
}
|
|
}
|
|
|
|
public MapView(Context context, AttributeSet attributeSet) {
|
|
super(context, attributeSet);
|
|
this.zzbg = new zzb(this, context, GoogleMapOptions.createFromAttributes(context, attributeSet));
|
|
setClickable(true);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes2.dex */
|
|
public static final class zzb extends DeferredLifecycleHelper<zza> {
|
|
private OnDelegateCreatedListener<zza> zzbd;
|
|
private final List<OnMapReadyCallback> zzbf = new ArrayList();
|
|
private final ViewGroup zzbj;
|
|
private final Context zzbk;
|
|
private final GoogleMapOptions zzbl;
|
|
|
|
zzb(ViewGroup viewGroup, Context context, GoogleMapOptions googleMapOptions) {
|
|
this.zzbj = viewGroup;
|
|
this.zzbk = context;
|
|
this.zzbl = googleMapOptions;
|
|
}
|
|
|
|
@Override // com.google.android.gms.dynamic.DeferredLifecycleHelper
|
|
public final void createDelegate(OnDelegateCreatedListener<zza> onDelegateCreatedListener) {
|
|
this.zzbd = onDelegateCreatedListener;
|
|
if (onDelegateCreatedListener == null || getDelegate() != null) {
|
|
return;
|
|
}
|
|
try {
|
|
MapsInitializer.initialize(this.zzbk);
|
|
IMapViewDelegate zza = zzbz.zza(this.zzbk).zza(ObjectWrapper.wrap(this.zzbk), this.zzbl);
|
|
if (zza == null) {
|
|
return;
|
|
}
|
|
this.zzbd.onDelegateCreated(new zza(this.zzbj, zza));
|
|
Iterator<OnMapReadyCallback> it = this.zzbf.iterator();
|
|
while (it.hasNext()) {
|
|
getDelegate().getMapAsync(it.next());
|
|
}
|
|
this.zzbf.clear();
|
|
} catch (RemoteException e) {
|
|
throw new RuntimeRemoteException(e);
|
|
} catch (GooglePlayServicesNotAvailableException unused) {
|
|
}
|
|
}
|
|
|
|
public final void getMapAsync(OnMapReadyCallback onMapReadyCallback) {
|
|
if (getDelegate() != null) {
|
|
getDelegate().getMapAsync(onMapReadyCallback);
|
|
} else {
|
|
this.zzbf.add(onMapReadyCallback);
|
|
}
|
|
}
|
|
}
|
|
|
|
public MapView(Context context, AttributeSet attributeSet, int i) {
|
|
super(context, attributeSet, i);
|
|
this.zzbg = new zzb(this, context, GoogleMapOptions.createFromAttributes(context, attributeSet));
|
|
setClickable(true);
|
|
}
|
|
|
|
public MapView(Context context, GoogleMapOptions googleMapOptions) {
|
|
super(context);
|
|
this.zzbg = new zzb(this, context, googleMapOptions);
|
|
setClickable(true);
|
|
}
|
|
|
|
public final void onCreate(Bundle bundle) {
|
|
StrictMode.ThreadPolicy threadPolicy = StrictMode.getThreadPolicy();
|
|
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder(threadPolicy).permitAll().build());
|
|
try {
|
|
this.zzbg.onCreate(bundle);
|
|
if (this.zzbg.getDelegate() == null) {
|
|
DeferredLifecycleHelper.showGooglePlayUnavailableMessage(this);
|
|
}
|
|
} finally {
|
|
StrictMode.setThreadPolicy(threadPolicy);
|
|
}
|
|
}
|
|
|
|
public final void onResume() {
|
|
this.zzbg.onResume();
|
|
}
|
|
|
|
public final void onPause() {
|
|
this.zzbg.onPause();
|
|
}
|
|
|
|
public final void onStart() {
|
|
this.zzbg.onStart();
|
|
}
|
|
|
|
public final void onStop() {
|
|
this.zzbg.onStop();
|
|
}
|
|
|
|
public final void onDestroy() {
|
|
this.zzbg.onDestroy();
|
|
}
|
|
|
|
public final void onLowMemory() {
|
|
this.zzbg.onLowMemory();
|
|
}
|
|
|
|
public final void onSaveInstanceState(Bundle bundle) {
|
|
this.zzbg.onSaveInstanceState(bundle);
|
|
}
|
|
|
|
public void getMapAsync(OnMapReadyCallback onMapReadyCallback) {
|
|
Preconditions.checkMainThread("getMapAsync() must be called on the main thread");
|
|
this.zzbg.getMapAsync(onMapReadyCallback);
|
|
}
|
|
|
|
public final void onEnterAmbient(Bundle bundle) {
|
|
Preconditions.checkMainThread("onEnterAmbient() must be called on the main thread");
|
|
zzb zzbVar = this.zzbg;
|
|
if (zzbVar.getDelegate() != null) {
|
|
zzbVar.getDelegate().onEnterAmbient(bundle);
|
|
}
|
|
}
|
|
|
|
public final void onExitAmbient() {
|
|
Preconditions.checkMainThread("onExitAmbient() must be called on the main thread");
|
|
zzb zzbVar = this.zzbg;
|
|
if (zzbVar.getDelegate() != null) {
|
|
zzbVar.getDelegate().onExitAmbient();
|
|
}
|
|
}
|
|
}
|