package com.ss.android.ugc.aweme.crossplatform.activity;

import X.070;
import X.0CB;
import X.0CH;
import X.0CN;
import X.0Gp;
import X.0HH;
import X.1hK;
import X.2GO;
import X.2HZ;
import X.2OR;
import X.2UX;
import X.2Ue;
import X.2cN;
import X.2nK;
import X.4CM;
import X.4Ek;
import X.4FQ;
import X.4vl;
import X.6Is;
import X.7ib;
import X.7lW;
import X.86a;
import X.9BJ;
import X.AGn;
import X.B6u;
import X.C0458K4r;
import X.C0677KDc;
import X.C0679KDe;
import X.C0720KEt;
import X.C2041KmO;
import X.C2051KmY;
import X.C2084Kn5;
import X.C2097KnI;
import X.C2098KnJ;
import X.C2118Knd;
import X.C2163KoM;
import X.C2172KoV;
import X.C2174KoX;
import X.C2272Kq7;
import X.C2273Kq8;
import X.C2274Kq9;
import X.C2275KqA;
import X.C2284KqJ;
import X.C2288KqN;
import X.C2289KqO;
import X.C2290KqP;
import X.C2291KqQ;
import X.C2299KqY;
import X.C2310Kqj;
import X.C2321Kqu;
import X.C2322Kqv;
import X.C2330Kr3;
import X.C2333Kr6;
import X.C2340KrD;
import X.C2341KrE;
import X.C2386Krx;
import X.C2405KsG;
import X.C3007L4s;
import X.C3197LCa;
import X.C4954LsH;
import X.CWM;
import X.Cbz;
import X.CqM;
import X.EvS;
import X.FNd;
import X.HeD;
import X.HmW;
import X.HmY;
import X.Hx0;
import X.Hzm;
import X.ISm;
import X.JJh;
import X.JX3;
import X.Jcz;
import X.L06;
import X.MNS;
import X.Mjy;
import X.Pdl;
import X.PgU;
import X.PhE;
import X.PlI;
import X.Rc9;
import X.SfZ;
import X.SvN;
import X.Swl;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.net.http.SslError;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.webkit.SslErrorHandler;
import android.webkit.WebBackForwardList;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import android.webkit.WebView;
import android.widget.FrameLayout;
import android.widget.Space;
import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;
import com.gyf.barlibrary.ImmersionBar;
import com.ss.android.ugc.aweme.compliance.api.a;
import com.ss.android.ugc.aweme.crossplatform.business.AdWebStatBusiness;
import com.ss.android.ugc.aweme.crossplatform.business.OpenUrlHintBusiness;
import com.ss.android.ugc.aweme.crossplatform.business.PassBackWebInfoBusiness;
import com.ss.android.ugc.aweme.crossplatform.business.PlayableBusiness;
import com.ss.android.ugc.aweme.crossplatform.business.PreRenderWebViewBusiness;
import com.ss.android.ugc.aweme.crossplatform.business.WalletBusiness;
import com.ss.android.ugc.aweme.crossplatform.business.proxy.ReportBusinessProxy;
import com.ss.android.ugc.aweme.im.sdk.common.controller.providedservices.IMService;
import com.ss.android.ugc.aweme.im.service.IIMService;
import com.ss.android.ugc.aweme.landpage.survey.AdLandPageSurveyServiceImpl;
import com.ss.android.ugc.aweme.landpage.survey.IAdLandPageSurveyService;
import com.ss.android.ugc.aweme.live.LiveOuterService;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.ThreadMode;
import org.json.JSONException;
import org.json.JSONObject;

public class MixActivityContainer extends AbsActivityContainer implements 6Is, C2098KnJ, 2HZ, 2GO {
    public final Activity LIZ;
    public C2041KmO LIZIZ;
    public Bundle LIZJ;
    public final C2174KoX LIZLLL;
    public Runnable LJ;
    public C2084Kn5 LJFF;
    public long LJI = -1;
    public 2cN LJII = null;
    public Pdl LJIIIIZZ = new Pdl<Boolean>() {
        static {
            Covode.recordClassIndex(62887);
        }

        public final void onComplete() {
        }

        public final void onError(Throwable th) {
        }

        public final /* synthetic */ void onNext(Object obj) {
            if (((Boolean) obj).booleanValue()) {
                HmY.LIZ(new HmW("appEnterBackgroundEvent", System.currentTimeMillis(), (C0458K4r) null));
            } else {
                HmY.LIZ(new HmW("appEnterForegroundEvent", System.currentTimeMillis(), (C0458K4r) null));
            }
        }
    };
    public C3007L4s LJIIIZ;
    public String LJIIJ;
    public JX3 LJIIJJI;
    public C2284KqJ LJIIL;
    public Space LJIILIIL;
    public boolean LJIILJJIL = false;
    public C2289KqO LJIILL;
    public C2310Kqj LJIILLIIL;
    public C2084Kn5 LJIIZILJ;
    public String LJIJ;
    public long LJIJI;
    public boolean LJIJJ;
    public Mjy LJIJJLI = new Mjy();
    public ImmersionBar LJIL;
    public L06 LJJ;
    public long LJJI;
    public C2341KrE LJJIFFI;
    public final Set<CWM> LJJII = new HashSet();

    static {
        Covode.recordClassIndex(62886);
    }

    public void LJIIL() {
    }

    public void LJIILIIL() {
    }

    public void LJIILJJIL() {
    }

    public void LJIILL() {
    }

    public void LJIILLIIL() {
    }

    public Map<Integer, Object> getSubscriberEventTypes() {
        HashMap hashMap = new HashMap();
        hashMap.put(59, new Rc9(MixActivityContainer.class, "onEvent", C2172KoV.class, ThreadMode.POSTING, 0, false));
        hashMap.put(36, new Rc9(MixActivityContainer.class, "onEvent", B6u.class, ThreadMode.POSTING, 0, false));
        hashMap.put(276, new Rc9(MixActivityContainer.class, "onEvent", C0679KDe.class, ThreadMode.POSTING, 0, false));
        hashMap.put(277, new Rc9(MixActivityContainer.class, "onEvent", C0677KDc.class, ThreadMode.POSTING, 0, false));
        hashMap.put(278, new Rc9(MixActivityContainer.class, "invokeRenderTimeEvent", Hx0.class, ThreadMode.POSTING, 0, false));
        hashMap.put(37, new Rc9(MixActivityContainer.class, "onEvent", 2Ue.class, ThreadMode.POSTING, 0, false));
        hashMap.put(279, new Rc9(MixActivityContainer.class, "onEvent", C0720KEt.class, ThreadMode.POSTING, 0, false));
        return hashMap;
    }

    public void onStateChanged(0CH r2, 0CB r3) {
        super.onStateChanged(r2, r3);
        if (r3 == 0CB.ON_CREATE) {
            onCreate();
        } else if (r3 == 0CB.ON_PAUSE) {
            onPause();
        } else if (r3 == 0CB.ON_RESUME) {
            onResume();
        } else if (r3 == 0CB.ON_STOP) {
            onStop();
        } else if (r3 == 0CB.ON_DESTROY) {
            onDestroy();
        }
    }

    @0CN(LIZ = 0CB.ON_STOP)
    public final void onStop() {
        this.LJIJJ = false;
    }

    public final C2084Kn5 LJ() {
        return this.LJIIZILJ;
    }

    public final C2289KqO LJFF() {
        return this.LJIILL;
    }

    public /* bridge */ /* synthetic */ Context getContext() {
        return this.LIZ;
    }

    public final C2174KoX getCrossPlatformBusiness() {
        return this.LIZLLL;
    }

    public final C2041KmO getCrossPlatformParams() {
        return this.LIZIZ;
    }

    public final boolean LIZ() {
        if (TextUtils.isEmpty(this.LIZIZ.LIZ.LIZJ)) {
            return false;
        }
        boolean LJJII2 = LJJII();
        this.LIZLLL.LIZ(this.LIZIZ);
        return LJJII2;
    }

    public final boolean LIZ(String str, int i) {
        return C4954LsH.LIZ(C4954LsH.LIZ(), this.LIZ, str, i);
    }

    public final boolean LIZ(int i, int i2, Intent intent) {
        MethodCollector.i(3481);
        this.LIZLLL.LIZ(WalletBusiness.class);
        String currentUrl = this.LJIILL.getCurrentUrl();
        if (currentUrl != null && currentUrl.contains("wallet/home")) {
            C2322Kqv kqv = new C2322Kqv();
            kqv.LIZ = i;
            kqv.LIZIZ = i2;
            kqv.LIZJ = intent;
            CqM.LIZ(kqv);
        }
        HashSet<CWM> hashSet = new HashSet<>();
        synchronized (this.LJJII) {
            try {
                hashSet.addAll(this.LJJII);
            } catch (Throwable th) {
                MethodCollector.o(3481);
                throw th;
            }
        }
        if (!hashSet.isEmpty()) {
            for (CWM LIZ2 : hashSet) {
                LIZ2.LIZ(i, i2, intent);
            }
        }
        MethodCollector.o(3481);
        return false;
    }

    public final void LJI() {
        this.LJIILL.LJI();
    }

    public final boolean LJII() {
        return this.LJIILL.LJII();
    }

    public final void LJIIIIZZ() {
        this.LJIILL.LIZJ();
    }

    public final void LJIIIZ() {
        FNd.LIZ(this.LIZ);
    }

    public final void LJIIJJI() {
        this.LIZ.finish();
    }

    private void LJJIIJ() {
        this.LJJIFFI = MNS.LIZ.LIZ().LIZ(this.LIZ);
    }

    private void LJJIIZI() {
        this.LJIILLIIL = new C2310Kqj(this.LIZ, this);
    }

    private void LJJIJIL() {
        this.LJIILL.setFullScreen(new C2097KnI() {
            public int LIZIZ = 1;

            static {
                Covode.recordClassIndex(62890);
            }

            public final void LIZ() {
                MethodCollector.i(1577);
                MixActivityContainer mixActivityContainer = MixActivityContainer.this;
                if (!mixActivityContainer.LIZIZ.LIZJ.LJIILL) {
                    mixActivityContainer.LJIIL.setVisibility(0);
                    mixActivityContainer.LJJ();
                } else if (!mixActivityContainer.getCrossPlatformParams().LIZJ.LJIJI) {
                    mixActivityContainer.LJIIL.setVisibility(0);
                    mixActivityContainer.LJIILIIL.setVisibility(0);
                }
                if (MixActivityContainer.this.LIZ != null) {
                    if (MixActivityContainer.this.LIZ.getRequestedOrientation() != this.LIZIZ) {
                        MixActivityContainer.this.LIZ.setRequestedOrientation(this.LIZIZ);
                        if (!C2275KqA.LIZ(MixActivityContainer.this.LIZIZ, MixActivityContainer.this.LIZ)) {
                            MixActivityContainer.this.LIZ.getWindow().clearFlags(1024);
                        } else {
                            MixActivityContainer.this.LIZJ();
                        }
                    }
                    ViewGroup viewGroup = (ViewGroup) MixActivityContainer.this.LIZ.findViewById(2131373108);
                    if (viewGroup != null) {
                        viewGroup.removeAllViews();
                        viewGroup.setVisibility(8);
                    }
                }
                MethodCollector.o(1577);
            }

            public final boolean LIZ(View view) {
                MethodCollector.i(1557);
                MixActivityContainer.this.LIZLLL();
                if (MixActivityContainer.this.LIZ == null || view == null || !MixActivityContainer.this.LIZIZ.LIZJ.LJJIIZI) {
                    MethodCollector.o(1557);
                    return false;
                }
                this.LIZIZ = MixActivityContainer.this.LIZ.getRequestedOrientation();
                MixActivityContainer.this.LIZ.setRequestedOrientation(11);
                4CM.LIZ(MixActivityContainer.this.LIZ);
                ViewGroup viewGroup = (ViewGroup) MixActivityContainer.this.LIZ.findViewById(2131373108);
                if (viewGroup == null) {
                    viewGroup = new FrameLayout(MixActivityContainer.this.LIZ);
                    viewGroup.setId(2131373108);
                    MixActivityContainer.this.LIZ.addContentView(viewGroup, new ViewGroup.LayoutParams(-1, -1));
                }
                viewGroup.setVisibility(0);
                viewGroup.addView(view, new ViewGroup.LayoutParams(-1, -1));
                MethodCollector.o(1557);
                return true;
            }
        });
    }

    private boolean LJJIZ() {
        if (this.LIZIZ.LIZIZ.LIZ > 0) {
            return true;
        }
        return false;
    }

    public final void LIZLLL() {
        this.LJIIL.setVisibility(8);
        this.LJIILIIL.setVisibility(8);
    }

    public final boolean LJIJ() {
        if (!TextUtils.isEmpty(this.LIZIZ.LIZ.LJIILJJIL)) {
            return true;
        }
        return false;
    }

    public final ReportBusinessProxy LJIJI() {
        return this.LIZLLL.LIZ(ReportBusinessProxy.class);
    }

    public final void LJJI() {
        if (!this.LJIILL.LIZ()) {
            LJJIJLIJ();
        }
    }

    @0CN(LIZ = 0CB.ON_CREATE)
    public void onCreate() {
        this.LJIJI = System.currentTimeMillis();
        EventBus.LIZ(EventBus.LIZ(), this);
    }

    private void LJJIJIIJI() {
        if (getCrossPlatformParams().LIZJ.LJIIL) {
            this.LJIIJJI.LIZ("copylink");
        }
    }

    private void LJJIJLIJ() {
        2UX r2 = new 2UX();
        r2.LIZ("method", this.LJIIJ);
        2nK.LIZ("h5_leave_detail", r2.LIZ);
        Runnable runnable = this.LJ;
        if (runnable != null) {
            runnable.run();
        }
    }

    private boolean LJJIL() {
        try {
            return 2OR.LIZ.LIZIZ.getAdLandingPageConfig().getEnableDynamicNavbar().booleanValue();
        } catch (4Ek unused) {
            return false;
        }
    }

    public final int LJIIZILJ() {
        WebBackForwardList copyBackForwardList;
        WebView LJIL2 = LJIL();
        if (LJIL2 == null || (copyBackForwardList = LJIL2.copyBackForwardList()) == null) {
            return 1;
        }
        return 1 + copyBackForwardList.getCurrentIndex();
    }

    /* JADX WARNING: type inference failed for: r0v3, types: [android.webkit.WebView, X.KmY] */
    public final WebView LJIL() {
        C2333Kr6 LIZ2;
        C2289KqO kqO = this.LJIILL;
        if (kqO == null || (LIZ2 = kqO.LIZ(C2333Kr6.class)) == null) {
            return null;
        }
        return LIZ2.LIZ();
    }

    private void LJJIIJZLJL() {
        this.LJIIZILJ = new C2084Kn5() {
            static {
                Covode.recordClassIndex(62888);
            }

            public final void LIZJ(WebView webView, String str) {
                if (MixActivityContainer.this.LJFF != null) {
                    MixActivityContainer.this.LJFF.LIZJ(webView, str);
                }
            }

            public final boolean LIZIZ(WebView webView, String str) {
                if (MixActivityContainer.this.LJFF != null) {
                    return MixActivityContainer.this.LJFF.LIZIZ(webView, str);
                }
                return false;
            }

            public final void LIZ(WebView webView, String str) {
                if (MixActivityContainer.this.LJFF != null) {
                    MixActivityContainer.this.LJFF.LIZ(webView, str);
                }
            }

            public final void LIZ(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) {
                if (MixActivityContainer.this.LJFF != null) {
                    MixActivityContainer.this.LJFF.LIZ(webView, sslErrorHandler, sslError);
                }
            }

            public final void LIZ(WebView webView, WebResourceRequest webResourceRequest, WebResourceResponse webResourceResponse) {
                if (MixActivityContainer.this.LJFF != null) {
                    MixActivityContainer.this.LJFF.LIZ(webView, webResourceRequest, webResourceResponse);
                }
            }

            public final void LIZ(WebView webView, WebResourceRequest webResourceRequest, WebResourceError webResourceError) {
                if (webResourceRequest != null && webResourceRequest.isForMainFrame() && MixActivityContainer.this.getCrossPlatformParams().LIZJ.LJIJI) {
                    if (!MixActivityContainer.this.LIZIZ.LIZJ.LJIILL) {
                        MixActivityContainer.this.LJJ();
                        return;
                    } else {
                        MixActivityContainer.this.LJIIL.setVisibility(0);
                        MixActivityContainer.this.LJIILIIL.setVisibility(0);
                    }
                }
                if (MixActivityContainer.this.LJFF != null) {
                    MixActivityContainer.this.LJFF.LIZ(webView, webResourceRequest, webResourceError);
                }
            }

            public final void LIZ(WebView webView, String str, Bitmap bitmap) {
                if (MixActivityContainer.this.LJFF != null) {
                    MixActivityContainer.this.LJFF.LIZ(webView, str, bitmap);
                }
                if (MixActivityContainer.this.LJIJ()) {
                    ReportBusinessProxy LJIJI = MixActivityContainer.this.LJIJI();
                    if (LJIJI.LIZIZ.longValue() == -1) {
                        LJIJI.LIZIZ = Long.valueOf(System.currentTimeMillis());
                    }
                    int i = MixActivityContainer.this.LIZIZ.LIZ.LJIILL;
                    if (i <= 0) {
                        return;
                    }
                    if (MixActivityContainer.this.LJIIZILJ() <= i) {
                        MixActivityContainer.this.LJIIL.LIZ(true);
                    } else {
                        MixActivityContainer.this.LJIIL.LIZ(false);
                    }
                }
            }

            public final void LIZ(WebView webView, int i, String str, String str2) {
                if (MixActivityContainer.this.getCrossPlatformParams().LIZJ.LJIJI) {
                    if (!MixActivityContainer.this.LIZIZ.LIZJ.LJIILL) {
                        MixActivityContainer.this.LJJ();
                        return;
                    } else {
                        MixActivityContainer.this.LJIIL.setVisibility(0);
                        MixActivityContainer.this.LJIILIIL.setVisibility(0);
                    }
                }
                if (MixActivityContainer.this.LJFF != null) {
                    MixActivityContainer.this.LJFF.LIZ(webView, i, str, str2);
                }
            }
        };
        if (TextUtils.equals("1", this.LIZIZ.LIZLLL.LIZ)) {
            this.LJIILL.LIZ(C2333Kr6.class).LIZ().setLoadNoCache();
        }
    }

    private void LJJIJ() {
        this.LJIIL = (C2284KqJ) LIZ(2131363854);
        this.LJIILIIL = (Space) LIZ(2131367898);
        this.LJIIL.setCrossPlatformParams(getCrossPlatformParams());
        this.LJIIL.setTitleWrap(new 3(this));
        this.LJIIL.post(new C2288KqN(this));
    }

    private void LJJIJIIJIL() {
        if (!getCrossPlatformParams().LIZ.LJIIJ) {
            String LIZ2 = C2275KqA.LIZ(getCrossPlatformParams().LIZ.LIZJ, ImmersionBar.getStatusBarHeight(this.LIZ));
            if (!EvS.LIZ().LIZIZ(getCrossPlatformParams())) {
                this.LJIILL.LIZ(C2333Kr6.class).LIZ(LIZ2);
            }
        }
    }

    private void LJJIJL() {
        this.LJIJ = "3";
        if (getCrossPlatformParams().LIZJ.LJIJI) {
            LIZLLL();
            return;
        }
        ((L06) LIZ(2131367308)).setGradualChangeMode(false);
        this.LJIILIIL.setVisibility(0);
        this.LJIIL.LIZIZ();
    }

    public final void LIZIZ() {
        Runnable runnable;
        if (getCrossPlatformParams().LIZ.LIZ.intValue() == 1) {
            this.LJIIJ = "phone_press";
            LJJI();
        } else if (!this.LJIILL.LIZ() && (runnable = this.LJ) != null) {
            runnable.run();
        }
    }

    public final void LJIIJ() {
        LJJIII();
        this.LJIILL.LIZ(this.LIZ);
        LJJIJIIJIL();
        Bundle bundle = this.LIZJ;
        if (bundle != null && bundle.getBoolean("bundle_from_referral")) {
            this.LJIILJJIL = true;
        }
        SfZ.LJIJ.LJI().LIZIZ(this.LJIIIIZZ);
        LIZ(true);
    }

    public final void LJIJJ() {
        if (LJIL() != null) {
            LJIL().onResume();
        }
        PlayableBusiness playableBusiness = (PlayableBusiness) this.LIZLLL.LIZ(PlayableBusiness.class);
        if (playableBusiness != null) {
            playableBusiness.LIZ = false;
            playableBusiness.LIZ(false, true);
        }
        PreRenderWebViewBusiness LIZ2 = PreRenderWebViewBusiness.LIZJ.LIZ((C2118Knd) this);
        if (LIZ2 != null) {
            LIZ2.LIZ((String) null);
        }
        Activity activity = this.LIZ;
        if (activity != null) {
            Cbz.LIZIZ(activity);
        }
        LIZ(true);
    }

    public final void LJJ() {
        this.LJIJ = "1";
        this.LJIILIIL.setVisibility(8);
        ((L06) LIZ(2131367308)).setGradualChangeMode(false);
        this.LJIIL.LIZ();
        this.LJIIL.setVisibility(0);
    }

    private boolean LJJII() {
        JSONObject jSONObject;
        Context applicationContext;
        if (getCrossPlatformParams().LIZ.LJIIIIZZ) {
            9BJ.LIZ(this.LIZ, "open_url", "push");
        }
        if (!86a.LIZ(getCrossPlatformParams().LIZIZ.LJIIIZ)) {
            if (!86a.LIZ(getCrossPlatformParams().LIZIZ.LJIIJ)) {
                try {
                    jSONObject = new JSONObject(getCrossPlatformParams().LIZIZ.LJIIJ);
                } catch (Exception unused) {
                }
                applicationContext = this.LIZ.getApplicationContext();
                if (7lW.LIZJ && applicationContext == null) {
                    applicationContext = 7lW.LIZ;
                }
                9BJ.LIZ(applicationContext, "wap_stat", "wap_enter", getCrossPlatformParams().LIZIZ.LJIIIZ, 0, 0, jSONObject);
            }
            jSONObject = null;
            applicationContext = this.LIZ.getApplicationContext();
            applicationContext = 7lW.LIZ;
            9BJ.LIZ(applicationContext, "wap_stat", "wap_enter", getCrossPlatformParams().LIZIZ.LJIIIZ, 0, 0, jSONObject);
        }
        if (TextUtils.isEmpty(getCrossPlatformParams().LIZ.LIZJ)) {
            return false;
        }
        return Jcz.LIZ(getCrossPlatformParams().LIZ.LIZJ);
    }

    private void LJJIII() {
        Activity activity;
        C2289KqO kqO = (C2289KqO) LIZ(2131363850);
        this.LJIILL = kqO;
        kqO.setCrossPlatformActivityContainer(this);
        LJJIIJZLJL();
        LJJIIZ();
        this.LJIILL.getViewStatusRegistry().LIZ((C2098KnJ) this);
        LJJIIZI();
        LJJIIJ();
        Bundle bundle = this.LIZJ;
        if ((bundle == null || !bundle.getBoolean("skip_consent", false)) && a.LJIIZILJ().LIZ(getCrossPlatformParams().LIZ.LIZJ) && (activity = this.LIZ) != null && !activity.isFinishing()) {
            a.LJIIZILJ().LIZ(this.LIZ, "deeplink");
        }
    }

    public final void LJIJJLI() {
        if (LJIL() != null) {
            LJIL().onPause();
        }
        AdWebStatBusiness adWebStatBusiness = (AdWebStatBusiness) this.LIZLLL.LIZ(AdWebStatBusiness.class);
        if (adWebStatBusiness != null) {
            adWebStatBusiness.LIZ(true);
        }
        C2272Kq7.LIZIZ();
        PlayableBusiness playableBusiness = (PlayableBusiness) this.LIZLLL.LIZ(PlayableBusiness.class);
        if (playableBusiness != null) {
            playableBusiness.LIZ = true;
            playableBusiness.LIZ(true, false);
        }
        PreRenderWebViewBusiness LIZ2 = PreRenderWebViewBusiness.LIZJ.LIZ((C2118Knd) this);
        if (LIZ2 != null) {
            LIZ2.LIZ();
        }
        if (this.LIZ != null && Build.VERSION.SDK_INT >= 23) {
            this.LIZ.getWindow().getDecorView().setSystemUiVisibility(1024);
        }
        LIZ(false);
    }

    public final void LJJIFFI() {
        if (!this.LIZ.isFinishing()) {
            this.LJJ.setBackgroundColor(this.LIZIZ.LIZJ.LJJIII);
            if (TextUtils.equals(this.LIZIZ.LIZJ.LJIIJ, "1")) {
                this.LJIIL.LIZJ();
            } else if (TextUtils.equals(this.LIZIZ.LIZJ.LJIIJ, "0") || !this.LJIILL.LIZ(C2333Kr6.class).LIZ().canGoBack()) {
                this.LJIIL.LIZLLL();
            } else {
                this.LJIIL.LIZJ();
            }
        }
    }

    @0CN(LIZ = 0CB.ON_DESTROY)
    public final void onDestroy() {
        this.LJIIIIZZ.dispose();
        ImmersionBar immersionBar = this.LJIL;
        if (immersionBar != null) {
            immersionBar.destroy();
        }
        C2289KqO kqO = this.LJIILL;
        if (kqO != null) {
            kqO.LIZLLL(this.LIZ);
        }
        PassBackWebInfoBusiness passBackWebInfoBusiness = (PassBackWebInfoBusiness) this.LIZLLL.LIZ(PassBackWebInfoBusiness.class);
        if (passBackWebInfoBusiness != null) {
            if (passBackWebInfoBusiness.LIZLLL()) {
                0Gp.LIZ(new C2405KsG(passBackWebInfoBusiness));
            }
            passBackWebInfoBusiness.LIZ().removeCallbacksAndMessages((Object) null);
        }
        if (LJIJ()) {
            ReportBusinessProxy LJIJI2 = LJIJI();
            if (TextUtils.equals(LJIJI2.LIZ, "bio_link")) {
                2UX r4 = new 2UX();
                r4.LIZ("duration", System.currentTimeMillis() - LJIJI2.LIZIZ.longValue());
                2nK.LIZ("biolink_session_duration", r4.LIZ);
            }
        }
        C2272Kq7.LIZIZ();
        EventBus.LIZ().LIZIZ(this);
        LIZ(false);
    }

    @0CN(LIZ = 0CB.ON_RESUME)
    public final void onResume() {
        this.LJIILL.LIZIZ(this.LIZ);
        this.LIZLLL.LIZ();
        this.LJJI = System.currentTimeMillis();
        LJIILL();
        AdWebStatBusiness adWebStatBusiness = (AdWebStatBusiness) this.LIZLLL.LIZ(AdWebStatBusiness.class);
        if (adWebStatBusiness != null) {
            adWebStatBusiness.LIZIZ();
        }
        PlayableBusiness playableBusiness = (PlayableBusiness) this.LIZLLL.LIZ(PlayableBusiness.class);
        boolean z = false;
        if (playableBusiness != null && !playableBusiness.LIZ) {
            playableBusiness.LIZ(false, true);
        }
        Bundle bundle = this.LIZJ;
        if (bundle != null && bundle.getBoolean("skip_consent", false)) {
            z = true;
        }
        this.LJII = PgU.LIZIZ(a.LJIIZILJ()).LIZIZ(PhE.LIZIZ(PlI.LIZJ)).LIZLLL(new C2291KqQ(this, z));
        this.LJIJJ = true;
    }

    public final void LIZJ() {
        ImmersionBar immersionBar = this.LJIL;
        if (immersionBar != null) {
            immersionBar.destroy();
            this.LJIL = null;
        }
        C2041KmO crossPlatformParams = getCrossPlatformParams();
        Activity activity = this.LIZ;
        activity.findViewById(2131363853).setPadding(0, 4CM.LIZ(), 0, 0);
        Window window = activity.getWindow();
        boolean z = true;
        if (window != null && Build.VERSION.SDK_INT >= 28) {
            WindowManager.LayoutParams attributes = window.getAttributes();
            attributes.layoutInDisplayCutoutMode = 1;
            window.setAttributes(attributes);
        }
        ImmersionBar with = ImmersionBar.with(activity);
        with.keyboardEnable(true, 32);
        with.init();
        if (crossPlatformParams.LIZJ.LJIJ) {
            C2275KqA.LIZ(activity);
            if (!crossPlatformParams.LIZJ.LJJIJ) {
                crossPlatformParams.LIZJ.LJIJI = true;
            }
        } else {
            z = false;
        }
        if (crossPlatformParams.LIZJ.LJIJI) {
            4CM.LIZ(activity, 0);
        }
        JJh.LIZ.LIZ(activity, activity.getWindow(), crossPlatformParams.LIZJ.LIZIZ);
        if (C2275KqA.LIZ(crossPlatformParams, activity)) {
            if (!z) {
                C2275KqA.LIZ(activity);
            }
            4CM.LIZ(activity);
        } else {
            if (!crossPlatformParams.LIZJ.LJIJ) {
                if (crossPlatformParams.LIZJ.LJIJJLI != -2) {
                    4CM.LIZ(activity, crossPlatformParams.LIZJ.LJIJJLI);
                }
            }
            this.LJIL = with;
        }
        crossPlatformParams.LIZJ.LJIJJLI = activity.getWindow().getStatusBarColor();
        this.LJIL = with;
    }

    /* JADX WARNING: type inference failed for: r0v22, types: [android.webkit.WebView, X.KmY] */
    @0CN(LIZ = 0CB.ON_PAUSE)
    public final void onPause() {
        PassBackWebInfoBusiness passBackWebInfoBusiness = (PassBackWebInfoBusiness) this.LIZLLL.LIZ(PassBackWebInfoBusiness.class);
        if (passBackWebInfoBusiness != null) {
            passBackWebInfoBusiness.LIZ((WebView) this.LJIILL.LIZ(C2333Kr6.class).LIZ(), false);
        }
        this.LJIILL.LIZJ(this.LIZ);
        this.LJI = System.currentTimeMillis() - this.LJJI;
        this.LJJI = 0;
        2UX r3 = new 2UX();
        r3.LIZ("duration", this.LJI);
        2nK.LIZ("h5_stay_time", r3.LIZ);
        LJIILJJIL();
        AdWebStatBusiness adWebStatBusiness = (AdWebStatBusiness) this.LIZLLL.LIZ(AdWebStatBusiness.class);
        if (adWebStatBusiness != null) {
            adWebStatBusiness.LIZ(false);
        }
        PlayableBusiness playableBusiness = (PlayableBusiness) this.LIZLLL.LIZ(PlayableBusiness.class);
        if (playableBusiness != null && !playableBusiness.LIZ) {
            playableBusiness.LIZ(true, false);
        }
        this.LJII = PgU.LIZ(PgU.LIZIZ(a.LJIIZILJ()), SfZ.LJIJ.LJ(), C2321Kqu.LIZ).LIZIZ(PhE.LIZIZ(PlI.LIZJ)).LIZLLL(new C2290KqP(this));
    }

    private void LJJIIZ() {
        this.LJIIIZ = (C3007L4s) LIZ(2131363853);
        this.LJJ = (L06) LIZ(2131367308);
        if (this.LIZIZ.LIZJ.LJI != -2) {
            this.LJJ.setBackgroundColor(this.LIZIZ.LIZJ.LJI);
        } else {
            this.LJJ.setBackgroundColor(070.LIZJ(this.LIZ, 2131099659));
        }
        if (this.LIZIZ.LIZJ.LJIILJJIL != -2) {
            this.LJIIIZ.setBackgroundColor(this.LIZIZ.LIZJ.LJIILJJIL);
            this.LIZ.getWindow().setBackgroundDrawableResource(2131099762);
            7ib.LIZ(this.LIZ);
        }
        LJJIJ();
        this.LJIIJJI = new JX3(this.LIZ, this);
        LJIIL();
        if (this.LIZIZ.LIZJ.LJJ) {
            4vl r1 = new 4vl(this.LIZ);
            r1.LIZLLL(2131827666);
            r1.LIZIZ(2131823152);
            4FQ.LIZ(r1.LIZ().LIZJ());
        }
        LJJIJIIJI();
        ((OpenUrlHintBusiness) this.LIZLLL.LIZ(OpenUrlHintBusiness.class)).LIZ(this.LJIIIZ, this.LIZIZ.LIZ.LJIIIZ);
        LJJIJIL();
        if (getCrossPlatformParams().LIZJ.LJIJI) {
            LIZLLL();
        }
        if (!this.LIZIZ.LIZJ.LJIILL) {
            LJJ();
        } else {
            LJJIJL();
        }
        if (getCrossPlatformParams().LIZJ.LJIIZILJ) {
            LIZ(2131363853).setPadding(0, 4CM.LIZ(), 0, 0);
        }
        if (getCrossPlatformParams().LIZJ.LJJIJ) {
            FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) this.LJIIL.getLayoutParams();
            int i = getCrossPlatformParams().LIZJ.LJJIJIIJI;
            if (i < 0) {
                i = 4CM.LIZ();
            }
            layoutParams.setMargins(0, i, 0, 0);
            this.LJIIL.setLayoutParams(layoutParams);
        }
    }

    public final void LIZ(Bundle bundle) {
        this.LIZJ = bundle;
    }

    private <T extends View> T LIZ(int i) {
        return this.LIZ.findViewById(i);
    }

    @ISm
    public void onEvent(C2172KoV koV) {
        C2310Kqj kqj = this.LJIILLIIL;
        if (kqj != null) {
            kqj.LIZ();
        }
    }

    public final <T extends Hzm> T LIZ(Class<T> cls) {
        return this.LJIILL.LIZ(cls);
    }

    public final void LIZ(CWM cwm) {
        MethodCollector.i(1863);
        synchronized (this.LJJII) {
            try {
                this.LJJII.add(cwm);
            } finally {
                MethodCollector.o(1863);
            }
        }
    }

    public final void LIZIZ(CWM cwm) {
        MethodCollector.i(1865);
        synchronized (this.LJJII) {
            try {
                this.LJJII.remove(cwm);
            } finally {
                MethodCollector.o(1865);
            }
        }
    }

    @ISm
    public final void onEvent(B6u b6u) {
        IIMService createIIMServicebyMonsterPlugin;
        if (TextUtils.equals("web", b6u.LIZLLL) && (createIIMServicebyMonsterPlugin = IMService.createIIMServicebyMonsterPlugin(false)) != null) {
            createIIMServicebyMonsterPlugin.showIMSnackbar(this.LIZ, this.LJIIL, b6u);
        }
    }

    private void LIZ(boolean z) {
        C2273Kq8 kq8 = this.LIZIZ.LIZIZ;
        if (kq8.LIZ <= 0) {
            return;
        }
        if (z) {
            IAdLandPageSurveyService LIZJ2 = AdLandPageSurveyServiceImpl.LIZJ();
            String str = kq8.LJJIJIL;
            StringBuilder sb = new StringBuilder();
            sb.append(kq8.LJJJJZI);
            LIZJ2.LIZ(str, sb.toString(), kq8.LJIIL, kq8.LJJJJZ, kq8.LJIIIIZZ, kq8.LJJJJJL, kq8.LJJJJL, kq8.LJJJJLI, kq8.LJJJJLL);
            return;
        }
        AdLandPageSurveyServiceImpl.LIZJ().LIZ();
    }

    @ISm
    public void onEvent(2Ue r6) {
        1hK r4 = this.LIZ;
        if (r4 instanceof 1hK) {
            1hK r42 = r4;
            AGn aGn = new AGn();
            aGn.LIZ(r6.LIZJ);
            LiveOuterService.LJJI().LJ().LIZ(r42, new 5(this, r6), r6.LIZIZ, aGn).showNow(r42.getSupportFragmentManager(), getClass().getSimpleName());
        }
    }

    public final void LIZ(Intent intent) {
        this.LIZ.setResult(50000, intent);
    }

    public final void LIZIZ(String str) {
        Bundle bundle = this.LIZJ;
        if (bundle != null && !TextUtils.equals(str, bundle.getString("url"))) {
            this.LIZJ.putString("url", str);
            this.LIZIZ = C2274Kq9.LIZ(this.LIZJ);
            LJJIIZ();
        }
        this.LJIILL.LIZ(C2333Kr6.class).LIZ(str);
        AdWebStatBusiness adWebStatBusiness = (AdWebStatBusiness) this.LIZLLL.LIZ(AdWebStatBusiness.class);
        if (adWebStatBusiness != null) {
            adWebStatBusiness.LIZIZ();
        }
    }

    @ISm
    public void onEvent(C0677KDc kDc) {
        C2051KmY LIZ2;
        PreRenderWebViewBusiness LIZ3 = PreRenderWebViewBusiness.LIZJ.LIZ((C2118Knd) this);
        if (LIZ3 != null) {
            LIZ3.LIZ(this.LJIILL, kDc);
        } else if (kDc != null && kDc.LIZIZ != null && kDc.LIZ != 0 && (LIZ2 = this.LJIILL.LIZ(C2333Kr6.class).LIZ()) != null && LIZ2.hashCode() == kDc.LIZ) {
            JSONObject jSONObject = new JSONObject();
            try {
                jSONObject.put("code", 1);
                jSONObject.put("preloadType", 0);
                String str = this.LIZIZ.LIZIZ.LJJIJIL;
                if ("splash".equals(str)) {
                    jSONObject.put("scene", 2);
                } else if ("feedad".equals(str)) {
                    jSONObject.put("scene", 1);
                }
            } catch (JSONException e) {
                0HH.LIZ(e);
            }
            kDc.LIZIZ.LIZ(jSONObject);
        }
    }

    public final void LIZ(Configuration configuration) {
        C2341KrE krE = this.LJJIFFI;
        if ((krE == null || !krE.LIZ()) && !this.LIZIZ.LIZJ.LJJIIZI) {
            this.LJIIIZ.setLayoutParams(new FrameLayout.LayoutParams(Double.valueOf((double) HeD.LIZIZ(this.LIZ, (float) configuration.screenWidthDp)).intValue(), Double.valueOf((double) HeD.LIZIZ(this.LIZ, (float) configuration.screenHeightDp)).intValue()));
        }
    }

    public final boolean LIZIZ(Runnable runnable) {
        boolean z;
        if (LIZ(C2333Kr6.class).LIZ() != null) {
            z = LIZ(C2333Kr6.class).LIZ().canGoBack();
        } else {
            z = false;
        }
        if (!LJJIZ() || z) {
            return false;
        }
        return AdLandPageSurveyServiceImpl.LIZJ().LIZ(this.LIZ, new C2330Kr3(this, runnable));
    }

    @ISm
    public final void invokeRenderTimeEvent(Hx0 hx0) {
        C2340KrD krD;
        if (this.LJIJJ && hx0.LIZIZ != null) {
            if (TextUtils.equals("goods_rn_page_monitor", hx0.LIZIZ.optString("eventName"))) {
                try {
                    JSONObject jSONObject = hx0.LIZIZ.getJSONObject("data");
                    SvN svN = new SvN();
                    svN.LJIILJJIL = Long.valueOf(Long.valueOf(jSONObject.optString("interact_render_ts")).longValue() - this.LJIJI);
                    svN.LJIIZILJ = jSONObject.optString("page_id");
                    svN.LJIILIIL = Long.valueOf(Long.valueOf(jSONObject.optString("ender_render_ts")).longValue() - this.LJIJI);
                    svN.LJIILL = jSONObject.optString("session_id");
                    Swl.LIZ().logCommerceEvents("commerce_page_render_time", svN);
                } catch (Exception e) {
                    0HH.LIZ(e);
                }
            } else if (TextUtils.equals("hybrid_prefetch_duration_monitor", hx0.LIZIZ.optString("eventName"))) {
                C2299KqY kqY = new C2299KqY();
                try {
                    JSONObject jSONObject2 = hx0.LIZIZ.getJSONObject("data");
                    kqY.LIZIZ.put("duration", Long.valueOf(jSONObject2.optString("duration")).longValue());
                    kqY.LIZ.put("duration_type", jSONObject2.optString("duration_type"));
                    kqY.LIZ.put("is_cache", jSONObject2.optString("is_cache"));
                    kqY.LIZ.put("page_id", jSONObject2.optString("page_id"));
                    C2289KqO kqO = this.LJIILL;
                    if (kqO != null) {
                        kqY.LIZLLL = kqO.getMonitorSession();
                    }
                    C2386Krx LIZ2 = C2386Krx.LJII.LIZ();
                    C3197LCa lCa = kqY.LIZLLL;
                    if (lCa != null) {
                        krD = (C2340KrD) lCa.LIZ(C2340KrD.class);
                    } else {
                        krD = null;
                    }
                    LIZ2.LIZ(krD, "hybrid_prefetch_duration_monitor", "invoke_render_event", kqY.LIZ, kqY.LIZIZ, kqY.LIZJ);
                } catch (Exception e2) {
                    0HH.LIZ(e2);
                }
            }
        }
    }

    @ISm
    public void onEvent(C0679KDe kDe) {
        C2289KqO kqO;
        C2333Kr6 LIZ2;
        C2051KmY LIZ3;
        if (kDe != null && kDe.LIZ != 0 && (kqO = this.LJIILL) != null && (LIZ2 = kqO.LIZ(C2333Kr6.class)) != null && (LIZ3 = LIZ2.LIZ()) != null && this.LJ != null && LIZ3.hashCode() == kDe.LIZ && !LIZIZ((Runnable) null)) {
            this.LJ.run();
        }
    }

    @ISm
    public final void onEvent(C0720KEt kEt) {
        if (kEt != null && kEt.LIZ != null && LJJIL()) {
            String str = kEt.LIZ;
            str.hashCode();
            if (str.equals("3") && "1".equals(this.LJIJ)) {
                LJJIJL();
            }
        }
    }

    public final void LIZ(Runnable runnable) {
        this.LJ = runnable;
    }

    public final void LIZ(String str) {
        LIZ((CharSequence) str, true);
    }

    public MixActivityContainer(Activity activity, C2041KmO kmO) {
        this.LIZ = activity;
        this.LIZIZ = kmO;
        this.LIZLLL = C2163KoM.LIZ(this);
    }

    public final void LIZ(CharSequence charSequence, boolean z) {
        if (this.LJIIL != null) {
            if ((!TextUtils.isEmpty(charSequence) && C2275KqA.LIZ(charSequence)) || this.LIZIZ.LIZ.LIZ == null || this.LIZIZ.LIZ.LIZ.intValue() != 1) {
                return;
            }
            if (this.LIZIZ.LIZJ.LJJI || z) {
                this.LJIIL.setTitle(charSequence);
            }
        }
    }
}
