| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168 |
- package eVVM.apk.ui.My;
- import android.content.Intent;
- import android.graphics.Color;
- import android.os.Bundle;
- import android.text.SpannableStringBuilder;
- import android.text.Spanned;
- import android.text.style.ForegroundColorSpan;
- import android.view.View;
- import android.widget.Button;
- import android.widget.CheckBox;
- import android.widget.CompoundButton;
- import android.widget.ImageView;
- import android.widget.LinearLayout;
- import android.widget.TextView;
- import com.hjq.dialog.ToastDialog;
- import butterknife.BindView;
- import butterknife.ButterKnife;
- import butterknife.OnClick;
- import eVVM.apk.R;
- import eVVM.apk.helper.SPUtils;
- import eVVM.apk.mvp.MvpActivity;
- import eVVM.apk.ui.My.examine.ExamineContract;
- import eVVM.apk.ui.My.examine.ExaminePresenter;
- import eVVM.apk.ui.bean.VerificationCodeBean;
- public class ExamineActivity extends MvpActivity<ExaminePresenter> implements ExamineContract.View {
- @BindView(R.id.examine_iv)
- ImageView examineIv;
- @BindView(R.id.examine_tv)
- TextView examineTv;
- @BindView(R.id.examine_cb_agree)
- CheckBox examineCbAgree;
- @BindView(R.id.examine_tv_protocol)
- TextView examineTvProtocol;
- @BindView(R.id.examine_btn_true)
- Button examineBtnTrue;
- @BindView(R.id.examine_ll)
- LinearLayout examineLl;
- private int loginStatusCode;
- @Override
- protected int getLayoutId() {
- return R.layout.activity_examine;
- }
- @Override
- protected int getTitleId() {
- return 0;
- }
- @Override
- protected void initView() {
- examineBtnTrue.setEnabled(false);
- //设置用户协议
- toProtocol();
- //设置 button的状态
- getBtnStact();
- Intent intent = getIntent();
- loginStatusCode = intent.getIntExtra("LoginStatusCode", 0);
- switch (loginStatusCode) {
- case 0:
- break;
- case 3: //您的账号正在审核中,请耐心等待
- examineIv.setVisibility(View.INVISIBLE);
- examineLl.setVisibility(View.INVISIBLE);
- examineTv.setText("您的账号正在审核中,请耐心等待");
- examineBtnTrue.setText("退出");
- examineBtnTrue.setEnabled(true);
- break;
- case 6: //通过
- examineIv.setVisibility(View.VISIBLE);
- examineLl.setVisibility(View.VISIBLE);
- examineTv.setText("恭喜你审核通过");
- examineBtnTrue.setText("确定");
- break;
- case 4: //未通过
- examineIv.setVisibility(View.INVISIBLE);
- examineLl.setVisibility(View.INVISIBLE);
- examineTv.setText("您的申请未通过审核");
- examineBtnTrue.setText("退出");
- examineBtnTrue.setEnabled(true);
- break;
- default:
- break;
- }
- }
- private void toProtocol() {
- SpannableStringBuilder builder = new SpannableStringBuilder(examineTvProtocol.getText().toString());
- ForegroundColorSpan blueSpan = new ForegroundColorSpan(Color.BLUE);
- //UnderlineSpan lineSpan = new UnderlineSpan();
- // builder.setSpan(lineSpan,8,16, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); //下划线
- builder.setSpan(blueSpan, 9, 15, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); //字体颜色
- examineTvProtocol.setText(builder);
- }
- private void getBtnStact() {
- examineCbAgree.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
- @Override
- public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
- if (b) {
- examineBtnTrue.setEnabled(true);
- } else {
- //forgetBtnLogin.setClickable(false);
- examineBtnTrue.setEnabled(false);
- }
- }
- });
- }
- @Override
- protected void initData() {
- }
- @OnClick(R.id.examine_btn_true)
- public void onViewClicked() {
- if (loginStatusCode == 6) {
- String user_id = (String) SPUtils.get("USER_ID", "");
- getPresenter().agreeProtocol(user_id + "");
- } else {
- finish();
- }
- }
- @Override
- protected ExaminePresenter createPresenter() {
- return new ExaminePresenter();
- }
- @Override
- public void agreeError(String msg) {
- toast(msg);
- }
- @Override
- public void agreeSuccess(VerificationCodeBean data) {
- new ToastDialog.Builder(this)
- .setType(ToastDialog.Type.FINISH)
- .setMessage("完成")
- .show();
- postDelayed(new Runnable() {
- @Override
- public void run() {
- toast("认证成功,请进行登录");
- finish();
- }
- }, 500);
- }
- }
|