|
|
@@ -94,7 +94,7 @@ public class PersonSettingActivity extends BaseActivity implements View.OnClickL
|
|
|
private static final int REQUEST_CODE_PICK_PHOTO = 2;//单选照片
|
|
|
private String photoselect=null;
|
|
|
private ProgressDialog mProgressDialog;
|
|
|
-
|
|
|
+ private Boolean updateChangeP = false; //更新是否更换了头像,若没换
|
|
|
@Override
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
super.onCreate(savedInstanceState);
|
|
|
@@ -339,6 +339,7 @@ public class PersonSettingActivity extends BaseActivity implements View.OnClickL
|
|
|
photoselect = mNewPhotoUri.getPath();
|
|
|
ImageLoader.getInstance().displayImage(mNewPhotoUri.toString(),image_im);
|
|
|
Log.i("files0x01",photoselect);
|
|
|
+ updateChangeP = true;
|
|
|
} else {
|
|
|
ToastUtil.showToast(this, com.uas.appworks.R.string.c_take_picture_failed);
|
|
|
}
|
|
|
@@ -350,6 +351,7 @@ public class PersonSettingActivity extends BaseActivity implements View.OnClickL
|
|
|
image_im.setImageURI(Uri.fromFile(new File(photoselect)));
|
|
|
// ImageLoader.getInstance().displayImage(photoselect,image_im);
|
|
|
Log.i("files0x01",photoselect);
|
|
|
+ updateChangeP = true;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -357,10 +359,19 @@ public class PersonSettingActivity extends BaseActivity implements View.OnClickL
|
|
|
|
|
|
private void saveJudge() {
|
|
|
File file= new File(photoselect);
|
|
|
- if (!file.exists()) {// 文件不存在
|
|
|
- ToastMessage("请添加头像照片");
|
|
|
- return;
|
|
|
- }
|
|
|
+ if (StringUtil.isEmpty(result)){
|
|
|
+ if (!file.exists()) {// 录入时的,且图片文件不存在
|
|
|
+ ToastMessage("请添加头像照片");
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ doSave();
|
|
|
+ }
|
|
|
+ }else
|
|
|
+ doSave();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private void doSave() {
|
|
|
if (mUserNameTv.testValidity() && mUserSexTv.testValidity()
|
|
|
&& mUserTelTv.testValidity()){
|
|
|
if (!StringUtil.isEmpty(mUserEmailTv.getText().toString())) {
|
|
|
@@ -371,7 +382,6 @@ public class PersonSettingActivity extends BaseActivity implements View.OnClickL
|
|
|
}
|
|
|
}else
|
|
|
saveRequest();
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -418,9 +428,13 @@ public class PersonSettingActivity extends BaseActivity implements View.OnClickL
|
|
|
if (o.toString().contains("imid")){
|
|
|
String imid = JSON.parseObject(o.toString()).getString("imid");
|
|
|
if (StringUtil.isEmpty(imid)) return;
|
|
|
- unLoadHeader(imid);
|
|
|
+ if (updateChangeP) { //更换过照片
|
|
|
+ unLoadHeader(imid);
|
|
|
+ }else {
|
|
|
+ beforeSendMsg(); //只有在更新操作时且没换头像走这里
|
|
|
+ }
|
|
|
}else
|
|
|
- jumpTo();
|
|
|
+ beforeSendMsg();
|
|
|
|
|
|
}else
|
|
|
ToastMessage(getString(R.string.save_failed));
|
|
|
@@ -485,14 +499,7 @@ public class PersonSettingActivity extends BaseActivity implements View.OnClickL
|
|
|
ProgressDialogUtil.dismiss(mProgressDialog);
|
|
|
if (success) {
|
|
|
ToastUtil.showToast(PersonSettingActivity.this, R.string.upload_avatar_success);
|
|
|
- String name = CommonUtil.getName();
|
|
|
- String phone = mUserTelTv.getText().toString().trim().replaceAll(" ", "");
|
|
|
- String modeid1 = "0398e112-97a3-40b0-8430-0e871ef22524";
|
|
|
-
|
|
|
- String modeid2 = "fd4ac30e-b176-4410-ac0e-e39c8b71dfe0";
|
|
|
-
|
|
|
- sendMessages(modeid1,name,phone);
|
|
|
- sendMessages(modeid2,name,phone);
|
|
|
+ beforeSendMsg();
|
|
|
|
|
|
} else {
|
|
|
ToastUtil.showToast(PersonSettingActivity.this, R.string.upload_avatar_failed);
|
|
|
@@ -508,6 +515,17 @@ public class PersonSettingActivity extends BaseActivity implements View.OnClickL
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ private void beforeSendMsg() {
|
|
|
+ String name = CommonUtil.getName();
|
|
|
+ String phone = mUserTelTv.getText().toString().trim().replaceAll(" ", "");
|
|
|
+ String modeid1 = "0398e112-97a3-40b0-8430-0e871ef22524";
|
|
|
+
|
|
|
+ String modeid2 = "fd4ac30e-b176-4410-ac0e-e39c8b71dfe0";
|
|
|
+
|
|
|
+ sendMessages(modeid1,name,phone);
|
|
|
+ sendMessages(modeid2,name,phone);
|
|
|
+ }
|
|
|
+
|
|
|
private void sendMessages( final String modeid, final String name, final String phone) {
|
|
|
StringJsonObjectRequest<AddAttentionResult> request = new StringJsonObjectRequest<AddAttentionResult>(
|
|
|
Request.Method.POST, "http://message.ubtob.com/sms/send", new Response.ErrorListener() {
|
|
|
@@ -587,6 +605,4 @@ public class PersonSettingActivity extends BaseActivity implements View.OnClickL
|
|
|
}
|
|
|
return super.onOptionsItemSelected(item);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|