真人认证
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) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
56
OneToOne/src/main/java/com/shayu/onetoone/bean/AuthBean.java
Normal file
56
OneToOne/src/main/java/com/shayu/onetoone/bean/AuthBean.java
Normal file
@@ -0,0 +1,56 @@
|
||||
package com.shayu.onetoone.bean;
|
||||
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
|
||||
public class AuthBean extends BaseModel {
|
||||
private int name_auth; //审核状态 1未提交 2通过 3已提交 4驳回
|
||||
private String auth_front; //身份证正面
|
||||
private String auth_back; //身份证反面
|
||||
private String auth_remark; //审核备注
|
||||
|
||||
public AuthBean(int name_auth, String auth_front, String auth_back, String auth_remark) {
|
||||
this.name_auth = name_auth;
|
||||
this.auth_front = auth_front;
|
||||
this.auth_back = auth_back;
|
||||
this.auth_remark = auth_remark;
|
||||
}
|
||||
|
||||
public int getName_auth() {
|
||||
return name_auth;
|
||||
}
|
||||
|
||||
public void setName_auth(int name_auth) {
|
||||
this.name_auth = name_auth;
|
||||
}
|
||||
|
||||
public String getAuth_front() {
|
||||
return auth_front;
|
||||
}
|
||||
|
||||
public void setAuth_front(String auth_front) {
|
||||
this.auth_front = auth_front;
|
||||
}
|
||||
|
||||
public String getAuth_back() {
|
||||
return auth_back;
|
||||
}
|
||||
|
||||
public void setAuth_back(String auth_back) {
|
||||
this.auth_back = auth_back;
|
||||
}
|
||||
|
||||
public String getAuth_remark() {
|
||||
return auth_remark;
|
||||
}
|
||||
|
||||
public void setAuth_remark(String auth_remark) {
|
||||
this.auth_remark = auth_remark;
|
||||
}
|
||||
|
||||
public AuthBean() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import android.net.Uri;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.shayu.onetoone.bean.AuthBean;
|
||||
import com.shayu.onetoone.bean.AvatarBean;
|
||||
import com.shayu.onetoone.bean.CustomBean;
|
||||
import com.shayu.onetoone.bean.FollowBean;
|
||||
@@ -848,5 +849,84 @@ public class OTONetManager {
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置
|
||||
*/
|
||||
public void setFiled(
|
||||
String key, String val,
|
||||
HttpCallback<HttpCallbackModel> callback) {
|
||||
|
||||
API.get().otoApi(mContext).setFiled(key, val)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<List<BaseModel>>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<List<BaseModel>> listResponseModel) throws Exception {
|
||||
if (listResponseModel.getData().getCode() == 0) {
|
||||
callback.onSuccess(new HttpCallbackModel(listResponseModel.getData().getCode(), listResponseModel.getData().getMsg()));
|
||||
} else {
|
||||
callback.onError(listResponseModel.getData().getMsg());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 實名認證
|
||||
*/
|
||||
public void setAuthInfo(
|
||||
String authFront, String authBack,
|
||||
HttpCallback<HttpCallbackModel> callback) {
|
||||
|
||||
API.get().otoApi(mContext).setAuthInfo(authFront, authBack)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<List<BaseModel>>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<List<BaseModel>> listResponseModel) throws Exception {
|
||||
if (listResponseModel.getData().getCode() == 0) {
|
||||
callback.onSuccess(new HttpCallbackModel(listResponseModel.getData().getCode(), listResponseModel.getData().getMsg()));
|
||||
} else {
|
||||
callback.onError(listResponseModel.getData().getMsg());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取实名认证
|
||||
*
|
||||
* @param callback
|
||||
*/
|
||||
public void getAuthInfo(HttpCallback<AuthBean> callback) {
|
||||
API.get().otoApi(mContext)
|
||||
.getAuthInfo()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(model -> {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(model.getData().getInfo());
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
Log.e(TAG, "accept: ", throwable);
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(com.yunbao.common.R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -18,13 +18,32 @@ public class RouteManager {
|
||||
public static final String ACTIVITY_HOME_SEARCH = "/activity/HomeSearchActivity";
|
||||
public static final String ACTIVITY_HOME_SCREEN = "/activity/HomeScreenActivity";
|
||||
public static final String ACTIVITY_CALL_VIDEO = "/activity/CallVideoActivity";
|
||||
public static final String PATH_EDITPROFILE = "/main/EditProfileActivity";
|
||||
public static final String PATH_EDITPROFILE = "/activity/EditProfileActivity";
|
||||
|
||||
//设置基本资料
|
||||
public static final String ACTIVITY_COMPLETE = "/activity/CompleteActivity";
|
||||
|
||||
//选择标签
|
||||
public static final String ACTIVITY_CHOOSE_LABEL = "/activity/ChooseLabelActivity";
|
||||
//真人认证
|
||||
public static final String ACTIVITY_AUTH = "/activity/AuthActivity";
|
||||
//达人认证
|
||||
public static final String ACTIVITY_AUTH_BLOGGER = "/activity/AuthBloggerActivity";
|
||||
|
||||
/**
|
||||
* 达人认证
|
||||
*/
|
||||
public static void forwardAuthBloggerActivity() {
|
||||
ARouter.getInstance().build(ACTIVITY_AUTH_BLOGGER).navigation();
|
||||
}
|
||||
|
||||
/**
|
||||
* 真人认证
|
||||
*/
|
||||
public static void forwaradAuthActivity() {
|
||||
ARouter.getInstance().build(ACTIVITY_AUTH).navigation();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 选择标签
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.shayu.onetoone.network;
|
||||
|
||||
import com.shayu.onetoone.bean.AuthBean;
|
||||
import com.shayu.onetoone.bean.AvatarBean;
|
||||
import com.shayu.onetoone.bean.CustomBean;
|
||||
import com.shayu.onetoone.bean.FollowBean;
|
||||
import com.shayu.onetoone.bean.GiftBean;
|
||||
import com.shayu.onetoone.bean.GreetBean;
|
||||
@@ -16,7 +16,6 @@ import com.shayu.onetoone.bean.SystemMessageBean;
|
||||
import com.shayu.onetoone.bean.TargetUserInfoBean;
|
||||
import com.shayu.onetoone.bean.UserBean;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.bean.HttpCallbackModel;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.bean.UserAvatarSelectBean;
|
||||
import com.yunbao.common.http.ResponseModel;
|
||||
@@ -212,6 +211,31 @@ public interface OneToOneApi {
|
||||
@Field("labels") String avatar
|
||||
);
|
||||
|
||||
/**
|
||||
* 设置基本信息
|
||||
*/
|
||||
@GET("/api/public/?service=Friendappinfos.setFiled")
|
||||
Observable<ResponseModel<List<BaseModel>>> setFiled(
|
||||
@Query("key") String key,
|
||||
@Query("val") String val
|
||||
);
|
||||
|
||||
/**
|
||||
* 真人认证
|
||||
*/
|
||||
@GET("/api/public/?service=Friendappinfos.setAuth")
|
||||
Observable<ResponseModel<List<BaseModel>>> setAuthInfo(
|
||||
@Query("auth_front") String authFront,
|
||||
@Query("auth_back") String authBack
|
||||
);
|
||||
|
||||
/**
|
||||
* 获取真人认证信息
|
||||
*/
|
||||
@GET("/api/public/?service=Friendappinfos.getAuth")
|
||||
Observable<ResponseModel<AuthBean>> getAuthInfo(
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.shayu.onetoone.upload;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* 文件上傳
|
||||
*/
|
||||
|
||||
public class UploadBean {
|
||||
private File mOriginFile;//要被上传的源文件
|
||||
private String mRemoteFileName;//上传成功后在云存储上的文件名字
|
||||
private String mRemoteAccessUrl;//上传成功后在云存储上的访问地址
|
||||
private boolean mSuccess;//是否上传成功了
|
||||
|
||||
public UploadBean() {
|
||||
}
|
||||
|
||||
|
||||
public UploadBean(File originFile) {
|
||||
mOriginFile = originFile;
|
||||
}
|
||||
|
||||
public File getOriginFile() {
|
||||
return mOriginFile;
|
||||
}
|
||||
|
||||
public void setOriginFile(File originFile) {
|
||||
mOriginFile = originFile;
|
||||
}
|
||||
|
||||
public String getRemoteFileName() {
|
||||
return mRemoteFileName;
|
||||
}
|
||||
|
||||
public void setRemoteFileName(String remoteFileName) {
|
||||
mRemoteFileName = remoteFileName;
|
||||
}
|
||||
|
||||
public String getRemoteAccessUrl() {
|
||||
return mRemoteAccessUrl;
|
||||
}
|
||||
|
||||
public void setRemoteAccessUrl(String remoteAccessUrl) {
|
||||
mRemoteAccessUrl = remoteAccessUrl;
|
||||
}
|
||||
|
||||
public boolean isSuccess() {
|
||||
return mSuccess;
|
||||
}
|
||||
|
||||
public void setSuccess(boolean success) {
|
||||
mSuccess = success;
|
||||
}
|
||||
|
||||
|
||||
public void setEmpty() {
|
||||
mOriginFile = null;
|
||||
mRemoteFileName = null;
|
||||
mRemoteAccessUrl = null;
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return mOriginFile == null && mRemoteFileName == null && mRemoteAccessUrl == null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.shayu.onetoone.upload;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 文件上传回调
|
||||
*/
|
||||
|
||||
public interface UploadCallback {
|
||||
void onFinish(List<UploadBean> list, boolean success);
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.shayu.onetoone.upload;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.shayu.onetoone.bean.AvatarBean;
|
||||
import com.shayu.onetoone.manager.OTONetManager;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
*/
|
||||
|
||||
public class UploadCustomImpl implements UploadStrategy {
|
||||
|
||||
private static final String TAG = "UploadQnImpl";
|
||||
private Context mContext;
|
||||
private List<UploadBean> mList;
|
||||
private int mIndex;
|
||||
private boolean mNeedCompress;
|
||||
private UploadCallback mUploadCallback;
|
||||
|
||||
public UploadCustomImpl(Context context) {
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void upload(List<UploadBean> list, boolean needCompress, UploadCallback callback) {
|
||||
if (callback == null) {
|
||||
return;
|
||||
}
|
||||
if (list == null || list.size() == 0) {
|
||||
callback.onFinish(list, false);
|
||||
return;
|
||||
}
|
||||
boolean hasFile = false;
|
||||
for (UploadBean bean : list) {
|
||||
if (bean.getOriginFile() != null) {
|
||||
hasFile = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!hasFile) {
|
||||
callback.onFinish(list, true);
|
||||
return;
|
||||
}
|
||||
mList = list;
|
||||
mNeedCompress = needCompress;
|
||||
mUploadCallback = callback;
|
||||
mIndex = 0;
|
||||
uploadNext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelUpload() {
|
||||
}
|
||||
|
||||
private void uploadNext() {
|
||||
UploadBean bean = null;
|
||||
while (mIndex < mList.size() && (bean = mList.get(mIndex)).getOriginFile() == null) {
|
||||
mIndex++;
|
||||
}
|
||||
if (mIndex >= mList.size() || bean == null) {
|
||||
if (mUploadCallback != null) {
|
||||
mUploadCallback.onFinish(mList, true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
upload(bean);
|
||||
}
|
||||
|
||||
private void upload(UploadBean bean) {
|
||||
OTONetManager.getInstance(mContext).updateFile(bean.getOriginFile(), new HttpCallback<AvatarBean>() {
|
||||
@Override
|
||||
public void onSuccess(AvatarBean data) {
|
||||
if (data != null) {
|
||||
bean.setRemoteAccessUrl(data.getAvatar());
|
||||
bean.setSuccess(true);
|
||||
uploadNext();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.shayu.onetoone.upload;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
public interface UploadStrategy {
|
||||
|
||||
/**
|
||||
* 执行上传
|
||||
*
|
||||
* @param list 被上传的文件列表
|
||||
* @param needCompress 是否需要压缩
|
||||
* @param callback 上传回调
|
||||
*/
|
||||
void upload(List<UploadBean> list, boolean needCompress, UploadCallback callback);
|
||||
|
||||
/**
|
||||
* 取消上传
|
||||
*/
|
||||
void cancelUpload();
|
||||
}
|
||||
@@ -404,8 +404,8 @@ public class MainHttpUtil {
|
||||
* @param fields 用户资料 ,以json形式出现
|
||||
*/
|
||||
public static void updateFields(String fields, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("User.updateFields", MainHttpConsts.UPDATE_FIELDS)
|
||||
.params("fields", fields)
|
||||
HttpClient.getInstance().get("Friendappinfos.setFiled", MainHttpConsts.UPDATE_FIELDS)
|
||||
.params("key", fields)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.shayu.onetoone.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.lxj.xpopup.core.BottomPopupView;
|
||||
import com.shayu.onetoone.R;
|
||||
|
||||
public class UserAuthPopup extends BottomPopupView implements View.OnClickListener {
|
||||
|
||||
private ImageView camera;
|
||||
private ImageView album;
|
||||
private Context mContext;
|
||||
|
||||
public interface OnItemClickListener<T> {
|
||||
void onItemClick(String userAvatar);
|
||||
}
|
||||
|
||||
private onIsCameraClickListener onIsCameraClickListener;
|
||||
|
||||
public interface onIsCameraClickListener {
|
||||
void onIsCamera(boolean isCamera);
|
||||
}
|
||||
|
||||
public UserAuthPopup(@NonNull Context context, onIsCameraClickListener onIsCameraClickListener) {
|
||||
super(context);
|
||||
this.mContext = context;
|
||||
this.onIsCameraClickListener = onIsCameraClickListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
}
|
||||
|
||||
// 返回自定义弹窗的布局
|
||||
@Override
|
||||
protected int getImplLayoutId() {
|
||||
return R.layout.dialog_auth_avatar;
|
||||
}
|
||||
|
||||
// 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
initView();
|
||||
}
|
||||
|
||||
|
||||
private void initView() {
|
||||
camera = findViewById(R.id.camera);
|
||||
album = findViewById(R.id.album);
|
||||
camera.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
onIsCameraClickListener.onIsCamera(true);
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
album.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
onIsCameraClickListener.onIsCamera(false);
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user