导航菜单

页面标题

页面副标题

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

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

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


package com.shiliuj.ui.activitys;

import android.os.Bundle;
import android.os.CountDownTimer;
import android.text.Editable;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RelativeLayout;
import butterknife.BindView;
import butterknife.OnTextChanged;
import com.base.commonlibrary.base.BaseResult;
import com.base.commonlibrary.base.baserx.RxSchedulers;
import com.base.commonlibrary.utils.RegexUtil;
import com.base.commonlibrary.views.ClearEditText;
import com.base.commonlibrary.views.TitleLayout;
import com.shiliuj.mjyp.app.api.Api;
import com.shiliuj.mjyp.app.base.BaseBindActivity;
import com.shiliuj.mjyp.app.base.RxSubscriber;
import com.shiliuj.ui.bean.PwdBean;
import com.shiliuj.ui.views.EditTextChangeListener;

public class MTM20act extends BaseBindActivity {

    @BindView(2131296385)
    Button btnGet;

    @BindView(2131296534)
    Button btnSendCode;

    @BindView(2131296429)
    EditText code;
    private CountDownTimer countDownTimer;
    protected boolean isCountDownFinish = true;

    @BindView(2131296616)
    View line;

    @BindView(2131296618)
    View line2;

    @BindView(2131296619)
    View line3;

    @BindView(2131296776)
    ClearEditText phone;

    @BindView(2131296791)
    ClearEditText pwd;

    @BindView(2131296813)
    RelativeLayout rl;

    @BindView(2131296998)
    TitleLayout title;

    protected boolean canLoadMore() {
        return false;
    }

    public int getLayoutId() {
        return 2131492902;
    }

    public void initPresenter() {
    }

    protected void loadMore() {
    }

    protected void refresh() {
    }

    public void initView(Bundle bundle) {
        new EditTextChangeListener(this.btnGet, 2131231132).setEditText(new EditText[]{this.phone, this.code, this.pwd});
        this.btnGet.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                MTM20act.this.pwdBean();
            }
        });
        this.btnSendCode.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                MTM20act mTM20act = MTM20act.this;
                mTM20act.getCode(mTM20act.phone.getText().toString());
            }
        });
    }

    private void stopCountDown() {
        CountDownTimer countDownTimer = this.countDownTimer;
        if (countDownTimer != null) {
            countDownTimer.cancel();
            this.countDownTimer = null;
        }
    }

    @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.btnSendCode.setEnabled(true);
                return;
            } else {
                this.btnSendCode.setEnabled(false);
                return;
            }
        }
        this.btnSendCode.setEnabled(false);
    }

    protected void startCountDown() {
        this.isCountDownFinish = false;
        if (this.countDownTimer == null) {
            this.countDownTimer = new CountDownTimer(60000L, 1000L) {
                @Override
                public void onTick(long j) {
                    String string = MTM20act.this.getResources().getString(2131689980);
                    MTM20act.this.btnSendCode.setText(string + "(" + (j / 1000) + MTM20act.this.getResources().getString(2131690093));
                }

                @Override
                public void onFinish() {
                    MTM20act.this.btnSendCode.setEnabled(true);
                    MTM20act.this.btnSendCode.setText(MTM20act.this.getResources().getString(2131689757));
                    MTM20act.this.isCountDownFinish = true;
                }
            };
        }
        this.countDownTimer.start();
    }

    protected void getCode(String str) {
        String trim = this.pwd.getText().toString().trim();
        if (!TextUtils.isEmpty(trim)) {
            this.btnSendCode.setEnabled(false);
            this.mRxManager.add(Api.getDefault().pdsendCode(str, trim).compose(RxSchedulers.io_main()).subscribe(new RxSubscriber<BaseResult>(this.mContext, true) {
                public void _onNext(BaseResult baseResult) {
                    if (baseResult != null && baseResult.getCode() == 200) {
                        MTM20act.this.startCountDown();
                        return;
                    }
                    String message = baseResult.getMessage();
                    MTM20act.this.btnSendCode.setEnabled(true);
                    MTM20act.this.showShortToast(message);
                }

                protected void _onError(String str2) {
                    MTM20act.this.showShortToast(str2);
                    MTM20act.this.btnSendCode.setEnabled(true);
                }
            }));
        } else {
            showShortToast(getResources().getString(2131689948));
        }
    }

    protected void pwdBean() {
        this.btnGet.setEnabled(false);
        this.mRxManager.add(Api.getDefault().findPassword(new PwdBean(this.pwd.getText().toString(), this.phone.getText().toString(), this.code.getText().toString())).compose(RxSchedulers.io_main()).subscribe(new RxSubscriber<BaseResult>(this.mContext, true) {
            public void _onNext(BaseResult baseResult) {
                String message = baseResult.getMessage();
                if (baseResult.getCode() == 200) {
                    MTM20act.this.finish();
                } else {
                    MTM20act.this.btnGet.setEnabled(true);
                }
                MTM20act.this.showShortToast(message);
            }

            protected void _onError(String str) {
                MTM20act.this.showShortToast(str);
                MTM20act.this.btnGet.setEnabled(true);
            }
        }));
    }

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