@Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.activity_mine_update_pwd); initView(); manager = AppManager.getInstance(); manager.addActivity(MineFragment_Update_Pwd.this); }
@Override public void handleMessage(android.os.Message msg) { switch (msg.what) { case 0: String result = (String) msg.obj; int update_Info = JsonUtil.getUpdate_Info(result); if (update_Info == 0) { Toast.makeText(getApplicationContext(), "修改密码成功", 0).show(); // 修改登录状态 getSharedPreferences("Login_UserInfo", Context.MODE_PRIVATE) .edit() .putBoolean("login_type", false) .commit(); Intent intent = new Intent(MineFragment_Update_Pwd.this, MineFragment_Login.class); startActivity(intent); manager.killActivity(MineFragment_Update_Pwd.this); } else if (update_Info == -1) { Toast.makeText(getApplicationContext(), "修改密码失败", 0).show(); } else if (update_Info == -2) { Toast.makeText(getApplicationContext(), "用户不存在", 0).show(); } else if (update_Info == -3) { Toast.makeText(getApplicationContext(), "原密码不正确", 0).show(); } pb_update.setVisibility(View.INVISIBLE); next_ok.setClickable(true); break; default: break; } };
@Override public void onClick(View v) { switch (v.getId()) { case R.id.iv_ActionBar: // 返回 manager.killActivity(MineFragment_Update_Pwd.this); break; case R.id.next_ok: // 确认修改 KeyBoardUtil.is_openKeyBoard(getApplicationContext(), MineFragment_Update_Pwd.this); String old_pwd = old_pwd_value.getText().toString(); String new_pwd = new_pwd_value.getText().toString(); String re_new_pwd = re_new_pwd_value.getText().toString(); if (old_type && new_type && re_new_type) { if (new_pwd.equals(re_new_pwd)) { String share = getShare(); // 修改密码提示框 ShowDialog(share, old_pwd, new_pwd); } else { Toast.makeText(getApplicationContext(), "两次输入密码不一致", 0).show(); } } else { if (old_pwd.length() == 0) { Toast.makeText(getApplicationContext(), "原密码不为空", 0).show(); } else if (new_pwd.length() == 0) { Toast.makeText(getApplicationContext(), "新密码不为空", 0).show(); } else if (re_new_pwd.length() == 0) { Toast.makeText(getApplicationContext(), "确认密码不为空", 0).show(); } else if (!old_type) { Toast.makeText(getApplicationContext(), "长度在6到16位之间", 0).show(); } else if (!new_type) { Toast.makeText(getApplicationContext(), "长度在6到16位之间", 0).show(); } else if (!re_new_type) { Toast.makeText(getApplicationContext(), "长度在6到16位之间", 0).show(); } } break; default: break; } }