OurPlay v5.5.9版本的 MD5 值为:d4e139798f4c2243a1145c8af5e21046
以下内容为反编译后的 BoundPhoneNumActivity.java 源代码,内容仅作参考
package com.excelliance.kxqp.user;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import com.excelliance.kxqp.GameUtil;
import com.excelliance.kxqp.bean.AppInfo;
import com.excelliance.kxqp.bean.DeviceInfo;
import com.excelliance.kxqp.bean.RegisterInfo;
import com.excelliance.kxqp.bean.UserInfo;
import com.excelliance.kxqp.user.b;
import com.excelliance.kxqp.util.ToastUtil;
import com.excelliance.kxqp.util.ac;
import com.excelliance.kxqp.util.ag;
import com.excelliance.kxqp.util.aj;
import com.excelliance.kxqp.util.n;
import com.excelliance.kxqp.util.t;
import org.json.JSONException;
import org.json.JSONObject;
public class BoundPhoneNumActivity extends Activity implements View.OnClickListener {
SharedPreferences f14759a;
Handler f14760b = new Handler() {
@Override
public void handleMessage(Message message) {
super.handleMessage(message);
if (message.what != 100 || BoundPhoneNumActivity.this.h == null || BoundPhoneNumActivity.this.i == null) {
return;
}
if (BoundPhoneNumActivity.this.k <= 0) {
BoundPhoneNumActivity.this.h.setVisibility(0);
BoundPhoneNumActivity.this.i.setVisibility(8);
return;
}
BoundPhoneNumActivity.d(BoundPhoneNumActivity.this);
String string = com.excelliance.kxqp.swipe.a.a.getString(BoundPhoneNumActivity.this.c, "user_get_indentify_code_again");
BoundPhoneNumActivity.this.i.setText(BoundPhoneNumActivity.this.k + string);
BoundPhoneNumActivity.this.f14760b.removeMessages(100);
BoundPhoneNumActivity.this.f14760b.sendEmptyMessageDelayed(100, 1000L);
}
};
private Context c;
private View d;
private ImageView e;
private EditText f;
private EditText g;
private TextView h;
private TextView i;
private TextView j;
private int k;
private SharedPreferences l;
static int d(BoundPhoneNumActivity boundPhoneNumActivity) {
int i = boundPhoneNumActivity.k;
boundPhoneNumActivity.k = i - 1;
return i;
}
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
this.c = this;
this.f14759a = getSharedPreferences("USERINFO", Build.VERSION.SDK_INT < 11 ? 0 : 4);
this.l = this.c.getSharedPreferences("MSG_INDENTIFY_CODE", Build.VERSION.SDK_INT < 11 ? 0 : 4);
this.d = com.excelliance.kxqp.swipe.a.a.getLayout(this.c, "activity_bound_phone_num");
if (this.d != null) {
setContentView(this.d);
a();
}
}
private void a() {
t a2 = t.a(this.c);
this.e = (ImageView) a2.a(this.d, "iv_back", 0);
this.e.setOnClickListener(this);
this.f = (EditText) a2.a("et_input_phone_number", this.d);
this.f.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
@Override
public void afterTextChanged(Editable editable) {
if (!TextUtils.isEmpty(editable) || BoundPhoneNumActivity.this.f == null) {
return;
}
BoundPhoneNumActivity.this.g.setText("");
}
});
this.g = (EditText) a2.a("et_input_identify_code", this.d);
this.f.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
return i == 2;
}
});
this.h = (TextView) a2.a(this.d, "tv_get_indentify_code", 1);
this.h.setOnClickListener(this);
this.i = (TextView) a2.a("tv_time_down", this.d);
this.j = (TextView) a2.a(this.d, "tv_bound_phone_num", 2);
this.j.setOnClickListener(this);
}
@Override
public void onClick(View view) {
switch (Integer.parseInt(view.getTag().toString())) {
case 0:
a(this.e);
d();
return;
case 1:
c();
return;
case 2:
b();
a(this.j);
return;
default:
return;
}
}
private void b() {
GameUtil.getIntance();
if (!GameUtil.isNetworkConnected(this.c)) {
ToastUtil.showToast(this.c, com.excelliance.kxqp.swipe.a.a.getString(this.c, "network_unavailable"));
return;
}
final String trim = this.f.getText().toString().trim();
if (TextUtils.isEmpty(trim)) {
ToastUtil.showToast(this.c, com.excelliance.kxqp.swipe.a.a.getString(this.c, "user_input_phone_number"));
return;
}
if (!b.a().b(trim)) {
ToastUtil.showToast(this.c, com.excelliance.kxqp.swipe.a.a.getString(this.c, "user_input_legal_phone_number"));
return;
}
if (TextUtils.isEmpty(this.g.getText().toString().trim())) {
ToastUtil.showToast(this.c, com.excelliance.kxqp.swipe.a.a.getString(this.c, "user_input_indentify_code"));
return;
}
String trim2 = this.g.getText().toString().trim();
String string = this.l.getString("MSG_CODE_" + this.f.getText().toString().trim(), "");
long j = this.l.getLong("MSG_TIME_" + this.f.getText().toString().trim(), 0L);
int currentTimeMillis = (int) ((System.currentTimeMillis() - j) / 60000);
Log.d("BoundPhoneNumActivity", "diffTime = " + currentTimeMillis);
if (currentTimeMillis > 30 && j != 0) {
ToastUtil.showToast(this.c, com.excelliance.kxqp.swipe.a.a.getString(this.c, "user_get_code_has_died"));
return;
}
if (!TextUtils.equals(trim2, string)) {
ToastUtil.showToast(this.c, com.excelliance.kxqp.swipe.a.a.getString(this.c, "user_get_code_error"));
return;
}
final ag a2 = ag.a();
a2.a(this.c);
a2.a("user_bounding");
String a3 = a(trim);
if (!TextUtils.isEmpty(a3)) {
ac.a().a("http://folder.appota.cn/bindmobile.php", com.excelliance.kxqp.util.b.a(a3), new ac.a() {
@Override
public void a(String str) {
a2.b();
if (!TextUtils.isEmpty(str)) {
BoundPhoneNumActivity.this.a(trim, str);
return;
}
Log.d("BoundPhoneNumActivity", "response is empty");
ToastUtil.showToast(BoundPhoneNumActivity.this.c, com.excelliance.kxqp.swipe.a.a.getString(BoundPhoneNumActivity.this.c, "server_exception"));
}
@Override
public void b(String str) {
a2.b();
Log.d("BoundPhoneNumActivity", "onFailed = " + str);
ToastUtil.showToast(BoundPhoneNumActivity.this.c, com.excelliance.kxqp.swipe.a.a.getString(BoundPhoneNumActivity.this.c, "server_exception"));
}
});
} else {
Log.d("BoundPhoneNumActivity", "data is empty");
ToastUtil.showToast(this.c, com.excelliance.kxqp.swipe.a.a.getString(this.c, "userinfo_error"));
}
}
public void a(String str, String str2) {
try {
JSONObject jSONObject = new JSONObject(str2);
String optString = jSONObject.optString("status");
String optString2 = jSONObject.optString("flag");
Log.d("BoundPhoneNumActivity", "status = " + optString + ", flag = " + optString2);
if (TextUtils.equals(optString, "1")) {
if (TextUtils.equals(optString2, "1")) {
ToastUtil.showToast(this.c, com.excelliance.kxqp.swipe.a.a.getString(this.c, "user_bound_success"));
aj.a().a(this.f14759a, n.h, str);
aj.a().a(this.f14759a, "USER_NAME", str);
d();
} else if (TextUtils.equals(optString2, "2")) {
ToastUtil.showToast(this.c, com.excelliance.kxqp.swipe.a.a.getString(this.c, "user_phone_has_bound_other"));
} else if (TextUtils.equals(optString2, "3")) {
ToastUtil.showToast(this.c, com.excelliance.kxqp.swipe.a.a.getString(this.c, "user_phone_num_bound_failed"));
} else {
ToastUtil.showToast(this.c, com.excelliance.kxqp.swipe.a.a.getString(this.c, "server_exception"));
}
} else {
ToastUtil.showToast(this.c, com.excelliance.kxqp.swipe.a.a.getString(this.c, "server_exception"));
}
} catch (Exception e) {
e.printStackTrace();
Log.d("BoundPhoneNumActivity", "exception = " + e.getMessage());
ToastUtil.showToast(this.c, com.excelliance.kxqp.swipe.a.a.getString(this.c, "server_exception"));
}
}
private String a(String str) {
RegisterInfo registerInfo = new RegisterInfo();
registerInfo.appInfo = new AppInfo();
registerInfo.deviceInfo = new DeviceInfo();
registerInfo.userInfo = new UserInfo();
GameUtil intance = GameUtil.getIntance();
registerInfo.appInfo.chid = intance.h();
registerInfo.appInfo.subChid = intance.i();
registerInfo.appInfo.pkgName = getPackageName();
registerInfo.deviceInfo.aid = intance.r(this.c);
registerInfo.deviceInfo.andVer = intance.p();
registerInfo.deviceInfo.sdkVer = intance.o();
registerInfo.deviceInfo.imei = intance.v(this.c);
registerInfo.deviceInfo.imsi = intance.w(this.c);
registerInfo.deviceInfo.model = intance.q();
registerInfo.deviceInfo.screen = intance.y(this.c);
registerInfo.deviceInfo.netType = intance.z(this.c);
registerInfo.deviceInfo.memInfo = intance.d();
try {
JSONObject jSONObject = new JSONObject();
jSONObject.put("phoneNum", str);
int b2 = aj.a().b(this.f14759a, "USER_ID");
if (b2 != 0) {
jSONObject.put("rid", b2);
jSONObject.put("chid", registerInfo.appInfo.chid);
jSONObject.put("subchid", registerInfo.appInfo.subChid);
jSONObject.put("pkgName", registerInfo.appInfo.pkgName);
jSONObject.put("aid", registerInfo.deviceInfo.aid);
jSONObject.put("andVer", registerInfo.deviceInfo.andVer);
jSONObject.put("sdkVer", registerInfo.deviceInfo.sdkVer);
jSONObject.put("imei", registerInfo.deviceInfo.imei);
jSONObject.put("imsi", registerInfo.deviceInfo.imsi);
jSONObject.put("model", registerInfo.deviceInfo.model);
jSONObject.put("screen", registerInfo.deviceInfo.screen);
jSONObject.put("netType", registerInfo.deviceInfo.netType);
jSONObject.put("memInfo", registerInfo.deviceInfo.memInfo);
return jSONObject.toString();
}
Log.d("BoundPhoneNumActivity", "userId = " + b2);
return null;
} catch (Exception e) {
e.printStackTrace();
Log.d("BoundPhoneNumActivity", "excepiton = " + e.getMessage());
return null;
}
}
private void a(View view) {
InputMethodManager inputMethodManager;
if (view == null || (inputMethodManager = (InputMethodManager) this.c.getSystemService("input_method")) == null) {
return;
}
inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
private void c() {
b a2 = b.a();
String a3 = a(a2);
if (TextUtils.isEmpty(a3)) {
return;
}
a2.a(a3, 3, new b.a() {
@Override
public void a(String str) {
Log.d("BoundPhoneNumActivity", "response = " + str);
if (!TextUtils.isEmpty(str)) {
BoundPhoneNumActivity.this.b(str);
return;
}
ToastUtil.showToast(BoundPhoneNumActivity.this.c, com.excelliance.kxqp.swipe.a.a.getString(BoundPhoneNumActivity.this.c, "user_get_indentify_code_failed"));
Log.d("BoundPhoneNumActivity", "response is null");
}
@Override
public void b(String str) {
String string = com.excelliance.kxqp.swipe.a.a.getString(BoundPhoneNumActivity.this.c, "user_get_indentify_code_failed");
Log.d("BoundPhoneNumActivity", "msgFailed = " + str);
ToastUtil.showToast(BoundPhoneNumActivity.this.c, string);
}
}, this.c);
ToastUtil.showToast(this.c, com.excelliance.kxqp.swipe.a.a.getString(this.c, "user_get_code_has_send"));
if (this.h == null || this.i == null) {
return;
}
this.h.setVisibility(8);
this.i.setVisibility(0);
this.k = 60;
String string = com.excelliance.kxqp.swipe.a.a.getString(this.c, "user_get_indentify_code_again");
this.i.setText(this.k + string);
this.f14760b.removeMessages(100);
this.f14760b.sendEmptyMessageDelayed(100, 1000L);
}
private String a(b bVar) {
if (this.f != null) {
String trim = this.f.getText().toString().trim();
if (TextUtils.isEmpty(trim)) {
ToastUtil.showToast(this.c, com.excelliance.kxqp.swipe.a.a.getString(this.c, "user_input_phone_number"));
return null;
}
if (!bVar.b(trim)) {
ToastUtil.showToast(this.c, com.excelliance.kxqp.swipe.a.a.getString(this.c, "user_input_legal_phone_number"));
return null;
}
GameUtil.getIntance();
if (GameUtil.isNetworkConnected(this.c)) {
return trim;
}
ToastUtil.showToast(this.c, com.excelliance.kxqp.swipe.a.a.getString(this.c, "network_unavailable"));
return null;
}
Log.d("BoundPhoneNumActivity", "获取不到控件");
return null;
}
public void b(String str) {
if (!TextUtils.isEmpty(str)) {
try {
JSONObject jSONObject = new JSONObject(str);
if (TextUtils.equals(jSONObject.optString("status", "0"), "1")) {
String optString = jSONObject.optString("flag", "0");
if (TextUtils.equals(optString, "0")) {
String optString2 = jSONObject.optString("code");
if (!TextUtils.isEmpty(optString2)) {
this.l.edit().putString("MSG_CODE_" + this.f.getText().toString().trim(), optString2).apply();
this.l.edit().putLong("MSG_TIME_" + this.f.getText().toString().trim(), System.currentTimeMillis()).apply();
} else {
Log.d("BoundPhoneNumActivity", "code is empty");
}
} else if (TextUtils.equals(optString, "1")) {
ToastUtil.showToast(this.c, com.excelliance.kxqp.swipe.a.a.getString(this.c, "user_get_code_reach_limit"));
} else if (TextUtils.equals(optString, "2")) {
ToastUtil.showToast(this.c, com.excelliance.kxqp.swipe.a.a.getString(this.c, "user_phone_has_bound_other"));
} else {
Log.d("BoundPhoneNumActivity", "暂无处理");
}
} else {
ToastUtil.showToast(this.c, com.excelliance.kxqp.swipe.a.a.getString(this.c, "user_get_indentify_code_failed"));
}
return;
} catch (JSONException e) {
e.printStackTrace();
Log.d("BoundPhoneNumActivity", "exception = " + e.getMessage());
return;
}
}
Log.d("BoundPhoneNumActivity", "data is empty");
}
@Override
protected void onDestroy() {
super.onDestroy();
this.f14760b.removeCallbacksAndMessages(null);
}
@Override
public void onBackPressed() {
d();
}
private void d() {
finish();
overridePendingTransition(0, getResources().getIdentifier("slide_right_out", "anim", getPackageName()));
}
}