OurPlay v5.5.9版本的 MD5 值为:d4e139798f4c2243a1145c8af5e21046
以下内容为反编译后的 LoginFragment.java 源代码,内容仅作参考
package com.excelliance.kxqp.gs.user;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
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.inputmethod.InputMethodManager;
import android.widget.Button;
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.g.aa;
import com.excelliance.kxqp.gs.util.UserUtil;
import com.excelliance.kxqp.gs.util.ao;
import com.excelliance.kxqp.gs.util.aq;
import com.excelliance.kxqp.gs.util.av;
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.bu;
import com.excelliance.kxqp.gs.util.bx;
import com.excelliance.kxqp.gs.util.c;
import com.excelliance.kxqp.gs.util.cd;
import com.excelliance.kxqp.gs.util.cg;
import com.excelliance.kxqp.gs.util.ci;
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 com.excelliance.kxqp.task.g.g;
import java.util.regex.Pattern;
import org.json.JSONException;
import org.json.JSONObject;
public class LoginFragment extends Fragment implements View.OnClickListener {
private EditText f11626b;
private Button c;
private int d;
private Context e;
private View f;
private TextView g;
private EditText h;
private ImageView i;
private ImageView j;
private TextView k;
private SharedPreferences l;
private TextView n;
private SharedPreferences o;
private View p;
private View q;
private bu m = null;
Handler f11625a = new Handler() {
@Override
public void handleMessage(Message message) {
super.handleMessage(message);
int i = message.what;
if (i == 10) {
cg.a(LoginFragment.this.e, w.e(LoginFragment.this.e, "server_exception"));
LoginFragment.this.d();
return;
}
if (i != 60) {
return;
}
String e = w.e(LoginFragment.this.e, "user_get_indentify_code_again");
if (LoginFragment.this.d <= 0) {
LoginFragment.this.c.setText(w.e(LoginFragment.this.e, "user_get_indentify_code"));
LoginFragment.this.c.setEnabled(true);
LoginFragment.this.c.setTextColor(w.l(LoginFragment.this.e, "green_main_theme"));
return;
}
LoginFragment.d(LoginFragment.this);
LoginFragment.this.c.setText(LoginFragment.this.d + e);
LoginFragment.this.f11625a.removeMessages(60);
LoginFragment.this.f11625a.sendEmptyMessageDelayed(60, 1000L);
}
};
private boolean r = false;
static int d(LoginFragment loginFragment) {
int i = loginFragment.d;
loginFragment.d = i - 1;
return i;
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
this.e = activity;
this.l = this.e.getSharedPreferences("USERINFO", Build.VERSION.SDK_INT < 11 ? 0 : 4);
this.o = this.e.getSharedPreferences("MSG_INDENTIFY_CODE", Build.VERSION.SDK_INT < 11 ? 0 : 4);
}
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
}
@Override
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
this.f = w.b(this.e, "activity_login");
b();
this.m = bu.a();
this.m.a(this.e);
return this.f;
}
@Override
public void onResume() {
super.onResume();
StatisticsGS.getInstance().uploadUserAction(this.e, StatisticsBase.UA_ACCOUNT_LOGIN);
if (((LoginActivity) this.e).b()) {
a();
return;
}
String a2 = ((LoginActivity) this.e).a();
this.g.setText(a2);
if (bx.a(a2)) {
this.n.setVisibility(0);
} else {
this.n.setVisibility(4);
}
this.h.requestFocus();
((InputMethodManager) this.e.getSystemService("input_method")).toggleSoftInput(0, 2);
}
@Override
public void onPause() {
super.onPause();
Log.d("LoginFragment", "onPause()");
((InputMethodManager) this.e.getSystemService("input_method")).hideSoftInputFromWindow(this.h.getWindowToken(), 0);
}
private void b() {
ao a2 = ao.a(this.e);
this.g = (TextView) a2.a("tv_account", this.f);
this.h = (EditText) a2.a("et_input_password", this.f);
this.f11626b = (EditText) a2.a("et_indentify_code", this.f);
this.p = a2.a("verify_code_divider", this.f);
this.q = a2.a("ll_verify_code", this.f);
if (((LoginActivity) this.e).c()) {
this.q.setVisibility(0);
} else {
this.q.setVisibility(8);
}
this.c = (Button) a2.a(this.f, "btn_send_verify_code", 100);
this.c.setOnClickListener(this);
this.h.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
if (i != 2) {
return false;
}
InputMethodManager inputMethodManager = (InputMethodManager) textView.getContext().getSystemService("input_method");
if (inputMethodManager.isActive()) {
inputMethodManager.hideSoftInputFromWindow(textView.getApplicationWindowToken(), 0);
}
LoginFragment.this.c();
return true;
}
});
this.f11626b.addTextChangedListener(new cd.a() {
@Override
public void afterTextChanged(Editable editable) {
if (!cd.a(LoginFragment.this.f11626b.getText().toString().toString())) {
LoginFragment.this.k.setEnabled(true);
LoginFragment.this.k.setAlpha(1.0f);
} else {
LoginFragment.this.k.setEnabled(false);
LoginFragment.this.k.setAlpha(0.3f);
}
}
});
this.i = (ImageView) a2.a(this.f, "iv_clear", 0);
this.i.setOnClickListener(this);
this.j = (ImageView) a2.a(this.f, "iv_switch", 1);
this.j.setOnClickListener(this);
this.k = (TextView) a2.a(this.f, "tv_login", 2);
this.k.setEnabled(true);
this.k.setTextColor(w.a(this.e, "app_title_white"));
this.k.setOnClickListener(this);
this.n = (TextView) a2.a(this.f, "tv_forget_pwd", 3);
this.n.setOnClickListener(this);
}
public void c() {
if (!av.a().b(this.e)) {
cg.a(this.e, w.e(this.e, "network_unavailable"));
return;
}
String trim = this.h.getText().toString().trim();
String trim2 = this.f11626b.getText().toString().trim();
String trim3 = this.g.getText().toString().trim();
if (TextUtils.isEmpty(trim3) || TextUtils.isEmpty(trim)) {
cg.a(this.e, w.e(this.e, "user_input_account_pwd"));
return;
}
if (this.q.getVisibility() == 0) {
if (TextUtils.isEmpty(trim2)) {
cg.a(this.e, w.e(this.e, "user_input_indentify_code"));
return;
}
String trim4 = this.f11626b.getText().toString().trim();
String string = this.o.getString("MSG_CODE_" + trim3, "");
long j = this.o.getLong("MSG_TIME_" + trim3, 0L);
int currentTimeMillis = (int) ((System.currentTimeMillis() - j) / 60000);
Log.d("LoginFragment", "diffTime = " + currentTimeMillis);
if (currentTimeMillis > 30 && j != 0) {
cg.a(this.e, w.e(this.e, "user_get_code_has_died"));
return;
} else {
if (!TextUtils.equals(trim4, string)) {
String e = w.e(this.e, "user_get_code_error");
this.p.setBackgroundColor(Color.parseColor("#fe533f"));
cg.a(this.e, e);
return;
}
this.p.setBackgroundColor(w.l(this.e, "login_hint_title"));
}
}
if (trim3.length() < 6 || trim3.length() > 20) {
cg.a(this.e, w.e(this.e, "user_account_pwd_error"));
return;
}
if (!bx.a(trim3)) {
cg.a(this.e, w.e(this.e, "user_account_pwd_error"));
return;
}
if (trim.length() < 6 || trim.length() > 20) {
cg.a(this.e, w.e(this.e, "user_pwd_be_error"));
}
if (!b(trim)) {
cg.a(this.e, w.e(this.e, "user_pwd_be_error"));
} else {
a(trim3, trim, 1);
}
}
private void a(String str, String str2, int i) {
Log.d("LoginFragment", "tosever start");
if (this.m == null) {
this.m = bu.a();
}
this.m.a(this.e);
this.m.a("user_logining");
String requestParamsForLogin = UserUtil.getInstance().getRequestParamsForLogin(this.e, str, str2, i);
az.d("LoginFragment", "requesetParmas:" + requestParamsForLogin);
if (TextUtils.isEmpty(requestParamsForLogin)) {
Log.d("LoginFragment", "requestParams is empty");
this.f11625a.removeMessages(10);
this.f11625a.sendEmptyMessage(10);
return;
}
a(requestParamsForLogin, str, str2);
}
private void a(String str, final String str2, final String str3) {
String a2 = c.a(str);
Log.d("LoginFragment", "content : " + a2);
bk.a().a("https://sdk.ourplay.com.cn/account/login.php", a2, new bk.a() {
@Override
public void a(String str4) {
if (LoginFragment.this.m == null) {
LoginFragment.this.m = bu.a();
LoginFragment.this.m.a(LoginFragment.this.e);
}
LoginFragment.this.m.b();
Log.d("LoginFragment", "response = " + str4);
try {
String a3 = c.a(str4, t.f12027a);
Log.d("LoginFragment", "AES content = " + a3);
if (TextUtils.isEmpty(a3)) {
Log.d("LoginFragment", "content is empty");
LoginFragment.this.f11625a.removeMessages(10);
LoginFragment.this.f11625a.sendEmptyMessage(10);
return;
}
try {
LoginFragment.this.a(new JSONObject(a3), str2, str3);
} catch (Exception e) {
e.printStackTrace();
Log.d("LoginFragment", "json exception");
LoginFragment.this.f11625a.removeMessages(10);
LoginFragment.this.f11625a.sendEmptyMessage(10);
}
} catch (Exception e2) {
e2.printStackTrace();
Log.d("LoginFragment", "AES exception = " + e2.getMessage().toString());
LoginFragment.this.f11625a.removeMessages(10);
LoginFragment.this.f11625a.sendEmptyMessage(10);
}
}
@Override
public void b(String str4) {
Log.d("LoginFragment", "onFailed info = " + str4);
LoginFragment.this.f11625a.removeMessages(10);
LoginFragment.this.f11625a.sendEmptyMessage(10);
}
});
}
public void a(JSONObject jSONObject, String str, String str2) {
int optInt = jSONObject.optInt("flag");
int optInt2 = jSONObject.optInt("firstPay");
int optInt3 = jSONObject.optInt("diamond");
Log.d("LoginFragment", "flag = " + optInt);
Log.d("LoginFragment", "firstPay = " + optInt2);
Log.d("LoginFragment", "diamond = " + optInt3);
if (optInt != 1) {
if (optInt == 2) {
cg.a(this.e, w.e(this.e, "account_no_register"));
d();
return;
} else if (optInt == 3) {
cg.a(this.e, w.e(this.e, "check_account_pwd"));
d();
return;
} else {
this.f11625a.removeMessages(10);
this.f11625a.sendEmptyMessage(10);
return;
}
}
StatisticsGS.getInstance().uploadUserAction(this.e, StatisticsBase.UA_ACCOUNT_LOGIN, 1, 1);
g.a().b(this.e);
aq.a().g(this.e);
cg.a(this.e, w.e(this.e, "login_success"));
this.l = this.e.getSharedPreferences("USERINFO", Build.VERSION.SDK_INT < 11 ? 0 : 4);
bx a2 = bx.a();
a2.b(this.l, "SWITCH_ACCOUNT", true);
a2.b(this.l, t.f12028b, true);
a2.b(this.l, "USER_NAME", str);
a2.b(this.l, "USER_P002", str2);
a2.a(this.l, "USER_FIRST_PAY", optInt2);
a2.a(this.l, "USER_DIAMOND", optInt3);
a(jSONObject);
this.l.edit().putBoolean("OFFLINE_NOTICE", false).apply();
e();
}
private void a(JSONObject jSONObject) {
int optInt = jSONObject.optInt("vip");
String optString = jSONObject.optString("nickname");
int optInt2 = jSONObject.optInt("sex", 0);
String optString2 = jSONObject.optString("birthday");
String optString3 = jSONObject.optString("phoneNum");
String optString4 = jSONObject.optString("headIconUrl");
Log.d("LoginFragment", "phoneNumber = " + optString3);
int optInt3 = jSONObject.optInt("rid");
String optString5 = jSONObject.optString("endTime", "0");
if ("null".equals(optString5)) {
optString5 = "0";
}
az.d("LoginFragment", "endTime:" + optString5);
String optString6 = jSONObject.optString("curtime", "0");
bx a2 = bx.a();
aa.a(this.e).a(optInt);
a2.b(this.l, t.c, optString);
a2.b(this.l, t.f, optString4);
a2.a(this.l, t.d, optInt2);
a2.b(this.l, t.e, optString2);
a2.b(this.l, t.j, optString3);
a2.a(this.l, "USER_ID", optInt3);
a2.b(this.l, "END_TIME", (Long.parseLong(optString5) * 1000) + "");
a2.b(this.l, "CUR_TIME", optString6);
}
public void d() {
if (this.m == null) {
this.m = bu.a();
this.m.a(this.e);
}
this.m.b();
this.l = this.e.getSharedPreferences("USERINFO", Build.VERSION.SDK_INT < 11 ? 0 : 4);
bx a2 = bx.a();
a2.b(this.l, t.c, "");
a2.b(this.l, t.f, "");
a2.a(this.l, t.d, 0);
a2.b(this.l, t.e, "");
a2.b(this.l, t.j, "");
aa.a(this.e).a(0);
a2.a(this.l, "USER_ID", 0);
a2.a(this.l, "USER_DIAMOND", 0);
}
private boolean b(String str) {
return Pattern.compile("^[0-9A-Za-z]{6,20}$").matcher(str).matches();
}
private void e() {
Intent intent = getActivity().getIntent();
if (intent != null) {
String stringExtra = intent.getStringExtra("prizeId");
int intExtra = intent.getIntExtra("newYearItemIndex", -1);
if (!TextUtils.isEmpty(stringExtra)) {
Intent intent2 = new Intent();
intent2.putExtra("prizeId", stringExtra);
getActivity().setResult(-1, intent2);
} else if (intExtra != -1) {
Intent intent3 = new Intent();
intent3.putExtra("newYearItemIndex", intExtra);
getActivity().setResult(-1, intent3);
}
int intExtra2 = intent.getIntExtra("flag", 0);
if (intExtra2 == 1) {
getActivity().setResult(-1, intent);
} else if (intExtra2 == 2) {
getActivity().setResult(-1, intent);
}
}
a(this.h);
if (this.m == null) {
this.m = bu.a();
this.m.a(this.e);
}
this.m.b();
((LoginActivity) this.e).finish();
}
private void a(View view) {
InputMethodManager inputMethodManager;
if (view == null || (inputMethodManager = (InputMethodManager) this.e.getSystemService("input_method")) == null) {
return;
}
inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
@Override
public void onDestroy() {
this.f11625a.removeCallbacksAndMessages(null);
if (this.m != null) {
this.m.b();
this.m.a((Context) null);
}
super.onDestroy();
}
@Override
public void onClick(View view) {
int intValue = ((Integer) view.getTag()).intValue();
int identifier = getResources().getIdentifier("slide_left_in", "anim", this.e.getPackageName());
int identifier2 = getResources().getIdentifier("slide_left_out", "anim", this.e.getPackageName());
if (intValue != 100) {
switch (intValue) {
case 0:
this.h.setText("");
return;
case 1:
if (this.h != null) {
if (!this.r) {
this.h.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
} else {
this.h.setTransformationMethod(PasswordTransformationMethod.getInstance());
}
this.r = !this.r;
this.h.postInvalidate();
Editable text = this.h.getText();
if (text instanceof Spannable) {
Selection.setSelection(text, text.length());
}
this.h.setSelection(text.length());
}
int j = w.j(this.e, "eye_open");
int j2 = w.j(this.e, "eye_close");
if (!this.r) {
this.j.setImageDrawable(this.e.getResources().getDrawable(j2));
return;
} else {
this.j.setImageDrawable(this.e.getResources().getDrawable(j));
return;
}
case 2:
c();
return;
case 3:
Intent intent = new Intent(this.e, (Class<?>) GetBackPwdActivity.class);
intent.putExtra("phone_number", this.g.getText());
startActivity(intent);
((Activity) this.e).overridePendingTransition(identifier, identifier2);
return;
default:
return;
}
}
f();
}
private void f() {
String trim = this.g.getText().toString().trim();
if (TextUtils.isEmpty(trim)) {
cg.a(this.e, w.e(this.e, "user_input_phone_number"));
return;
}
if (!bx.a(trim)) {
cg.a(this.e, w.e(this.e, "user_input_legal_phone_number"));
return;
}
GameUtil.getIntance();
if (!GameUtil.isNetworkConnected(this.e)) {
cg.a(this.e, w.e(this.e, "network_unavailable"));
return;
}
ci.a().a(trim, 2, new ci.a() {
@Override
public void a(String str) {
Log.d("LoginFragment", "response = " + str);
if (!TextUtils.isEmpty(str)) {
LoginFragment.this.c(str);
return;
}
cg.a(LoginFragment.this.e, w.e(LoginFragment.this.e, "user_get_indentify_code_failed"));
Log.d("LoginFragment", "response is null");
}
@Override
public void b(String str) {
String e = w.e(LoginFragment.this.e, "user_get_indentify_code_failed");
Log.d("LoginFragment", "msgFailed = " + str);
cg.a(LoginFragment.this.e, e);
}
});
cg.a(this.e, w.e(this.e, "user_get_code_has_send"));
this.c.setEnabled(false);
this.c.setTextColor(Color.parseColor("#999999"));
this.d = 60;
String e = w.e(this.e, "user_get_indentify_code_again");
this.c.setText(this.d + e);
this.f11625a.removeMessages(60);
this.f11625a.sendEmptyMessageDelayed(60, 1000L);
}
public void c(String str) {
String str2;
try {
str2 = bp.a(str, t.f12027a, "utf-8");
} catch (Exception e) {
e.printStackTrace();
Log.d("LoginFragment", "exception = " + e.getMessage());
str2 = null;
}
if (!TextUtils.isEmpty(str2)) {
try {
JSONObject jSONObject = new JSONObject(str2);
String optString = jSONObject.optString("status", "0");
Log.d("LoginFragment", "status = " + optString);
if (TextUtils.equals(optString, "1")) {
String optString2 = jSONObject.optString("flag", "0");
Log.d("LoginFragment", "flag = " + optString2);
if (TextUtils.equals(optString2, "0")) {
String optString3 = jSONObject.optString("code");
if (!TextUtils.isEmpty(optString3)) {
String trim = this.g.getText().toString().trim();
this.o.edit().putString("MSG_CODE_" + trim, optString3).apply();
this.o.edit().putLong("MSG_TIME_" + trim, System.currentTimeMillis()).apply();
} else {
Log.d("LoginFragment", "code is empty");
}
} else if (TextUtils.equals(optString2, "1")) {
cg.a(this.e, w.e(this.e, "user_get_code_reach_limit"));
} else if (TextUtils.equals(optString2, "2")) {
cg.a(this.e, w.e(this.e, "has_register"));
} else {
Log.d("LoginFragment", "暂无处理");
}
} else {
cg.a(this.e, w.e(this.e, "user_get_indentify_code_failed"));
}
return;
} catch (JSONException e2) {
e2.printStackTrace();
Log.d("LoginFragment", "exception = " + e2.getMessage());
return;
}
}
Log.d("LoginFragment", "data is empty");
}
public void a(boolean z) {
if (this.q != null) {
this.q.setVisibility(z ? 0 : 8);
}
}
public void a(String str) {
if (this.g != null) {
this.g.setText(str);
}
}
public void a() {
((LoginActivity) this.e).a(false);
String a2 = bx.a().a(this.l, t.j);
String a3 = bx.a().a(this.l, "USER_P002");
if (a2 == null || a3 == null) {
return;
}
this.g.setText(a2);
this.h.setText(a3);
a(a2, a3, 1);
}
}