|
|
@@ -0,0 +1,376 @@
|
|
|
+package com.sheep.groups.creditcard.zx;
|
|
|
+
|
|
|
+import android.app.DatePickerDialog;
|
|
|
+import android.content.Intent;
|
|
|
+import android.graphics.Bitmap;
|
|
|
+import android.support.v7.app.AppCompatActivity;
|
|
|
+import android.os.Bundle;
|
|
|
+import android.support.v7.widget.AppCompatSpinner;
|
|
|
+import android.text.TextUtils;
|
|
|
+import android.util.Log;
|
|
|
+import android.util.TypedValue;
|
|
|
+import android.view.View;
|
|
|
+import android.widget.AdapterView;
|
|
|
+import android.widget.ArrayAdapter;
|
|
|
+import android.widget.Button;
|
|
|
+import android.widget.CheckBox;
|
|
|
+import android.widget.DatePicker;
|
|
|
+import android.widget.ImageView;
|
|
|
+import android.widget.LinearLayout;
|
|
|
+import android.widget.TextView;
|
|
|
+import android.widget.Toast;
|
|
|
+
|
|
|
+import com.bumptech.glide.Glide;
|
|
|
+import com.kfzs.libs.DaggerActivity;
|
|
|
+import com.kfzs.libs.IPresenter;
|
|
|
+import com.kfzs.libs.IView;
|
|
|
+import com.kfzs.libs.di.http.HttpModule;
|
|
|
+import com.kfzs.libs.widget.CompleteCommitEditText;
|
|
|
+import com.kfzs.libs.widget.navigation.NavigationBar;
|
|
|
+import com.sheep.groups.creditcard.CITICBackOtherInfoActivity;
|
|
|
+import com.sheep.groups.creditcard.CountDownUtil;
|
|
|
+import com.sheep.groups.creditcard.RegexUtils;
|
|
|
+import com.sheep.jiuyan.samllsheep.R;
|
|
|
+import com.sheep.jiuyan.samllsheep.SheepApp;
|
|
|
+
|
|
|
+import java.util.Calendar;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+import javax.inject.Inject;
|
|
|
+
|
|
|
+import butterknife.BindView;
|
|
|
+import butterknife.ButterKnife;
|
|
|
+
|
|
|
+public class ZhongXinCreditStep1Activity extends DaggerActivity implements ZXStep1Contact.View{
|
|
|
+
|
|
|
+ private static final String TAG = "ZhongXinCreditStep1";
|
|
|
+ @Inject
|
|
|
+ ZXStep1Presenter presenter;
|
|
|
+ @BindView(R.id.navigationbar)
|
|
|
+ NavigationBar navigationBar;
|
|
|
+ @BindView(R.id.ll_agreement)
|
|
|
+ LinearLayout llAgreement;
|
|
|
+ @BindView(R.id.cb_agreement)
|
|
|
+ CheckBox cbAgreement;
|
|
|
+ @BindView(R.id.btn_next)
|
|
|
+ Button btnNext;
|
|
|
+ @BindView(R.id.sp_tuijian)
|
|
|
+ AppCompatSpinner spTj;
|
|
|
+ @BindView(R.id.tv_dynamic)
|
|
|
+ TextView tvSms;
|
|
|
+ @BindView(R.id.et_sms)
|
|
|
+ CompleteCommitEditText etSms;
|
|
|
+ @BindView(R.id.iv_image)
|
|
|
+ ImageView ivImage;
|
|
|
+ @BindView(R.id.et_mobile)
|
|
|
+ CompleteCommitEditText etMobile;
|
|
|
+ @BindView(R.id.tv_end_expire)
|
|
|
+ TextView tvEndExpire;
|
|
|
+ @BindView(R.id.tv_start_expire)
|
|
|
+ TextView tvStartExpire;
|
|
|
+ @BindView(R.id.et_fzjg)
|
|
|
+ CompleteCommitEditText etFzjg;
|
|
|
+ @BindView(R.id.et_id_no)
|
|
|
+ CompleteCommitEditText etIdNo;
|
|
|
+ @BindView(R.id.et_name)
|
|
|
+ CompleteCommitEditText etName;
|
|
|
+ @BindView(R.id.et_image)
|
|
|
+ CompleteCommitEditText etImage;
|
|
|
+ private ArrayAdapter<CharSequence> adapter;
|
|
|
+ private CountDownUtil countDownUtil;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void onCreate(Bundle savedInstanceState) {
|
|
|
+ super.onCreate(savedInstanceState);
|
|
|
+ setContentView(R.layout.activity_zhong_xin_credit);
|
|
|
+ ButterKnife.bind(this);
|
|
|
+ navigationBar
|
|
|
+ .titleText("个人基本信息")
|
|
|
+ .titleTextSize(TypedValue.COMPLEX_UNIT_SP,17)
|
|
|
+ .titleTextColor(android.R.color.white)
|
|
|
+ .changeNavigationType(NavigationBar.IOS);
|
|
|
+
|
|
|
+
|
|
|
+ llAgreement.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ cbAgreement.setChecked(!cbAgreement.isChecked());
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ setOnCompleteEdit(etName,"name");
|
|
|
+ setOnCompleteEdit(etIdNo,"id_card");
|
|
|
+
|
|
|
+ setOnCompleteEdit(etFzjg,"issuing_authority");
|
|
|
+ setOnCompleteEdit(etMobile,"mobile");
|
|
|
+
|
|
|
+ setOnCompleteEdit(etImage,"photo_num");
|
|
|
+
|
|
|
+ setOnCompleteEdit(etSms,"code");
|
|
|
+
|
|
|
+
|
|
|
+ adapter = ArrayAdapter.createFromResource(this, R.array.credit_card_zx_tj, R.layout.spinner_text_item);
|
|
|
+// CreditCardZXManager.getInstance().c_d_relation = adapter.getItem(0).toString();
|
|
|
+ spTj.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
|
|
+ String value = (String) adapter.getItem(position);
|
|
|
+ is_invite = value.equals("是") ? "Y" : "N";
|
|
|
+// presenter.commitFormData("c_d_relation",value,CreditCardZXManager.getInstance().card_id);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onNothingSelected(AdapterView<?> parent) {
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+ spTj.setAdapter(adapter);
|
|
|
+
|
|
|
+ tvStartExpire.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ showDatePicker(true);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ tvEndExpire.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ showDatePicker(false);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ ivImage.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ loadImage();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ btnNext.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ zxBasic();
|
|
|
+// startActivity(new Intent(ZhongXinCreditStep1Activity.this,CITICBackOtherInfoActivity.class));
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ tvSms.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ sendDynamic();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ test();
|
|
|
+ }
|
|
|
+ private String is_invite = "N";
|
|
|
+ private void zxBasic(){
|
|
|
+ if(TextUtils.isEmpty(etName.getText().toString())){
|
|
|
+ Toast.makeText(this,"请输入姓名",Toast.LENGTH_SHORT).show();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if(TextUtils.isEmpty(etMobile.getText().toString())){
|
|
|
+ Toast.makeText(this,"请输入手机号",Toast.LENGTH_SHORT).show();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(TextUtils.isEmpty(etIdNo.getText().toString())){
|
|
|
+ Toast.makeText(this,"请输入身份证号",Toast.LENGTH_SHORT).show();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(TextUtils.isEmpty(etSms.getText().toString())){
|
|
|
+ Toast.makeText(this,"请输入验证码",Toast.LENGTH_SHORT).show();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ Map<String,String> map = new HashMap<>();
|
|
|
+ map.put("name",etName.getText().toString());
|
|
|
+ map.put("mobile",etMobile.getText().toString());
|
|
|
+ map.put("id_card",etIdNo.getText().toString());
|
|
|
+ map.put("code",etSms.getText().toString());
|
|
|
+
|
|
|
+ map.put("is_invite",is_invite);
|
|
|
+
|
|
|
+ if(!TextUtils.isEmpty(etFzjg.getText().toString())){
|
|
|
+ map.put("issuing_authority",etFzjg.getText().toString());
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!TextUtils.isEmpty(etFzjg.getText().toString())){
|
|
|
+ map.put("issuing_authority",etFzjg.getText().toString());
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!TextUtils.isEmpty(tvStartExpire.getText().toString())){
|
|
|
+ map.put("id_date_from",etFzjg.getText().toString());
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!TextUtils.isEmpty(tvEndExpire.getText().toString())){
|
|
|
+ map.put("id_date_end",etFzjg.getText().toString());
|
|
|
+ }
|
|
|
+
|
|
|
+ presenter.zxBasic(map);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void test(){
|
|
|
+ etName.setText("郭鑫");
|
|
|
+ etIdNo.setText("511023198811029192");
|
|
|
+ etMobile.setText("18608003614");
|
|
|
+ }
|
|
|
+
|
|
|
+ private void sendDynamic(){
|
|
|
+
|
|
|
+ if(TextUtils.isEmpty(etName.getText().toString())){
|
|
|
+ Toast.makeText(this,"请填写姓名",Toast.LENGTH_SHORT).show();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(TextUtils.isEmpty(etIdNo.getText().toString())){
|
|
|
+ Toast.makeText(this,"请填写身份证号",Toast.LENGTH_SHORT).show();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!RegexUtils.isIDCard18(etIdNo.getText().toString())){
|
|
|
+ Toast.makeText(this,"身份证号不正确",Toast.LENGTH_SHORT).show();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+// if(TextUtils.isEmpty(etFzjg.getText().toString())){
|
|
|
+// Toast.makeText(this,"请填写发证机关",Toast.LENGTH_SHORT).show();
|
|
|
+// return;
|
|
|
+// }
|
|
|
+//
|
|
|
+// if(TextUtils.isEmpty(tvStartExpire.getText().toString())){
|
|
|
+// Toast.makeText(this,"请选择有效期(起)",Toast.LENGTH_SHORT).show();
|
|
|
+// return;
|
|
|
+// }
|
|
|
+//
|
|
|
+// if(TextUtils.isEmpty(tvEndExpire.getText().toString())){
|
|
|
+// Toast.makeText(this,"请选择有效期(止)",Toast.LENGTH_SHORT).show();
|
|
|
+// return;
|
|
|
+// }
|
|
|
+
|
|
|
+ if(TextUtils.isEmpty(etImage.getText().toString())){
|
|
|
+ Toast.makeText(this,"请输入图形验证码",Toast.LENGTH_SHORT).show();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!RegexUtils.isMobileSimple(etMobile.getText().toString())){
|
|
|
+ Toast.makeText(this,"手机号不正确",Toast.LENGTH_SHORT).show();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ Map<String,String> map = new HashMap<>();
|
|
|
+ map.put("name",etName.getText().toString());
|
|
|
+ map.put("mobile",etMobile.getText().toString());
|
|
|
+ map.put("id_card",etIdNo.getText().toString());
|
|
|
+ map.put("photo_num",etImage.getText().toString());
|
|
|
+
|
|
|
+ Log.e(TAG, "sendDynamic: "+map.toString());
|
|
|
+ presenter.getDynamic(map);
|
|
|
+ //倒计时60000ms
|
|
|
+ //不同状态字体颜色
|
|
|
+ //倒计时60000ms
|
|
|
+ //不同状态字体颜色
|
|
|
+ countDownUtil = new CountDownUtil(tvSms)
|
|
|
+ .setCountDownMillis(60_000L)//倒计时60000ms
|
|
|
+ .setCountDownColor(R.color.credit_blue_color,R.color.credit_blue_color)//不同状态字体颜色
|
|
|
+ .start();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void loadImage(){
|
|
|
+ presenter.getImageCode();
|
|
|
+// Glide.with(this).download(HttpModule.BASE_URL + "credits/ecitic/img_code").into(ivImage);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void showDatePicker(final boolean start){
|
|
|
+ // 获得日历对象
|
|
|
+ Calendar c = Calendar.getInstance();
|
|
|
+ // 获取当前年份
|
|
|
+ int year = c.get(Calendar.YEAR);
|
|
|
+ // 获取当前月份
|
|
|
+ int monthOfYear = c.get(Calendar.MONTH);
|
|
|
+ // 获取当前月份的天数
|
|
|
+ int dayOfMonth = c.get(Calendar.DAY_OF_MONTH);
|
|
|
+
|
|
|
+ new DatePickerDialog(this, new DatePickerDialog.OnDateSetListener() {
|
|
|
+ @Override
|
|
|
+ public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) {
|
|
|
+ String expire = year + "/" + month + "/" + dayOfMonth;
|
|
|
+ if(start){
|
|
|
+ tvStartExpire.setText(expire);
|
|
|
+ CreditCardZXManager.getInstance().o_id_expire = expire;
|
|
|
+ presenter.commitFormData("o_id_expire",expire,CreditCardZXManager.getInstance().card_id);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ tvEndExpire.setText(expire);
|
|
|
+ CreditCardZXManager.getInstance().o_id_expire = expire;
|
|
|
+ presenter.commitFormData("o_id_expire",expire,CreditCardZXManager.getInstance().card_id);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ },year,monthOfYear,dayOfMonth).show();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public IPresenter currentPresenter() {
|
|
|
+ return presenter;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public IView currentIView() {
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void setupDaggerComponent() {
|
|
|
+
|
|
|
+ DaggerZXStep1Component.builder().httpComponent(SheepApp.getInstance().getHttpComponent()).build().inject(this);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean isViewActive() {
|
|
|
+ return isFinishing();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void showProgress(String msg) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void goNext() {
|
|
|
+
|
|
|
+ startActivity(new Intent(ZhongXinCreditStep1Activity.this,CITICBackOtherInfoActivity.class));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void showImageCode(Bitmap bitmap) {
|
|
|
+ ivImage.setImageBitmap(bitmap);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void setOnCompleteEdit(final CompleteCommitEditText et, final String key){
|
|
|
+ et.setOnCompleteEditListener(new CompleteCommitEditText.OnCompleteEditListener() {
|
|
|
+ @Override
|
|
|
+ public void onCompleteEdit(String text) {
|
|
|
+ presenter.commitFormData(key,et.getText().toString(), CreditCardZXManager.getInstance().card_id);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ private void setOnCompleteEditDouble(final CompleteCommitEditText et,final CompleteCommitEditText etQ, final String key){
|
|
|
+ et.setOnCompleteEditListener(new CompleteCommitEditText.OnCompleteEditListener() {
|
|
|
+ @Override
|
|
|
+ public void onCompleteEdit(String text) {
|
|
|
+ presenter.commitFormData(key,etQ.getText().toString()+et.getText().toString(),CreditCardZXManager.getInstance().card_id);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+}
|