真人认证
This commit is contained in:
@@ -2,6 +2,7 @@ package com.shayu.onetoone.activity.login;
|
||||
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Dialog;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
@@ -31,6 +32,7 @@ import com.yunbao.common.bean.HttpCallbackModel;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.interfaces.ImageResultCallback;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.ProcessImageUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
@@ -66,6 +68,7 @@ public class CompleteActivity extends AbsOTOActivity {
|
||||
int day;
|
||||
|
||||
private String avatarUrl;
|
||||
Dialog dialog;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
@@ -81,6 +84,7 @@ public class CompleteActivity extends AbsOTOActivity {
|
||||
|
||||
initView();
|
||||
initCamera();
|
||||
dialog = DialogUitl.loadingDialog(mContext, "上传中");
|
||||
}
|
||||
|
||||
private void initCamera() {
|
||||
@@ -96,17 +100,20 @@ public class CompleteActivity extends AbsOTOActivity {
|
||||
L.e("cameraUtil.setImageResultCallback:");
|
||||
if (file != null) {
|
||||
mAvatarFile = file;
|
||||
dialog.show();
|
||||
OTONetManager.getInstance(CompleteActivity.this).updateFile(mAvatarFile, new HttpCallback<AvatarBean>() {
|
||||
@Override
|
||||
public void onSuccess(AvatarBean data) {
|
||||
ImgLoader.display(mContext, file, userAvatar);
|
||||
//txtChoose.setVisibility(View.GONE);
|
||||
avatarUrl = data.getAvatar();
|
||||
dialog.hide();
|
||||
ToastUtil.show("上传成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
dialog.hide();
|
||||
ToastUtil.show("上传失败");
|
||||
}
|
||||
});
|
||||
@@ -115,7 +122,7 @@ public class CompleteActivity extends AbsOTOActivity {
|
||||
|
||||
@Override
|
||||
public void onFailure() {
|
||||
|
||||
dialog.hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import android.os.Handler;
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.shayu.onetoone.R;
|
||||
import com.shayu.onetoone.activity.login.EntryActivity;
|
||||
import com.shayu.onetoone.manager.RouteManager;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.activity.AbsActivity;
|
||||
@@ -51,12 +52,12 @@ public class SettingActivity extends AbsActivity {
|
||||
}
|
||||
});
|
||||
|
||||
//黑名单
|
||||
//修改密码
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.change_the_password), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
// 达人认证
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.toBlogger), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
//forwardModifyPwd();
|
||||
RouteManager.forwardAuthBloggerActivity();
|
||||
}
|
||||
});
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.logout), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
|
||||
@@ -0,0 +1,264 @@
|
||||
package com.shayu.onetoone.activity.user;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.shayu.onetoone.R;
|
||||
import com.shayu.onetoone.bean.AuthBean;
|
||||
import com.shayu.onetoone.bean.AvatarBean;
|
||||
import com.shayu.onetoone.manager.OTONetManager;
|
||||
import com.shayu.onetoone.manager.RouteManager;
|
||||
import com.shayu.onetoone.view.UserAuthPopup;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.activity.AbsActivity;
|
||||
import com.yunbao.common.bean.HttpCallbackModel;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.interfaces.ImageResultCallback;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.ProcessImageUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* 我的 编辑资料
|
||||
*/
|
||||
@Route(path = RouteManager.ACTIVITY_AUTH)
|
||||
public class AuthActivity extends AbsActivity {
|
||||
|
||||
private ImageView image1;
|
||||
private ImageView image2;
|
||||
|
||||
private ImageView image11;
|
||||
private ImageView image22;
|
||||
|
||||
private TextView submit;
|
||||
private ProcessImageUtil cameraUtil;
|
||||
|
||||
private File file1;
|
||||
private File file2;
|
||||
|
||||
private String imgUrl1;
|
||||
private String imgUrl2;
|
||||
|
||||
Dialog dialog;
|
||||
AuthBean authBean;
|
||||
|
||||
private TextView remake;
|
||||
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_auth;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void main() {
|
||||
setTitle(mContext.getString(R.string.edit_profile));
|
||||
image1 = findViewById(R.id.image1);
|
||||
image11 = findViewById(R.id.image11);
|
||||
image2 = findViewById(R.id.image2);
|
||||
image22 = findViewById(R.id.image22);
|
||||
submit = findViewById(R.id.submit);
|
||||
remake = findViewById(R.id.remake);
|
||||
|
||||
image1.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
isFront = true;
|
||||
setImage();
|
||||
}
|
||||
});
|
||||
image11.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
isFront = true;
|
||||
setImage();
|
||||
}
|
||||
});
|
||||
image2.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
isFront = false;
|
||||
setImage();
|
||||
}
|
||||
});
|
||||
image22.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
isFront = false;
|
||||
setImage();
|
||||
}
|
||||
});
|
||||
submit.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
submit();
|
||||
}
|
||||
});
|
||||
initCamera();
|
||||
dialog = DialogUitl.loadingDialog(mContext, "上传中");
|
||||
getAuthInfo();
|
||||
}
|
||||
|
||||
private void getAuthInfo() {
|
||||
OTONetManager.getInstance(AuthActivity.this).getAuthInfo(new HttpCallback<AuthBean>() {
|
||||
@Override
|
||||
public void onSuccess(AuthBean data) {
|
||||
authBean = data;
|
||||
if (data.getName_auth() == 2) {//已通过
|
||||
ImgLoader.display(mContext, data.getAuth_front(), image1);
|
||||
ImgLoader.display(mContext, data.getAuth_back(), image2);
|
||||
image11.setVisibility(View.GONE);
|
||||
image22.setVisibility(View.GONE);
|
||||
submit.setEnabled(false);
|
||||
} else if (data.getName_auth() == 3) {//已提交
|
||||
ImgLoader.display(mContext, data.getAuth_front(), image1);
|
||||
ImgLoader.display(mContext, data.getAuth_back(), image2);
|
||||
image11.setVisibility(View.GONE);
|
||||
image22.setVisibility(View.GONE);
|
||||
submit.setText("審核中,請耐心等待");
|
||||
submit.setEnabled(false);
|
||||
} else {
|
||||
ImgLoader.display(mContext, data.getAuth_front(), image1);
|
||||
ImgLoader.display(mContext, data.getAuth_back(), image2);
|
||||
submit.setText("重新提交");
|
||||
remake.setText(data.getAuth_remark());
|
||||
submit.setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initCamera() {
|
||||
cameraUtil = new ProcessImageUtil(this, "com.shayu.onetoone.fileprovider");
|
||||
cameraUtil.setImageResultCallback(new ImageResultCallback() {
|
||||
@Override
|
||||
public void beforeCamera() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(File file) {
|
||||
L.e("cameraUtil.setImageResultCallback:");
|
||||
if (!dialog.isShowing()) {
|
||||
dialog.show();
|
||||
}
|
||||
if (file != null) {
|
||||
OTONetManager.getInstance(mContext).updateFile(file, new HttpCallback<AvatarBean>() {
|
||||
@Override
|
||||
public void onSuccess(AvatarBean data) {
|
||||
if (data != null) {
|
||||
ToastUtil.show("上传成功");
|
||||
if (isFront) {
|
||||
imgUrl1 = data.getAvatar();
|
||||
file1 = file;
|
||||
ImgLoader.display(mContext, file1, image1);
|
||||
image11.setVisibility(View.GONE);
|
||||
} else {
|
||||
imgUrl2 = data.getAvatar();
|
||||
file2 = file;
|
||||
ImgLoader.display(mContext, file2, image2);
|
||||
image22.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
if (file1 != null && file2 != null) {
|
||||
submit.setBackground(getResources().getDrawable(R.drawable.bg_auth_submit_2));
|
||||
}
|
||||
dialog.hide();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
dialog.hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
boolean isFront = true;
|
||||
|
||||
private void submit() {
|
||||
OTONetManager.getInstance(AuthActivity.this).setAuthInfo(imgUrl1, imgUrl2, new HttpCallback<HttpCallbackModel>() {
|
||||
@Override
|
||||
public void onSuccess(HttpCallbackModel data) {
|
||||
if (data.getCode() == 0) {
|
||||
ToastUtil.show("已發起審核,請耐心等待審核結果");
|
||||
submit.setBackground(getResources().getDrawable(R.drawable.bg_auth_submit_1));
|
||||
submit.setText("審核中,請耐心等待");
|
||||
imgUrl1 = null;
|
||||
imgUrl2 = null;
|
||||
} else {
|
||||
ToastUtil.show(data.getMsg());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setImage() {
|
||||
UserAuthPopup userAuthPopup = new UserAuthPopup(AuthActivity.this, new UserAuthPopup.onIsCameraClickListener() {
|
||||
@Override
|
||||
public void onIsCamera(boolean isCamera) {
|
||||
if (isCamera) {
|
||||
cameraUtil.getImageByCamera();
|
||||
} else {
|
||||
cameraUtil.getImageByAlumb();
|
||||
}
|
||||
}
|
||||
});
|
||||
new XPopup.Builder(mContext).asCustom(userAuthPopup).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
Bus.getOff(this);
|
||||
if (cameraUtil != null) {
|
||||
cameraUtil.release();
|
||||
}
|
||||
//MainHttpUtil.cancel(MainHttpConsts.UPDATE_AVATAR);
|
||||
//MainHttpUtil.cancel(MainHttpConsts.UPDATE_FIELDS);
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
private UserBean userModel;
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
if (Constants.isShowPage != -1) {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
package com.shayu.onetoone.activity.user;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.shayu.onetoone.R;
|
||||
import com.shayu.onetoone.bean.AvatarBean;
|
||||
import com.shayu.onetoone.manager.OTONetManager;
|
||||
import com.shayu.onetoone.manager.RouteManager;
|
||||
import com.shayu.onetoone.view.UserAuthPopup;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.activity.AbsActivity;
|
||||
import com.yunbao.common.bean.HttpCallbackModel;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.interfaces.ImageResultCallback;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.ProcessImageUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.views.CompleteInformationPopup;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* 我的 编辑资料
|
||||
*/
|
||||
@Route(path = RouteManager.ACTIVITY_AUTH_BLOGGER)
|
||||
public class AuthBloggerActivity extends AbsActivity {
|
||||
|
||||
private TextView submit;
|
||||
private ProcessImageUtil cameraUtil;
|
||||
|
||||
Dialog dialog;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_auth_blogger;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void main() {
|
||||
setTitle(mContext.getString(R.string.edit_profile));
|
||||
submit = findViewById(R.id.submit);
|
||||
submit.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
submit();
|
||||
}
|
||||
});
|
||||
initCamera();
|
||||
dialog = DialogUitl.loadingDialog(mContext, "上传中");
|
||||
}
|
||||
|
||||
private void initCamera() {
|
||||
cameraUtil = new ProcessImageUtil(this, "com.shayu.onetoone.fileprovider");
|
||||
cameraUtil.setImageResultCallback(new ImageResultCallback() {
|
||||
@Override
|
||||
public void beforeCamera() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(File file) {
|
||||
L.e("cameraUtil.setImageResultCallback:");
|
||||
if (!dialog.isShowing()) {
|
||||
dialog.show();
|
||||
}
|
||||
if (file != null) {
|
||||
OTONetManager.getInstance(mContext).updateFile(file, new HttpCallback<AvatarBean>() {
|
||||
@Override
|
||||
public void onSuccess(AvatarBean data) {
|
||||
dialog.hide();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
dialog.hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
boolean isFront = true;
|
||||
|
||||
private void submit() {
|
||||
/*OTONetManager.getInstance(AuthBloggerActivity.this).setAuthInfo(imgUrl1, imgUrl2, new HttpCallback<HttpCallbackModel>() {
|
||||
@Override
|
||||
public void onSuccess(HttpCallbackModel data) {
|
||||
if (data.getCode() == 0) {
|
||||
ToastUtil.show("已發起審核,請耐心等待審核結果");
|
||||
submit.setBackground(getResources().getDrawable(R.drawable.bg_auth_submit_1));
|
||||
submit.setText("審核中,請耐心等待");
|
||||
imgUrl1 = null;
|
||||
imgUrl2 = null;
|
||||
} else {
|
||||
ToastUtil.show(data.getMsg());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});*/
|
||||
}
|
||||
|
||||
public void setImage() {
|
||||
UserAuthPopup userAuthPopup = new UserAuthPopup(AuthBloggerActivity.this, new UserAuthPopup.onIsCameraClickListener() {
|
||||
@Override
|
||||
public void onIsCamera(boolean isCamera) {
|
||||
if (isCamera) {
|
||||
cameraUtil.getImageByCamera();
|
||||
} else {
|
||||
cameraUtil.getImageByAlumb();
|
||||
}
|
||||
}
|
||||
});
|
||||
new XPopup.Builder(mContext).asCustom(userAuthPopup).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
Bus.getOff(this);
|
||||
if (cameraUtil != null) {
|
||||
cameraUtil.release();
|
||||
}
|
||||
//MainHttpUtil.cancel(MainHttpConsts.UPDATE_AVATAR);
|
||||
//MainHttpUtil.cancel(MainHttpConsts.UPDATE_FIELDS);
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
private UserBean userModel;
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
if (Constants.isShowPage != -1) {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if (userModel.getUserInfoComplete() == 1) {
|
||||
finish();
|
||||
} else {
|
||||
new XPopup.Builder(mContext).asCustom(new CompleteInformationPopup(mContext, true, new CompleteInformationPopup.CompleteInformationCallBack() {
|
||||
@Override
|
||||
public void onCancel() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSure() {
|
||||
finish();
|
||||
}
|
||||
})).show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -6,9 +6,8 @@ import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.shayu.onetoone.R;
|
||||
import com.shayu.onetoone.manager.OTONetManager;
|
||||
import com.shayu.onetoone.utils.MainHttpConsts;
|
||||
import com.shayu.onetoone.utils.MainHttpUtil;
|
||||
import com.tencent.imsdk.v2.V2TIMCallback;
|
||||
@@ -17,8 +16,8 @@ import com.tencent.imsdk.v2.V2TIMUserFullInfo;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.activity.AbsActivity;
|
||||
import com.yunbao.common.bean.HttpCallbackModel;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
|
||||
@@ -67,41 +66,43 @@ public class EditNameActivity extends AbsActivity {
|
||||
ToastUtil.show(R.string.edit_profile_name_empty);
|
||||
return;
|
||||
}
|
||||
MainHttpUtil.updateFields("{\"user_nicename\":\"" + content + "\"}", new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0) {
|
||||
if (info.length > 0) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
ToastUtil.show(obj.getString("msg"));
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
if (u != null) {
|
||||
u.setUserNiceName(content);
|
||||
V2TIMUserFullInfo v2TIMUserFullInfo = new V2TIMUserFullInfo();
|
||||
v2TIMUserFullInfo.setNickname(content);
|
||||
V2TIMManager.getInstance().setSelfInfo(v2TIMUserFullInfo, new V2TIMCallback() {
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
}
|
||||
});
|
||||
}
|
||||
Intent intent = getIntent();
|
||||
intent.putExtra(Constants.NICK_NAME, content);
|
||||
setResult(RESULT_OK, intent);
|
||||
finish();
|
||||
OTONetManager.getInstance(EditNameActivity.this).setFiled("user_nicename", content, new com.yunbao.common.http.base.HttpCallback<HttpCallbackModel>() {
|
||||
@Override
|
||||
public void onSuccess(HttpCallbackModel data) {
|
||||
if (data.getCode() == 0) {
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
if (u != null) {
|
||||
u.setUserNiceName(content);
|
||||
V2TIMUserFullInfo v2TIMUserFullInfo = new V2TIMUserFullInfo();
|
||||
v2TIMUserFullInfo.setNickname(content);
|
||||
V2TIMManager.getInstance().setSelfInfo(v2TIMUserFullInfo, new V2TIMCallback() {
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
}
|
||||
});
|
||||
}
|
||||
} else if (code == 2001) {
|
||||
Intent intent = getIntent();
|
||||
intent.putExtra(Constants.NICK_NAME, content);
|
||||
setResult(RESULT_OK, intent);
|
||||
finish();
|
||||
} else if (data.getCode() == 2001) {
|
||||
//余额不足,跳转支付页面
|
||||
RouteUtil.forwardMyCoin(mContext);
|
||||
ToastUtil.show(msg);
|
||||
ToastUtil.show(data.getMsg());
|
||||
} else {
|
||||
ToastUtil.show(msg);
|
||||
ToastUtil.show(data.getMsg());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -10,8 +10,6 @@ import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.bigkoo.pickerview.builder.TimePickerBuilder;
|
||||
import com.bigkoo.pickerview.listener.OnTimeSelectListener;
|
||||
import com.bigkoo.pickerview.view.TimePickerView;
|
||||
@@ -20,7 +18,6 @@ import com.sahooz.library.Country;
|
||||
import com.sahooz.library.CountryPicker;
|
||||
import com.sahooz.library.OnPick;
|
||||
import com.shayu.onetoone.R;
|
||||
import com.shayu.onetoone.activity.login.CompleteActivity;
|
||||
import com.shayu.onetoone.bean.AvatarBean;
|
||||
import com.shayu.onetoone.manager.OTONetManager;
|
||||
import com.shayu.onetoone.manager.RouteManager;
|
||||
@@ -114,6 +111,12 @@ public class EditProfileActivity extends AbsActivity {
|
||||
showData(u);
|
||||
}
|
||||
});
|
||||
findViewById(R.id.btn_person).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
RouteManager.forwaradAuthActivity();
|
||||
}
|
||||
});
|
||||
/*if (mUserBean != null) {
|
||||
showData(mUserBean);
|
||||
} else {
|
||||
@@ -150,21 +153,23 @@ public class EditProfileActivity extends AbsActivity {
|
||||
avatarUrl = data.getAvatar();
|
||||
ToastUtil.show("上传成功");
|
||||
|
||||
OTONetManager.getInstance(mContext).setInfo(avatarUrl, mName.getText().toString(), userSex, mBirthday.getText().toString(), new com.yunbao.common.http.base.HttpCallback<HttpCallbackModel>() {
|
||||
OTONetManager.getInstance(EditProfileActivity.this).setFiled("avatar", avatarUrl, new com.yunbao.common.http.base.HttpCallback<HttpCallbackModel>() {
|
||||
@Override
|
||||
public void onSuccess(HttpCallbackModel data) {
|
||||
Toast.makeText(mContext, data.getMsg(), Toast.LENGTH_SHORT).show();
|
||||
V2TIMUserFullInfo v2TIMUserFullInfo = new V2TIMUserFullInfo();
|
||||
v2TIMUserFullInfo.setFaceUrl(avatarUrl);
|
||||
V2TIMManager.getInstance().setSelfInfo(v2TIMUserFullInfo, new V2TIMCallback() {
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
}
|
||||
if (data.getCode() == 0) {
|
||||
Toast.makeText(mContext, data.getMsg(), Toast.LENGTH_SHORT).show();
|
||||
V2TIMUserFullInfo v2TIMUserFullInfo = new V2TIMUserFullInfo();
|
||||
v2TIMUserFullInfo.setFaceUrl(avatarUrl);
|
||||
V2TIMManager.getInstance().setSelfInfo(v2TIMUserFullInfo, new V2TIMCallback() {
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -189,7 +194,6 @@ public class EditProfileActivity extends AbsActivity {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if (userModel.getUserInfoComplete() == 1) {
|
||||
@@ -258,16 +262,22 @@ public class EditProfileActivity extends AbsActivity {
|
||||
@Override
|
||||
public void onSex(int sex) {
|
||||
userSex = sex;
|
||||
MainHttpUtil.updateFields("{\"sex\":\"" + sex + "\"}", new HttpCallback() {
|
||||
|
||||
|
||||
OTONetManager.getInstance(EditProfileActivity.this).setFiled("sex", String.valueOf(sex), new com.yunbao.common.http.base.HttpCallback<HttpCallbackModel>() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
ToastUtil.show(obj.getString("msg"));
|
||||
public void onSuccess(HttpCallbackModel data) {
|
||||
if (data.getCode() == 0) {
|
||||
ToastUtil.show(data.getMsg());
|
||||
userModel.setSex(sex);
|
||||
showData(userModel);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
})).show();
|
||||
@@ -276,26 +286,29 @@ public class EditProfileActivity extends AbsActivity {
|
||||
@Override
|
||||
public void onPick(final Country country) {
|
||||
mCity.setText(country.name);
|
||||
MainHttpUtil.updateFields("{\"location\":\"" + country.name + "\"}", new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
if (info.length > 0) {
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
if (u != null) {
|
||||
u.setLocation(country.name);
|
||||
}
|
||||
if (userModel != null) {
|
||||
userModel.setLocation(country.name);
|
||||
}
|
||||
|
||||
showData(userModel);
|
||||
EventBus.getDefault().post(new UpdateFieldEvent());
|
||||
OTONetManager.getInstance(EditProfileActivity.this).setFiled("location", country.name, new com.yunbao.common.http.base.HttpCallback<HttpCallbackModel>() {
|
||||
@Override
|
||||
public void onSuccess(HttpCallbackModel data) {
|
||||
if (data.getCode() == 0) {
|
||||
ToastUtil.show(data.getMsg());
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
if (u != null) {
|
||||
u.setLocation(country.name);
|
||||
}
|
||||
ToastUtil.show(obj.getString("msg"));
|
||||
if (userModel != null) {
|
||||
userModel.setLocation(country.name);
|
||||
}
|
||||
|
||||
showData(userModel);
|
||||
EventBus.getDefault().post(new UpdateFieldEvent());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}).show(getSupportFragmentManager(), "country");
|
||||
@@ -305,6 +318,8 @@ public class EditProfileActivity extends AbsActivity {
|
||||
.putExtra("token", CommonAppConfig.getInstance().getToken())
|
||||
.putExtra("isBind", isBind)
|
||||
.putExtra("mobile", mobile));*/
|
||||
} else if (i == R.id.auth) {
|
||||
RouteManager.forwaradAuthActivity();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -352,21 +367,23 @@ public class EditProfileActivity extends AbsActivity {
|
||||
avatarUrl = userAvatar1;
|
||||
ImgLoader.display(EditProfileActivity.this, avatarUrl, mAvatar);
|
||||
|
||||
OTONetManager.getInstance(mContext).setInfo(avatarUrl, mName.getText().toString(), userSex, mBirthday.getText().toString(), new com.yunbao.common.http.base.HttpCallback<HttpCallbackModel>() {
|
||||
OTONetManager.getInstance(EditProfileActivity.this).setFiled("avatar", avatarUrl, new com.yunbao.common.http.base.HttpCallback<HttpCallbackModel>() {
|
||||
@Override
|
||||
public void onSuccess(HttpCallbackModel data) {
|
||||
Toast.makeText(mContext, data.getMsg(), Toast.LENGTH_SHORT).show();
|
||||
V2TIMUserFullInfo v2TIMUserFullInfo = new V2TIMUserFullInfo();
|
||||
v2TIMUserFullInfo.setFaceUrl(avatarUrl);
|
||||
V2TIMManager.getInstance().setSelfInfo(v2TIMUserFullInfo, new V2TIMCallback() {
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
}
|
||||
if (data.getCode() == 0) {
|
||||
V2TIMUserFullInfo v2TIMUserFullInfo = new V2TIMUserFullInfo();
|
||||
v2TIMUserFullInfo.setFaceUrl(avatarUrl);
|
||||
V2TIMManager.getInstance().setSelfInfo(v2TIMUserFullInfo, new V2TIMCallback() {
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -374,7 +391,6 @@ public class EditProfileActivity extends AbsActivity {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
//txtChoose.setVisibility(View.GONE);
|
||||
}, isCamera -> {
|
||||
if (isCamera) {
|
||||
@@ -436,31 +452,31 @@ public class EditProfileActivity extends AbsActivity {
|
||||
month = calendar.get(Calendar.MONTH);
|
||||
day = calendar.get(Calendar.DAY_OF_MONTH);
|
||||
|
||||
String strbri = year + "-" + (month + 1) + "-" + day;
|
||||
String strbir = year + "-" + (month + 1) + "-" + day;
|
||||
|
||||
mBirthday.setText(strbri);
|
||||
|
||||
MainHttpUtil.updateFields("{\"birthday\":\"" + strbri + "\"}", new HttpCallback() {
|
||||
mBirthday.setText(strbir);
|
||||
OTONetManager.getInstance(EditProfileActivity.this).setFiled("birthday", strbir, new com.yunbao.common.http.base.HttpCallback<HttpCallbackModel>() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0) {
|
||||
if (info.length > 0) {
|
||||
ToastUtil.show(JSON.parseObject(info[0]).getString("msg"));
|
||||
mUserBean.setBirthday(strbri);
|
||||
mBirthday.setText(strbri);
|
||||
public void onSuccess(HttpCallbackModel data) {
|
||||
if (data.getCode() == 0) {
|
||||
mUserBean.setBirthday(strbir);
|
||||
mBirthday.setText(strbir);
|
||||
|
||||
if (userModel != null) {
|
||||
userModel.setBirthday(strbri);
|
||||
}
|
||||
|
||||
showData(userModel);
|
||||
EventBus.getDefault().post(new UpdateFieldEvent());
|
||||
if (userModel != null) {
|
||||
userModel.setBirthday(strbir);
|
||||
}
|
||||
} else {
|
||||
ToastUtil.show(msg);
|
||||
|
||||
showData(userModel);
|
||||
EventBus.getDefault().post(new UpdateFieldEvent());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}).setCancelText("生日").setSubmitColor(getResources().getColor(R.color.blue01)).setSubmitText("完成").setContentTextSize(20).setDate(selectedDate).build();
|
||||
pvTime.show();
|
||||
@@ -704,21 +720,23 @@ public class EditProfileActivity extends AbsActivity {
|
||||
mCity.setText(location);
|
||||
}
|
||||
|
||||
MainHttpUtil.updateFields("{\"location\":\"" + location + "\"}", new HttpCallback() {
|
||||
OTONetManager.getInstance(EditProfileActivity.this).setFiled("location", location, new com.yunbao.common.http.base.HttpCallback<HttpCallbackModel>() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
if (info.length > 0) {
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
if (u != null) {
|
||||
u.setLocation(location);
|
||||
}
|
||||
EventBus.getDefault().post(new UpdateFieldEvent());
|
||||
public void onSuccess(HttpCallbackModel data) {
|
||||
ToastUtil.show(data.getMsg());
|
||||
if (data.getCode() == 0) {
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
if (u != null) {
|
||||
u.setLocation(location);
|
||||
}
|
||||
ToastUtil.show(obj.getString("msg"));
|
||||
EventBus.getDefault().post(new UpdateFieldEvent());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -9,11 +9,13 @@ import android.widget.EditText;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.shayu.onetoone.R;
|
||||
import com.shayu.onetoone.manager.OTONetManager;
|
||||
import com.shayu.onetoone.utils.MainHttpConsts;
|
||||
import com.shayu.onetoone.utils.MainHttpUtil;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.activity.AbsActivity;
|
||||
import com.yunbao.common.bean.HttpCallbackModel;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
@@ -63,26 +65,29 @@ public class EditSignActivity extends AbsActivity {
|
||||
ToastUtil.show(R.string.edit_profile_sign_empty);
|
||||
return;
|
||||
}
|
||||
MainHttpUtil.updateFields("{\"signature\":\"" + content + "\"}", new HttpCallback() {
|
||||
|
||||
OTONetManager.getInstance(EditSignActivity.this).setFiled("signature", content, new com.yunbao.common.http.base.HttpCallback<HttpCallbackModel>() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0) {
|
||||
if (info.length > 0) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
ToastUtil.show(obj.getString("msg"));
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
public void onSuccess(HttpCallbackModel data) {
|
||||
if (data.getCode() == 0) {
|
||||
ToastUtil.show(data.getMsg());
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
// if (u != null) {
|
||||
// u.setUserNiceName(content);
|
||||
// }
|
||||
Intent intent = getIntent();
|
||||
intent.putExtra(Constants.SIGN, content);
|
||||
setResult(RESULT_OK, intent);
|
||||
finish();
|
||||
}
|
||||
Intent intent = getIntent();
|
||||
intent.putExtra(Constants.SIGN, content);
|
||||
setResult(RESULT_OK, intent);
|
||||
finish();
|
||||
} else {
|
||||
ToastUtil.show(msg);
|
||||
ToastUtil.show(data.getMsg());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user