OurPlay v5.5.9版本的 MD5 值为:d4e139798f4c2243a1145c8af5e21046

以下内容为反编译后的 PasswordResetActivity.java 源代码,内容仅作参考


package com.excelliance.kxqp.gs.user;

import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle;
import android.text.Editable;
import android.text.Selection;
import android.text.Spannable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.text.method.HideReturnsTransformationMethod;
import android.text.method.PasswordTransformationMethod;
import android.util.Log;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.excelliance.kxqp.GameUtil;
import com.excelliance.kxqp.gs.base.BaseActivity;
import com.excelliance.kxqp.gs.util.ao;
import com.excelliance.kxqp.gs.util.bk;
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.cg;
import com.excelliance.kxqp.gs.util.ci;
import com.excelliance.kxqp.gs.util.t;
import com.excelliance.kxqp.gs.util.w;
import java.util.regex.Pattern;
import org.json.JSONObject;

public class PasswordResetActivity extends BaseActivity {

    private Context f11633a;

    private View f11634b;
    private ImageView c;
    private EditText d;
    private TextView e;
    private TextView f;
    private EditText g;
    private ImageView h;
    private TextView i;
    private EditText j;
    private SharedPreferences k;
    private String l;
    private RelativeLayout m;
    private RelativeLayout n;
    private boolean o = false;

    @Override
    public void onCreate(Bundle bundle) {
        requestWindowFeature(1);
        super.onCreate(bundle);
        this.f11633a = this;
        this.f11634b = w.b(this.f11633a, "activity_reset_pwd");
        if (this.f11634b != null) {
            setContentView(this.f11634b);
            initStatusbar();
            a();
        }
        this.k = getSharedPreferences("USERINFO", Build.VERSION.SDK_INT < 11 ? 0 : 4);
        this.l = bx.a().a(this.k, t.j);
    }

    private void a() {
        ao a2 = ao.a(this.f11633a);
        this.m = (RelativeLayout) a2.a("step1_layout", this.f11634b);
        this.n = (RelativeLayout) a2.a("step2_layout", this.f11634b);
        this.c = (ImageView) a2.a(this.f11634b, "iv_back", 0);
        this.c.setOnClickListener(this);
        this.d = (EditText) a2.a("edit_old_pwd", this.f11634b);
        this.e = (TextView) a2.a(this.f11634b, "send", 1);
        this.e.setOnClickListener(this);
        this.f = (TextView) a2.a(this.f11634b, "forget_pwd", 2);
        this.f.setOnClickListener(this);
        this.g = (EditText) a2.a("new_pwd_input", this.f11634b);
        this.g.addTextChangedListener(new a() {
            @Override
            public void afterTextChanged(Editable editable) {
                if (!TextUtils.isEmpty(editable) || PasswordResetActivity.this.j == null) {
                    return;
                }
                PasswordResetActivity.this.j.setText("");
            }
        });
        this.j = (EditText) a2.a("new_pwd_confirm", this.f11634b);
        this.h = (ImageView) a2.a(this.f11634b, "iv_switch", 3);
        this.h.setOnClickListener(this);
        this.i = (TextView) a2.a(this.f11634b, "btn_confirm_new_pwd", 4);
        this.i.setOnClickListener(this);
    }

    @Override
    public void singleClick(View view) {
        switch (Integer.valueOf(view.getTag().toString()).intValue()) {
            case 0:
                c();
                return;
            case 1:
                b();
                a(this.d);
                return;
            case 2:
                int identifier = getResources().getIdentifier("slide_left_in", "anim", getPackageName());
                int identifier2 = getResources().getIdentifier("slide_left_out", "anim", getPackageName());
                startActivity(new Intent(this.f11633a, (Class<?>) GetBackPwdActivity.class));
                finish();
                overridePendingTransition(identifier, identifier2);
                return;
            case 3:
                if (this.g != null) {
                    if (!this.o) {
                        this.g.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
                    } else {
                        this.g.setTransformationMethod(PasswordTransformationMethod.getInstance());
                    }
                    this.o = !this.o;
                    this.g.postInvalidate();
                    Editable text = this.g.getText();
                    if (text instanceof Spannable) {
                        Selection.setSelection(text, text.length());
                    }
                }
                int j = w.j(this.f11633a, "eye_open");
                int j2 = w.j(this.f11633a, "eye_close");
                if (!this.o) {
                    this.h.setImageDrawable(this.f11633a.getResources().getDrawable(j2));
                    return;
                } else {
                    this.h.setImageDrawable(this.f11633a.getResources().getDrawable(j));
                    return;
                }
            case 4:
                d();
                return;
            default:
                return;
        }
    }

    private void b() {
        GameUtil.getIntance();
        if (!GameUtil.isNetworkConnected(this.f11633a)) {
            cg.a(this.f11633a, w.e(this.f11633a, "network_unavailable"));
            return;
        }
        String a2 = bx.a().a(this.k, "USER_P002");
        String trim = this.d.getText().toString().trim();
        if (TextUtils.isEmpty(trim)) {
            cg.a(this.f11633a, w.e(this.f11633a, "please_enter_pwd"));
            return;
        }
        if (trim.length() < 6 || trim.length() > 20) {
            cg.a(this.f11633a, w.e(this.f11633a, "user_pwd_be_error"));
            return;
        }
        if (!a(trim)) {
            cg.a(this.f11633a, w.e(this.f11633a, "user_pwd_be_error"));
        } else if (!a2.equals(trim)) {
            cg.a(this.f11633a, w.e(this.f11633a, "user_pwd_be_error"));
        } else {
            cg.a(this.f11633a, w.e(this.f11633a, "pwd_reset_confirm_success"));
            this.m.setVisibility(8);
            this.n.setVisibility(0);
        }
    }

    @Override
    public void onBackPressed() {
        super.onBackPressed();
        c();
    }

    private void c() {
        a(this.d);
        finish();
        overridePendingTransition(0, getResources().getIdentifier("slide_right_out", "anim", getPackageName()));
    }

    private void d() {
        final String trim = this.g.getText().toString().trim();
        if (TextUtils.isEmpty(trim)) {
            cg.a(this.f11633a, w.e(this.f11633a, "please_set_password"));
            return;
        }
        String trim2 = this.j.getText().toString().trim();
        if (TextUtils.isEmpty(trim2)) {
            cg.a(this.f11633a, w.e(this.f11633a, "please_repeat_password"));
            return;
        }
        if (TextUtils.isEmpty(trim) || trim.length() < 6 || trim.length() > 20 || TextUtils.isEmpty(trim2) || trim2.length() < 6 || trim2.length() > 20) {
            cg.a(this.f11633a, w.e(this.f11633a, "account_password_length"));
            return;
        }
        ci a2 = ci.a();
        if (!a2.a(trim) || !a2.a(trim2)) {
            cg.a(this.f11633a, w.e(this.f11633a, "password_group"));
            return;
        }
        if (!TextUtils.equals(trim, trim2)) {
            cg.a(this.f11633a, w.e(this.f11633a, "two_unlike"));
            return;
        }
        GameUtil.getIntance();
        if (!GameUtil.isNetworkConnected(this.f11633a)) {
            cg.a(this.f11633a, w.e(this.f11633a, "network_unavailable"));
            return;
        }
        final bu a3 = bu.a();
        a3.a(this.f11633a);
        a3.a("user_pwd_resetting");
        bk.a().a("https://sdk.ourplay.com.cn/account/modifypwd.php", c.a(b(this.l, trim)), new bk.a() {
            @Override
            public void a(String str) {
                Log.d("PassWordReset", "response = " + str);
                a3.b();
                if (!TextUtils.isEmpty(str)) {
                    PasswordResetActivity.this.a(str, trim);
                    return;
                }
                Log.d("PassWordReset", "response is empty");
                cg.a(PasswordResetActivity.this.f11633a, w.e(PasswordResetActivity.this.f11633a, "server_exception"));
            }

            @Override
            public void b(String str) {
                a3.b();
                Log.d("PassWordReset", "onFailed = " + str);
                cg.a(PasswordResetActivity.this.f11633a, w.e(PasswordResetActivity.this.f11633a, "server_exception"));
            }
        });
    }

    public void a(String str, String str2) {
        try {
            JSONObject jSONObject = new JSONObject(str);
            String optString = jSONObject.optString("status");
            String optString2 = jSONObject.optString("flag");
            Log.d("PassWordReset", "status = " + optString + ", flag = " + optString2);
            if (TextUtils.equals(optString, "1")) {
                if (TextUtils.equals(optString2, "1")) {
                    cg.a(this.f11633a, w.e(this.f11633a, "user_pwd_success_reset"));
                    bx.a().b(this.k, "USER_P002", str2);
                    c();
                } else if (TextUtils.equals(optString2, "2")) {
                    cg.a(this.f11633a, w.e(this.f11633a, "user_phone_num_un_bound"));
                } else if (TextUtils.equals(optString2, "3")) {
                    cg.a(this.f11633a, w.e(this.f11633a, "user_pwd_reset_sample"));
                } else {
                    cg.a(this.f11633a, w.e(this.f11633a, "server_exception"));
                }
            } else {
                cg.a(this.f11633a, w.e(this.f11633a, "server_exception"));
            }
        } catch (Exception e) {
            e.printStackTrace();
            Log.d("PassWordReset", "exception = " + e.getMessage());
            cg.a(this.f11633a, w.e(this.f11633a, "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("PassWordReset", "excepiton = " + e.getMessage());
            return null;
        }
    }

    private void a(View view) {
        InputMethodManager inputMethodManager;
        if (view == null || (inputMethodManager = (InputMethodManager) this.f11633a.getSystemService("input_method")) == null) {
            return;
        }
        inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0);
    }

    private boolean a(String str) {
        return Pattern.compile("^[0-9A-Za-z]{6,20}$").matcher(str).matches();
    }

    private class a implements TextWatcher {
        @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) {
        }

        private a() {
        }
    }
}