OurPlay v5.5.9版本的 MD5 值为:d4e139798f4c2243a1145c8af5e21046
以下内容为反编译后的 RegisterFragment.java 源代码,内容仅作参考
package com.excelliance.kxqp.gs.user;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
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.Selection;
import android.text.Spannable;
import android.text.TextUtils;
import android.text.method.HideReturnsTransformationMethod;
import android.text.method.PasswordTransformationMethod;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AnimationUtils;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.fragment.app.Fragment;
import com.excelliance.kxqp.GameUtil;
import com.excelliance.kxqp.gs.bean.AppInfo;
import com.excelliance.kxqp.gs.bean.DeviceInfo;
import com.excelliance.kxqp.gs.bean.RegisterInfo;
import com.excelliance.kxqp.gs.bean.UserInfo;
import com.excelliance.kxqp.gs.ui.flow.b;
import com.excelliance.kxqp.gs.util.ao;
import com.excelliance.kxqp.gs.util.az;
import com.excelliance.kxqp.gs.util.bk;
import com.excelliance.kxqp.gs.util.bp;
import com.excelliance.kxqp.gs.util.bx;
import com.excelliance.kxqp.gs.util.c;
import com.excelliance.kxqp.gs.util.cg;
import com.excelliance.kxqp.gs.util.ci;
import com.excelliance.kxqp.gs.util.cn;
import com.excelliance.kxqp.gs.util.t;
import com.excelliance.kxqp.gs.util.w;
import com.excelliance.kxqp.sdk.StatisticsBase;
import com.excelliance.kxqp.sdk.StatisticsGS;
import java.util.regex.Pattern;
import org.json.JSONException;
import org.json.JSONObject;
public class RegisterFragment extends Fragment implements View.OnClickListener {
private Context f11640b;
private View c;
private TextView d;
private EditText e;
private ImageView f;
private EditText g;
private TextView h;
private SharedPreferences i;
private ImageView j;
private TextView l;
private TextView m;
private int n;
private String o;
private SharedPreferences p;
private boolean k = false;
Handler f11639a = new Handler() {
@Override
public void handleMessage(Message message) {
super.handleMessage(message);
if (message.what != 100 || RegisterFragment.this.l == null || RegisterFragment.this.m == null) {
return;
}
if (RegisterFragment.this.n <= 0) {
RegisterFragment.this.l.setVisibility(0);
RegisterFragment.this.m.setVisibility(8);
return;
}
RegisterFragment.d(RegisterFragment.this);
String e = w.e(RegisterFragment.this.f11640b, "user_get_indentify_code_again");
RegisterFragment.this.m.setText(RegisterFragment.this.n + e);
RegisterFragment.this.f11639a.removeMessages(100);
RegisterFragment.this.f11639a.sendEmptyMessageDelayed(100, 1000L);
}
};
private Dialog q = null;
static int d(RegisterFragment registerFragment) {
int i = registerFragment.n;
registerFragment.n = i - 1;
return i;
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
this.f11640b = activity;
this.p = this.f11640b.getSharedPreferences("MSG_INDENTIFY_CODE", Build.VERSION.SDK_INT < 11 ? 0 : 4);
this.o = ((LoginActivity) activity).a();
}
@Override
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
this.c = w.b(this.f11640b, "activity_register");
a();
return this.c;
}
@Override
public void onResume() {
super.onResume();
StatisticsGS.getInstance().uploadUserAction(this.f11640b, StatisticsBase.UA_ACCOUNT_REGISTER);
Log.d("RegisterFragment", "onResume()");
this.o = ((LoginActivity) this.f11640b).a();
this.d.setText(this.o);
}
private void a() {
ao a2 = ao.a(this.f11640b);
this.d = (TextView) a2.a("tv_account", this.c);
this.e = (EditText) a2.a("et_set_password", this.c);
this.f = (ImageView) a2.a(this.c, "iv_clear", 0);
this.f.setOnClickListener(this);
this.j = (ImageView) a2.a(this.c, "iv_switch", 2);
this.j.setOnClickListener(this);
this.g = (EditText) a2.a("et_input_identify_code", this.c);
this.g.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
if (i != 2) {
return false;
}
RegisterFragment.this.a(textView);
RegisterFragment.this.c();
return true;
}
});
this.h = (TextView) a2.a(this.c, "tv_register", 1);
this.h.setEnabled(true);
this.h.setTextColor(w.a(this.f11640b, "app_title_white"));
this.h.setOnClickListener(this);
this.l = (TextView) a2.a(this.c, "tv_get_indentify_code", 3);
this.l.setOnClickListener(this);
this.m = (TextView) a2.a("tv_time_down", this.c);
}
@Override
public void onClick(View view) {
switch (Integer.valueOf(view.getTag().toString()).intValue()) {
case 0:
this.e.setText("");
return;
case 1:
a(this.h);
c();
return;
case 2:
if (this.e != null) {
if (!this.k) {
this.e.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
} else {
this.e.setTransformationMethod(PasswordTransformationMethod.getInstance());
}
this.k = !this.k;
this.e.postInvalidate();
Editable text = this.e.getText();
if (text instanceof Spannable) {
Selection.setSelection(text, text.length());
}
this.e.setSelection(text.length());
}
int j = w.j(this.f11640b, "eye_open");
int j2 = w.j(this.f11640b, "eye_close");
if (!this.k) {
this.j.setImageDrawable(this.f11640b.getResources().getDrawable(j2));
return;
} else {
this.j.setImageDrawable(this.f11640b.getResources().getDrawable(j));
return;
}
case 3:
b();
return;
default:
return;
}
}
private void b() {
String trim = this.d.getText().toString().trim();
if (TextUtils.isEmpty(trim)) {
cg.a(this.f11640b, w.e(this.f11640b, "user_input_phone_number"));
return;
}
bx.a();
if (!bx.a(trim)) {
cg.a(this.f11640b, w.e(this.f11640b, "user_input_legal_phone_number"));
return;
}
GameUtil.getIntance();
if (!GameUtil.isNetworkConnected(this.f11640b)) {
cg.a(this.f11640b, w.e(this.f11640b, "network_unavailable"));
return;
}
ci.a().a(trim, 1, new ci.a() {
@Override
public void a(String str) {
Log.d("RegisterFragment", "response = " + str);
if (!TextUtils.isEmpty(str)) {
RegisterFragment.this.b(str);
return;
}
cg.a(RegisterFragment.this.f11640b, w.e(RegisterFragment.this.f11640b, "user_get_indentify_code_failed"));
Log.d("RegisterFragment", "response is null");
}
@Override
public void b(String str) {
String e = w.e(RegisterFragment.this.f11640b, "user_get_indentify_code_failed");
Log.d("RegisterFragment", "msgFailed = " + str);
cg.a(RegisterFragment.this.f11640b, e);
}
});
cg.a(this.f11640b, w.e(this.f11640b, "user_get_code_has_send"));
if (this.l == null || this.m == null) {
return;
}
this.l.setVisibility(8);
this.m.setVisibility(0);
this.n = 60;
String e = w.e(this.f11640b, "user_get_indentify_code_again");
this.m.setText(this.n + e);
this.f11639a.removeMessages(100);
this.f11639a.sendEmptyMessageDelayed(100, 1000L);
}
public void b(String str) {
String str2;
try {
str2 = bp.a(str, t.f12027a, "utf-8");
} catch (Exception e) {
e.printStackTrace();
Log.d("RegisterFragment", "exception = " + e.getMessage());
str2 = null;
}
if (!TextUtils.isEmpty(str2)) {
try {
JSONObject jSONObject = new JSONObject(str2);
String optString = jSONObject.optString("status", "0");
Log.d("RegisterFragment", "status = " + optString);
if (TextUtils.equals(optString, "1")) {
String optString2 = jSONObject.optString("flag", "0");
Log.d("RegisterFragment", "flag = " + optString2);
if (TextUtils.equals(optString2, "0")) {
String optString3 = jSONObject.optString("code");
if (!TextUtils.isEmpty(optString3)) {
this.p.edit().putString("MSG_CODE_" + this.d.getText().toString().trim(), optString3).apply();
this.p.edit().putLong("MSG_TIME_" + this.d.getText().toString().trim(), System.currentTimeMillis()).apply();
} else {
Log.d("RegisterFragment", "code is empty");
}
} else if (TextUtils.equals(optString2, "1")) {
cg.a(this.f11640b, w.e(this.f11640b, "user_get_code_reach_limit"));
} else if (TextUtils.equals(optString2, "2")) {
cg.a(this.f11640b, w.e(this.f11640b, "has_register"));
} else {
Log.d("RegisterFragment", "暂无处理");
}
} else {
cg.a(this.f11640b, w.e(this.f11640b, "user_get_indentify_code_failed"));
}
return;
} catch (JSONException e2) {
e2.printStackTrace();
Log.d("RegisterFragment", "exception = " + e2.getMessage());
return;
}
}
Log.d("RegisterFragment", "data is empty");
}
public void c() {
GameUtil.getIntance();
if (!GameUtil.isNetworkConnected(this.f11640b)) {
cg.a(this.f11640b, w.e(this.f11640b, "network_unavailable"));
return;
}
String trim = this.d.getText().toString().trim();
if (TextUtils.isEmpty(trim)) {
cg.a(this.f11640b, w.e(this.f11640b, "user_input_phone_number"));
return;
}
String trim2 = this.e.getText().toString().trim();
if (TextUtils.isEmpty(trim2)) {
cg.a(this.f11640b, w.e(this.f11640b, "please_set_password"));
return;
}
if (TextUtils.isEmpty(trim2) || trim2.length() < 6 || trim2.length() > 20) {
cg.a(this.f11640b, w.e(this.f11640b, "account_password_length"));
return;
}
bx.a();
if (!bx.a(trim)) {
cg.a(this.f11640b, w.e(this.f11640b, "user_input_legal_phone_number"));
return;
}
if (!c(trim2)) {
cg.a(this.f11640b, w.e(this.f11640b, "password_group"));
return;
}
if (TextUtils.isEmpty(this.g.getText().toString().trim())) {
cg.a(this.f11640b, w.e(this.f11640b, "user_input_indentify_code"));
return;
}
String trim3 = this.g.getText().toString().trim();
String string = this.p.getString("MSG_CODE_" + this.d.getText().toString().trim(), "");
long j = this.p.getLong("MSG_TIME_" + this.d.getText().toString().trim(), 0L);
int currentTimeMillis = (int) ((System.currentTimeMillis() - j) / 60000);
Log.d("RegisterFragment", "diffTime = " + currentTimeMillis);
if (currentTimeMillis > 30 && j != 0) {
cg.a(this.f11640b, w.e(this.f11640b, "user_get_code_has_died"));
} else if (!TextUtils.equals(trim3, string)) {
cg.a(this.f11640b, w.e(this.f11640b, "user_get_code_error"));
} else {
a(trim, trim2);
}
}
private void a(final String str, final String str2) {
Log.d("RegisterFragment", "toserver start");
String b2 = b(str, str2);
if (TextUtils.isEmpty(b2)) {
Log.d("RegisterFragment", "requestParams is empty");
cg.a(this.f11640b, w.e(this.f11640b, "server_exception"));
return;
}
a("user_registering");
String a2 = c.a(b2);
Log.d("RegisterFragment", "content = " + a2);
bk.a().a("https://sdk.ourplay.com.cn/account/register.php", a2, new bk.a() {
@Override
public void a(String str3) {
az.d("RegisterFragment", "responese:" + str3);
RegisterFragment.this.d();
Log.d("RegisterFragment", "onsuccess = " + str3);
if (!TextUtils.isEmpty(str3)) {
try {
JSONObject jSONObject = new JSONObject(str3);
int optInt = jSONObject.optInt("flag");
Log.d("RegisterFragment", "flag = " + optInt);
if (optInt == 1) {
StatisticsGS.getInstance().uploadUserAction(RegisterFragment.this.f11640b, 116);
StatisticsGS.getInstance().uploadUserAction(RegisterFragment.this.f11640b, StatisticsBase.UA_ACCOUNT_REGISTER, 1, 1);
jSONObject.optInt("rid");
cg.a(RegisterFragment.this.f11640b, w.e(RegisterFragment.this.f11640b, "user_register_success"));
RegisterFragment.this.i = RegisterFragment.this.f11640b.getSharedPreferences("USERINFO", Build.VERSION.SDK_INT < 11 ? 0 : 4);
bx a3 = bx.a();
a3.b(RegisterFragment.this.i, t.f12028b, false);
a3.b(RegisterFragment.this.i, "USER_P002", str2);
a3.b(RegisterFragment.this.i, "USER_NAME", str);
a3.b(RegisterFragment.this.i, t.j, str);
RegisterFragment.this.getResources().getIdentifier("slide_left_in", "anim", RegisterFragment.this.f11640b.getPackageName());
RegisterFragment.this.getResources().getIdentifier("slide_left_out", "anim", RegisterFragment.this.f11640b.getPackageName());
((LoginActivity) RegisterFragment.this.f11640b).a(true);
((LoginActivity) RegisterFragment.this.f11640b).a(1);
cn.c(RegisterFragment.this.f11640b, 0);
} else {
cg.a(RegisterFragment.this.f11640b, w.e(RegisterFragment.this.f11640b, "server_exception"));
}
return;
} catch (JSONException e) {
e.printStackTrace();
Log.d("RegisterFragment", "json exception");
cg.a(RegisterFragment.this.f11640b, w.e(RegisterFragment.this.f11640b, "server_exception"));
return;
}
}
Log.d("RegisterFragment", "服务器返回为空");
cg.a(RegisterFragment.this.f11640b, w.e(RegisterFragment.this.f11640b, "server_exception"));
}
@Override
public void b(String str3) {
RegisterFragment.this.d();
Log.d("RegisterFragment", "failed = " + str3);
cg.a(RegisterFragment.this.f11640b, w.e(RegisterFragment.this.f11640b, "server_exception"));
}
});
}
private String b(String str, String str2) {
RegisterInfo registerInfo = new RegisterInfo();
registerInfo.appInfo = new AppInfo();
registerInfo.deviceInfo = new DeviceInfo();
registerInfo.userInfo = new UserInfo();
GameUtil intance = GameUtil.getIntance();
registerInfo.userInfo.userName = str;
registerInfo.userInfo.pwd = str2;
registerInfo.userInfo.phoneNumber = "";
registerInfo.appInfo.chid = intance.h();
registerInfo.appInfo.subChid = intance.i();
registerInfo.appInfo.pkgName = this.f11640b.getPackageName();
registerInfo.deviceInfo.aid = intance.r(this.f11640b);
registerInfo.deviceInfo.andVer = intance.p();
registerInfo.deviceInfo.sdkVer = intance.o();
registerInfo.deviceInfo.imei = intance.v(this.f11640b);
registerInfo.deviceInfo.imsi = intance.w(this.f11640b);
registerInfo.deviceInfo.model = intance.q();
registerInfo.deviceInfo.screen = intance.y(this.f11640b);
registerInfo.deviceInfo.netType = intance.z(this.f11640b);
registerInfo.deviceInfo.memInfo = intance.d();
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("userName", registerInfo.userInfo.userName);
jSONObject.put("pwd", registerInfo.userInfo.pwd);
jSONObject.put("phoneNumber", registerInfo.userInfo.phoneNumber);
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);
jSONObject.put("apiPublicFlag", 29);
try {
jSONObject.put("infoid", b.INSTANCE.d);
} catch (JSONException e) {
e.printStackTrace();
}
JSONObject a2 = intance.a(this.f11640b, jSONObject);
cn.a(this.f11640b, a2);
return a2.toString();
} catch (JSONException e2) {
e2.printStackTrace();
Log.d("RegisterFragment", "获取参数异常");
return "";
}
}
private boolean c(String str) {
return Pattern.compile("^[0-9A-Za-z]{6,20}$").matcher(str).matches();
}
public void a(View view) {
InputMethodManager inputMethodManager;
if (view == null || (inputMethodManager = (InputMethodManager) this.f11640b.getSystemService("input_method")) == null) {
return;
}
inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
public void a(String str) {
if (this.q == null) {
View inflate = LayoutInflater.from(this.f11640b).inflate(getResources().getIdentifier("custom_progress_dialog", "layout", this.f11640b.getPackageName()), (ViewGroup) null, false);
ImageView imageView = (ImageView) inflate.findViewById(getResources().getIdentifier("custom_progress_dialog_img", "id", this.f11640b.getPackageName()));
imageView.setImageDrawable(getResources().getDrawable(getResources().getIdentifier("spinner", "drawable", this.f11640b.getPackageName())));
imageView.startAnimation(AnimationUtils.loadAnimation(this.f11640b, getResources().getIdentifier("progress_animator", "anim", this.f11640b.getPackageName())));
((TextView) inflate.findViewById(getResources().getIdentifier("progress_note", "id", this.f11640b.getPackageName()))).setText(getResources().getIdentifier(str, "string", this.f11640b.getPackageName()));
this.q = new Dialog(this.f11640b, getResources().getIdentifier("custom_dialog_theme", "style", this.f11640b.getPackageName()));
this.q.getWindow().setBackgroundDrawable(getResources().getDrawable(getResources().getIdentifier("dialog_transparent_bg", "drawable", this.f11640b.getPackageName())));
this.q.setContentView(inflate);
this.q.setCanceledOnTouchOutside(false);
this.q.setOnKeyListener(new DialogInterface.OnKeyListener() {
@Override
public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
return i == 4;
}
});
}
if (this.q.isShowing()) {
return;
}
this.q.show();
}
public void d() {
if (this.q != null) {
this.q.cancel();
this.q = null;
}
}
@Override
public void onDestroy() {
super.onDestroy();
this.f11639a.removeCallbacksAndMessages(null);
}
@Override
public void onHiddenChanged(boolean z) {
super.onHiddenChanged(z);
if (isAdded()) {
if (z) {
onPause();
} else {
onResume();
}
}
}
}