package com.ss.android.ugc.aweme.unlogin;

import X.070;
import X.0Q2;
import X.0Q9;
import X.1I0;
import X.1hK;
import X.9Y3;
import X.AnonymousClass2GO;
import X.AnonymousClass2HZ;
import X.AnonymousClass3ZQ;
import X.AnonymousClass46R;
import X.AnonymousClass4MI;
import X.AnonymousClass4ND;
import X.AnonymousClass4NE;
import X.AnonymousClass4NF;
import X.AnonymousClass4NG;
import X.AnonymousClass4NH;
import X.AnonymousClass4NK;
import X.AnonymousClass4ZZ;
import X.C03012Pr;
import X.C08922hg;
import X.C18812xd;
import X.C18872xj;
import X.C32653er;
import X.CbG;
import X.Cc1;
import X.ENr;
import X.EcI;
import X.EnJ;
import X.ISm;
import X.LeS;
import X.Lel;
import X.LnI;
import X.LsC;
import X.Lw4;
import X.M12;
import X.NzO;
import X.Qeg;
import X.Ql4;
import X.Rc9;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.drawable.GradientDrawable;
import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import android.util.SparseArray;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewStub;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;
import com.bytedance.router.SmartRouter;
import com.ss.android.ugc.aweme.base.fragment.AmeBaseFragment;
import com.ss.android.ugc.aweme.main.TabChangeManager;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import kotlin.h.b.n;
import org.greenrobot.eventbus.ThreadMode;

public final class UnloginSignUpFragment extends AmeBaseFragment implements View.OnClickListener, 1I0, EnJ, AnonymousClass2HZ, AnonymousClass2GO {
    public static final AnonymousClass4NG LIZLLL = new AnonymousClass4NG((byte) 0);
    public AnonymousClass4NK LIZ;
    public boolean LIZIZ = true;
    public View LIZJ;
    public SparseArray LJ;

    static {
        Covode.recordClassIndex(121403);
    }

    private final String LJ(int i) {
        return i != 0 ? i != 1 ? "" : "click_area" : "click_button";
    }

    private View LJFF(int i) {
        if (this.LJ == null) {
            this.LJ = new SparseArray();
        }
        View view = (View) this.LJ.get(i);
        if (view != null) {
            return view;
        }
        View view2 = getView();
        if (view2 == null) {
            return null;
        }
        View findViewById = view2.findViewById(i);
        this.LJ.put(i, findViewById);
        return findViewById;
    }

    public final void LIZIZ(Bundle bundle) {
        M12.LIZ(bundle);
    }

    public final boolean LJJIJIIJI() {
        return true;
    }

    public final String az_() {
        return "MainTabPage";
    }

    public final Map<Integer, Object> getSubscriberEventTypes() {
        HashMap hashMap = new HashMap();
        hashMap.put(259, new Rc9(UnloginSignUpFragment.class, "onEvent", AnonymousClass4MI.class, ThreadMode.POSTING, 0, false));
        return hashMap;
    }

    public final String aB_() {
        return 0Q9.LIZ(this);
    }

    public final Map<String, String> aE_() {
        return 0Q9.LIZIZ(this);
    }

    private final void LIZ() {
        LJFF(2131372573).setTuxFont(33);
    }

    private String LJI() {
        if (this.LIZIZ) {
            return "message";
        }
        return "personal_homepage";
    }

    public final /* synthetic */ void onDestroyView() {
        UnloginSignUpFragment.super.onDestroyView();
        SparseArray sparseArray = this.LJ;
        if (sparseArray != null) {
            sparseArray.clear();
        }
    }

    public final void onResume() {
        UnloginSignUpFragment.super.onResume();
        1hK activity = getActivity();
        if (activity != null && n.LIZ(TabChangeManager.LJII.LIZ(activity).LIZ(), this)) {
            0Q2.LIZ(this);
        }
    }

    private final void LJ() {
        ImageView imageView = (ImageView) LJFF(2131365905);
        n.LIZIZ(imageView, "");
        imageView.setVisibility(8);
        Qeg LJFF = LJFF(2131365589);
        n.LIZIZ(LJFF, "");
        LJFF.setVisibility(8);
        CbG LJFF2 = LJFF(2131363038);
        n.LIZIZ(LJFF2, "");
        LJFF2.setVisibility(8);
        View LJFF3 = LJFF(2131371274);
        n.LIZIZ(LJFF3, "");
        LJFF3.setVisibility(8);
    }

    public final String getBtmPageCode() {
        Bundle arguments = getArguments();
        if (arguments != null) {
            String string = arguments.getString("tab");
            if (n.LIZ("UNLOGIN_NOTIFICATION", string)) {
                return "b3426";
            }
            if (n.LIZ("UNLOGIN_PROFILE", string)) {
                return "b2706";
            }
            if (string != null) {
                return string;
            }
        }
        String simpleName = getClass().getSimpleName();
        n.LIZIZ(simpleName, "");
        return simpleName;
    }

    public final void onDestroy() {
        if (this.LIZ != null) {
            AnonymousClass4NK r3 = this.LIZ;
            if (r3 == null) {
                n.LIZ("");
            }
            r3.LIZ.dispose();
            if (r3.LIZ().isRunning()) {
                r3.LIZ().cancel();
            }
            Handler handler = r3.LIZLLL.getHandler();
            if (handler != null) {
                Runnable runnable = r3.LIZJ;
                if (runnable == null) {
                    n.LIZ("");
                }
                handler.removeCallbacks(runnable);
            }
        }
        UnloginSignUpFragment.super.onDestroy();
    }

    private final void LJFF() {
        MethodCollector.i(7044);
        ((LinearLayout) LJFF(2131372574)).addView(LIZ(2131755268, true));
        ((LinearLayout) LJFF(2131372574)).addView(LIZ(2131755304, true));
        ((LinearLayout) LJFF(2131372574)).addView(LIZ(2131755344, true));
        ((LinearLayout) LJFF(2131372574)).addView(LIZ(2131755317, false));
        MethodCollector.o(7044);
    }

    public final void LIZ(Bundle bundle) {
        M12.LIZ(bundle);
        0Q2.LIZ(this);
    }

    public final void LIZ(int i) {
        Lw4.LIZ(this, LJI(), LJ(i), new AnonymousClass4ND(this));
        AnonymousClass46R.LIZ.LIZ(LJI(), LJ(i));
    }

    @ISm
    public final void onEvent(AnonymousClass4MI r5) {
        M12.LIZ(r5);
        if (!this.LIZIZ) {
            C32653er r1 = TabChangeManager.LJII;
            1hK activity = getActivity();
            if (activity == null) {
                n.LIZIZ();
            }
            TabChangeManager.LIZ(r1.LIZ(activity), "HOME", false, 30);
        }
    }

    public static View LIZ(LayoutInflater layoutInflater) {
        MethodCollector.i(7047);
        if (9Y3.LIZ(9Y3.LIZ(), true, "tiktok_tux_text_view_opt", false) && layoutInflater != null && layoutInflater.getFactory() == null && layoutInflater.getFactory2() == null) {
            try {
                layoutInflater.setFactory(new Ql4());
            } catch (Exception unused) {
                View inflate = layoutInflater.inflate(2131559852, (ViewGroup) null);
                MethodCollector.o(7047);
                return inflate;
            }
        }
        View inflate2 = layoutInflater.inflate(2131559852, (ViewGroup) null);
        MethodCollector.o(7047);
        return inflate2;
    }

    private final void LIZJ(int i) {
        if (i == 0) {
            FrameLayout frameLayout = (FrameLayout) LJFF(2131372575);
            n.LIZIZ(frameLayout, "");
            this.LIZ = new AnonymousClass4NK(frameLayout, LIZLLL(i));
        } else if (i == 1) {
            FrameLayout frameLayout2 = (FrameLayout) LJFF(2131372575);
            n.LIZIZ(frameLayout2, "");
            this.LIZ = new AnonymousClass4NK(frameLayout2, LIZLLL(i));
        }
        AnonymousClass4NK r0 = this.LIZ;
        if (r0 == null) {
            n.LIZ("");
        }
        r0.LJI();
    }

    public final void onClick(View view) {
        if (view != null && !Cc1.LIZ(view, 1200)) {
            int id = view.getId();
            if (id == 2131372573 || id == 2131363038) {
                LIZ(0);
            } else if (id == 2131370135) {
                SmartRouter.buildRoute(getActivity(), "//setting").open();
            }
        }
    }

    private final List<String> LIZLLL(int i) {
        if (i == 0) {
            String string = getString(2131827088);
            n.LIZIZ(string, "");
            String string2 = getString(2131827089);
            n.LIZIZ(string2, "");
            String string3 = getString(2131827090);
            n.LIZIZ(string3, "");
            return LeS.LIZIZ(new String[]{string, string2, string3});
        } else if (i != 1) {
            return Lel.INSTANCE;
        } else {
            String string4 = getString(2131827095);
            n.LIZIZ(string4, "");
            String string5 = getString(2131827096);
            n.LIZIZ(string5, "");
            String string6 = getString(2131827097);
            n.LIZIZ(string6, "");
            return LeS.LIZIZ(new String[]{string4, string5, string6});
        }
    }

    private final void LIZIZ(int i) {
        MethodCollector.i(7040);
        LIZ();
        LJ();
        LIZJ(i);
        FrameLayout frameLayout = (FrameLayout) LJFF(2131372576);
        n.LIZIZ(frameLayout, "");
        frameLayout.setVisibility(0);
        if (i != 0) {
            if (i == 1) {
                View inflate = ((ViewStub) getView().findViewById(2131372578)).inflate();
                n.LIZIZ(inflate, "");
                this.LIZJ = inflate;
                if (inflate == null) {
                    n.LIZ("");
                }
                inflate.setVisibility(0);
                View LJFF = LJFF(2131372576);
                Resources system = Resources.getSystem();
                n.LIZIZ(system, "");
                C08922hg.LIZ(LJFF, LnI.LIZ(TypedValue.applyDimension(1, 60.0f, system.getDisplayMetrics())));
            }
            MethodCollector.o(7040);
            return;
        }
        LinearLayout linearLayout = (LinearLayout) LJFF(2131372574);
        n.LIZIZ(linearLayout, "");
        linearLayout.setVisibility(0);
        LJFF();
        View LJFF2 = LJFF(2131372576);
        Resources system2 = Resources.getSystem();
        n.LIZIZ(system2, "");
        C08922hg.LIZ(LJFF2, LnI.LIZ(TypedValue.applyDimension(1, 3.0f, system2.getDisplayMetrics())));
        MethodCollector.o(7040);
    }

    private final View LIZ(int i, boolean z) {
        View LIZ2 = LIZ(LayoutInflater.from(getActivity()));
        n.LIZIZ(LIZ2, "");
        Resources system = Resources.getSystem();
        n.LIZIZ(system, "");
        LIZ2.setLayoutParams(new LinearLayout.LayoutParams(-2, LnI.LIZ(TypedValue.applyDimension(1, 56.0f, system.getDisplayMetrics()))));
        View findViewById = LIZ2.findViewById(2131365405);
        n.LIZIZ(findViewById, "");
        GradientDrawable.Orientation orientation = GradientDrawable.Orientation.LEFT_RIGHT;
        int[] iArr = new int[2];
        1hK activity = getActivity();
        if (activity == null) {
            n.LIZIZ();
        }
        iArr[0] = 070.LIZJ(activity, 2131100087);
        1hK activity2 = getActivity();
        if (activity2 == null) {
            n.LIZIZ();
        }
        iArr[1] = 070.LIZJ(activity2, 2131100086);
        findViewById.setBackground(new GradientDrawable(orientation, iArr));
        View findViewById2 = LIZ2.findViewById(2131364152);
        if (z) {
            n.LIZIZ(findViewById2, "");
            findViewById2.setVisibility(0);
        } else {
            n.LIZIZ(findViewById2, "");
            findViewById2.setVisibility(8);
        }
        ((AnonymousClass4ZZ) LIZ2.findViewById(2131365748)).setTuxIcon(C18812xd.LIZ((LsC<? super AnonymousClass3ZQ, C03012Pr>) new C18872xj(i)));
        return LIZ2;
    }

    public final void onViewCreated(View view, Bundle bundle) {
        String str;
        int i;
        int i2;
        int identifier;
        M12.LIZ(view);
        UnloginSignUpFragment.super.onViewCreated(view, bundle);
        view.setOnTouchListener(AnonymousClass4NE.LIZ);
        Bundle arguments = getArguments();
        if (arguments != null) {
            str = arguments.getString("tab");
        } else {
            str = null;
        }
        this.LIZIZ = TextUtils.equals(str, "UNLOGIN_NOTIFICATION");
        M12.LIZ(view);
        Context context = getContext();
        if (context == null || (identifier = context.getResources().getIdentifier("status_bar_height", "dimen", "android")) <= 0) {
            i = 0;
        } else {
            i = context.getResources().getDimensionPixelSize(identifier);
        }
        if (i > 0) {
            View LJFF = LJFF(2131365257);
            n.LIZIZ(LJFF, "");
            LJFF.getLayoutParams().height = i;
        } else {
            View LJFF2 = LJFF(2131365257);
            n.LIZIZ(LJFF2, "");
            LJFF2.setVisibility(8);
        }
        if (this.LIZIZ) {
            NzO LJFF3 = LJFF(2131372426);
            n.LIZIZ(LJFF3, "");
            Context context2 = view.getContext();
            if (EcI.LIZ.LIZIZ()) {
                i2 = 2131827718;
            } else {
                i2 = 2131823049;
            }
            LJFF3.setText(context2.getText(i2));
            if (ENr.LIZIZ.LIZ()) {
                LIZIZ(0);
            } else {
                Qeg LJFF4 = LJFF(2131365589);
                n.LIZIZ(LJFF4, "");
                LJFF4.setText(view.getContext().getText(2131823048));
                ((ImageView) LJFF(2131365905)).setImageResource(2131232323);
            }
        } else {
            NzO LJFF5 = LJFF(2131372426);
            n.LIZIZ(LJFF5, "");
            LJFF5.setText(view.getContext().getText(2131831076));
            AnonymousClass4ZZ r0 = (AnonymousClass4ZZ) LJFF(2131370135);
            n.LIZIZ(r0, "");
            r0.setVisibility(0);
            if (ENr.LIZIZ.LIZ()) {
                LIZIZ(1);
            } else {
                Qeg LJFF6 = LJFF(2131365589);
                n.LIZIZ(LJFF6, "");
                LJFF6.setText(view.getContext().getText(2131831075));
                ((ImageView) LJFF(2131365905)).setImageResource(2131232322);
            }
        }
        LJFF(2131363038).setOnClickListener(this);
        ((AnonymousClass4ZZ) LJFF(2131370135)).setOnClickListener(this);
        if (ENr.LIZIZ.LIZ()) {
            ArrayList<View> arrayList = new ArrayList<>();
            if (this.LIZJ != null) {
                View view2 = this.LIZJ;
                if (view2 == null) {
                    n.LIZ("");
                }
                View findViewById = view2.findViewById(2131372577);
                n.LIZIZ(findViewById, "");
                arrayList.add(findViewById);
                View view3 = this.LIZJ;
                if (view3 == null) {
                    n.LIZ("");
                }
                View findViewById2 = view3.findViewById(2131372580);
                n.LIZIZ(findViewById2, "");
                arrayList.add(findViewById2);
                View view4 = this.LIZJ;
                if (view4 == null) {
                    n.LIZ("");
                }
                View findViewById3 = view4.findViewById(2131372579);
                n.LIZIZ(findViewById3, "");
                arrayList.add(findViewById3);
            }
            View LJFF7 = LJFF(2131372575);
            n.LIZIZ(LJFF7, "");
            arrayList.add(LJFF7);
            View LJFF8 = LJFF(2131372574);
            n.LIZIZ(LJFF8, "");
            arrayList.add(LJFF8);
            for (View onClickListener : arrayList) {
                onClickListener.setOnClickListener(new AnonymousClass4NF(this));
            }
            ((ScrollView) LJFF(2131372581)).setOnTouchListener(AnonymousClass4NH.LIZ);
            LJFF(2131372573).setOnClickListener(this);
        }
    }

    /* JADX DEBUG: Multi-variable search result rejected for TypeSearchVarInfo{r2v1, resolved type: X.3hP} */
    /* JADX DEBUG: Multi-variable search result rejected for TypeSearchVarInfo{r2v2, resolved type: X.3hP} */
    /* JADX WARNING: Multi-variable type inference failed */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final android.view.View onCreateView(android.view.LayoutInflater r5, android.view.ViewGroup r6, android.os.Bundle r7) {
        /*
            r4 = this;
            X.M12.LIZ(r5)
            X.1hK r3 = r4.getActivity()
            if (r3 == 0) goto L_0x0037
            android.os.Bundle r1 = r4.getArguments()
            if (r1 == 0) goto L_0x0037
            java.lang.String r0 = "tab"
            java.lang.String r2 = r1.getString(r0)
            java.lang.String r0 = "UNLOGIN_NOTIFICATION"
            boolean r0 = kotlin.h.b.n.LIZ(r0, r2)
            java.lang.String r1 = ""
            if (r0 == 0) goto L_0x0040
            X.3he r0 = com.bytedance.hox.Hox.LJ
            kotlin.h.b.n.LIZIZ(r3, r1)
            com.bytedance.hox.Hox r0 = r0.LIZ(r3)
            r2 = r4
            java.lang.String r1 = "NOTIFICATION"
            r0.LIZIZ(r1, r2)
            X.3he r0 = com.bytedance.hox.Hox.LJ
            com.bytedance.hox.Hox r0 = r0.LIZ(r3)
            r0.LIZ(r1, r2)
        L_0x0037:
            r1 = 2131559850(0x7f0d05aa, float:1.8745056E38)
            r0 = 0
            android.view.View r0 = X.0HH.LIZ(r5, r1, r6, r0)
            return r0
        L_0x0040:
            java.lang.String r0 = "UNLOGIN_PROFILE"
            boolean r0 = kotlin.h.b.n.LIZ(r0, r2)
            if (r0 == 0) goto L_0x0037
            X.3he r0 = com.bytedance.hox.Hox.LJ
            kotlin.h.b.n.LIZIZ(r3, r1)
            com.bytedance.hox.Hox r0 = r0.LIZ(r3)
            r2 = r4
            java.lang.String r1 = "USER"
            r0.LIZIZ(r1, r2)
            X.3he r0 = com.bytedance.hox.Hox.LJ
            com.bytedance.hox.Hox r0 = r0.LIZ(r3)
            r0.LIZ(r1, r2)
            goto L_0x0037
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.unlogin.UnloginSignUpFragment.onCreateView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle):android.view.View");
    }
}
