| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- package eVVM.apk.ui.My;
- import android.graphics.Color;
- import android.os.Bundle;
- import android.text.SpannableStringBuilder;
- import android.text.Spanned;
- import android.text.TextUtils;
- import android.text.style.ForegroundColorSpan;
- import android.widget.Button;
- import android.widget.CheckBox;
- import android.widget.CompoundButton;
- import android.widget.ImageView;
- 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.common.MyActivity;
- 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;
- @Override
- protected int getLayoutId() {
- return R.layout.activity_examine;
- }
- @Override
- protected int getTitleId() {
- return 0;
- }
- @Override
- protected void initView() {
- //设置用户协议
- toProtocol();
- examineBtnTrue.setEnabled(false);
- //设置 button的状态
- getBtnStact();
- }
- 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() {
- String user_id = (String) SPUtils.get("USER_ID", "");
- getPresenter().agreeProtocol(user_id + "");
- }
- @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);
- }
- }
|