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

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


package com.excelliance.kxqp.gs.user;

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.gs.base.BaseActivity;
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.util.ao;
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.cg;
import com.excelliance.kxqp.gs.util.ci;
import com.excelliance.kxqp.gs.util.t;
import com.excelliance.kxqp.gs.util.w;
import org.json.JSONException;
import org.json.JSONObject;

public class BoundPhoneNumActivity extends BaseActivity {

    SharedPreferences f11591a;

    Handler f11592b = 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 e = w.e(BoundPhoneNumActivity.this.c, "user_get_indentify_code_again");
            BoundPhoneNumActivity.this.i.setText(BoundPhoneNumActivity.this.k + e);
            BoundPhoneNumActivity.this.f11592b.removeMessages(100);
            BoundPhoneNumActivity.this.f11592b.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
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        this.c = this;
        this.f11591a = 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 = w.b(this.c, "activity_bound_phone_num");
        if (this.d != null) {
            setContentView(this.d);
            initStatusbar();
            a();
        }
    }

    private void a() {
        ao a2 = ao.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 singleClick(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)) {
            cg.a(this.c, w.e(this.c, "network_unavailable"));
            return;
        }
        final String trim = this.f.getText().toString().trim();
        if (TextUtils.isEmpty(trim)) {
            cg.a(this.c, w.e(this.c, "user_input_phone_number"));
            return;
        }
        if (!ci.a().b(trim)) {
            cg.a(this.c, w.e(this.c, "user_input_legal_phone_number"));
            return;
        }
        if (TextUtils.isEmpty(this.g.getText().toString().trim())) {
            cg.a(this.c, w.e(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) {
            cg.a(this.c, w.e(this.c, "user_get_code_has_died"));
            return;
        }
        if (!TextUtils.equals(trim2, string)) {
            cg.a(this.c, w.e(this.c, "user_get_code_error"));
            return;
        }
        final bu a2 = bu.a();
        a2.a(this.c);
        a2.a("user_bounding");
        String a3 = a(trim);
        if (!TextUtils.isEmpty(a3)) {
            bk.a().a("https://sdk.ourplay.com.cn/account/bindmobile.php", c.a(a3), new bk.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");
                    cg.a(BoundPhoneNumActivity.this.c, w.e(BoundPhoneNumActivity.this.c, "server_exception"));
                }

                @Override
                public void b(String str) {
                    a2.b();
                    Log.d("BoundPhoneNumActivity", "onFailed = " + str);
                    cg.a(BoundPhoneNumActivity.this.c, w.e(BoundPhoneNumActivity.this.c, "server_exception"));
                }
            });
        } else {
            Log.d("BoundPhoneNumActivity", "data is empty");
            cg.a(this.c, w.e(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")) {
                    cg.a(this.c, w.e(this.c, "user_bound_success"));
                    bx.a().b(this.f11591a, t.j, str);
                    bx.a().b(this.f11591a, "USER_NAME", str);
                    d();
                } else if (TextUtils.equals(optString2, "2")) {
                    cg.a(this.c, w.e(this.c, "user_phone_has_bound_other"));
                } else if (TextUtils.equals(optString2, "3")) {
                    cg.a(this.c, w.e(this.c, "user_phone_num_bound_failed"));
                } else {
                    cg.a(this.c, w.e(this.c, "server_exception"));
                }
            } else {
                cg.a(this.c, w.e(this.c, "server_exception"));
            }
        } catch (Exception e) {
            e.printStackTrace();
            Log.d("BoundPhoneNumActivity", "exception = " + e.getMessage());
            cg.a(this.c, w.e(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 = bx.a().b(this.f11591a, "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() {
        ci a2 = ci.a();
        String a3 = a(a2);
        if (TextUtils.isEmpty(a3)) {
            return;
        }
        a2.a(a3, 3, new ci.a() {
            @Override
            public void a(String str) {
                Log.d("BoundPhoneNumActivity", "response = " + str);
                if (!TextUtils.isEmpty(str)) {
                    BoundPhoneNumActivity.this.b(str);
                    return;
                }
                cg.a(BoundPhoneNumActivity.this.c, w.e(BoundPhoneNumActivity.this.c, "user_get_indentify_code_failed"));
                Log.d("BoundPhoneNumActivity", "response is null");
            }

            @Override
            public void b(String str) {
                String e = w.e(BoundPhoneNumActivity.this.c, "user_get_indentify_code_failed");
                Log.d("BoundPhoneNumActivity", "msgFailed = " + str);
                cg.a(BoundPhoneNumActivity.this.c, e);
            }
        }, this.c);
        cg.a(this.c, w.e(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 e = w.e(this.c, "user_get_indentify_code_again");
        this.i.setText(this.k + e);
        this.f11592b.removeMessages(100);
        this.f11592b.sendEmptyMessageDelayed(100, 1000L);
    }

    private String a(ci ciVar) {
        if (this.f != null) {
            String trim = this.f.getText().toString().trim();
            if (TextUtils.isEmpty(trim)) {
                cg.a(this.c, w.e(this.c, "user_input_phone_number"));
                return null;
            }
            if (!ciVar.b(trim)) {
                cg.a(this.c, w.e(this.c, "user_input_legal_phone_number"));
                return null;
            }
            GameUtil.getIntance();
            if (GameUtil.isNetworkConnected(this.c)) {
                return trim;
            }
            cg.a(this.c, w.e(this.c, "network_unavailable"));
            return null;
        }
        Log.d("BoundPhoneNumActivity", "获取不到控件");
        return null;
    }

    public void b(String str) {
        String str2;
        try {
            str2 = bp.a(str, t.f12027a, "utf-8");
        } catch (Exception e) {
            e.printStackTrace();
            Log.d("BoundPhoneNumActivity", "exception = " + e.getMessage());
            str2 = null;
        }
        if (!TextUtils.isEmpty(str)) {
            try {
                JSONObject jSONObject = new JSONObject(str2);
                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")) {
                        cg.a(this.c, w.e(this.c, "user_get_code_reach_limit"));
                    } else if (TextUtils.equals(optString, "2")) {
                        cg.a(this.c, w.e(this.c, "user_phone_has_bound_other"));
                    } else {
                        Log.d("BoundPhoneNumActivity", "暂无处理");
                    }
                } else {
                    cg.a(this.c, w.e(this.c, "user_get_indentify_code_failed"));
                }
                return;
            } catch (JSONException e2) {
                e2.printStackTrace();
                Log.d("BoundPhoneNumActivity", "exception = " + e2.getMessage());
                return;
            }
        }
        Log.d("BoundPhoneNumActivity", "data is empty");
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        this.f11592b.removeCallbacksAndMessages(null);
    }

    @Override
    public void onBackPressed() {
        d();
    }

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