package com.ss.android.ugc.aweme.account.login.v2.ui.fragments;

import X.0AA;
import X.0GZ;
import X.0Q2;
import X.0Q6;
import X.7he;
import X.C2160Rtk;
import X.C2162Rtm;
import X.C2202RuQ;
import X.C2421Rxx;
import X.C2422Rxy;
import X.C2425Ry1;
import X.Crj;
import X.HeD;
import X.M12;
import X.Qz0;
import X.Qz3;
import X.Qz9;
import X.S2A;
import X.S2C;
import X.S2D;
import X.S2F;
import X.S2H;
import android.os.Bundle;
import android.text.TextPaint;
import android.view.View;
import android.widget.TextView;
import com.bytedance.covode.number.Covode;
import java.util.HashMap;
import kotlin.h.b.n;

public final class PhoneEmailLoginFragment extends BaseI18nLoginFragment {
    public static final S2H LIZLLL = new S2H((byte) 0);
    public S2A LIZ;
    public int LIZIZ = -1;
    public boolean LIZJ = true;
    public final Crj LJIIL = 7he.LIZ(new S2C(this));
    public final Crj LJIILIIL = 7he.LIZ(new C2421Rxx(this));
    public final Crj LJIILJJIL = 7he.LIZ(new C2422Rxy(this));
    public HashMap LJIILL;

    static {
        Covode.recordClassIndex(51876);
    }

    public final int LIZ() {
        return 2131558761;
    }

    public final View LIZ(int i) {
        if (this.LJIILL == null) {
            this.LJIILL = new HashMap();
        }
        View view = (View) this.LJIILL.get(Integer.valueOf(i));
        if (view != null) {
            return view;
        }
        View view2 = getView();
        if (view2 == null) {
            return null;
        }
        View findViewById = view2.findViewById(i);
        this.LJIILL.put(Integer.valueOf(i), findViewById);
        return findViewById;
    }

    public final void LIZ(int i, String str) {
        M12.LIZ(str);
    }

    public final void LJFF() {
    }

    public final void LJI() {
    }

    public final C2425Ry1 LJII() {
        return (C2425Ry1) this.LJIILIIL.getValue();
    }

    public final C2425Ry1 LJIIIZ() {
        return (C2425Ry1) this.LJIILJJIL.getValue();
    }

    public final void LJIIJ() {
        HashMap hashMap = this.LJIILL;
        if (hashMap != null) {
            hashMap.clear();
        }
    }

    public final /* synthetic */ void onDestroyView() {
        super.onDestroyView();
        LJIIJ();
    }

    public final boolean LJIIJJI() {
        0GZ LIZ2 = LIZ(2131368467);
        n.LIZIZ(LIZ2, "");
        if (LIZ2.getCurrentItem() == 0) {
            return true;
        }
        return false;
    }

    public final C2202RuQ LIZLLL() {
        boolean z;
        String string = getString(2131823075);
        if (LJJI() != C2160Rtk.RECOVER_ACCOUNT) {
            z = true;
        } else {
            z = false;
        }
        return new C2202RuQ(string, (String) null, false, (String) null, (String) null, false, "phone_login_homepage", z, false, 1278);
    }

    public final void onStart() {
        PhoneEmailLoginFragment.super.onStart();
        int i = this.LIZIZ;
        if (i == -1) {
            Bundle arguments = getArguments();
            if (arguments == null || arguments.getInt("child_page") != C2162Rtm.INPUT_EMAIL_LOGIN.getValue()) {
                i = 0;
            } else {
                i = 1;
            }
        }
        int i2 = this.LIZIZ;
        if (i2 != i) {
            if (i2 != -1) {
                this.LIZJ = false;
            }
            this.LIZIZ = i;
            0GZ LIZ2 = LIZ(2131368467);
            n.LIZIZ(LIZ2, "");
            LIZ2.setCurrentItem(i);
        }
        S2A s2a = this.LIZ;
        if (s2a == null) {
            n.LIZ("");
        }
        0Q6 LIZ3 = s2a.LIZ(this.LIZIZ);
        if (LIZ3 instanceof 0Q6) {
            0Q2.LIZ(LIZ3);
        }
    }

    public final void onViewCreated(View view, Bundle bundle) {
        float f;
        Qz0 qz0;
        TextView customTextView;
        TextPaint paint;
        M12.LIZ(view);
        super.onViewCreated(view, bundle);
        0AA childFragmentManager = getChildFragmentManager();
        n.LIZIZ(childFragmentManager, "");
        S2A s2a = new S2A(childFragmentManager);
        this.LIZ = s2a;
        s2a.LIZ(LJII());
        S2A s2a2 = this.LIZ;
        if (s2a2 == null) {
            n.LIZ("");
        }
        s2a2.LIZ(LJIIIZ());
        0GZ LIZ2 = LIZ(2131368467);
        n.LIZIZ(LIZ2, "");
        S2A s2a3 = this.LIZ;
        if (s2a3 == null) {
            n.LIZ("");
        }
        LIZ2.setAdapter(s2a3);
        LIZ(2131368468).setCustomTabViewResId(2131558748);
        LIZ(2131368468).setupWithViewPager(LIZ(2131368467));
        LIZ(2131368467).addOnPageChangeListener(new S2D(this));
        LIZ(2131368468).setOnTabClickListener(new S2F(this));
        Qz9 LIZIZ2 = LIZ(2131368468).LIZIZ(1);
        if (LIZIZ2 == null || (qz0 = LIZIZ2.LJIIIIZZ) == null || (customTextView = qz0.getCustomTextView()) == null || (paint = customTextView.getPaint()) == null) {
            f = 0.0f;
        } else {
            f = paint.measureText(LJIIIZ().LIZIZ);
        }
        if (f + HeD.LIZIZ(getContext(), 24.0f) > ((float) (HeD.LIZ(getContext()) / 2))) {
            Qz3 LIZ3 = LIZ(2131368468);
            n.LIZIZ(LIZ3, "");
            LIZ3.setTabMode(0);
        }
        Integer num = (Integer) this.LJIIL.getValue();
        if (num != null) {
            int intValue = num.intValue();
            0GZ LIZ4 = LIZ(2131368467);
            n.LIZIZ(LIZ4, "");
            LIZ4.setCurrentItem(intValue);
        }
    }
}
