Exemplo n.º 1
1
  private void initViews() {
    body = (RelativeLayout) findViewById(R.id.body);
    loadingoverlay = (LoadingOverlay) findViewById(R.id.loadingoverlay);

    registerTV = (TextView) findViewById(R.id.registerTV);
    findpwdTV = (TextView) findViewById(R.id.findpwdTV);

    userNameET = (ExEditText) findViewById(R.id.userNameET);
    passwordET = (ExEditText) findViewById(R.id.passwordET);
    loginButton = (Button) findViewById(R.id.loginButton);

    EditText pwdinneret = passwordET.getEditText();
    int pl = pwdinneret.getPaddingLeft();
    pwdinneret.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
    pwdinneret.setBackgroundDrawable(getResources().getDrawable(R.drawable.blue_input_bg));
    pwdinneret.setPadding(pl, 0, 0, 0); // 如果同时用,setPadding 将不会起作用,用的是
    // drawable里面自带的padding。setPadding要在setBackgroundDrawable之后执行才能生效
    pwdinneret.setFilters(new InputFilter[] {new InputFilter.LengthFilter(20)});

    EditText usernameinneret = userNameET.getEditText();
    pl = usernameinneret.getPaddingLeft();
    usernameinneret.setBackgroundDrawable(getResources().getDrawable(R.drawable.blue_input_bg));
    usernameinneret.setPadding(pl, 0, 0, 0);
    usernameinneret.setFilters(new InputFilter[] {new InputFilter.LengthFilter(20)});
  }
  private void initListener() {
    btn_title_right.setOnClickListener(this);
    btn_title_left.setOnClickListener(this);
    loadingoverlay.addOnCancelListener(
        new LoadingOverlay.OnCancelListener() {

          @Override
          public void onCancel() {

            if (regBiz != null) regBiz.cancel();
            loadingoverlay.setVisibility(View.INVISIBLE);
          }
        });

    findpwd_pwd_ET.addOnValidateListener(
        new ExEditText.OnValidateListener() {

          @Override
          public String onValidate(String text) {
            if (StringUtil.isNull(text)) return "请输入密码!";
            else return "";
          }
        });
    findpwd_pwd1_ET.addOnValidateListener(
        new ExEditText.OnValidateListener() {

          @Override
          public String onValidate(String text) {
            if (StringUtil.isNull(text)) return "请输入密码!";
            return "";
          }
        });
  }
  @Override
  public void onClick(View v) {
    switch (v.getId()) {
      case R.id.btn_title_right:
        if (checkInputInfo()) {
          if (!findpwd_pwd1_ET.getText().toString().equals(findpwd_pwd_ET.getText().toString())) {
            Toast.makeText(getApplicationContext(), "两次输入密码不一致", Toast.LENGTH_SHORT).show();
            break;
          }

          loadingoverlay.setVisibility(View.VISIBLE);
          loadingoverlay.setLoadingTip("正在提交,请稍候...");
          startSubmitTask();

        } else {
          String errmsg = getErrorMsg();
          Toast.makeText(getApplicationContext(), errmsg, Toast.LENGTH_SHORT).show();
        }

        break;
      case R.id.btn_title_left:
        // 返回登录

        this.finish();
        break;
      default:
        break;
    }
  }
  private void initViews() {
    loadingoverlay = (LoadingOverlay) findViewById(R.id.loadingoverlay);
    findpwd_pwd_ET = (ExEditText) findViewById(R.id.findpwd_pwd_ET);
    findpwd_pwd1_ET = (ExEditText) findViewById(R.id.findpwd_pwd1_ET);
    btn_title_left = (Button) findViewById(R.id.btn_title_left);
    tv_top_title = (TextView) findViewById(R.id.tv_top_title);
    btn_title_right = (Button) findViewById(R.id.btn_title_right);

    btn_title_right.setText(R.string.next);
    tv_top_title.setText(R.string.findpwdtitle);

    EditText pwd1inneret = findpwd_pwd1_ET.getEditText();

    pwd1inneret.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);

    pwd1inneret.setFilters(new InputFilter[] {new InputFilter.LengthFilter(20)});

    EditText pwdinneret = findpwd_pwd_ET.getEditText();
    pwdinneret.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);

    pwdinneret.setFilters(new InputFilter[] {new InputFilter.LengthFilter(20)});
  }
  private void startSubmitTask() {
    if (regBiz != null) regBiz.cancel();
    String pwdmd5 = Tools.getMD5Str(findpwd_pwd_ET.getText()).toUpperCase(Locale.US);
    regBiz =
        new FindPwdBiz(
            getApplicationContext(),
            new FindpwdHandler(FindPWDActivity_InputNewPWD.this),
            YtApplication.getInstance().getFindpwdPhone(),
            ACCOUTTYPE,
            pwdmd5);

    regBiz.execute();
  }
Exemplo n.º 6
0
  @Override
  public void onClick(View v) {
    switch (v.getId()) {
      case R.id.registerTV:
        Intent intent1 = new Intent(getApplication(), RegisterActivity_Protocol.class);

        startActivity(intent1);

        break;
      case R.id.findpwdTV:
        Intent intent2 = new Intent(getApplication(), FindPWDActivity_InputPhone.class);

        startActivity(intent2);
        break;

      case R.id.loginButton:
        String userName = StringUtil.parseStr(userNameET.getText());
        String pwdmd5 = Tools.getMD5Str(passwordET.getText()).toUpperCase(Locale.US);
        String password = StringUtil.parseStr(pwdmd5);

        LoginInfoBean loginInfoBean = new LoginInfoBean();
        if (checkInputInfo(userName, password)) {

          loginInfoBean.setUsr_pwd(password);
          loginInfoBean.setUsr_account(userName.trim());
          // YtApplication.getInstance().setUserName(userName.trim());
          loadingoverlay.setVisibility(View.VISIBLE);
          loadingoverlay.setLoadingTip("正在登录,请稍候...");
          startLoginTask(loginInfoBean);

        } else {
          String errmsg = getErrorMsg();
          Toast.makeText(getApplicationContext(), errmsg, Toast.LENGTH_SHORT).show();
        }
        break;
      default:
    }
  }
Exemplo n.º 7
0
  private void registerListener() {

    registerTV.setOnClickListener(this);
    findpwdTV.setOnClickListener(this);

    loginButton.setOnClickListener(this);

    loadingoverlay.addOnCancelListener(
        new LoadingOverlay.OnCancelListener() {

          @Override
          public void onCancel() {

            if (biz != null) biz.cancel();
            loadingoverlay.setVisibility(View.INVISIBLE);
          }
        });

    userNameET.addOnValidateListener(
        new ExEditText.OnValidateListener() {

          @Override
          public String onValidate(String text) {
            if (StringUtil.isNull(text)) return "请输入登录账号!";
            else return "";
          }
        });
    passwordET.addOnValidateListener(
        new ExEditText.OnValidateListener() {

          @Override
          public String onValidate(String text) {
            if (StringUtil.isNull(text)) return "请输入密码!";
            return "";
          }
        });
  }
Exemplo n.º 8
0
 private String getErrorMsg() {
   return userNameET.getErrMsg() + passwordET.getErrMsg();
 }
Exemplo n.º 9
0
 private boolean checkInputInfo(String userName, String password) {
   boolean uservalid = userNameET.validate();
   boolean pwdvalid = passwordET.validate();
   return uservalid && pwdvalid;
 }
 private String getErrorMsg() {
   return findpwd_pwd_ET.getErrMsg() + findpwd_pwd1_ET.getErrMsg();
 }
 private boolean checkInputInfo() {
   boolean pwdvalid = findpwd_pwd_ET.validate();
   boolean pwd1valid = findpwd_pwd1_ET.validate();
   return pwdvalid && pwd1valid;
 }