package com.chartboost.sdk.impl;

import android.content.Context;
import android.webkit.WebChromeClient;
import android.widget.RelativeLayout;
import com.unity3d.ads.adplayer.AndroidWebViewClient;
import kotlin.Unit;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public abstract class xb extends RelativeLayout {

    /* renamed from: a  reason: collision with root package name */
    public p2 f1869a;
    public WebChromeClient b;
    public RelativeLayout c;
    public b8 d;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public xb(Context context) {
        super(context);
        Intrinsics.checkNotNullParameter(context, "context");
        setFocusableInTouchMode(true);
        requestFocus();
    }

    public final b8 getLastOrientation() {
        return this.d;
    }

    public final WebChromeClient getWebChromeClient() {
        return this.b;
    }

    public final p2 getWebView() {
        return this.f1869a;
    }

    public final RelativeLayout getWebViewContainer() {
        return this.c;
    }

    public final void setLastOrientation(b8 b8Var) {
        this.d = b8Var;
    }

    public final void setWebChromeClient(WebChromeClient webChromeClient) {
        this.b = webChromeClient;
    }

    public final void setWebView(p2 p2Var) {
        this.f1869a = p2Var;
    }

    public final void setWebViewContainer(RelativeLayout relativeLayout) {
        this.c = relativeLayout;
    }

    public void a() {
        Unit unit;
        p2 p2Var = this.f1869a;
        if (p2Var == null) {
            c7.a("Webview is null on destroyWebview", (Throwable) null, 2, (Object) null);
            return;
        }
        RelativeLayout relativeLayout = this.c;
        if (relativeLayout != null) {
            relativeLayout.removeView(p2Var);
            removeView(relativeLayout);
            unit = Unit.INSTANCE;
        } else {
            unit = null;
        }
        if (unit == null) {
            c7.a("webViewContainer is null destroyWebview", (Throwable) null, 2, (Object) null);
        }
        p2 p2Var2 = this.f1869a;
        if (p2Var2 != null) {
            p2Var2.loadUrl(AndroidWebViewClient.BLANK_PAGE);
            p2Var2.onPause();
            p2Var2.removeAllViews();
            p2Var2.destroy();
        }
        removeAllViews();
    }
}
