package com.tencent.mm.plugin.account.ui;

import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import android.content.Intent;
import android.widget.Toast;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.ai.f;
import com.tencent.mm.g.b.a.ba;
import com.tencent.mm.kernel.a;
import com.tencent.mm.kernel.g;
import com.tencent.mm.plugin.account.ui.MobileInputUI.b;
import com.tencent.mm.sdk.platformtools.ab;
import com.tencent.mm.sdk.platformtools.av;
import com.tencent.mm.ui.applet.SecurityImage;
import com.tencent.mm.ui.base.h;
import com.tencent.mm.ui.base.m;
import com.tencent.mm.ui.widget.a.d;
import com.tencent.smtt.sdk.TbsMediaPlayer$TbsMediaPlayerListener;
import com.tencent.ytcommon.BuildConfig;
import java.util.ArrayList;

public final class i implements f, b {
    ba gBm = new ba();
    MobileInputUI gDo;
    private g gDu = null;
    private SecurityImage gue = null;

    public i() {
        AppMethodBeat.i(125101);
        AppMethodBeat.o(125101);
    }

    public final void a(MobileInputUI mobileInputUI) {
        AppMethodBeat.i(125102);
        this.gDo = mobileInputUI;
        mobileInputUI.grF.setVisibility(0);
        mobileInputUI.gDH.setVisibility(0);
        mobileInputUI.gDI.requestFocus();
        mobileInputUI.gDN.setText(2131296989);
        mobileInputUI.gDN.setVisibility(0);
        mobileInputUI.gDP.setVisibility(0);
        ArrayList arrayList = new ArrayList();
        m mVar = new m(this.gDo, 2001, 0);
        mVar.setTitle(2131301007);
        arrayList.add(mVar);
        mVar = new m(this.gDo, 2002, 0);
        if (com.tencent.mm.au.b.ahL()) {
            mVar.setTitle(2131301003);
            arrayList.add(mVar);
        }
        if (arrayList.size() > 1) {
            d dVar = new d(this.gDo, 1, false);
            dVar.rBl = new 1(this, arrayList);
            dVar.rBm = new 2(this);
            dVar.zQf = new 3(this);
            this.gDo.gDR.setText(2131301008);
            this.gDo.gDR.setOnClickListener(new 4(this, dVar, arrayList, mVar));
        } else {
            this.gDo.gDR.setText(2131301007);
            this.gDo.gDR.setOnClickListener(new 5(this));
        }
        this.gDo.gDR.setVisibility(0);
        AppMethodBeat.o(125102);
    }

    public final void start() {
        AppMethodBeat.i(125103);
        g.Rg().a(145, this);
        StringBuilder stringBuilder = new StringBuilder();
        g.RN();
        stringBuilder = stringBuilder.append(a.Rb()).append(",").append(getClass().getName()).append(",L200_100,");
        g.RN();
        com.tencent.mm.plugin.b.a.f(true, stringBuilder.append(a.lF("L200_100")).append(",1").toString());
        com.tencent.mm.plugin.b.a.wz("L200_100");
        AppMethodBeat.o(125103);
    }

    public final void stop() {
        AppMethodBeat.i(125104);
        g.Rg().b(145, this);
        StringBuilder stringBuilder = new StringBuilder();
        g.RN();
        stringBuilder = stringBuilder.append(a.Rb()).append(",").append(getClass().getName()).append(",L200_100,");
        g.RN();
        com.tencent.mm.plugin.b.a.f(false, stringBuilder.append(a.lF("L200_100")).append(",2").toString());
        AppMethodBeat.o(125104);
    }

    public final void a(MobileInputUI.a aVar) {
        AppMethodBeat.i(125105);
        switch (7.gDt[aVar.ordinal()]) {
            case 1:
                this.gDo.gDU = av.amP(this.gDo.countryCode);
                this.gDo.gDV = this.gDo.gDI.getText().toString();
                String amN = av.amN(this.gDo.gDU + this.gDo.gDV);
                MobileInputUI mobileInputUI = this.gDo;
                MobileInputUI mobileInputUI2 = this.gDo;
                this.gDo.getString(2131297061);
                mobileInputUI.guc = h.b(mobileInputUI2, this.gDo.getString(2131302257), true, new OnCancelListener() {
                    public final void onCancel(DialogInterface dialogInterface) {
                    }
                });
                g.Rg().a(new com.tencent.mm.modelfriend.a(amN, 13, BuildConfig.FLAVOR, 0, BuildConfig.FLAVOR), 0);
                break;
        }
        AppMethodBeat.o(125105);
    }

    public final void onSceneEnd(int i, int i2, String str, com.tencent.mm.ai.m mVar) {
        AppMethodBeat.i(125106);
        ab.i("MicroMsg.MobileInputLoginLogic", "onSceneEnd: errType = " + i + " errCode = " + i2 + " errMsg = " + str);
        if (this.gDo.guc != null) {
            this.gDo.guc.dismiss();
            this.gDo.guc = null;
        }
        if ((mVar.getType() == 252 || mVar.getType() == TbsMediaPlayer$TbsMediaPlayerListener.MEDIA_INFO_BUFFERING_START) && this.gDu != null) {
            this.gDu.gDc = this.gDo.gDc;
            this.gDu.a(this.gDo, i, i2, str, mVar);
            AppMethodBeat.o(125106);
        } else if (mVar.getType() != 145 || ((com.tencent.mm.modelfriend.a) mVar).Ah() != 13) {
            AppMethodBeat.o(125106);
        } else if (i2 == -41) {
            com.tencent.mm.h.a jY = com.tencent.mm.h.a.jY(str);
            if (jY != null) {
                jY.a(this.gDo, null, null);
                AppMethodBeat.o(125106);
                return;
            }
            h.g(this.gDo, 2131302269, 2131302270);
            AppMethodBeat.o(125106);
        } else if (i2 == -1) {
            Toast.makeText(this.gDo, this.gDo.getString(2131299925, new Object[]{Integer.valueOf(i), Integer.valueOf(i2)}), 0).show();
            AppMethodBeat.o(125106);
        } else if (i2 == -34) {
            h.b(this.gDo, this.gDo.getString(2131297538), BuildConfig.FLAVOR, true);
            AppMethodBeat.o(125106);
        } else {
            this.gDo.aqX();
            Intent intent = new Intent(this.gDo, MobileInputUI.class);
            intent.putExtra("mobile_input_purpose", -1);
            intent.putExtra("mobile_auth_type", 7);
            intent.putExtra("from_switch_account", this.gDo.gDa);
            intent.putExtra("couttry_code", this.gDo.countryCode);
            intent.putExtra("input_mobile_number", this.gDo.gDV);
            this.gDo.startActivity(intent);
            AppMethodBeat.o(125106);
        }
    }
}
