|  | @@ -4,9 +4,12 @@ import android.content.Intent;
 | 
	
		
			
				|  |  |  import android.os.Bundle;
 | 
	
		
			
				|  |  |  import android.text.TextUtils;
 | 
	
		
			
				|  |  |  import android.view.View;
 | 
	
		
			
				|  |  | +import android.widget.TextView;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import com.alibaba.android.arouter.facade.annotation.Route;
 | 
	
		
			
				|  |  |  import com.alibaba.android.arouter.launcher.ARouter;
 | 
	
		
			
				|  |  | +import com.bigkoo.pickerview.builder.OptionsPickerBuilder;
 | 
	
		
			
				|  |  | +import com.bigkoo.pickerview.view.OptionsPickerView;
 | 
	
		
			
				|  |  |  import com.cooleshow.base.bean.QueryParamsConfigBean;
 | 
	
		
			
				|  |  |  import com.cooleshow.base.common.BaseApplication;
 | 
	
		
			
				|  |  |  import com.cooleshow.base.router.RouterPath;
 | 
	
	
		
			
				|  | @@ -21,6 +24,8 @@ import com.cooleshow.usercenter.helper.PhoneCheckHelper;
 | 
	
		
			
				|  |  |  import com.cooleshow.usercenter.presenter.BindPasswordPresenter;
 | 
	
		
			
				|  |  |  import com.cooleshow.usercenter.presenter.contract.BindPasswordContract;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +import java.util.ArrayList;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  import androidx.annotation.NonNull;
 | 
	
		
			
				|  |  |  import androidx.annotation.Nullable;
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -30,6 +35,10 @@ import androidx.annotation.Nullable;
 | 
	
		
			
				|  |  |  @Route(path = RouterPath.UserCenter.PATH_BIND_PASSWORD)
 | 
	
		
			
				|  |  |  public class BindPasswordActivity extends BaseMVPActivity<ActivityBindPwdLayoutBinding, BindPasswordPresenter> implements BindPasswordContract.BindPwdView, View.OnClickListener {
 | 
	
		
			
				|  |  |      private String tempToken;
 | 
	
		
			
				|  |  | +    private OptionsPickerView pvOptions;
 | 
	
		
			
				|  |  | +    private ArrayList<String> sexList = new ArrayList<>();
 | 
	
		
			
				|  |  | +    private String currentGander = "";
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      protected void onCreate(@Nullable Bundle savedInstanceState) {
 | 
	
	
		
			
				|  | @@ -47,17 +56,16 @@ public class BindPasswordActivity extends BaseMVPActivity<ActivityBindPwdLayoutB
 | 
	
		
			
				|  |  |      protected void initView() {
 | 
	
		
			
				|  |  |          viewBinding.tvConfirm.setOnClickListener(this);
 | 
	
		
			
				|  |  |          tempToken = getIntent().getStringExtra(UserConstants.TEMP_TOKEN);
 | 
	
		
			
				|  |  | +        sexList.add("男");
 | 
	
		
			
				|  |  | +        sexList.add("女");
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      public void initData() {
 | 
	
		
			
				|  |  |          super.initData();
 | 
	
		
			
				|  |  | -        if(BaseApplication.Companion.isTeacherClient()){
 | 
	
		
			
				|  |  | -            presenter.queryModifyConfig();
 | 
	
		
			
				|  |  | -            viewBinding.groupNickname.setVisibility(View.VISIBLE);
 | 
	
		
			
				|  |  | -        }else{
 | 
	
		
			
				|  |  | -            viewBinding.groupNickname.setVisibility(View.GONE);
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | +        presenter.queryModifyConfig();
 | 
	
		
			
				|  |  | +        viewBinding.groupNickname.setVisibility(View.VISIBLE);
 | 
	
		
			
				|  |  | +        viewBinding.tvSetSex.setOnClickListener(this);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
	
		
			
				|  | @@ -79,21 +87,28 @@ public class BindPasswordActivity extends BaseMVPActivity<ActivityBindPwdLayoutB
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      public void onClick(View v) {
 | 
	
		
			
				|  |  | -        if (v.getId() == R.id.tv_confirm) {
 | 
	
		
			
				|  |  | +        int id = v.getId();
 | 
	
		
			
				|  |  | +        if (id == R.id.tv_confirm) {
 | 
	
		
			
				|  |  |              String pwd = viewBinding.etPwd.getText().toString();
 | 
	
		
			
				|  |  |              String pwdAgain = viewBinding.etPwdAgain.getText().toString();
 | 
	
		
			
				|  |  |              String nickName = viewBinding.etNickname.getText().toString().trim();
 | 
	
		
			
				|  |  | -            if(BaseApplication.Companion.isTeacherClient()){
 | 
	
		
			
				|  |  | -                if (TextUtils.isEmpty(nickName)) {
 | 
	
		
			
				|  |  | -                    ToastUtil.getInstance().showShort("请输入昵称!");
 | 
	
		
			
				|  |  | -                    return;
 | 
	
		
			
				|  |  | -                }
 | 
	
		
			
				|  |  | +            if (TextUtils.isEmpty(nickName)) {
 | 
	
		
			
				|  |  | +                ToastUtil.getInstance().showShort("请输入昵称!");
 | 
	
		
			
				|  |  | +                return;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            if (TextUtils.isEmpty(currentGander)) {
 | 
	
		
			
				|  |  | +                ToastUtil.getInstance().showShort("请设置性别!");
 | 
	
		
			
				|  |  | +                return;
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              if (PhoneCheckHelper.checkPwdValidity(pwd, pwdAgain)) {
 | 
	
		
			
				|  |  | -                presenter.onBindPwd(pwdAgain,nickName);
 | 
	
		
			
				|  |  | +                presenter.onBindPwd(pwdAgain, nickName,currentGander);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              return;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +        if (id == R.id.tv_set_sex) {
 | 
	
		
			
				|  |  | +            selectSex();
 | 
	
		
			
				|  |  | +            return;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      private void reBackLogin() {
 | 
	
	
		
			
				|  | @@ -104,8 +119,38 @@ public class BindPasswordActivity extends BaseMVPActivity<ActivityBindPwdLayoutB
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    private void selectSex() {
 | 
	
		
			
				|  |  | +        pvOptions = new OptionsPickerBuilder(this, (options1, options2, options3, v) -> {
 | 
	
		
			
				|  |  | +            if (options1 < sexList.size()) {
 | 
	
		
			
				|  |  | +                String s = sexList.get(options1);
 | 
	
		
			
				|  |  | +                viewBinding.tvSetSex.setTextColor(getResources().getColor(com.cooleshow.base.R.color.color_333333));
 | 
	
		
			
				|  |  | +                viewBinding.tvSetSex.setText(s);
 | 
	
		
			
				|  |  | +                setGanderValue(s);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }).setLayoutRes(R.layout.pickerview_sex_select_layout, v -> {
 | 
	
		
			
				|  |  | +            //自定义布局中的控件初始化及事件处理
 | 
	
		
			
				|  |  | +            final TextView tvSubmit = (TextView) v.findViewById(com.cooleshow.base.R.id.tv_finish);
 | 
	
		
			
				|  |  | +            TextView ivCancel = (TextView) v.findViewById(com.cooleshow.base.R.id.tv_cancel);
 | 
	
		
			
				|  |  | +            tvSubmit.setOnClickListener(v12 -> {
 | 
	
		
			
				|  |  | +                pvOptions.returnData();
 | 
	
		
			
				|  |  | +                pvOptions.dismiss();
 | 
	
		
			
				|  |  | +            });
 | 
	
		
			
				|  |  | +            ivCancel.setOnClickListener(v1 -> pvOptions.dismiss());
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        }).isDialog(false).build();
 | 
	
		
			
				|  |  | +        pvOptions.setPicker(sexList);
 | 
	
		
			
				|  |  | +        pvOptions.show();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      protected BindPasswordPresenter createPresenter() {
 | 
	
		
			
				|  |  |          return new BindPasswordPresenter();
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private void setGanderValue(String result) {
 | 
	
		
			
				|  |  | +        if (!TextUtils.isEmpty(result)) {
 | 
	
		
			
				|  |  | +            currentGander = TextUtils.equals(result, "男") ? UserConstants.GENDER_TYPE_MALE : UserConstants.GENDER_TYPE_FEMALE;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |  }
 |