OurPlay v5.5.9版本的 MD5 值为:d4e139798f4c2243a1145c8af5e21046
以下内容为反编译后的 GetBackPwdActivity.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.LinearLayout;
import android.widget.TextView;
import com.excelliance.kxqp.GameUtil;
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 GetBackPwdActivity extends Activity implements View.OnClickListener {
Handler f14772a = new Handler() {
@Override
public void handleMessage(Message message) {
super.handleMessage(message);
if (message.what != 100 || GetBackPwdActivity.this.i == null || GetBackPwdActivity.this.j == null) {
return;
}
if (GetBackPwdActivity.this.o <= 0) {
GetBackPwdActivity.this.i.setVisibility(0);
GetBackPwdActivity.this.j.setVisibility(8);
return;
}
GetBackPwdActivity.d(GetBackPwdActivity.this);
String string = com.excelliance.kxqp.swipe.a.a.getString(GetBackPwdActivity.this.f14773b, "user_get_indentify_code_again");
GetBackPwdActivity.this.j.setText(GetBackPwdActivity.this.o + string);
GetBackPwdActivity.this.f14772a.removeMessages(100);
GetBackPwdActivity.this.f14772a.sendEmptyMessageDelayed(100, 1000L);
}
};
private Context f14773b;
private View c;
private ImageView d;
private LinearLayout e;
private LinearLayout f;
private EditText g;
private EditText h;
private TextView i;
private TextView j;
private TextView k;
private EditText l;
private EditText m;
private TextView n;
private int o;
private SharedPreferences p;
private SharedPreferences q;
private String r;
private String s;
private boolean t;
static int d(GetBackPwdActivity getBackPwdActivity) {
int i = getBackPwdActivity.o;
getBackPwdActivity.o = i - 1;
return i;
}
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
this.f14773b = this;
this.q = getSharedPreferences("USERINFO", Build.VERSION.SDK_INT < 11 ? 0 : 4);
this.p = this.f14773b.getSharedPreferences("MSG_INDENTIFY_CODE", Build.VERSION.SDK_INT < 11 ? 0 : 4);
this.c = com.excelliance.kxqp.swipe.a.a.getLayout(this.f14773b, "activity_get_back_pwd");
this.t = getIntent().getBooleanExtra("isResetPassword", false);
if (this.c != null) {
setContentView(this.c);
a();
}
}
private void a() {
t a2 = t.a(this.f14773b);
this.d = (ImageView) a2.a(this.c, "iv_back", 0);
this.d.setOnClickListener(this);
this.e = (LinearLayout) a2.a("first_step", this.c);
this.g = (EditText) a2.a("et_input_phone_number", this.c);
this.g.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) || GetBackPwdActivity.this.h == null) {
return;
}
GetBackPwdActivity.this.h.setText("");
}
});
this.h = (EditText) a2.a("et_input_identify_code", this.c);
this.h.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
if (i != 2) {
return false;
}
GetBackPwdActivity.this.c();
return true;
}
});
this.i = (TextView) a2.a(this.c, "tv_get_indentify_code", 1);
this.i.setOnClickListener(this);
this.j = (TextView) a2.a("tv_time_down", this.c);
this.k = (TextView) a2.a(this.c, "tv_next_step", 2);
this.k.setOnClickListener(this);
this.f = (LinearLayout) a2.a("second_step", this.c);
this.l = (EditText) a2.a("et_set_new_pwd", this.c);
this.m = (EditText) a2.a("et_sure_new_pwd", this.c);
this.l.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(GetBackPwdActivity.this.l.getText()) || GetBackPwdActivity.this.m == null) {
return;
}
GetBackPwdActivity.this.m.setText("");
}
});
this.n = (TextView) a2.a(this.c, "tv_finish", 3);
this.n.setOnClickListener(this);
TextView textView = (TextView) a2.a("title", this.c);
if (this.t) {
this.s = com.excelliance.kxqp.swipe.a.a.getString(this, "user_info_reset_password");
textView.setText(this.s);
this.g.setText(aj.a().a(this.q, n.h));
this.g.setEnabled(false);
this.h.setFocusable(true);
this.h.requestFocus();
this.h.setSelection(0);
}
}
@Override
public void onClick(View view) {
switch (Integer.parseInt(view.getTag().toString())) {
case 0:
a(this.d);
d();
return;
case 1:
e();
return;
case 2:
c();
return;
case 3:
b();
a(this.n);
return;
default:
return;
}
}
private void b() {
final String trim = this.l.getText().toString().trim();
if (TextUtils.isEmpty(trim)) {
ToastUtil.showToast(this.f14773b, com.excelliance.kxqp.swipe.a.a.getString(this.f14773b, "please_set_password"));
return;
}
String trim2 = this.m.getText().toString().trim();
if (TextUtils.isEmpty(trim2)) {
ToastUtil.showToast(this.f14773b, com.excelliance.kxqp.swipe.a.a.getString(this.f14773b, "please_repeat_password"));
return;
}
if (TextUtils.isEmpty(trim) || trim.length() < 6 || trim.length() > 20 || TextUtils.isEmpty(trim2) || trim2.length() < 6 || trim2.length() > 20) {
ToastUtil.showToast(this.f14773b, com.excelliance.kxqp.swipe.a.a.getString(this.f14773b, "account_password_length"));
return;
}
b a2 = b.a();
if (!a2.a(trim) || !a2.a(trim2)) {
ToastUtil.showToast(this.f14773b, com.excelliance.kxqp.swipe.a.a.getString(this.f14773b, "password_group"));
return;
}
if (!TextUtils.equals(trim, trim2)) {
ToastUtil.showToast(this.f14773b, com.excelliance.kxqp.swipe.a.a.getString(this.f14773b, "two_unlike"));
return;
}
GameUtil.getIntance();
if (!GameUtil.isNetworkConnected(this.f14773b)) {
ToastUtil.showToast(this.f14773b, com.excelliance.kxqp.swipe.a.a.getString(this.f14773b, "network_unavailable"));
return;
}
final ag a3 = ag.a();
a3.a(this.f14773b);
a3.a("user_pwd_resetting");
ac.a().a("http://folder.appota.cn/modifypwd.php", com.excelliance.kxqp.util.b.a(b(this.r, trim)), new ac.a() {
@Override
public void a(String str) {
Log.d("GetBackPwdActivity", "response = " + str);
a3.b();
if (!TextUtils.isEmpty(str)) {
GetBackPwdActivity.this.a(str, trim);
return;
}
Log.d("GetBackPwdActivity", "response is empty");
ToastUtil.showToast(GetBackPwdActivity.this.f14773b, com.excelliance.kxqp.swipe.a.a.getString(GetBackPwdActivity.this.f14773b, "server_exception"));
}
@Override
public void b(String str) {
a3.b();
Log.d("GetBackPwdActivity", "onFailed = " + str);
ToastUtil.showToast(GetBackPwdActivity.this.f14773b, com.excelliance.kxqp.swipe.a.a.getString(GetBackPwdActivity.this.f14773b, "server_exception"));
}
});
}
public void a(String str, String str2) {
String string;
try {
JSONObject jSONObject = new JSONObject(str);
String optString = jSONObject.optString("status");
String optString2 = jSONObject.optString("flag");
Log.d("GetBackPwdActivity", "status = " + optString + ", flag = " + optString2);
if (TextUtils.equals(optString, "1")) {
if (TextUtils.equals(optString2, "1")) {
if (this.t) {
string = com.excelliance.kxqp.swipe.a.a.getString(this.f14773b, "user_pwd_success_reset");
} else {
string = com.excelliance.kxqp.swipe.a.a.getString(this.f14773b, "user_pwd_reset_success");
}
ToastUtil.showToast(this.f14773b, string);
aj.a().a(this.q, "USER_P002", str2);
d();
return;
}
if (TextUtils.equals(optString2, "2")) {
ToastUtil.showToast(this.f14773b, com.excelliance.kxqp.swipe.a.a.getString(this.f14773b, "user_phone_num_un_bound"));
return;
} else if (TextUtils.equals(optString2, "3")) {
ToastUtil.showToast(this.f14773b, com.excelliance.kxqp.swipe.a.a.getString(this.f14773b, "user_pwd_reset_sample"));
return;
} else {
ToastUtil.showToast(this.f14773b, com.excelliance.kxqp.swipe.a.a.getString(this.f14773b, "server_exception"));
return;
}
}
ToastUtil.showToast(this.f14773b, com.excelliance.kxqp.swipe.a.a.getString(this.f14773b, "server_exception"));
} catch (Exception e) {
e.printStackTrace();
Log.d("GetBackPwdActivity", "exception = " + e.getMessage());
ToastUtil.showToast(this.f14773b, com.excelliance.kxqp.swipe.a.a.getString(this.f14773b, "server_exception"));
}
}
private String b(String str, String str2) {
try {
JSONObject jSONObject = new JSONObject();
jSONObject.put("phoneNum", str);
jSONObject.put("pwd", str2);
return jSONObject.toString();
} catch (Exception e) {
e.printStackTrace();
Log.d("GetBackPwdActivity", "excepiton = " + e.getMessage());
return null;
}
}
public void c() {
this.r = a(b.a());
if (TextUtils.isEmpty(this.r)) {
return;
}
if (TextUtils.isEmpty(this.h.getText().toString().trim())) {
ToastUtil.showToast(this.f14773b, com.excelliance.kxqp.swipe.a.a.getString(this.f14773b, "user_input_indentify_code"));
return;
}
String trim = this.h.getText().toString().trim();
String string = this.p.getString("MSG_CODE_" + this.g.getText().toString().trim(), "");
long j = this.p.getLong("MSG_TIME_" + this.g.getText().toString().trim(), 0L);
int currentTimeMillis = (int) ((System.currentTimeMillis() - j) / 60000);
Log.d("GetBackPwdActivity", "diffTime = " + currentTimeMillis);
if (currentTimeMillis > 30 && j != 0) {
ToastUtil.showToast(this.f14773b, com.excelliance.kxqp.swipe.a.a.getString(this.f14773b, "user_get_code_has_died"));
} else if (!TextUtils.equals(trim, string)) {
ToastUtil.showToast(this.f14773b, com.excelliance.kxqp.swipe.a.a.getString(this.f14773b, "user_get_code_error"));
} else {
if (this.e == null || this.f == null) {
return;
}
this.e.setVisibility(8);
this.f.setVisibility(0);
}
}
private void d() {
finish();
overridePendingTransition(0, getResources().getIdentifier("slide_right_out", "anim", getPackageName()));
}
@Override
public void onBackPressed() {
d();
}
private void a(View view) {
InputMethodManager inputMethodManager;
if (view == null || (inputMethodManager = (InputMethodManager) this.f14773b.getSystemService("input_method")) == null) {
return;
}
inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
private void e() {
b a2 = b.a();
String a3 = a(a2);
if (TextUtils.isEmpty(a3)) {
return;
}
a2.a(a3, 2, new b.a() {
@Override
public void a(String str) {
Log.d("GetBackPwdActivity", "response = " + str);
if (!TextUtils.isEmpty(str)) {
GetBackPwdActivity.this.a(str);
return;
}
ToastUtil.showToast(GetBackPwdActivity.this.f14773b, com.excelliance.kxqp.swipe.a.a.getString(GetBackPwdActivity.this.f14773b, "user_get_indentify_code_failed"));
Log.d("GetBackPwdActivity", "response is null");
}
@Override
public void b(String str) {
String string = com.excelliance.kxqp.swipe.a.a.getString(GetBackPwdActivity.this.f14773b, "user_get_indentify_code_failed");
Log.d("GetBackPwdActivity", "msgFailed = " + str);
ToastUtil.showToast(GetBackPwdActivity.this.f14773b, string);
}
});
ToastUtil.showToast(this.f14773b, com.excelliance.kxqp.swipe.a.a.getString(this.f14773b, "user_get_code_has_send"));
if (this.i == null || this.j == null) {
return;
}
this.i.setVisibility(8);
this.j.setVisibility(0);
this.o = 60;
String string = com.excelliance.kxqp.swipe.a.a.getString(this.f14773b, "user_get_indentify_code_again");
this.j.setText(this.o + string);
this.f14772a.removeMessages(100);
this.f14772a.sendEmptyMessageDelayed(100, 1000L);
}
private String a(b bVar) {
if (this.g != null) {
String trim = this.g.getText().toString().trim();
if (TextUtils.isEmpty(trim)) {
ToastUtil.showToast(this.f14773b, com.excelliance.kxqp.swipe.a.a.getString(this.f14773b, "user_input_phone_number"));
return null;
}
if (!bVar.b(trim)) {
ToastUtil.showToast(this.f14773b, com.excelliance.kxqp.swipe.a.a.getString(this.f14773b, "user_input_legal_phone_number"));
return null;
}
GameUtil.getIntance();
if (GameUtil.isNetworkConnected(this.f14773b)) {
return trim;
}
ToastUtil.showToast(this.f14773b, com.excelliance.kxqp.swipe.a.a.getString(this.f14773b, "network_unavailable"));
return null;
}
Log.d("GetBackPwdActivity", "获取不到控件");
return null;
}
public void a(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.p.edit().putString("MSG_CODE_" + this.g.getText().toString().trim(), optString2).apply();
this.p.edit().putLong("MSG_TIME_" + this.g.getText().toString().trim(), System.currentTimeMillis()).apply();
} else {
Log.d("GetBackPwdActivity", "code is empty");
}
} else if (TextUtils.equals(optString, "1")) {
ToastUtil.showToast(this.f14773b, com.excelliance.kxqp.swipe.a.a.getString(this.f14773b, "user_get_code_reach_limit"));
} else if (TextUtils.equals(optString, "2")) {
ToastUtil.showToast(this.f14773b, com.excelliance.kxqp.swipe.a.a.getString(this.f14773b, "user_phone_num_un_bound"));
} else {
Log.d("GetBackPwdActivity", "暂无处理");
}
} else {
ToastUtil.showToast(this.f14773b, com.excelliance.kxqp.swipe.a.a.getString(this.f14773b, "user_get_indentify_code_failed"));
}
return;
} catch (JSONException e) {
e.printStackTrace();
Log.d("GetBackPwdActivity", "exception = " + e.getMessage());
return;
}
}
Log.d("GetBackPwdActivity", "data is empty");
}
@Override
protected void onDestroy() {
super.onDestroy();
this.f14772a.removeCallbacksAndMessages(null);
}
}