package com.ss.android.ugc.aweme.homepage.ui.view.tab.bottom.hometab;

import X.86a;
import X.C0295Crj;
import X.C4969EpZ;
import X.C5266EuM;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import androidx.fragment.app.Fragment;
import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;
import com.ss.android.ugc.aweme.TabFragmentGroup;
import com.ss.android.ugc.aweme.main.uiApiImpl.HomePageUIFrameServiceImpl;

public final class HomeTab extends TabFragmentGroup {
    public C5266EuM LJIIIZ;
    public final Context LJIIJ;
    public View.OnClickListener LJIIJJI;
    public final C0295Crj LJIIL;

    static {
        Covode.recordClassIndex(83259);
    }

    private final C4969EpZ LJIIJ() {
        return (C4969EpZ) this.LJIIL.getValue();
    }

    public final boolean LIZIZ() {
        return true;
    }

    public final String cC_() {
        return "homepage_hot";
    }

    public final String LJ() {
        return LJIIJ().LJIIIZ;
    }

    public final String ap_() {
        return LJIIJ().LJIIJ;
    }

    public final Class<? extends Fragment> LJI() {
        return HomePageUIFrameServiceImpl.LJ().LIZIZ(LJIIJ().LJIIIZ);
    }

    public final void LIZLLL() {
        if (this.LJIIJJI == null) {
            this.LJIIJJI = HomePageUIFrameServiceImpl.LJ().LIZ(this.LJIIJ, LJIIJ().LJIIIZ);
        }
        View.OnClickListener onClickListener = this.LJIIJJI;
        if (onClickListener != null) {
            onClickListener.onClick((View) null);
        }
    }

    /* JADX WARNING: Code restructure failed: missing block: B:5:0x000c, code lost:
        if (r1 == null) goto L_0x000e;
     */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final android.os.Bundle LJII() {
        /*
            r3 = this;
            android.content.Context r2 = r3.LJIIJ
            r1 = 0
            if (r2 == 0) goto L_0x000e
        L_0x0005:
            boolean r0 = r2 instanceof android.app.Activity
            if (r0 == 0) goto L_0x001f
            android.app.Activity r2 = (android.app.Activity) r2
            r1 = r2
            if (r1 != 0) goto L_0x0011
        L_0x000e:
            kotlin.h.b.n.LIZIZ()
        L_0x0011:
            android.content.Intent r1 = r1.getIntent()
            java.lang.String r0 = ""
            kotlin.h.b.n.LIZIZ(r1, r0)
            android.os.Bundle r0 = r3.LIZ((android.content.Intent) r1)
            return r0
        L_0x001f:
            boolean r0 = r2 instanceof android.content.ContextWrapper
            if (r0 == 0) goto L_0x000e
            android.content.ContextWrapper r2 = (android.content.ContextWrapper) r2
            android.content.Context r2 = r2.getBaseContext()
            if (r2 == 0) goto L_0x000e
            goto L_0x0005
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.homepage.ui.view.tab.bottom.hometab.HomeTab.LJII():android.os.Bundle");
    }

    public final void LJIIIIZZ() {
        MethodCollector.i(6336);
        if (this.LJIIJJI == null) {
            this.LJIIJJI = HomePageUIFrameServiceImpl.LJ().LIZ(this.LJIIJ, LJIIJ().LJIIIZ);
        }
        View view = new View(this.LJIIJ);
        view.setTag("is_mocked_click");
        View.OnClickListener onClickListener = this.LJIIJJI;
        if (onClickListener != null) {
            onClickListener.onClick(view);
            MethodCollector.o(6336);
            return;
        }
        MethodCollector.o(6336);
    }

    private final Bundle LIZ(Intent intent) {
        int i;
        if (intent == null) {
            return null;
        }
        String LIZ = LIZ(intent, "tab");
        if (86a.LIZ(LIZ)) {
            i = intent.getIntExtra("tab", -1);
        } else {
            try {
                i = Integer.parseInt(LIZ);
            } catch (Throwable unused) {
                i = -1;
            }
        }
        int intExtra = intent.getIntExtra("page_type", -1);
        if (i < 0 && intExtra < 0) {
            return null;
        }
        Bundle bundle = new Bundle();
        bundle.putInt("tab", i);
        bundle.putInt("page_type", intExtra);
        return bundle;
    }

    /* JADX WARNING: Code restructure failed: missing block: B:5:0x0014, code lost:
        if (r1 == null) goto L_0x0016;
     */
    /* JADX WARNING: Removed duplicated region for block: B:10:0x002b A[LOOP:1: B:8:0x0025->B:10:0x002b, LOOP_END] */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public HomeTab(android.content.Context r4) {
        /*
            r3 = this;
            X.M12.LIZ(r4)
            r3.<init>()
            r3.LJIIJ = r4
            X.Ei3 r2 = com.ss.android.ugc.aweme.homepage.ui.view.tab.HomeTabViewModel.LJ
            r1 = 0
            if (r4 == 0) goto L_0x0016
        L_0x000d:
            boolean r0 = r4 instanceof X.1hK
            if (r0 == 0) goto L_0x003c
            X.1hK r4 = (X.1hK) r4
            r1 = r4
            if (r1 != 0) goto L_0x0019
        L_0x0016:
            kotlin.h.b.n.LIZIZ()
        L_0x0019:
            com.ss.android.ugc.aweme.homepage.ui.view.tab.HomeTabViewModel r0 = r2.LIZ(r1)
            java.util.List r0 = r0.LIZLLL()
            java.util.Iterator r2 = r0.iterator()
        L_0x0025:
            boolean r0 = r2.hasNext()
            if (r0 == 0) goto L_0x0049
            java.lang.Object r1 = r2.next()
            X.EiP r1 = (X.C4525EiP) r1
            java.lang.String r0 = "null cannot be cast to non-null type com.bytedance.hox.HoxNode"
            java.util.Objects.requireNonNull(r1, r0)
            X.EnF r1 = (X.C4825EnF) r1
            r3.LIZ((X.C4825EnF) r1)
            goto L_0x0025
        L_0x003c:
            boolean r0 = r4 instanceof android.content.ContextWrapper
            if (r0 == 0) goto L_0x0016
            android.content.ContextWrapper r4 = (android.content.ContextWrapper) r4
            android.content.Context r4 = r4.getBaseContext()
            if (r4 == 0) goto L_0x0016
            goto L_0x000d
        L_0x0049:
            X.EnC r0 = new X.EnC
            r0.<init>(r3)
            X.Crj r0 = X.7he.LIZ(r0)
            r3.LJIIL = r0
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.homepage.ui.view.tab.bottom.hometab.HomeTab.<init>(android.content.Context):void");
    }

    /* JADX WARNING: Code restructure failed: missing block: B:8:0x0034, code lost:
        if (r0 == null) goto L_0x001e;
     */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final android.view.View LIZ(X.C4519EiJ r5) {
        /*
            r4 = this;
            X.M12.LIZ(r5)
            X.7qE r0 = X.7qE.LJI
            boolean r0 = r0.LIZJ()
            r3 = 1
            if (r0 == 0) goto L_0x0037
            X.9Fh r1 = X.9Fh.LJIILIIL
            com.ss.android.ugc.aweme.homepage.ui.inflate.X2CFragmentMainPageIcon r0 = new com.ss.android.ugc.aweme.homepage.ui.inflate.X2CFragmentMainPageIcon
            r0.<init>()
            java.lang.Object r2 = r1.LIZ(r0)
            com.ss.android.ugc.aweme.homepage.ui.inflate.X2CFragmentMainPageIcon r2 = (com.ss.android.ugc.aweme.homepage.ui.inflate.X2CFragmentMainPageIcon) r2
            X.EpW r0 = r2.LIZ
            r1 = 0
            if (r0 != 0) goto L_0x002b
        L_0x001e:
            X.EpW r0 = new X.EpW
            X.EpZ r1 = r4.LJIIJ()
            r0.<init>(r1)
        L_0x0027:
            r0.setSelected(r3)
            return r0
        L_0x002b:
            X.EpW r0 = r2.LIZ
            com.ss.android.ugc.aweme.homepage.ui.inflate.X2CFragmentMainPageIcon.LIZ(r0)
            X.EpW r0 = r2.LIZ
            r2.LIZ = r1
            if (r0 != 0) goto L_0x0027
            goto L_0x001e
        L_0x0037:
            X.EpW r1 = new X.EpW
            X.EpZ r0 = r4.LJIIJ()
            r1.<init>(r0)
            r1.setSelected(r3)
            return r1
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.homepage.ui.view.tab.bottom.hometab.HomeTab.LIZ(X.EiJ):android.view.View");
    }

    public static String LIZ(Intent intent, String str) {
        try {
            return intent.getStringExtra(str);
        } catch (Exception unused) {
            return null;
        }
    }

    /* JADX WARNING: Code restructure failed: missing block: B:5:0x000f, code lost:
        if (r1 == null) goto L_0x0011;
     */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final void LIZ(java.lang.String r4, android.os.Bundle r5) {
        /*
            r3 = this;
            X.M12.LIZ(r4, r5)
            android.content.Context r2 = r3.LJIIJ
            r1 = 0
            if (r2 == 0) goto L_0x0011
        L_0x0008:
            boolean r0 = r2 instanceof X.1hK
            if (r0 == 0) goto L_0x0045
            r1 = r2
            X.1hK r1 = (X.1hK) r1
            if (r1 != 0) goto L_0x0014
        L_0x0011:
            kotlin.h.b.n.LIZIZ()
        L_0x0014:
            X.3he r0 = com.bytedance.hox.Hox.LJ
            com.bytedance.hox.Hox r0 = r0.LIZ(r1)
            X.M12.LIZ(r4)
            X.EnF r1 = r0.LJ(r4)
            if (r1 != 0) goto L_0x0033
        L_0x0023:
            r2 = -1
        L_0x0024:
            java.lang.String r1 = X.C4820EnA.LJFF
            r0 = 0
            boolean r1 = r5.getBoolean(r1, r0)
            X.EuM r0 = r3.LJIIIZ
            if (r0 == 0) goto L_0x0032
            r0.LIZ(r2, r1)
        L_0x0032:
            return
        L_0x0033:
            X.EnE r0 = r1.LJFF
            if (r0 == 0) goto L_0x0023
            X.EnE r0 = r1.LJFF
            if (r0 != 0) goto L_0x003e
            kotlin.h.b.n.LIZ()
        L_0x003e:
            java.util.List<X.EnF> r0 = r0.LJ
            int r2 = r0.indexOf(r1)
            goto L_0x0024
        L_0x0045:
            boolean r0 = r2 instanceof android.content.ContextWrapper
            if (r0 == 0) goto L_0x0011
            android.content.ContextWrapper r2 = (android.content.ContextWrapper) r2
            android.content.Context r2 = r2.getBaseContext()
            if (r2 == 0) goto L_0x0011
            goto L_0x0008
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.homepage.ui.view.tab.bottom.hometab.HomeTab.LIZ(java.lang.String, android.os.Bundle):void");
    }
}
