031aa9ae6a7446f66ecc3c71ff8944ab9ab384ef.svn-base 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. package eVVM.apk.ui.My;
  2. import android.graphics.Color;
  3. import android.os.Bundle;
  4. import android.text.SpannableStringBuilder;
  5. import android.text.Spanned;
  6. import android.text.TextUtils;
  7. import android.text.style.ForegroundColorSpan;
  8. import android.widget.Button;
  9. import android.widget.CheckBox;
  10. import android.widget.CompoundButton;
  11. import android.widget.ImageView;
  12. import android.widget.TextView;
  13. import butterknife.BindView;
  14. import butterknife.ButterKnife;
  15. import butterknife.OnClick;
  16. import eVVM.apk.R;
  17. import eVVM.apk.common.MyActivity;
  18. import eVVM.apk.helper.SPUtils;
  19. import eVVM.apk.mvp.MvpActivity;
  20. import eVVM.apk.ui.My.examine.ExamineContract;
  21. import eVVM.apk.ui.My.examine.ExaminePresenter;
  22. import eVVM.apk.ui.bean.VerificationCodeBean;
  23. public class ExamineActivity extends MvpActivity<ExaminePresenter> implements ExamineContract.View {
  24. @BindView(R.id.examine_iv)
  25. ImageView examineIv;
  26. @BindView(R.id.examine_tv)
  27. TextView examineTv;
  28. @BindView(R.id.examine_cb_agree)
  29. CheckBox examineCbAgree;
  30. @BindView(R.id.examine_tv_protocol)
  31. TextView examineTvProtocol;
  32. @BindView(R.id.examine_btn_true)
  33. Button examineBtnTrue;
  34. @Override
  35. protected int getLayoutId() {
  36. return R.layout.activity_examine;
  37. }
  38. @Override
  39. protected int getTitleId() {
  40. return 0;
  41. }
  42. @Override
  43. protected void initView() {
  44. //设置用户协议
  45. toProtocol();
  46. examineBtnTrue.setEnabled(false);
  47. //设置 button的状态
  48. getBtnStact();
  49. }
  50. private void toProtocol() {
  51. SpannableStringBuilder builder = new SpannableStringBuilder(examineTvProtocol.getText().toString());
  52. ForegroundColorSpan blueSpan = new ForegroundColorSpan(Color.BLUE);
  53. //UnderlineSpan lineSpan = new UnderlineSpan();
  54. // builder.setSpan(lineSpan,8,16, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); //下划线
  55. builder.setSpan(blueSpan, 9, 15, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); //字体颜色
  56. examineTvProtocol.setText(builder);
  57. }
  58. private void getBtnStact() {
  59. examineCbAgree.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
  60. @Override
  61. public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
  62. if (b) {
  63. examineBtnTrue.setEnabled(true);
  64. } else {
  65. //forgetBtnLogin.setClickable(false);
  66. examineBtnTrue.setEnabled(false);
  67. }
  68. }
  69. });
  70. }
  71. @Override
  72. protected void initData() {
  73. }
  74. @OnClick(R.id.examine_btn_true)
  75. public void onViewClicked() {
  76. String user_id = (String) SPUtils.get("USER_ID", "");
  77. getPresenter().agreeProtocol(user_id + "");
  78. }
  79. @Override
  80. protected ExaminePresenter createPresenter() {
  81. return new ExaminePresenter();
  82. }
  83. @Override
  84. public void agreeError(String msg) {
  85. toast(msg);
  86. }
  87. @Override
  88. public void agreeSuccess(VerificationCodeBean data) {
  89. toast("认证成功,请进行登录");
  90. finish();
  91. }
  92. }