和通讯录 v3.9.6版本的 MD5 值为:669178e2ee1b2311daf378bd20c6bbe1
以下内容为反编译后的 SettingNewRegisterActivity.java 源代码,内容仅作参考
package com.chinamobile.contacts.im.login;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.content.LocalBroadcastManager;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageButton;
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.config.LoginInfoSP;
import com.chinamobile.contacts.im.data.ContactAccessor;
import com.chinamobile.contacts.im.ui.ICloudActivity;
import com.chinamobile.contacts.im.view.BaseToast;
import com.chinamobile.contacts.im.view.ProgressDialog;
import com.chinamobile.contacts.im.view.actionbar.IcloudActionBar;
import com.umeng.analytics.MobclickAgent;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class SettingNewRegisterActivity extends ICloudActivity implements TextWatcher, View.OnClickListener, com.chinamobile.contacts.im.login.a.b {
public static String f2482a;
private IcloudActionBar f2483b;
private Button c;
private Button d;
private EditText e;
private EditText f;
private CheckBox g;
private com.chinamobile.contacts.im.login.a.a h;
private ProgressDialog i;
private Context j;
private TextView k;
private int l;
private LocalBroadcastManager m;
private BroadcastReceiver n;
private LinearLayout o;
private LinearLayout p;
private ImageButton q;
private ImageButton r;
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
this.m = LocalBroadcastManager.getInstance(this);
this.n = new t(this, null);
this.m.registerReceiver(this.n, new IntentFilter("register"));
requestWindowFeature(1);
setContentView(C0019R.layout.setting_new_login_register);
this.j = this;
this.h = com.chinamobile.contacts.im.login.a.a.a((Context) this);
c();
b();
a();
}
@Override
public void onResume() {
super.onResume();
this.h.a((com.chinamobile.contacts.im.login.a.b) this);
String item = LoginInfoSP.getItem(this);
Matcher matcher = Pattern.compile("^(1)\\d{10}$").matcher(item);
if (!TextUtils.isEmpty(item) && matcher.find()) {
String replace = item.replace(ContactAccessor.PHONE_PREFIX1, "");
if (replace.length() > 14) {
replace = replace.substring(3, 14);
}
this.e.setText(replace);
this.e.setSelection(replace.length());
return;
}
String line1Number = App.a().f().getLine1Number();
if (!TextUtils.isEmpty(line1Number)) {
String replace2 = line1Number.replace(ContactAccessor.PHONE_PREFIX1, "");
if (replace2.length() > 14) {
replace2 = replace2.substring(3, 14);
}
this.e.setText(replace2);
this.e.setSelection(replace2.length());
}
}
@Override
public void onDestroy() {
super.onDestroy();
this.h.a((com.chinamobile.contacts.im.login.a.b) null);
if (this.m != null && this.n != null) {
try {
this.m.unregisterReceiver(this.n);
} catch (Exception e) {
e.printStackTrace();
}
}
}
private void a() {
this.f2483b = getIcloudActionBar();
this.f2483b.setNavigationMode(2);
this.f2483b.setDisplayAsUpTitle("注册");
this.f2483b.setDisplayAsUpBack(C0019R.drawable.iab_green_back, this);
this.f2483b.setDisplayAsUpTitleBtn("", null);
}
private void b() {
this.d.setOnClickListener(this);
this.c.setOnClickListener(this);
}
private void c() {
this.c = (Button) findViewById(C0019R.id.setting_register_now_btn);
this.c.setEnabled(false);
this.c.setTextColor(-3086108);
this.d = (Button) findViewById(C0019R.id.setting_register_get_ver_btn);
this.d.setEnabled(false);
this.d.setTextColor(-3026479);
this.o = (LinearLayout) findViewById(C0019R.id.register_phone_bg);
this.p = (LinearLayout) findViewById(C0019R.id.register_ver_code_bg);
this.q = (ImageButton) findViewById(C0019R.id.register_phone_input_del_btn);
this.q.setOnClickListener(this);
this.r = (ImageButton) findViewById(C0019R.id.register_vercode_input_del_btn);
this.r.setOnClickListener(this);
this.e = (EditText) findViewById(C0019R.id.setting_register_phone_et);
this.e.addTextChangedListener(this);
this.e.setOnFocusChangeListener(new r(this));
this.f = (EditText) findViewById(C0019R.id.setting_register_ver_code_et);
this.f.addTextChangedListener(this);
this.f.setOnFocusChangeListener(new s(this));
this.g = (CheckBox) findViewById(C0019R.id.setting_register_checkbox);
this.k = (TextView) findViewById(C0019R.id.agreement_text);
this.k.getPaint().setFlags(8);
this.k.setClickable(true);
this.k.setOnClickListener(this);
}
@Override
public void afterTextChanged(Editable editable) {
}
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
if (this.e.getText().toString().length() > 0 && this.f.getText().toString().length() > 0) {
this.c.setEnabled(true);
this.c.setTextColor(-1);
} else {
this.c.setEnabled(false);
this.c.setTextColor(-3086108);
}
if (this.e.getText().toString().length() > 0) {
this.d.setEnabled(true);
this.d.setTextColor(-16777216);
this.q.setVisibility(0);
} else {
this.d.setEnabled(false);
this.d.setTextColor(-3026479);
this.q.setVisibility(8);
}
if (!TextUtils.isEmpty(this.f.getText())) {
this.r.setVisibility(0);
} else {
this.r.setVisibility(8);
}
}
@Override
public void onClick(View view) {
this.h.a((com.chinamobile.contacts.im.login.a.b) this);
switch (view.getId()) {
case C0019R.id.iab_back_area:
finish();
return;
case C0019R.id.register_phone_input_del_btn:
a(0);
MobclickAgent.onEvent(this, "login_input_del_btn");
return;
case C0019R.id.setting_register_get_ver_btn:
f2482a = this.e.getText().toString();
if (!Pattern.compile("^(1)\\d{10}$").matcher(f2482a).find()) {
BaseToast.makeText(this.j, getString(C0019R.string.phone_number_error), 1000).show();
return;
}
this.l = 10;
this.h.a(this.l, f2482a);
this.f.setEnabled(true);
LoginInfoSP.saveItem(this, f2482a);
return;
case C0019R.id.register_vercode_input_del_btn:
a(1);
MobclickAgent.onEvent(this, "login_input_del_btn");
return;
case C0019R.id.agreement_text:
Intent intent = new Intent();
intent.setAction("android.intent.action.VIEW");
intent.setData(Uri.parse("http://wap.cmpassport.com/resources/html/contract.html "));
startActivity(intent);
return;
case C0019R.id.setting_register_now_btn:
if (this.g.isChecked()) {
f2482a = this.e.getText().toString();
String obj = this.f.getText().toString();
String a2 = a(f2482a, obj);
if (a2.equals("ok")) {
startActivity(SettingNewRegisterPassword.a(this, f2482a, obj));
return;
} else {
BaseToast.makeText(this.j, a2, 1000).show();
return;
}
}
BaseToast.makeText(this.j, "请先阅读中国移动互联网通行证协议", 1000).show();
return;
default:
return;
}
}
private void a(int i) {
try {
if (i == 0) {
if (this.e != null) {
this.e.setText("");
}
} else if (i == 1) {
if (this.f != null) {
this.f.setText("");
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
private String a(String str, String str2) {
if (str.length() == 0) {
return "手机号不能为空";
}
if (!Pattern.compile("^(1)\\d{10}$").matcher(str).find()) {
return getString(C0019R.string.phone_number_error);
}
if (str2.length() == 0) {
return "验证码不能为空";
}
if (!Pattern.compile("^\\d{6}$").matcher(str2).find()) {
return "请输入6位纯数字验证码";
}
return "ok";
}
@Override
public void a(String str) {
if (this.l == 10) {
str = "正在获取验证码,请稍候...";
this.d.setClickable(false);
}
this.i = new ProgressDialog(this.j, str);
this.i.setCancelable(false);
this.i.show();
}
@Override
public void a(int i, com.chinamobile.icloud.im.sync.a.a aVar) {
if ((i == 10 || i == 2) && aVar.f() == 1 && TextUtils.isEmpty(aVar.e())) {
new u(this).sendEmptyMessage(0);
this.i.setMessage("正在等待验证码短信,请稍候...");
this.i.setCancelable(false);
this.i.show();
return;
}
if (this.i != null) {
this.i.dismiss();
new u(this).sendEmptyMessage(1);
new u(this).sendEmptyMessage(2);
}
if (i == 12) {
if (aVar.f() == 1) {
Toast.makeText(this.j, "注册成功", 1000).show();
Intent intent = new Intent(this.j, (Class<?>) SettingRegisterFinished.class);
intent.putExtra("pass_id", aVar.d());
intent.putExtra("mobile", f2482a);
startActivity(intent);
finish();
return;
}
if (aVar.g() == -32227) {
this.f.setText("");
this.f.setFocusableInTouchMode(true);
this.f.requestFocus();
}
Toast.makeText(this.j, "注册失败:" + aVar.h(), 1000).show();
return;
}
if (aVar.f() == 1) {
this.f.setText(aVar.e());
if (this.g.isChecked()) {
f2482a = this.e.getText().toString();
aVar.e();
startActivity(SettingNewRegisterPassword.a(this.j, f2482a, aVar.e()));
return;
}
BaseToast.makeText(this.j, "请先阅读中国移动互联网通行证协议", 1000).show();
return;
}
if (aVar.g() == 8) {
BaseToast.makeText(this.j, "请查收短信,手动获取验证码", 2000).show();
} else {
BaseToast.makeText(this.j, aVar.h(), 2000).show();
}
}
}