导航菜单

页面标题

页面副标题

大众借. v4.1.2 - S0ACT.java 源代码

正在查看: 大众借. v4.1.2 应用的 S0ACT.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.shiliuj.ui.activitys;

import android.app.ProgressDialog;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import butterknife.BindView;
import butterknife.OnClick;
import butterknife.OnTextChanged;
import com.alipay.alipaysecuritysdk.common.config.Constant;
import com.alipay.face.api.ZIMFacade;
import com.base.commonlibrary.base.BaseResult;
import com.base.commonlibrary.base.baserx.RxHelper;
import com.base.commonlibrary.base.baserx.RxManager;
import com.base.commonlibrary.base.baserx.RxSchedulers;
import com.base.commonlibrary.utils.ApplicationUtil;
import com.base.commonlibrary.utils.MD5Utils;
import com.base.commonlibrary.utils.RSAUtils;
import com.base.commonlibrary.utils.RegexUtil;
import com.base.commonlibrary.utils.SPUtils;
import com.base.commonlibrary.views.ClearEditText;
import com.base.commonlibrary.views.TitleLayout;
import com.google.gson.Gson;
import com.shiliuj.mjyp.app.api.Api;
import com.shiliuj.mjyp.app.api.AppConfig;
import com.shiliuj.mjyp.app.api.OssUtil;
import com.shiliuj.mjyp.app.base.BaseVerCodeActivity;
import com.shiliuj.mjyp.app.base.RxSubscriber;
import com.shiliuj.ui.bean.CheckIpBean;
import com.shiliuj.ui.bean.ConfigBean;
import com.shiliuj.ui.bean.EncForm;
import com.shiliuj.ui.bean.MessageEvent;
import com.shiliuj.ui.bean.RegBean;
import com.shiliuj.ui.bean.RegisterForm;
import com.shiliuj.ui.views.EditTextChangeListener;
import java.util.UUID;
import org.greenrobot.eventbus.EventBus;
import rx.android.schedulers.AndroidSchedulers;
import rx.functions.Action1;
import rx.schedulers.Schedulers;

public class S0ACT extends BaseVerCodeActivity {

    @BindView(2131296385)
    Button btnGet;

    @BindView(2131296423)
    CheckBox ckXy;

    @BindView(2131296429)
    EditText code;

    @BindView(2131296534)
    Button getCode;

    @BindView(2131296603)
    TextView kef;

    @BindView(2131296604)
    TextView kef_qq;

    @BindView(2131296607)
    TextView kef_wx;

    @BindView(2131296616)
    View line;

    @BindView(2131296619)
    View line3;

    @BindView(2131296674)
    ImageView logo;

    @BindView(2131296776)
    ClearEditText phone;
    private ProgressDialog progressDialog;
    private String regChannelCode = "09ce2f7bfb9243debf2c2efe05a1d047";

    @BindView(2131296817)
    RelativeLayout rlBtn;

    @BindView(2131296963)
    TextView time;

    @BindView(2131296998)
    TitleLayout title;

    @BindView(2131297009)
    TextView toLogin;

    @BindView(2131297074)
    TextView xy;

    protected boolean canLoadMore() {
        return false;
    }

    public int getLayoutId() {
        return 2131492918;
    }

    public void initPresenter() {
    }

    protected void loadMore() {
    }

    protected void refresh() {
    }

    protected Button returnButton() {
        return this.getCode;
    }

    public void initView() {
        ZIMFacade.install(this);
        this.progressDialog = new ProgressDialog(this);
        OssUtil.INSTANCE.getUrl(this, new OssUtil.IpCallBack() {
            public void getIpSuccess() {
                S0ACT.this.config();
                S0ACT.this.checkIp();
            }
        });
        new EditTextChangeListener(this.btnGet, 2131231132).setEditText(new EditText[]{this.phone, this.code});
        SPUtils.putData("latitude", "0.00");
        SPUtils.putData("longitude", "0.00");
        SPUtils.putData("address", "0.00");
        this.xy.setText("《" + getResources().getString(2131690144) + getResources().getString(2131689961) + "》");
        config();
    }

    @OnTextChanged(callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED, value = {2131296776})
    public void editTextDetailChange(Editable editable) {
        if (editable != null) {
            if (RegexUtil.isPhoneNumber(editable.toString()) && this.isCountDownFinish) {
                this.getCode.setEnabled(true);
                return;
            } else {
                this.getCode.setEnabled(false);
                return;
            }
        }
        this.getCode.setEnabled(false);
    }

    @OnClick({2131296385, 2131296534, 2131296603, 2131297074})
    protected void onClick(View view) {
        switch (view.getId()) {
            case 2131296385:
                if (this.ckXy.isChecked()) {
                    login(new RegisterForm(this.phone.getText().toString(), this.code.getText().toString(), Constant.SDK_OS, ApplicationUtil.getChannelName(this.mContext), "", (String) SPUtils.getData("longitude", "0.0"), (String) SPUtils.getData("latitude", "0.0"), this.regChannelCode, (String) SPUtils.getData("address", "中国"), ""));
                    break;
                } else {
                    showShortToast(getResources().getString(2131689532));
                    break;
                }
            case 2131296534:
                sendVerCode(this.phone.getText().toString(), null);
                break;
            case 2131296603:
                startActivity(new Intent("android.intent.action.DIAL", Uri.parse("tel:" + ((String) SPUtils.getData("TEL", "")))));
                break;
            case 2131297074:
                Bundle bundle = new Bundle();
                bundle.putString("title", "");
                bundle.putString("url", ((String) SPUtils.getData("baseH5", "")) + AppConfig.niceAgreement);
                startActivity(MT10ACT.class, bundle);
                break;
        }
    }

    protected void login(RegisterForm registerForm) {
        this.btnGet.setEnabled(false);
        String json = new Gson().toJson(registerForm);
        long currentTimeMillis = System.currentTimeMillis();
        String uuid = UUID.randomUUID().toString();
        String str = json + "@" + uuid + "@" + currentTimeMillis;
        String encrypt = RSAUtils.getInstance().encrypt(str + "@" + MD5Utils.md5(str, "f4qgkb85q4pMRMChLeC7uSn2wwTWGXrs"));
        StringBuilder sb = new StringBuilder();
        sb.append(currentTimeMillis);
        sb.append("");
        this.mRxManager.add(Api.getDefault().logins(new EncForm(encrypt, uuid, sb.toString())).compose(RxHelper.handleResult()).subscribe(new RxSubscriber<RegBean>(this.mContext, true) {
            public void _onNext(RegBean regBean) {
                SPUtils.putData("APP_TOKEN", regBean.getToken());
                String userCode = regBean.getUserCode();
                SPUtils.putData("PHONE", S0ACT.this.phone.getText().toString());
                SPUtils.putData("USERCODE", userCode);
                S0ACT.this.mRxManager.post("Status", "登录");
                EventBus.getDefault().post(new MessageEvent("login_ok"));
                S0ACT.this.finish();
            }

            protected void _onError(String str2) {
                S0ACT.this.btnGet.setEnabled(true);
                if (!TextUtils.isEmpty(str2) && str2.contains("JsonReader.setLenient")) {
                    S0ACT.this.showShortToast("数据解析异常,建议杀掉app后重新启动");
                } else {
                    S0ACT.this.showShortToast(str2);
                }
            }
        }));
    }

    protected void config() {
        this.mRxManager.add(Api.getDefault().getServiceConfig().compose(RxHelper.handleResult()).subscribe(new RxSubscriber<ConfigBean>(this.mContext, false) {
            protected void _onError(String str) {
            }

            public void _onNext(ConfigBean configBean) {
                String tel = configBean.getTel();
                String time = configBean.getTime();
                String qq = configBean.getQq();
                String wx = configBean.getWx();
                SPUtils.putData("TEL", tel);
                if (!RegexUtil.isEmpty(tel)) {
                    S0ACT.this.kef.setText(S0ACT.this.getResources().getString(2131689629) + tel);
                }
                if (!RegexUtil.isEmpty(wx)) {
                    S0ACT.this.kef_wx.setText(S0ACT.this.getResources().getString(2131689630) + wx);
                }
                if (!RegexUtil.isEmpty(qq)) {
                    S0ACT.this.kef_qq.setText(S0ACT.this.getResources().getString(2131689632) + qq);
                }
                if (RegexUtil.isEmpty(time)) {
                    return;
                }
                S0ACT.this.time.setText(S0ACT.this.getResources().getString(2131690108) + time);
            }
        }));
    }

    protected void sendMsg() {
        this.mRxManager.add(Api.getDefault().sendMsg().compose(RxSchedulers.io_main()).subscribe(new RxSubscriber<BaseResult>(this.mContext, true) {
            public void _onNext(BaseResult baseResult) {
            }

            protected void _onError(String str) {
                S0ACT.this.showShortToast(str);
            }
        }));
    }

    protected void onDestroy() {
        super.onDestroy();
    }

    public void checkIp() {
        new RxManager().add(Api.getDefault().checkIp().subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Action1<BaseResult<CheckIpBean>>() {
            public void call(BaseResult<CheckIpBean> baseResult) {
                if (baseResult.getCode() != 200) {
                    S0ACT.this.progressDialog.setTitle("hm/check不通,可能IP被特殊地区(江苏福建等)屏蔽");
                    S0ACT.this.progressDialog.show();
                }
            }
        }, new Action1<Throwable>() {
            public void call(Throwable th) {
                S0ACT.this.progressDialog.setTitle("hm/check不通,可能IP被特殊地区(江苏福建等)屏蔽");
                S0ACT.this.progressDialog.show();
            }
        }));
    }
}