package com.google.android.gms.ads.nativead;

import android.content.Context;
import android.os.RemoteException;
import android.util.AttributeSet;
import android.widget.FrameLayout;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.android.gms.internal.ads.gr;
import com.google.android.gms.internal.ads.iq;
import g7.l;
import n7.f3;
import xyz.stream.utils.f0;
import xyz.stream.utils.j0;

/* JADX INFO: loaded from: classes2.dex */
public class MediaView extends FrameLayout {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public boolean f7965a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public iq f7966b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public ImageView.ScaleType f7967c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public boolean f7968d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public f0 f7969e;

    @Nullable
    private l zza;

    public MediaView(@NonNull Context context) {
        super(context);
    }

    public final synchronized void a(j0 j0Var) {
        this.f7966b = j0Var;
        if (this.f7965a) {
            j0Var.zza(this.zza);
        }
    }

    @Nullable
    public l getMediaContent() {
        return this.zza;
    }

    public void setImageScaleType(@NonNull ImageView.ScaleType scaleType) {
        this.f7968d = true;
        this.f7967c = scaleType;
        f0 f0Var = this.f7969e;
        if (f0Var != null) {
            ((NativeAdView) f0Var.f36136b).b(scaleType);
        }
    }

    public void setMediaContent(@Nullable l lVar) {
        boolean zR;
        this.f7965a = true;
        this.zza = lVar;
        iq iqVar = this.f7966b;
        if (iqVar != null) {
            ((j0) iqVar).zza(lVar);
        }
        if (lVar == null) {
            return;
        }
        try {
            gr grVarZzb = ((f3) lVar).zzb();
            if (grVarZzb != null) {
                if (!((f3) lVar).f30945a.zzk()) {
                    try {
                        if (((f3) lVar).f30945a.zzl()) {
                            zR = grVarZzb.r(new k8.b(this));
                        }
                    } catch (RemoteException unused) {
                    }
                    removeAllViews();
                }
                zR = grVarZzb.p(new k8.b(this));
                if (zR) {
                    return;
                }
                removeAllViews();
            }
        } catch (RemoteException unused2) {
            removeAllViews();
        }
    }

    public MediaView(@NonNull Context context, @NonNull AttributeSet attributeSet) {
        super(context, attributeSet);
    }

    public MediaView(@NonNull Context context, @NonNull AttributeSet attributeSet, int i10) {
        super(context, attributeSet, i10);
    }
}
