和通讯录 v4.2.0版本的 MD5 值为:f213fa766dccbfebde0dd8add5534518

以下内容为反编译后的 SettingNewLoginMainActivity.java 源代码,内容仅作参考


package com.chinamobile.contacts.im.login;

import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.content.LocalBroadcastManager;
import android.support.v4.view.ViewPager;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.DisplayMetrics;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.chinamobile.contacts.im.App;
import com.chinamobile.contacts.im.C0019R;
import com.chinamobile.contacts.im.Main;
import com.chinamobile.contacts.im.cloudserver.an;
import com.chinamobile.contacts.im.config.LoginInfoSP;
import com.chinamobile.contacts.im.contacts.d.ad;
import com.chinamobile.contacts.im.data.ContactAccessor;
import com.chinamobile.contacts.im.data.MediaPlatformDBManager;
import com.chinamobile.contacts.im.mms2.ui.NotificationManagerPopVerification;
import com.chinamobile.contacts.im.mms2.utils.MessageTools;
import com.chinamobile.contacts.im.mobilecard.OneCardLoginController;
import com.chinamobile.contacts.im.mobilecard.dao.OneCardDao;
import com.chinamobile.contacts.im.mobilecard.data.SubPhonesCache;
import com.chinamobile.contacts.im.service.PushService;
import com.chinamobile.contacts.im.setting.MainSettingActivity;
import com.chinamobile.contacts.im.setting.ManageSIMMActivity;
import com.chinamobile.contacts.im.sync.SyncActivity;
import com.chinamobile.contacts.im.ui.ICloudActivity;
import com.chinamobile.contacts.im.utils.ApplicationUtils;
import com.chinamobile.contacts.im.utils.bm;
import com.chinamobile.contacts.im.view.BaseToast;
import com.chinamobile.contacts.im.view.HintsDialog;
import com.chinamobile.contacts.im.view.ProgressDialog;
import com.chinamobile.contacts.im.view.actionbar.IcloudActionBar;
import com.umeng.analytics.AspMobclickAgent;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class SettingNewLoginMainActivity extends ICloudActivity implements TextWatcher, View.OnClickListener, com.chinamobile.contacts.im.login.a.b, OneCardLoginController.OnLoadCompletedListener {
    public static String e;
    private LinearLayout A;
    private EditText B;
    private EditText C;
    private Button D;
    private Button E;
    private Button F;
    private ImageButton G;
    private ImageButton H;
    private ProgressDialog I;
    private LinearLayout J;
    private TextView K;
    private LocalBroadcastManager L;
    private BroadcastReceiver M;
    private String O;
    private long Q;

    DisplayMetrics f2453a;
    Handler g;
    u h;
    private IcloudActionBar i;
    private Context j;
    private List<View> k;
    private Toast l;
    private ViewPager m;
    private Button n;
    private Button o;
    private ImageView p;
    private com.chinamobile.contacts.im.login.a.a q;
    private int r;
    private EditText s;
    private EditText t;
    private Button u;
    private Button v;
    private ImageButton w;
    private ImageButton x;
    private LinearLayout y;
    private LinearLayout z;

    public static boolean f2452b = true;
    public static boolean c = true;
    public static boolean d = true;
    public static String f = "loginSource";
    private com.chinamobile.icloud.im.c.a.a N = new com.chinamobile.icloud.im.c.a.a();
    private Intent P = null;
    private boolean R = false;
    private boolean S = false;
    private Handler T = new g(this);

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        com.chinamobile.contacts.im.feiliao.e.d("Forest", "SettingNewLoginMainActivity-- oncreate");
        c = true;
        this.L = LocalBroadcastManager.getInstance(this);
        this.M = new t(this, null);
        this.L.registerReceiver(this.M, new IntentFilter("register"));
        requestWindowFeature(1);
        setContentView(C0019R.layout.setting_new_login_success);
        d();
        c();
        e();
        this.q = com.chinamobile.contacts.im.login.a.a.a(this.j);
        if (f2452b) {
            l();
            g();
        } else {
            m();
            f();
        }
        this.h = new u(this);
        this.g = new a(this);
        if (!MainSettingActivity.f3209a && ApplicationUtils.isNetworkAvailable(this.j) && !ApplicationUtils.isWifiConnected(this.j)) {
            b();
        }
    }

    private void b() {
        this.I = new ProgressDialog(this.j, "");
        this.I.setCancelable(false);
        this.I.setOnDismissListener(new j(this));
        this.I.show();
        this.q.a((com.chinamobile.contacts.im.login.a.b) null);
        String line1Number = App.a().c().getLine1Number();
        if (line1Number != null) {
            this.q.a(MessageTools.getInstance().addressFilter(line1Number));
        }
        Main.c.execute(new k(this));
        this.g.postDelayed(new l(this), 2000L);
    }

    private void c() {
        this.n = (Button) findViewById(C0019R.id.btn_login_static);
        this.o = (Button) findViewById(C0019R.id.btn_login_dynamic);
        this.J = (LinearLayout) findViewById(C0019R.id.title_layout);
        this.p = (ImageView) findViewById(C0019R.id.cursor);
        try {
            this.f2453a = new DisplayMetrics();
            getWindowManager().getDefaultDisplay().getMetrics(this.f2453a);
            this.p.setLayoutParams(new LinearLayout.LayoutParams(this.f2453a.widthPixels / 4, 4));
        } catch (Exception e2) {
        }
    }

    private void d() {
        this.j = this;
        this.k = new ArrayList();
        Intent intent = getIntent();
        if (intent != null) {
            this.O = intent.getStringExtra(f);
        } else {
            this.O = "";
        }
        if (intent != null) {
            String stringExtra = intent.getStringExtra("plugins_intent_uri");
            String stringExtra2 = intent.getStringExtra("url");
            String stringExtra3 = intent.getStringExtra(MediaPlatformDBManager.KEY_TITLE);
            if (!TextUtils.isEmpty(stringExtra)) {
                try {
                    this.P = Intent.parseUri(stringExtra, 1);
                    if (!TextUtils.isEmpty(stringExtra2)) {
                        this.P.putExtra("url", stringExtra2);
                        bm.d("long", "plugin url = " + stringExtra2);
                    }
                    if (!TextUtils.isEmpty(stringExtra3)) {
                        this.P.putExtra(MediaPlatformDBManager.KEY_TITLE, stringExtra3);
                        bm.d("long", "plugin title = " + stringExtra3);
                    }
                    bm.d("long", "plugin uri = " + this.P);
                } catch (URISyntaxException e2) {
                    e2.printStackTrace();
                }
            }
        }
    }

    private void e() {
        this.i = getIcloudActionBar();
        this.i.setNavigationMode(2);
        this.i.setDisplayAsUpTitle("登录");
        this.i.setDisplayAsUpBack(C0019R.drawable.iab_green_back, this);
        this.i.setDisplayAsUpTitleBtn("", null);
    }

    @SuppressLint({"ResourceAsColor"})
    private void a(View view) {
        this.D = (Button) view.findViewById(C0019R.id.setting_new_login_success_btn_login);
        this.D.setEnabled(false);
        this.B = (EditText) view.findViewById(C0019R.id.setting_input_phone_number);
        this.B.addTextChangedListener(this);
        this.B.setOnEditorActionListener(new m(this));
        this.G = (ImageButton) view.findViewById(C0019R.id.input_del_btn);
        this.G.setOnClickListener(this);
        this.B.setOnFocusChangeListener(new n(this));
    }

    @SuppressLint({"ResourceAsColor"})
    private void b(View view) {
        this.w = (ImageButton) view.findViewById(C0019R.id.account_input_del_btn);
        this.w.setOnClickListener(this);
        this.x = (ImageButton) view.findViewById(C0019R.id.password_input_del_btn);
        this.x.setOnClickListener(this);
        this.z = (LinearLayout) view.findViewById(C0019R.id.login_static_phonenum_bg);
        this.A = (LinearLayout) view.findViewById(C0019R.id.login_static_password_bg);
        this.u = (Button) view.findViewById(C0019R.id.setting_new_login_mobile_btn_login);
        this.u.setEnabled(false);
        this.v = (Button) view.findViewById(C0019R.id.setting_new_login_btn_register);
        this.y = (LinearLayout) view.findViewById(C0019R.id.setting_new_login_btn_forgot_pw);
        this.s = (EditText) view.findViewById(C0019R.id.setting_new_login_mobile_et_num);
        this.s.addTextChangedListener(this);
        this.s.setOnFocusChangeListener(new o(this));
        this.t = (EditText) view.findViewById(C0019R.id.setting_new_login_mobile_et_password);
        this.t.addTextChangedListener(this);
        this.t.setOnEditorActionListener(new p(this));
        this.t.setOnFocusChangeListener(new q(this));
    }

    private void c(View view) {
        this.E = (Button) view.findViewById(C0019R.id.setting_new_login_sms_btn_login);
        this.E.setOnClickListener(this);
        this.F = (Button) view.findViewById(C0019R.id.setting_new_login_success_btn_send_pass);
        this.F.setOnClickListener(this);
        this.C = (EditText) view.findViewById(C0019R.id.setting_new_login_success_et_pass);
        this.C.addTextChangedListener(this);
        this.K = (TextView) view.findViewById(C0019R.id.info);
        this.H = (ImageButton) view.findViewById(C0019R.id.dynapassword_input_del_btn);
        this.H.setOnClickListener(this);
        this.C.setOnFocusChangeListener(new b(this));
    }

    @Override
    public void onResume() {
        super.onResume();
        this.q = com.chinamobile.contacts.im.login.a.a.a(this.j);
        if (TextUtils.isEmpty(this.s.getText().toString())) {
            String item = LoginInfoSP.getItem(this);
            Matcher matcher = Pattern.compile("^(1)\\d{10}$").matcher(item);
            if (!TextUtils.isEmpty(item)) {
                if (f2452b) {
                    this.s.setText(item);
                    this.s.setSelection(this.s.getText().toString().length());
                }
                if (matcher.find() && f2452b) {
                    this.B.setText(item);
                    this.B.setSelection(this.B.getText().toString().length());
                }
            } else {
                String line1Number = App.a().c().getLine1Number();
                if (!TextUtils.isEmpty(line1Number)) {
                    if (line1Number.length() > 11) {
                        line1Number = line1Number.substring(line1Number.length() - 11, line1Number.length());
                    }
                    if (f2452b) {
                        this.s.setText(line1Number);
                        this.B.setText(line1Number);
                        this.B.setSelection(this.B.getText().toString().length());
                        this.s.setSelection(this.s.getText().toString().length());
                    }
                }
            }
            if (this.B != null && this.B.getText() != null) {
                this.B.setSelection(this.B.getText().toString().length());
            }
            if (this.s != null && this.s.getText() != null) {
                this.s.setSelection(this.s.getText().toString().length());
            }
        }
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        this.q.a((com.chinamobile.contacts.im.login.a.b) null);
        if (this.L != null && this.M != null) {
            try {
                this.L.unregisterReceiver(this.M);
            } catch (Exception e2) {
                e2.printStackTrace();
            }
        }
    }

    private void f() {
        this.n.setOnClickListener(this);
        this.o.setOnClickListener(this);
        this.u.setOnClickListener(this);
        this.v.setOnClickListener(this);
        this.y.setOnClickListener(this);
    }

    private void g() {
        this.n.setOnClickListener(this);
        this.o.setOnClickListener(this);
        this.u.setOnClickListener(this);
        this.v.setOnClickListener(this);
        this.y.setOnClickListener(this);
        this.D.setOnClickListener(this);
    }

    @Override
    public void afterTextChanged(Editable editable) {
        if (!c && this.C != null && !TextUtils.isEmpty(this.C.getText()) && !this.E.isEnabled()) {
            this.E.setEnabled(true);
            this.H.setVisibility(0);
        }
    }

    @Override
    public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
    }

    @Override
    @SuppressLint({"ResourceAsColor"})
    public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
        if (c) {
            if (this.B != null && !TextUtils.isEmpty(this.B.getText()) && this.D != null) {
                this.D.setEnabled(true);
                this.G.setVisibility(0);
            } else if (this.D != null) {
                this.D.setEnabled(false);
                this.G.setVisibility(8);
            }
        } else if (this.C != null && !TextUtils.isEmpty(this.C.getText())) {
            this.E.setEnabled(true);
            this.H.setVisibility(0);
        } else if (this.E != null) {
            this.E.setEnabled(false);
            this.H.setVisibility(8);
        }
        if (!TextUtils.isEmpty(this.s.getText())) {
            if (this.s.isFocused()) {
                this.w.setVisibility(0);
            }
        } else {
            this.w.setVisibility(8);
        }
        if (!TextUtils.isEmpty(this.t.getText())) {
            if (this.t.isFocused()) {
                this.x.setVisibility(0);
            }
        } else {
            this.x.setVisibility(8);
        }
        if (!TextUtils.isEmpty(this.t.getText()) && !TextUtils.isEmpty(this.s.getText()) && this.u != null) {
            this.u.setEnabled(true);
        } else if (this.u != null) {
            this.u.setEnabled(false);
        }
    }

    @Override
    public void onBackPressed() {
        super.onBackPressed();
        f2452b = true;
        com.chinamobile.contacts.im.feiliao.e.d("Forest", "onBackPressed");
    }

    @Override
    public void onClick(View view) {
        this.q.a((com.chinamobile.contacts.im.login.a.b) this);
        switch (view.getId()) {
            case C0019R.id.iab_back_area:
                InputMethodManager inputMethodManager = (InputMethodManager) getSystemService("input_method");
                if (!inputMethodManager.hideSoftInputFromWindow(view.getApplicationWindowToken(), 2)) {
                    inputMethodManager.hideSoftInputFromInputMethod(view.getApplicationWindowToken(), 2);
                }
                if (ApplicationUtils.getSystemVersion() <= 10) {
                    new Handler().postDelayed(new c(this), 200L);
                } else {
                    finish();
                }
                f2452b = true;
                return;
            case C0019R.id.input_del_btn:
                k();
                AspMobclickAgent.onEvent(this, "login_input_del_btn");
                return;
            case C0019R.id.setting_new_login_success_btn_login:
                if (o().booleanValue()) {
                    LoginInfoSP.saveItem(this, "");
                    String str = e;
                    this.r = 1;
                    this.q.a(1, str);
                    return;
                }
                return;
            case C0019R.id.dynapassword_input_del_btn:
                h();
                AspMobclickAgent.onEvent(this, "login_input_del_btn");
                return;
            case C0019R.id.setting_new_login_success_btn_send_pass:
                long currentTimeMillis = System.currentTimeMillis();
                if (currentTimeMillis - this.Q >= 800) {
                    if (!ApplicationUtils.isNetworkAvailable(this.j)) {
                        BaseToast.makeText(this.j, "网络不给力,请检查网络设置", 1000).show();
                        return;
                    }
                    this.Q = currentTimeMillis;
                    String str2 = e;
                    this.r = 1;
                    this.q.a(1, str2);
                    return;
                }
                return;
            case C0019R.id.setting_new_login_sms_btn_login:
                this.r = 11;
                String obj = this.C.getText().toString();
                String a2 = a(this.r, e, obj);
                if (a2.equals("ok")) {
                    if (!ApplicationUtils.isNetworkAvailable(this.j)) {
                        BaseToast.makeText(this.j, "网络不给力,请检查网络设置", 1000).show();
                        return;
                    } else {
                        this.q.a(11, e, obj);
                        return;
                    }
                }
                BaseToast.makeText(this.j, a2, 1000).show();
                return;
            case C0019R.id.account_input_del_btn:
                j();
                AspMobclickAgent.onEvent(this, "login_input_del_btn");
                return;
            case C0019R.id.password_input_del_btn:
                i();
                AspMobclickAgent.onEvent(this, "login_input_del_btn");
                return;
            case C0019R.id.setting_new_login_btn_register:
                startActivity(new Intent().setClass(this.j, SettingNewRegisterActivity.class));
                return;
            case C0019R.id.setting_new_login_mobile_btn_login:
                p();
                return;
            case C0019R.id.setting_new_login_btn_forgot_pw:
                Intent intent = new Intent();
                intent.setAction("android.intent.action.VIEW");
                intent.setData(Uri.parse("http://wap.cmpassport.com/fm?optype=10&sourceid=6&backurl=&check=57028feb6dea2afc46be28cd9c224cbb"));
                startActivity(intent);
                return;
            case C0019R.id.btn_login_static:
                AspMobclickAgent.onEvent(this.j, "loginRegister_login_static");
                this.m.setCurrentItem(0);
                return;
            case C0019R.id.btn_login_dynamic:
                AspMobclickAgent.onEvent(this.j, "loginRegister_login_dynamic");
                this.m.setCurrentItem(1);
                return;
            default:
                return;
        }
    }

    private void h() {
        try {
            if (this.C != null) {
                this.C.setText("");
            }
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    private void i() {
        try {
            if (this.t != null) {
                this.t.setText("");
            }
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    private void j() {
        try {
            if (this.s != null) {
                this.s.setText("");
                this.s.setFocusableInTouchMode(true);
                this.s.requestFocus();
            }
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    private void k() {
        try {
            if (this.B != null) {
                this.B.setText("");
            }
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    private String a(int i, String... strArr) {
        String str = strArr[0];
        if (str.length() == 0) {
            return "帐号不能为空";
        }
        switch (i) {
            case 2:
            case 10:
                if (strArr.length == 2) {
                    if (a(i, str) == "ok") {
                        String str2 = strArr[1];
                        if (str2.length() == 0) {
                            return "密码不能为空";
                        }
                        return b(i, str2);
                    }
                    return a(i, str);
                }
                return a(i, str);
            case 9:
            case 11:
                if (strArr.length == 2) {
                    if (a(i, str) == "ok") {
                        String str3 = strArr[1];
                        if (str3.length() == 0) {
                            return "密码不能为空";
                        }
                        return b(i, str3);
                    }
                    return a(i, str);
                }
                return a(i, str);
            default:
                return "ok";
        }
    }

    private String a(int i, String str) {
        Matcher matcher = Pattern.compile("^\\d+$").matcher(str);
        switch (i) {
            case 2:
            case 10:
            case 11:
                if (matcher.find() && !Pattern.compile("^(1)\\d{10}$").matcher(str).find()) {
                    return getString(C0019R.string.phone_number_error);
                }
                LoginInfoSP.saveItem(this, str);
                return "ok";
            case 9:
                if (matcher.find()) {
                    if (str.length() < 9) {
                        return getString(C0019R.string.accoutshort);
                    }
                    if (str.length() > 15) {
                        return getString(C0019R.string.accoutlong);
                    }
                } else {
                    if (str.indexOf("@") < 0 || str.length() > 50) {
                        return getString(C0019R.string.accoutformaterror);
                    }
                    if (str.indexOf("@") > 0 && str.length() < 6) {
                        return getString(C0019R.string.accoutshort);
                    }
                }
                LoginInfoSP.saveItem(this, str);
                return "ok";
            default:
                LoginInfoSP.saveItem(this, str);
                return "ok";
        }
    }

    private String b(int i, String str) {
        switch (i) {
            case 9:
                if (str.length() < 6) {
                    return "输入的密码过短,请重新输入";
                }
                if (str.length() > 30) {
                    return "输入的密码过长,请重新输入";
                }
                return "ok";
            case 11:
                if (!Pattern.compile("^\\d{6}$").matcher(str).find()) {
                    return "请输入6位纯数字验证码";
                }
                break;
        }
    }

    @Override
    public void a(String str) {
        if (this.r != 2 && this.r != 1) {
            this.I = new ProgressDialog(this.j, str);
            this.I.setCancelable(false);
            this.I.show();
        }
        if (this.r == 10 || this.r == 2) {
        }
    }

    @Override
    public void a(int i, com.chinamobile.icloud.im.sync.a.a aVar) {
        d = true;
        if ((i == 10 || i == 2 || i == 1) && aVar.f() == 1 && TextUtils.isEmpty(aVar.e())) {
            this.h.sendEmptyMessage(0);
            return;
        }
        if (this.I != null) {
            this.I.dismiss();
            this.h.sendEmptyMessage(1);
            this.h.sendEmptyMessage(2);
        }
        if (i == 9 || i == 11) {
            if (aVar.f() == 1) {
                if (!TextUtils.isEmpty(aVar.l())) {
                    try {
                        this.R = getIntent().getBooleanExtra("subphoneDialogSource", false);
                        if (this.R) {
                            this.j.startActivity(new Intent(this.j, (Class<?>) ManageSIMMActivity.class));
                        }
                        String stringExtra = getIntent().getStringExtra("noSmsOrContact");
                        bm.d("su", "noSmsOrContact:" + stringExtra);
                        if ("1".equals(stringExtra)) {
                            Intent intent = new Intent(this.j, (Class<?>) SyncActivity.class);
                            String stringExtra2 = getIntent().getStringExtra("isFromSms");
                            bm.d("su", "isFromSms:" + stringExtra2);
                            if ("1".equals(stringExtra2)) {
                                intent.putExtra("isConversionListFragment", true);
                            }
                            this.j.startActivity(intent);
                        }
                    } catch (Exception e2) {
                        e2.printStackTrace();
                    }
                    if (i == 11) {
                        LoginInfoSP.saveItem(this.j, this.B.getText().toString());
                        NotificationManagerPopVerification.a(this.j).c();
                    }
                    a(aVar);
                    if ("CM".equals(LoginInfoSP.getMobileNet(this))) {
                        if (!TextUtils.isEmpty(this.O) && (this.O.equals("simm_login") || this.O.equals("simm_login_from_callfragment") || this.O.equals("user_layout"))) {
                            this.I = new ProgressDialog(this.j, "正在获取副号信息");
                            this.I.show();
                            SubPhonesCache.getInstance().startLoadingSubPhones(this);
                        } else {
                            BaseToast.makeText(this, "成功登录" + aVar.k(), 2000).show();
                            if (!this.R) {
                                SubPhonesCache.getInstance().startLoadingSubPhones(null);
                            }
                            finish();
                        }
                    } else {
                        BaseToast.makeText(this, "成功登录" + aVar.k(), 2000).show();
                        finish();
                    }
                } else {
                    return;
                }
            } else if (aVar.f() == 0) {
                this.N.d(String.valueOf(2));
                this.N.e(String.valueOf(aVar.g()));
                com.chinamobile.icloud.im.c.b.b.a().a(this.N);
                this.t.setText("");
                if (aVar.h().contains("超时:请检查网络配置") || aVar.g() == 2015) {
                    if (aVar.g() == 2015) {
                        AspMobclickAgent.onEvent(this, "ip_islocked_error_password");
                    }
                    BaseToast.makeText(this, aVar.h(), 2000).show();
                } else if (aVar.g() == 2014 || aVar.g() == 2016 || aVar.g() == 3002014 || aVar.g() == 3004010 || aVar.g() == -32228) {
                    if (aVar.g() == 2014) {
                        AspMobclickAgent.onEvent(this, "account_islocked_error_password");
                    }
                    if (aVar.g() == 2016) {
                        AspMobclickAgent.onEvent(this, "same_password_islocked");
                    }
                    if (aVar.g() == 3004010) {
                        AspMobclickAgent.onEvent(this, "get_smscode_hour_limit");
                        this.h.sendEmptyMessage(0);
                    } else if (aVar.g() == -32228) {
                        AspMobclickAgent.onEvent(this, "get_smscode_day_limit");
                        this.h.sendEmptyMessage(0);
                    }
                    String h = aVar.h();
                    if (h.length() > 11) {
                        h = b(h);
                    }
                    HintsDialog hintsDialog = new HintsDialog(this, "温馨提示", h);
                    hintsDialog.setButton(new d(this));
                    hintsDialog.setStyle(1);
                    hintsDialog.show();
                } else if (!aVar.h().contains("请查收短信")) {
                    if (i == 11) {
                        BaseToast.makeText(this, getString(C0019R.string.loginsmserror), 2000).show();
                    } else {
                        BaseToast.makeText(this, getString(C0019R.string.loginunifiederror), 2000).show();
                    }
                }
            }
            if (this.S) {
                this.S = false;
                this.E.setClickable(true);
                return;
            }
            return;
        }
        if (i == 1) {
            if (aVar.f() == 1 && aVar.e() != null) {
                try {
                    this.C.setText(aVar.e());
                    if (this.B != null && this.B.getText().toString() != null) {
                        this.q.a(11, this.B.getText().toString(), aVar.e());
                        if (!this.S) {
                            this.S = true;
                            this.E.setClickable(false);
                            return;
                        }
                        return;
                    }
                    return;
                } catch (Exception e3) {
                    return;
                }
            }
            if (aVar.g() == 8) {
                BaseToast.makeText(this.j, aVar.h(), 2000).show();
                return;
            }
            d = false;
            String h2 = aVar.h();
            if (TextUtils.isEmpty(h2)) {
                h2 = "服务异常";
            } else if (h2.length() > 11) {
                h2 = b(aVar.h());
            }
            if (aVar.g() == 3004010) {
                AspMobclickAgent.onEvent(this, "get_smscode_hour_limit");
                this.h.sendEmptyMessage(0);
            } else if (aVar.g() == -32228) {
                AspMobclickAgent.onEvent(this, "get_smscode_day_limit");
                this.h.sendEmptyMessage(0);
            }
            HintsDialog hintsDialog2 = new HintsDialog(this, "温馨提示", h2);
            hintsDialog2.setButton(new e(this));
            hintsDialog2.setStyle(1);
            hintsDialog2.show();
            return;
        }
        if (i == 2) {
            if (aVar.f() == 1 && aVar.e() != null) {
                this.q.a(11, this.B.getText().toString(), aVar.e());
                return;
            }
            if (aVar.g() == 8) {
                BaseToast.makeText(this.j, aVar.h(), 2000).show();
                return;
            }
            if (aVar.h().equals("请求超时:请检查网络配置")) {
                BaseToast.makeText(this.j, aVar.h(), 2000).show();
                return;
            }
            if (aVar.g() == 3004010 || aVar.g() == -32228) {
                if (aVar.g() == 3004010) {
                    AspMobclickAgent.onEvent(this, "get_smscode_hour_limit");
                    this.h.sendEmptyMessage(0);
                } else if (aVar.g() == -32228) {
                    AspMobclickAgent.onEvent(this, "get_smscode_day_limit");
                    this.h.sendEmptyMessage(0);
                }
                String h3 = aVar.h();
                if (TextUtils.isEmpty(h3)) {
                    h3 = "服务异常";
                }
                HintsDialog hintsDialog3 = new HintsDialog(this, "温馨提示", h3);
                hintsDialog3.setButton(new f(this));
                hintsDialog3.setStyle(1);
                hintsDialog3.show();
                return;
            }
            d = false;
            c = false;
            this.k.remove(1);
            this.k.remove(0);
            m();
            g();
            f2452b = false;
        }
    }

    private void l() {
        View inflate = View.inflate(getApplicationContext(), C0019R.layout.setting_new_login_static, null);
        View inflate2 = View.inflate(getApplicationContext(), C0019R.layout.setting_new_login_dynamic, null);
        this.k.add(0, inflate2);
        this.k.add(1, inflate);
        this.m = (ViewPager) findViewById(C0019R.id.login_pager);
        this.m.setAdapter(new v(this, this.k, null));
        this.m.setOnPageChangeListener(new r(this));
        this.m.setCurrentItem(0);
        b(inflate);
        a(inflate2);
    }

    private void m() {
        View inflate = View.inflate(getApplicationContext(), C0019R.layout.setting_new_login_static, null);
        View inflate2 = View.inflate(getApplicationContext(), C0019R.layout.setting_new_login_dynamic_finish, null);
        this.k.add(0, inflate2);
        this.k.add(1, inflate);
        this.m = (ViewPager) findViewById(C0019R.id.login_pager);
        this.m.setAdapter(new v(this, this.k, null));
        this.m.setOnPageChangeListener(new r(this));
        this.m.setCurrentItem(0);
        b(inflate);
        c(inflate2);
        this.E.setEnabled(false);
        this.K.setText(e);
        a();
    }

    public static Intent a(Context context) {
        return new Intent(context, (Class<?>) SettingNewLoginMainActivity.class);
    }

    public void n() {
        AlertDialog.Builder builder = new AlertDialog.Builder(this.j);
        builder.setTitle(C0019R.string.upgrade_title1);
        builder.setMessage(C0019R.string.upgrade_text1);
        builder.setPositiveButton(getString(C0019R.string.cancel), new h(this));
        builder.setNeutralButton(getString(C0019R.string.upgrade_btn_text2), new i(this));
        builder.setNegativeButton(getString(C0019R.string.cancel), (DialogInterface.OnClickListener) null);
        builder.create().show();
    }

    public Boolean o() {
        this.r = 2;
        e = this.B.getText().toString();
        String obj = this.B.getText().toString();
        this.r = 2;
        String a2 = a(this.r, obj);
        if (a2.equals("ok")) {
            if (ApplicationUtils.isNetworkAvailable(this.j)) {
                AspMobclickAgent.onEvent(this.j, "loginRegister_dynamic_login");
                d = false;
                c = false;
                this.k.remove(1);
                this.k.remove(0);
                m();
                g();
                f2452b = false;
                return true;
            }
            try {
                BaseToast.makeText(this.j, "网络不给力,请检查网络设置", 1000).show();
            } catch (Exception e2) {
                e2.printStackTrace();
            }
        } else {
            Toast.makeText(this.j, a2, 1000).show();
        }
        return false;
    }

    public void p() {
        if (!ApplicationUtils.isNetworkAvailable(this.j)) {
            BaseToast.makeText(this.j, "网络不给力,请检查网络设置", 1000).show();
            return;
        }
        if (ApplicationUtils.query_is_register(this.j)) {
            this.r = 9;
            String obj = this.s.getText().toString();
            String obj2 = this.t.getText().toString();
            String a2 = a(this.r, obj, obj2);
            if (a2.equals("ok")) {
                AspMobclickAgent.onEvent(this.j, "loginRegister_passport_login");
                this.q.a(9, obj, obj2);
                return;
            } else {
                BaseToast.makeText(this.j, a2, 1000).show();
                return;
            }
        }
        BaseToast.makeText(this.j, "网络不给力,请检查网络设置", 1000).show();
        ApplicationUtils.doRegister(this.j);
    }

    private void a(com.chinamobile.icloud.im.sync.a.a aVar) {
        String preUserName = LoginInfoSP.getPreUserName(this.j);
        LoginInfoSP.saveSession(this.j, aVar.l());
        LoginInfoSP.saveLogin(this.j, true);
        com.chinamobile.contacts.im.sync.c.x.a(this.j, aVar);
        LoginInfoSP.saveUserName(this.j, aVar.k());
        LoginInfoSP.savePreUserName(this.j, aVar.k());
        ApplicationUtils.saveLoginUserArea(this.j, aVar.k());
        if (ApplicationUtils.isCMCCPhone(aVar.k())) {
            LoginInfoSP.saveBunding(this.j, true);
        }
        f2452b = true;
        SubPhonesCache.getInstance().clearCache();
        new OneCardDao(App.b()).deleteAll();
        LoginInfoSP.savefirstloginvnet(this.j, true);
        com.chinamobile.contacts.im.service.l.b().a((Object) 8226);
        PushService.a(this.j);
        com.chinamobile.contacts.im.mms2.voicesms.l.a().g();
        com.chinamobile.contacts.im.f.c.d b2 = com.chinamobile.contacts.im.f.c.a.a().b();
        int i = com.chinamobile.contacts.im.f.c.a.f2431a;
        com.chinamobile.contacts.im.f.c.a.f2431a = i + 1;
        b2.a(i);
        setResult(-1);
        ad.a(this.j, 0L);
        if (com.chinamobile.contacts.im.config.h.q) {
            com.chinamobile.contacts.im.sync.c.z.a().b();
        }
        q();
        an.a().b();
        com.chinamobile.contacts.im.enterpriseContact.utils.c.d(this.j, preUserName);
        com.chinamobile.contacts.im.config.m.c(this.j, (Boolean) false);
        sendBroadcast(new Intent("com.chinamobile.contacts.im.LOGIN_SUCCESS"));
    }

    public void q() {
        if (this.P != null) {
            String stringExtra = this.P.getStringExtra("url");
            if (!TextUtils.isEmpty(stringExtra) && stringExtra.contains("token=null")) {
                this.P.putExtra("url", stringExtra.replace("token=null", "token=" + ContactAccessor.getAuth(this.j).l()));
            }
            startActivity(this.P);
        }
        sendBroadcast(new Intent("com.chinamobile.contacts.im.LOGIN_SUCCESS"));
    }

    @Override
    public void onLoadCompleted(String str) {
        if (this.I != null && this.I.isShowing()) {
            this.I.dismiss();
        }
        if (!TextUtils.isEmpty(str)) {
            BaseToast.makeText(this.j, str, 1000).show();
        } else {
            com.jeremyfeinstein.slidingmenu.lib.i.a().b();
            if (this.O.equals("simm_login")) {
                an.a((Context) this, false);
            }
        }
        finish();
    }

    public static String b(String str) {
        return str.replaceAll("请2小时后再试", "请 2小时后再试").replaceAll("请1小时后再试", "请 1小时后再试").replaceAll("请联系客服QQ:", "请联系客服 QQ: ");
    }

    public void a() {
        String item = LoginInfoSP.getItem(this);
        Matcher matcher = Pattern.compile("^(1)\\d{10}$").matcher(item);
        if (!TextUtils.isEmpty(item)) {
            if (f2452b) {
                this.s.setText(item);
                this.s.setSelection(this.s.getText().toString().length());
            }
            if (matcher.find() && f2452b) {
                this.B.setText(item);
                this.B.setSelection(this.B.getText().toString().length());
                return;
            }
            return;
        }
        String line1Number = App.a().c().getLine1Number();
        if (!TextUtils.isEmpty(line1Number)) {
            if (line1Number.length() > 11) {
                line1Number = line1Number.substring(line1Number.length() - 11, line1Number.length());
            }
            if (f2452b) {
                this.s.setText(line1Number);
                this.B.setText(line1Number);
                this.B.setSelection(this.B.getText().toString().length());
                this.s.setSelection(this.s.getText().toString().length());
            }
        }
    }
}