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

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


package com.excelliance.kxqp.pay.share;

import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.drawable.AnimationDrawable;
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.util.Log;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.excelliance.kxqp.ui.BaseActivity;
import com.excelliance.kxqp.ui.c;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import org.json.JSONObject;

public class ShareForRegister extends BaseActivity implements View.OnClickListener {

    private String f12674b;
    private Context c;
    private SharedPreferences d;
    private RelativeLayout e = null;
    private ShareCodeEdit f = null;
    private TextView g = null;
    private Button h = null;

    Handler f12673a = new Handler() {
        @Override
        public void handleMessage(Message message) {
            String str;
            a aVar = (a) message.obj;
            int i = 0;
            if (aVar != null) {
                String e = aVar.e();
                if (!TextUtils.isEmpty(e) && !e.equalsIgnoreCase("null")) {
                    i = Integer.parseInt(e);
                }
                str = aVar.i();
            } else {
                str = null;
            }
            ShareForRegister.this.a((Object) ("message:" + i + " otherCode:" + str));
            switch (message.what) {
                case 1:
                    ShareForRegister.this.a(i, str);
                    if (i != 3 || TextUtils.isEmpty(str)) {
                        return;
                    }
                    ShareForRegister.this.a(str);
                    return;
                case 2:
                    ShareForRegister.this.a(i, str);
                    return;
                default:
                    return;
            }
        }
    };

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        this.f12674b = getPackageName();
        this.c = this;
        int identifier = getResources().getIdentifier("share_for_register_layout", "layout", this.f12674b);
        if (identifier > 0) {
            setContentView(identifier);
        }
        this.d = this.c.getSharedPreferences("alipay", Build.VERSION.SDK_INT < 11 ? 0 : 4);
        boolean z = this.d.getBoolean("share_is_input", false);
        d();
        a(z);
    }

    @Override
    public void onClick(View view) {
        try {
            switch (Integer.parseInt(view.getTag().toString())) {
                case 1:
                    a(view);
                    e();
                    return;
                case 2:
                    a(view);
                    if (this.f != null) {
                        Editable text = this.f.getText();
                        if (text == null || text.length() < 6) {
                            c.a(this.c, getResources().getIdentifier("shared_toast_edit_fail", "string", this.f12674b), c.f13996a);
                            this.f.setText("");
                            return;
                        } else {
                            if (b.a().e(this.c)) {
                                a();
                                return;
                            }
                            return;
                        }
                    }
                    return;
                case 3:
                    a(view);
                    e();
                    return;
                default:
                    return;
            }
        } catch (Exception unused) {
        }
    }

    private void a(View view) {
        try {
            InputMethodManager inputMethodManager = (InputMethodManager) getSystemService("input_method");
            if (Build.VERSION.SDK_INT >= 3) {
                inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private void a() {
        c();
        try {
            final String obj = this.f.getText().toString();
            final a a2 = b.a().a(this.c, obj, "3");
            a("data:" + a2.q("3") + "  isNet:" + a2.getType());
            new Thread(new Runnable() {
                @Override
                public void run() {
                    try {
                        b a3 = b.a();
                        b.a();
                        HttpURLConnection a4 = a3.a("http://mto.multiopen.cn/alipaysharenew.php");
                        if (a4 != null) {
                            String a5 = com.excelliance.kxqp.pay.ali.b.a(a2.q("3"), b.a().b());
                            if (a5 != null) {
                                DataOutputStream dataOutputStream = new DataOutputStream(a4.getOutputStream());
                                dataOutputStream.writeBytes(a5);
                                dataOutputStream.flush();
                                dataOutputStream.close();
                            }
                            if (a4.getResponseCode() == 200) {
                                a aVar = new a();
                                String str = "";
                                BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(a4.getInputStream()));
                                while (true) {
                                    String readLine = bufferedReader.readLine();
                                    if (readLine == null) {
                                        break;
                                    }
                                    str = str + readLine;
                                }
                                bufferedReader.close();
                                if (!TextUtils.isEmpty(str)) {
                                    JSONObject jSONObject = new JSONObject(str);
                                    if (jSONObject.length() > 0) {
                                        String optString = jSONObject.optString("sharepay");
                                        if (!TextUtils.isEmpty(optString)) {
                                            JSONObject jSONObject2 = new JSONObject(optString);
                                            String optString2 = jSONObject2.optString("code");
                                            String optString3 = jSONObject2.optString("isin");
                                            String optString4 = jSONObject2.optString("msg");
                                            ShareForRegister.this.a((Object) ("shareMsg:" + optString4));
                                            if (!TextUtils.isEmpty(optString2)) {
                                                aVar.e(optString2);
                                            }
                                            if (!TextUtils.isEmpty(optString3)) {
                                                if (optString3.equals("1")) {
                                                    aVar.a(true);
                                                } else {
                                                    aVar.a(false);
                                                }
                                            }
                                            if (!TextUtils.isEmpty(optString4)) {
                                                aVar.c(optString4);
                                            }
                                        }
                                    }
                                }
                                Message obtainMessage = ShareForRegister.this.f12673a.obtainMessage();
                                aVar.g(obj);
                                obtainMessage.what = 1;
                                obtainMessage.obj = aVar;
                                ShareForRegister.this.f12673a.sendMessage(obtainMessage);
                                return;
                            }
                            throw new Exception("error connect...");
                        }
                        throw new Exception("error connect...");
                    } catch (Exception e) {
                        e.printStackTrace();
                        ShareForRegister.this.a((Object) e, true);
                        Message obtainMessage2 = ShareForRegister.this.f12673a.obtainMessage();
                        obtainMessage2.what = 2;
                        ShareForRegister.this.f12673a.sendMessage(obtainMessage2);
                    }
                }
            }).start();
        } catch (Exception e) {
            e.printStackTrace();
            a((Object) e, true);
            Message obtainMessage = this.f12673a.obtainMessage();
            obtainMessage.what = 2;
            this.f12673a.sendMessage(obtainMessage);
        }
    }

    private void c() {
        AnimationDrawable animationDrawable;
        try {
            if (this.e != null) {
                this.e.setVisibility(0);
                this.e.setFocusable(true);
                this.e.setClickable(true);
                View childAt = this.e.getChildAt(0);
                if (childAt == null || !(childAt instanceof ImageView) || (animationDrawable = (AnimationDrawable) ((ImageView) childAt).getDrawable()) == null) {
                    return;
                }
                animationDrawable.start();
            }
        } catch (Exception e) {
            e.printStackTrace();
            a((Object) ("e:" + e), true);
        }
    }

    public void a(int i, String str) {
        AnimationDrawable animationDrawable;
        try {
            if (this.e != null) {
                this.e.setVisibility(8);
                this.e.setFocusable(false);
                this.e.setClickable(false);
                View childAt = this.e.getChildAt(0);
                if (childAt != null && (childAt instanceof ImageView) && (animationDrawable = (AnimationDrawable) ((ImageView) childAt).getDrawable()) != null) {
                    animationDrawable.stop();
                }
            }
            if (i >= 0 || i <= 4) {
                int identifier = getResources().getIdentifier("shared_toast_code_" + i, "string", this.f12674b);
                if (identifier > 0) {
                    c.a(this.c, identifier, c.f13996a);
                }
                if (i != 1 || TextUtils.isEmpty(str)) {
                    return;
                }
                this.d.edit().putBoolean("share_is_input", true).commit();
                this.d.edit().putString("share_other_code", str).commit();
                a(true);
            }
        } catch (Exception e) {
            e.printStackTrace();
            a((Object) ("e:" + e), true);
        }
    }

    public void a(String str) {
        this.d.edit().putBoolean("share_is_input", true).commit();
        this.d.edit().putString("share_other_code", str).commit();
    }

    private void a(boolean z) {
        if (this.f == null || this.g == null || this.h == null) {
            return;
        }
        if (z) {
            this.f.setText(this.d.getString("share_other_code", "******"));
            this.f.setTouchMode(false);
            this.g.setText(getResources().getIdentifier("share_register_hint_succ", "string", this.f12674b));
            this.h.setText(getResources().getIdentifier("share_register_but_succ", "string", this.f12674b));
            this.h.setTag(3);
            return;
        }
        this.f.setText("");
        this.f.setHint(getResources().getIdentifier("share_register_edit_hint", "string", this.f12674b));
        this.f.setTouchMode(true);
        this.g.setText(getResources().getIdentifier("share_register_hint", "string", this.f12674b));
        this.h.setText(getResources().getIdentifier("share_register_but", "string", this.f12674b));
        this.h.setTag(2);
    }

    private void d() {
        try {
            ((ImageView) a("share_nav_back", "id", 1)).setImageResource(getResources().getIdentifier("button_back_normal", "drawable", this.f12674b));
            this.f = (ShareCodeEdit) a("share_edit_code", "id", 0);
            this.g = (TextView) a("share_text_introduction", "id", 0);
            this.h = (Button) a("share_sure_but", "id", 2);
            this.e = (RelativeLayout) a("progress_layout", "id", 0);
        } catch (Exception e) {
            e.printStackTrace();
            a((Object) e, true);
        }
    }

    private View a(String str, String str2, int i) {
        int identifier = getResources().getIdentifier(str, str2, this.f12674b);
        if (identifier <= 0) {
            return null;
        }
        View findViewById = findViewById(identifier);
        if (i == 0) {
            return findViewById;
        }
        findViewById.setTag(Integer.valueOf(i));
        findViewById.setOnClickListener(this);
        return findViewById;
    }

    public void a(Object obj) {
        Log.d("lyl", "MSG:" + obj);
    }

    public void a(Object obj, boolean z) {
        if (z) {
            Log.e("ShareForRegister", "MSG:" + obj);
        }
    }

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

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