|
@@ -2,16 +2,22 @@ package com.ynstkz.shitu.android.activity;
|
|
|
|
|
|
import android.os.Bundle;
|
|
|
import android.support.annotation.Nullable;
|
|
|
+import android.text.TextUtils;
|
|
|
+import android.view.View;
|
|
|
import android.widget.Button;
|
|
|
import android.widget.EditText;
|
|
|
import android.widget.ImageView;
|
|
|
import android.widget.RelativeLayout;
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
+import com.common.library.okhttp.callback.Callback;
|
|
|
import com.ynstkz.shitu.android.R;
|
|
|
import com.ynstkz.shitu.android.base.TitleBarActivity;
|
|
|
+import com.ynstkz.shitu.android.data.RequestGroup;
|
|
|
|
|
|
import butterknife.Bind;
|
|
|
+import okhttp3.Call;
|
|
|
+import okhttp3.Response;
|
|
|
|
|
|
|
|
|
* 作者:fuchangle on 2018/2/12 10:50
|
|
@@ -23,19 +29,20 @@ public class AlterPasswordActivity extends TitleBarActivity {
|
|
|
TextView tvTitle;
|
|
|
@Bind(R.id.view_title)
|
|
|
RelativeLayout viewTitle;
|
|
|
- @Bind(R.id.edit_username)
|
|
|
- EditText editUsername;
|
|
|
+ @Bind(R.id.edit_pswwword_old)
|
|
|
+ EditText editPswwwordOld;
|
|
|
@Bind(R.id.edit_pswwword)
|
|
|
EditText editPswwword;
|
|
|
@Bind(R.id.edit_pswwword_again)
|
|
|
EditText editPswwwordAgain;
|
|
|
- @Bind(R.id.btn_login)
|
|
|
- Button btnLogin;
|
|
|
+ @Bind(R.id.btn_save)
|
|
|
+ Button btnSave;
|
|
|
|
|
|
@Override
|
|
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
|
|
super.onCreate(savedInstanceState);
|
|
|
initView();
|
|
|
+ initData();
|
|
|
setListener();
|
|
|
}
|
|
|
|
|
@@ -48,7 +55,63 @@ public class AlterPasswordActivity extends TitleBarActivity {
|
|
|
tvTitle.setText("修改密码");
|
|
|
}
|
|
|
|
|
|
+ private void initData(){
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
private void setListener(){
|
|
|
|
|
|
+ btnSave.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View view) {
|
|
|
+ String pwd_old = editPswwwordOld.getText().toString().trim();
|
|
|
+ String pwd = editPswwword.getText().toString().trim();
|
|
|
+ String pwd_again = editPswwwordAgain.getText().toString().trim();
|
|
|
+
|
|
|
+ if(TextUtils.isEmpty(pwd_old)){
|
|
|
+ showToast("原密码不能为空");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(TextUtils.isEmpty(pwd)){
|
|
|
+ showToast("密码不能为空");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(TextUtils.isEmpty(pwd_again)){
|
|
|
+ showToast("确认密码不能为空");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(!pwd.equals(pwd_again)){
|
|
|
+ showToast("确认密码不一致");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ resetPwd(pwd_old, pwd, pwd_again);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 修改密码
|
|
|
+ * @param oldPwd
|
|
|
+ * @param pwd
|
|
|
+ * @param rePwd
|
|
|
+ */
|
|
|
+ public static void resetPwd(String oldPwd, String pwd, String rePwd){
|
|
|
+
|
|
|
+ RequestGroup.resetPwd(oldPwd, pwd, rePwd, new Callback() {
|
|
|
+ @Override
|
|
|
+ public Object parseNetworkResponse(Response response, int id) throws Exception {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onError(Call call, Exception e, int id) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onResponse(Object response, int id) {
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
}
|