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

import X.2r0;
import X.2s9;
import X.44F;
import X.C2094Rsg;
import X.C2133RtJ;
import X.C2278Rve;
import X.C2346Rwk;
import X.C2671S4t;
import X.JLi;
import X.M12;
import X.S52;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.RecyclerView;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.account.login.v2.ui.AccountKeyBoardHelper;
import java.util.HashMap;
import kotlin.h.b.n;

public abstract class CommonInputEmailFragment extends BaseI18nLoginFragment {
    public HashMap LIZ;
    public EditText LJIIL;

    static {
        Covode.recordClassIndex(51795);
    }

    public final int LIZ() {
        return 2131558753;
    }

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

    public abstract void LIZ(String str);

    public void LJIIIIZZ() {
    }

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

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

    public final void LJFF() {
        ((C2671S4t) LIZ(2131366050)).LIZIZ(true);
    }

    public final void LJI() {
        ((C2671S4t) LIZ(2131366050)).LIZ(true);
    }

    public final EditText LJIIIZ() {
        EditText editText = this.LJIIL;
        if (editText == null) {
            n.LIZ("");
        }
        return editText;
    }

    public final void LJIILLIIL() {
        super.LJIILLIIL();
        RecyclerView LIZ2 = LIZ(2131366048);
        n.LIZIZ(LIZ2, "");
        LIZ2.setVisibility(0);
    }

    public final void LJIIZILJ() {
        super.LJIIZILJ();
        RecyclerView LIZ2 = LIZ(2131366048);
        n.LIZIZ(LIZ2, "");
        LIZ2.setVisibility(8);
    }

    public final void LJIIJJI() {
        EditText editText = this.LJIIL;
        if (editText == null) {
            n.LIZ("");
        }
        String obj = editText.getText().toString();
        if (!44F.LIZ(obj)) {
            View LIZ2 = LIZ(2131366049);
            n.LIZIZ(LIZ2, "");
            String string = getString(2131823059);
            n.LIZIZ(string, "");
            LIZ2.findViewById(2131366066).LIZ(string);
            LJIIIIZZ();
            return;
        }
        LIZ(obj);
    }

    public void onResume() {
        super.onResume();
        if (AccountKeyBoardHelper.LIZLLL.LIZ()) {
            EditText editText = this.LJIIL;
            if (editText == null) {
                n.LIZ("");
            }
            C2094Rsg.LIZ(editText);
            return;
        }
        EditText editText2 = this.LJIIL;
        if (editText2 == null) {
            n.LIZ("");
        }
        editText2.requestFocus();
    }

    public final void LIZ(int i, String str) {
        JLi findViewById;
        M12.LIZ(str);
        View LIZ2 = LIZ(2131366049);
        if (LIZ2 != null && (findViewById = LIZ2.findViewById(2131366066)) != null) {
            findViewById.LIZ(str);
        }
    }

    public void onViewCreated(View view, Bundle bundle) {
        M12.LIZ(view);
        super.onViewCreated(view, bundle);
        EditText editText = ((S52) LIZ(2131366065)).getEditText();
        this.LJIIL = editText;
        if (editText == null) {
            n.LIZ("");
        }
        editText.setInputType(32);
        editText.addTextChangedListener(new C2278Rve(this));
        editText.setNextFocusDownId(editText.getId());
        editText.setHint(getString(2131823029));
        String LIZ2 = C2133RtJ.LIZ.LIZ((Fragment) this);
        if (!TextUtils.isEmpty(LIZ2)) {
            editText.setText(LIZ2);
            editText.setSelection(LIZ2.length());
        }
        LIZ(LIZ(2131366050), new C2346Rwk(this));
        2r0 r4 = 2s9.LJII;
        RecyclerView LIZ3 = LIZ(2131366048);
        n.LIZIZ(LIZ3, "");
        EditText editText2 = this.LJIIL;
        if (editText2 == null) {
            n.LIZ("");
        }
        String as_ = as_();
        n.LIZIZ(as_, "");
        String LJIJI = LJIJI();
        n.LIZIZ(LJIJI, "");
        r4.LIZ(LIZ3, editText2, as_, LJIJI);
    }
}
