package com.fob.ds.activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.webkit.JavascriptInterface; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.Button; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.EditText; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; import butterknife.BindView; import com.flb.zj.omkxm.R; import com.fob.ds.domain.HuaDongBean; import com.fob.ds.domain.PostLogin; import com.fob.ds.domain.TenCodeBean; import com.fob.ds.domain.TengXunYanzhengBean; import com.fob.ds.domain.UserBean; import com.fob.ds.domain.VerificationBean; import com.fob.ds.weiget.IconFontTextView; import d.d.a.d.t; import d.d.a.d.y; import d.d.a.j.b0; import d.d.a.j.f0; import d.d.a.j.l0; import d.d.a.j.m0; public class LoginActivity extends com.fob.ds.base.a implements View.OnClickListener { public static String J = "0"; public static String K = "1"; public static String L = "4"; private String B = "1"; private int C; private VerificationBean D; HuaDongBean F; TengXunYanzhengBean G; boolean H = false; d.d.a.f.g I = new h(); @BindView Button btn_login; @BindView CheckBox cb_remember_acc; @BindView CheckBox cb_remember_password; @BindView EditText ed_login_verification_code; @BindView EditText et_user_name; @BindView EditText et_user_password; @BindView IconFontTextView iftv_1; @BindView IconFontTextView iftv_2; @BindView ImageView imageButton2; @BindView ImageView iv_login_verification_code; @BindView LinearLayout ll_verification; @BindView RelativeLayout rl_huadong_yanzheng; @BindView TextView tv_get_password; @BindView TextView tv_login_register; @BindView TextView tv_try_play; @BindView TextView tv_version; @BindView WebView wv_huadong_code; class a implements CompoundButton.OnCheckedChangeListener { a() { } public void onCheckedChanged(CompoundButton compoundButton, boolean z) { if (!z) { LoginActivity.this.cb_remember_password.setChecked(false); } LoginActivity.this.f0(); } } class b implements CompoundButton.OnCheckedChangeListener { b() { } public void onCheckedChanged(CompoundButton compoundButton, boolean z) { if (z) { LoginActivity.this.cb_remember_acc.setChecked(true); } LoginActivity.this.f0(); } } /* access modifiers changed from: package-private */ public class c implements d.d.a.i.d<VerificationBean> { c() { } @Override // d.d.a.i.d public void a(String str) { LoginActivity.this.D = null; } /* renamed from: b */ public void onNext(VerificationBean verificationBean) { if (verificationBean.getCode() == 100000 && verificationBean.getData() != null) { LoginActivity.this.D = verificationBean; String type = verificationBean.getData().getType() == null ? "-1" : verificationBean.getData().getType(); boolean equals = "1".equals(verificationBean.getData().getStatus()); if (!"2".equals(type) || !equals) { LoginActivity.this.g0(); } else { LoginActivity.this.l0(); } if (!"1".equals(type) || !equals) { LoginActivity.this.ll_verification.setVisibility(8); } else { LoginActivity.this.ll_verification.setVisibility(0); LoginActivity.this.iv_login_verification_code.setImageBitmap(f0.b(verificationBean.getData().getVarcode())); } if (!LoginActivity.L.equals(type) || !equals) { LoginActivity.this.H = false; } else { LoginActivity.this.H = true; } } } } /* access modifiers changed from: package-private */ public class d extends WebViewClient { d(LoginActivity loginActivity) { } @Override // android.webkit.WebViewClient public boolean shouldOverrideUrlLoading(WebView webView, String str) { webView.loadUrl(str); return true; } } /* access modifiers changed from: package-private */ public class e extends d.d.a.f.a { e() { } @Override // d.d.a.f.a @JavascriptInterface public void getSlideData(String str) { super.getSlideData(str); d.e.a.e eVar = new d.e.a.e(); LoginActivity.this.F = (HuaDongBean) eVar.i(str, HuaDongBean.class); LoginActivity.this.F.setScene("nc_login_h5"); } } /* access modifiers changed from: package-private */ public class f implements d.d.a.f.c<TenCodeBean> { f() { } /* access modifiers changed from: private */ /* renamed from: c */ public /* synthetic */ void d() { LoginActivity.this.btn_login.performClick(); } /* renamed from: b */ public void a(TenCodeBean tenCodeBean) { if ("0".equals(tenCodeBean.ret)) { LoginActivity.this.G = new TengXunYanzhengBean(); LoginActivity loginActivity = LoginActivity.this; TengXunYanzhengBean tengXunYanzhengBean = loginActivity.G; tengXunYanzhengBean.randstr = tenCodeBean.randstr; tengXunYanzhengBean.region = tenCodeBean.ret; tengXunYanzhengBean.ticket = tenCodeBean.ticket; loginActivity.btn_login.post(new b(this)); return; } LoginActivity loginActivity2 = LoginActivity.this; loginActivity2.G = null; d.d.a.g.h.a(loginActivity2, "验证失败"); } } /* access modifiers changed from: package-private */ public class g implements d.d.a.i.d<UserBean> { final /* synthetic */ String a; final /* synthetic */ PostLogin b; g(String str, PostLogin postLogin) { this.a = str; this.b = postLogin; } @Override // d.d.a.i.d public void a(String str) { } /* renamed from: b */ public void onNext(UserBean userBean) { if (userBean == null) { return; } if (userBean.getCode() != 100000) { LoginActivity loginActivity = LoginActivity.this; loginActivity.F = null; loginActivity.G = null; loginActivity.i0(); LoginActivity.this.k0(); LoginActivity.this.ed_login_verification_code.setText(""); if (!b0.a(userBean.getMessage())) { d.d.a.g.h.a(LoginActivity.this, userBean.getMessage()); } else { d.d.a.g.h.a(LoginActivity.this, "登录失败"); } } else if (userBean.getData() != null) { ((com.fob.ds.base.a) LoginActivity.this).p.r(userBean.getData()); ((com.fob.ds.base.a) LoginActivity.this).p.s(userBean.getData().getUsername()); if (!this.a.equals(LoginActivity.this.B)) { ((com.fob.ds.base.a) LoginActivity.this).p.q(this.b.getPassword()); ((com.fob.ds.base.a) LoginActivity.this).p.p(userBean.getData().getUsername()); } d.d.a.g.d.g().s(LoginActivity.this.cb_remember_acc.isChecked()); d.d.a.g.d.g().t(LoginActivity.this.cb_remember_password.isChecked()); d.d.a.g.a.d(LoginActivity.this).e(); if (this.a.equals(LoginActivity.this.B)) { d.d.a.g.h.c(LoginActivity.this, "试玩账号登录成功"); } else { d.d.a.g.h.c(LoginActivity.this, "登录成功"); } d.d.a.g.e.i(); } } } class h implements d.d.a.f.g { h() { } @Override // d.d.a.f.g public void a() { LoginActivity.this.tv_version.setVisibility(0); } @Override // d.d.a.f.g public void b(int i) { LoginActivity.this.tv_version.setVisibility(8); } } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private void f0() { if (this.cb_remember_acc.isChecked()) { this.iftv_1.setText(getResources().getString(R.string.login_ok)); this.iftv_1.setTextColor(getResources().getColor(R.color.main_color)); } else { this.iftv_1.setText(getResources().getString(R.string.login_no)); this.iftv_1.setTextColor(getResources().getColor(R.color.text_hit_color)); } if (this.cb_remember_password.isChecked()) { this.iftv_2.setText(getResources().getString(R.string.login_ok)); this.iftv_2.setTextColor(getResources().getColor(R.color.main_color)); return; } this.iftv_2.setText(getResources().getString(R.string.login_no)); this.iftv_2.setTextColor(getResources().getColor(R.color.text_hit_color)); } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private void g0() { this.rl_huadong_yanzheng.setVisibility(8); } private void h0(String str) { TengXunYanzhengBean tengXunYanzhengBean; HuaDongBean huaDongBean; VerificationBean verificationBean; VerificationBean verificationBean2; String trim = this.et_user_name.getText().toString().trim(); String trim2 = this.et_user_password.getText().toString().trim(); String trim3 = this.ed_login_verification_code.getText().toString().trim(); if (!str.equals(J)) { str.equals(this.B); trim = "-1"; trim2 = trim; } else if (b0.a(trim)) { d.d.a.g.h.a(this, "用户名为空"); return; } else if (b0.a(trim2)) { d.d.a.g.h.a(this, "密码为空"); return; } else if (b0.a(trim3) && (verificationBean2 = this.D) != null && K.equals(verificationBean2.getData().getIsVarCode())) { d.d.a.g.h.a(this, "请输入验证码"); return; } else if (this.rl_huadong_yanzheng.getVisibility() == 0 && this.F == null) { d.d.a.g.h.a(this, "请滑动验证"); return; } else if (this.H && this.G == null) { new y(this, true, new f()).show(); return; } PostLogin postLogin = new PostLogin(); postLogin.setSiteId(d.d.a.b.b.a); postLogin.setUsername(trim); postLogin.setPassword(trim2); postLogin.setSiteType(d.d.a.b.b.b + ""); postLogin.setLoginChannel(d.d.a.b.a.f2660c); if (str.equals(J) && (verificationBean = this.D) != null && verificationBean.getData() != null && K.equals(this.D.getData().getIsVarCode())) { postLogin.setVarcode(trim3); postLogin.setVarcodeId(this.D.getData().getVarcodeId()); } if (this.rl_huadong_yanzheng.getVisibility() == 0 && (huaDongBean = this.F) != null) { postLogin.setSign(huaDongBean.getSig()); postLogin.setScene(this.F.getScene()); postLogin.setToken(this.F.getNc_token()); postLogin.setSessionId(this.F.getSessionid()); } if (this.H && (tengXunYanzhengBean = this.G) != null) { postLogin.setTicket(tengXunYanzhengBean.ticket); postLogin.setRegion(this.G.region); postLogin.setRandstr(this.G.randstr); } d.d.a.e.d.y().B(new d.d.a.i.b((d.d.a.i.d) new g(str, postLogin), (Context) this, false, "登录中..."), postLogin); } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private void i0() { d.d.a.e.d.y().d0(new d.d.a.i.c(new c()), "login"); } private void j0() { this.wv_huadong_code.getSettings().setUseWideViewPort(false); this.wv_huadong_code.getSettings().setLoadWithOverviewMode(true); this.wv_huadong_code.getSettings().setCacheMode(2); this.wv_huadong_code.setWebViewClient(new d(this)); this.wv_huadong_code.getSettings().setJavaScriptEnabled(true); this.wv_huadong_code.addJavascriptInterface(new e(), "AliJsInterface"); k0(); } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private void k0() { this.wv_huadong_code.loadUrl("file:///android_asset/web/index.html"); } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private void l0() { this.rl_huadong_yanzheng.setVisibility(0); } /* access modifiers changed from: protected */ @Override // com.fob.ds.base.a public int K() { return R.layout.activity_login; } /* access modifiers changed from: protected */ @Override // com.fob.ds.base.a public void M() { super.M(); i0(); } /* access modifiers changed from: protected */ @Override // com.fob.ds.base.a public void N(Bundle bundle) { this.btn_login.setOnClickListener(this); this.tv_try_play.setOnClickListener(this); this.imageButton2.setOnClickListener(this); this.tv_login_register.setOnClickListener(this); this.iftv_1.setOnClickListener(this); this.iftv_2.setOnClickListener(this); S("登录"); m0.a(this, this.I); if (!d.d.a.g.d.g().j() || b0.a(this.p.f())) { this.et_user_password.setText(""); } else { this.et_user_password.setText(this.p.f()); EditText editText = this.et_user_password; editText.setSelection(editText.getText().toString().length()); } if (!d.d.a.g.d.g().i() || b0.a(this.p.d())) { this.et_user_name.setText(""); } else { this.et_user_name.setText(this.p.d()); EditText editText2 = this.et_user_name; editText2.setSelection(editText2.getText().toString().length()); } d.d.a.g.c.c(" 密码 " + this.p.f()); d.d.a.g.c.c(" 用户名 " + this.p.d()); this.cb_remember_password.setChecked(d.d.a.g.d.g().j()); this.cb_remember_acc.setChecked(d.d.a.g.d.g().i()); f0(); this.cb_remember_acc.setOnCheckedChangeListener(new a()); this.cb_remember_password.setOnCheckedChangeListener(new b()); this.C = this.et_user_password.getInputType(); this.iv_login_verification_code.setOnClickListener(this); this.tv_get_password.setOnClickListener(this); TextView textView = this.tv_version; textView.setText("V " + d.d.a.j.b.e(this)); if (l0.a()) { this.tv_login_register.setVisibility(8); } else { this.tv_login_register.setVisibility(0); } j0(); } public void onClick(View view) { switch (view.getId()) { case R.id.btn_login /*{ENCODED_INT: 2131230777}*/: h0(J); return; case R.id.iftv_1 /*{ENCODED_INT: 2131230943}*/: CheckBox checkBox = this.cb_remember_acc; checkBox.setChecked(true ^ checkBox.isChecked()); return; case R.id.iftv_2 /*{ENCODED_INT: 2131230944}*/: CheckBox checkBox2 = this.cb_remember_password; checkBox2.setChecked(true ^ checkBox2.isChecked()); return; case R.id.imageButton2 /*{ENCODED_INT: 2131230953}*/: ImageView imageView = this.imageButton2; imageView.setSelected(!imageView.isSelected()); if (this.et_user_password.getInputType() == 1) { this.et_user_password.setInputType(this.C); } else { this.et_user_password.setInputType(1); } EditText editText = this.et_user_password; editText.setSelection(editText.getText().toString().length()); return; case R.id.iv_login_verification_code /*{ENCODED_INT: 2131230982}*/: i0(); return; case R.id.tv_get_password /*{ENCODED_INT: 2131231363}*/: if (d.d.a.g.d.g().e() != null) { new t(this, d.d.a.g.d.g().e()).show(); return; } else { d.d.a.g.h.a(this, "获取客服失败,请重试"); return; } case R.id.tv_login_register /*{ENCODED_INT: 2131231398}*/: startActivity(new Intent(this, RegisterActivity.class)); finish(); return; case R.id.tv_try_play /*{ENCODED_INT: 2131231524}*/: h0(this.B); return; default: return; } } }