8fd0b4521b2813e997f5db19ebf5a2f3a845d384.svn-base 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. package eVVM.apk.ui.My;
  2. import android.content.Intent;
  3. import android.graphics.Color;
  4. import android.os.Bundle;
  5. import android.text.SpannableStringBuilder;
  6. import android.text.Spanned;
  7. import android.text.style.ForegroundColorSpan;
  8. import android.view.View;
  9. import android.widget.Button;
  10. import android.widget.CheckBox;
  11. import android.widget.CompoundButton;
  12. import android.widget.ImageView;
  13. import android.widget.LinearLayout;
  14. import android.widget.TextView;
  15. import com.hjq.dialog.ToastDialog;
  16. import butterknife.BindView;
  17. import butterknife.ButterKnife;
  18. import butterknife.OnClick;
  19. import eVVM.apk.R;
  20. import eVVM.apk.helper.SPUtils;
  21. import eVVM.apk.mvp.MvpActivity;
  22. import eVVM.apk.ui.My.examine.ExamineContract;
  23. import eVVM.apk.ui.My.examine.ExaminePresenter;
  24. import eVVM.apk.ui.bean.VerificationCodeBean;
  25. public class ExamineActivity extends MvpActivity<ExaminePresenter> implements ExamineContract.View {
  26. @BindView(R.id.examine_iv)
  27. ImageView examineIv;
  28. @BindView(R.id.examine_tv)
  29. TextView examineTv;
  30. @BindView(R.id.examine_cb_agree)
  31. CheckBox examineCbAgree;
  32. @BindView(R.id.examine_tv_protocol)
  33. TextView examineTvProtocol;
  34. @BindView(R.id.examine_btn_true)
  35. Button examineBtnTrue;
  36. @BindView(R.id.examine_ll)
  37. LinearLayout examineLl;
  38. private int loginStatusCode;
  39. @Override
  40. protected int getLayoutId() {
  41. return R.layout.activity_examine;
  42. }
  43. @Override
  44. protected int getTitleId() {
  45. return 0;
  46. }
  47. @Override
  48. protected void initView() {
  49. examineBtnTrue.setEnabled(false);
  50. //设置用户协议
  51. toProtocol();
  52. //设置 button的状态
  53. getBtnStact();
  54. Intent intent = getIntent();
  55. loginStatusCode = intent.getIntExtra("LoginStatusCode", 0);
  56. switch (loginStatusCode) {
  57. case 0:
  58. break;
  59. case 3: //您的账号正在审核中,请耐心等待
  60. examineIv.setVisibility(View.INVISIBLE);
  61. examineLl.setVisibility(View.INVISIBLE);
  62. examineTv.setText("您的账号正在审核中,请耐心等待");
  63. examineBtnTrue.setText("退出");
  64. examineBtnTrue.setEnabled(true);
  65. break;
  66. case 6: //通过
  67. examineIv.setVisibility(View.VISIBLE);
  68. examineLl.setVisibility(View.VISIBLE);
  69. examineTv.setText("恭喜你审核通过");
  70. examineBtnTrue.setText("确定");
  71. break;
  72. case 4: //未通过
  73. examineIv.setVisibility(View.INVISIBLE);
  74. examineLl.setVisibility(View.INVISIBLE);
  75. examineTv.setText("您的申请未通过审核");
  76. examineBtnTrue.setText("退出");
  77. examineBtnTrue.setEnabled(true);
  78. break;
  79. default:
  80. break;
  81. }
  82. }
  83. private void toProtocol() {
  84. SpannableStringBuilder builder = new SpannableStringBuilder(examineTvProtocol.getText().toString());
  85. ForegroundColorSpan blueSpan = new ForegroundColorSpan(Color.BLUE);
  86. //UnderlineSpan lineSpan = new UnderlineSpan();
  87. // builder.setSpan(lineSpan,8,16, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); //下划线
  88. builder.setSpan(blueSpan, 9, 15, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); //字体颜色
  89. examineTvProtocol.setText(builder);
  90. }
  91. private void getBtnStact() {
  92. examineCbAgree.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
  93. @Override
  94. public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
  95. if (b) {
  96. examineBtnTrue.setEnabled(true);
  97. } else {
  98. //forgetBtnLogin.setClickable(false);
  99. examineBtnTrue.setEnabled(false);
  100. }
  101. }
  102. });
  103. }
  104. @Override
  105. protected void initData() {
  106. }
  107. @OnClick(R.id.examine_btn_true)
  108. public void onViewClicked() {
  109. if (loginStatusCode == 6) {
  110. String user_id = (String) SPUtils.get("USER_ID", "");
  111. getPresenter().agreeProtocol(user_id + "");
  112. } else {
  113. finish();
  114. }
  115. }
  116. @Override
  117. protected ExaminePresenter createPresenter() {
  118. return new ExaminePresenter();
  119. }
  120. @Override
  121. public void agreeError(String msg) {
  122. toast(msg);
  123. }
  124. @Override
  125. public void agreeSuccess(VerificationCodeBean data) {
  126. new ToastDialog.Builder(this)
  127. .setType(ToastDialog.Type.FINISH)
  128. .setMessage("完成")
  129. .show();
  130. postDelayed(new Runnable() {
  131. @Override
  132. public void run() {
  133. toast("认证成功,请进行登录");
  134. finish();
  135. }
  136. }, 500);
  137. }
  138. }