達人認證

This commit is contained in:
hch
2023-10-20 18:26:51 +08:00
parent d3ab50e844
commit ebeb276bb1
30 changed files with 921 additions and 47 deletions

View File

@@ -3,6 +3,7 @@ package com.shayu.onetoone.activity.fragments;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.graphics.Outline;
import android.os.Bundle;
import android.text.TextUtils;
@@ -29,6 +30,7 @@ import com.opensource.svgaplayer.SVGAImageView;
import com.opensource.svgaplayer.SVGAParser;
import com.opensource.svgaplayer.SVGAVideoEntity;
import com.shayu.onetoone.R;
import com.shayu.onetoone.activity.setting.SettingActivity;
import com.shayu.onetoone.adapter.MainMeAdapter;
import com.shayu.onetoone.bean.SlideBean;
import com.shayu.onetoone.manager.RouteManager;
@@ -537,7 +539,7 @@ public class MyFragment extends BaseFragment implements OnItemClickListener<User
* 设置
*/
private void forwardSetting() {
// mContext.startActivity(new Intent(mContext, SettingActivity.class));
// mContext.startActivity(new Intent(mContext, SettingActivity.class));
}
/**

View File

@@ -57,7 +57,7 @@ public class SettingActivity extends AbsActivity {
@Override
public void onViewClicks() {
//forwardModifyPwd();
RouteManager.forwardAuthBloggerActivity();
RouteManager.forwardAuthBloggerInletActivity();
}
});
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.logout), new ViewClicksAntiShake.ViewClicksCallBack() {

View File

@@ -120,6 +120,8 @@ public class AuthActivity extends AbsActivity {
image11.setVisibility(View.GONE);
image22.setVisibility(View.GONE);
submit.setEnabled(false);
image1.setEnabled(false);
image2.setEnabled(false);
} else if (data.getName_auth() == 3) {//已提交
ImgLoader.display(mContext, data.getAuth_front(), image1);
ImgLoader.display(mContext, data.getAuth_back(), image2);
@@ -127,6 +129,8 @@ public class AuthActivity extends AbsActivity {
image22.setVisibility(View.GONE);
submit.setText("審核中,請耐心等待");
submit.setEnabled(false);
image1.setEnabled(false);
image2.setEnabled(false);
} else {
ImgLoader.display(mContext, data.getAuth_front(), image1);
ImgLoader.display(mContext, data.getAuth_back(), image2);
@@ -168,6 +172,7 @@ public class AuthActivity extends AbsActivity {
file1 = file;
ImgLoader.display(mContext, file1, image1);
image11.setVisibility(View.GONE);
findViewById(R.id.image11).setVisibility(View.GONE);
} else {
imgUrl2 = data.getAvatar();
file2 = file;
@@ -245,8 +250,6 @@ public class AuthActivity extends AbsActivity {
super.onDestroy();
}
private UserBean userModel;
@Override
protected void onResume() {
super.onResume();
@@ -254,11 +257,4 @@ public class AuthActivity extends AbsActivity {
finish();
}
}
@Override
public void onBackPressed() {
}
}

View File

@@ -1,21 +1,37 @@
package com.shayu.onetoone.activity.user;
import android.annotation.SuppressLint;
import android.app.Dialog;
import android.content.Context;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.blankj.utilcode.util.StringUtils;
import com.lxj.xpopup.XPopup;
import com.shayu.onetoone.R;
import com.shayu.onetoone.bean.AvatarBean;
import com.shayu.onetoone.bean.ImageBean;
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.adapter.RefreshAdapter;
import com.yunbao.common.bean.BaseModel;
import com.yunbao.common.bean.HttpCallbackModel;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.custom.ItemDecoration;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.interfaces.ImageResultCallback;
@@ -27,18 +43,42 @@ import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.CompleteInformationPopup;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
/**
* 我的 编辑资料
* 達人認證
*/
@Route(path = RouteManager.ACTIVITY_AUTH_BLOGGER)
public class AuthBloggerActivity extends AbsActivity {
private ImageView personImg;
private TextView submit;
private ProcessImageUtil cameraUtil;
Dialog dialog;
private RecyclerView mRecyclerViewImage;
ActiveAdapter adapter;
List<ImageBean> imageBeanList = new ArrayList<>();
private int selectIndex;
private String personImgUrl;
private LinearLayout sexLayoutMan;
private LinearLayout sexLayoutWoman;
private ImageView sexImgMan;
private ImageView sexImgWoman;
private int sex = 1;
private EditText editUserName;
private EditText editUserMobile;
private EditText editCardId;
@Override
protected int getLayoutId() {
return R.layout.activity_auth_blogger;
@@ -46,7 +86,17 @@ public class AuthBloggerActivity extends AbsActivity {
@Override
protected void main() {
setTitle(mContext.getString(R.string.edit_profile));
setTitle("上傳入駐資料");
sexLayoutMan = findViewById(R.id.sex_man);
sexLayoutWoman = findViewById(R.id.sex_woman);
sexImgMan = findViewById(R.id.sex_img_man);
sexImgWoman = findViewById(R.id.sex_img_woman);
editUserName = findViewById(R.id.name);
editUserMobile = findViewById(R.id.mobile);
editCardId = findViewById(R.id.cardId);
personImg = findViewById(R.id.personImg);
submit = findViewById(R.id.submit);
submit.setOnClickListener(new View.OnClickListener() {
@Override
@@ -56,8 +106,70 @@ public class AuthBloggerActivity extends AbsActivity {
});
initCamera();
dialog = DialogUitl.loadingDialog(mContext, "上传中");
mRecyclerViewImage = findViewById(R.id.recyclerView_image);
mRecyclerViewImage.setLayoutManager(new GridLayoutManager(mContext, 3, GridLayoutManager.VERTICAL, false));
ItemDecoration decoration = new ItemDecoration(mContext, 0x00000000, 15, 15);
decoration.setOnlySetItemOffsetsButNoDraw(true);
mRecyclerViewImage.addItemDecoration(decoration);
imageBeanList = new ArrayList<>();
for (int i = 0; i < 9; i++) {
imageBeanList.add(new ImageBean(i));
}
adapter = new ActiveAdapter(AuthBloggerActivity.this);
mRecyclerViewImage.setAdapter(adapter);
adapter.setList(imageBeanList);
personImg.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
selectIndex = -1;
setImage();
}
});
sexLayoutMan.setOnClickListener(new View.OnClickListener() {
@SuppressLint("UseCompatLoadingForDrawables")
@Override
public void onClick(View v) {
sex = 1;
sexImgMan.setImageDrawable(getResources().getDrawable(R.mipmap.sex_radio_2));
sexImgWoman.setImageDrawable(getResources().getDrawable(R.mipmap.sex_radio_1));
}
});
sexLayoutWoman.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
sex = 2;
sexImgMan.setImageDrawable(getResources().getDrawable(R.mipmap.sex_radio_1));
sexImgWoman.setImageDrawable(getResources().getDrawable(R.mipmap.sex_radio_2));
}
});
editCardId.addTextChangedListener(textWatcher);
editUserName.addTextChangedListener(textWatcher);
editUserMobile.addTextChangedListener(textWatcher);
}
TextWatcher textWatcher = new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
checkSubmit();
}
@Override
public void afterTextChanged(Editable s) {
}
};
private void initCamera() {
cameraUtil = new ProcessImageUtil(this, "com.shayu.onetoone.fileprovider");
cameraUtil.setImageResultCallback(new ImageResultCallback() {
@@ -76,12 +188,23 @@ public class AuthBloggerActivity extends AbsActivity {
OTONetManager.getInstance(mContext).updateFile(file, new HttpCallback<AvatarBean>() {
@Override
public void onSuccess(AvatarBean data) {
if (selectIndex == -1) {
personImgUrl = data.getAvatar();
ImgLoader.display(mContext, personImgUrl, personImg);
findViewById(R.id.image11).setVisibility(View.GONE);
checkSubmit();
} else {
imageBeanList.get(selectIndex).setFile(file);
imageBeanList.get(selectIndex).setUrl(data.getAvatar());
adapter.notifyItemChanged(selectIndex);
}
dialog.hide();
}
@Override
public void onError(String error) {
dialog.hide();
ToastUtil.show(error);
}
});
}
@@ -94,18 +217,53 @@ public class AuthBloggerActivity extends AbsActivity {
});
}
boolean isFront = true;
@SuppressLint("UseCompatLoadingForDrawables")
public void checkSubmit() {
if (CheckInput()) {
submit.setBackground(getResources().getDrawable(R.drawable.bg_auth_submit_2));
submit.setEnabled(true);
} else {
submit.setBackground(getResources().getDrawable(R.drawable.bg_auth_submit_1));
submit.setEnabled(false);
}
}
private boolean CheckInput() {
if (StringUtils.isEmpty(editUserName.getText().toString())) {
return false;
}
if (StringUtils.isEmpty(editUserMobile.getText().toString())) {
return false;
}
if (StringUtils.isEmpty(editCardId.getText().toString())) {
return false;
}
if (StringUtils.isEmpty(personImgUrl)) {
return false;
}
return true;
}
private void submit() {
/*OTONetManager.getInstance(AuthBloggerActivity.this).setAuthInfo(imgUrl1, imgUrl2, new HttpCallback<HttpCallbackModel>() {
StringBuffer imgs = new StringBuffer();
for (int i = 0; i < imageBeanList.size(); i++) {
if (!StringUtils.isEmpty(imageBeanList.get(i).getUrl())) {
if (imgs.length() == 0) {
imgs.append(imageBeanList.get(i).getUrl());
} else {
imgs.append("," + imageBeanList.get(i).getUrl());
}
}
}
OTONetManager.getInstance(AuthBloggerActivity.this).authSage(editUserName.getText().toString(), editUserMobile.getText().toString(), editCardId.getText().toString(), personImgUrl, imgs.toString(), sex, 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());
}
@@ -115,7 +273,7 @@ public class AuthBloggerActivity extends AbsActivity {
public void onError(String error) {
}
});*/
});
}
public void setImage() {
@@ -138,8 +296,6 @@ public class AuthBloggerActivity extends AbsActivity {
if (cameraUtil != null) {
cameraUtil.release();
}
//MainHttpUtil.cancel(MainHttpConsts.UPDATE_AVATAR);
//MainHttpUtil.cancel(MainHttpConsts.UPDATE_FIELDS);
super.onDestroy();
}
@@ -172,5 +328,50 @@ public class AuthBloggerActivity extends AbsActivity {
}
}
public class ActiveAdapter extends RefreshAdapter<ImageBean> {
public ActiveAdapter(Context context) {
super(context);
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new Vh(mInflater.inflate(R.layout.item_auth_img, parent, false));
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder vh, int position) {
((Vh) vh).setData(mList.get(position));
}
class Vh extends RecyclerView.ViewHolder {
ImageView img1;
ImageView img11;
public Vh(View itemView) {
super(itemView);
img1 = itemView.findViewById(R.id.image1);
img11 = itemView.findViewById(R.id.image11);
itemView.setOnClickListener(v -> {
ImageBean imageBean = (ImageBean) itemView.getTag();
selectIndex = imageBean.getIndex();
setImage();
});
}
void setData(ImageBean bean) {
itemView.setTag(bean);
if (bean.getFile() == null) {
img11.setVisibility(View.VISIBLE);
} else {
img11.setVisibility(View.INVISIBLE);
img1.setVisibility(View.VISIBLE);
ImgLoader.display(mContext, bean.getFile(), img1);
}
}
}
}
}

View File

@@ -0,0 +1,173 @@
package com.shayu.onetoone.activity.user;
import android.annotation.SuppressLint;
import android.app.Dialog;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.shayu.onetoone.R;
import com.shayu.onetoone.bean.AuthBean;
import com.shayu.onetoone.bean.AuthBloggerBean;
import com.shayu.onetoone.manager.OTONetManager;
import com.shayu.onetoone.manager.RouteManager;
import com.yunbao.common.Constants;
import com.yunbao.common.activity.AbsActivity;
import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.DialogUitl;
/**
* 達人認證入口
*/
@Route(path = RouteManager.ACTIVITY_AUTH_BLOGGER_INLET)
public class AuthBloggerInletActivity extends AbsActivity {
private LinearLayout personLayout;
private LinearLayout sageLayout;
private ImageView personImg;
private ImageView sageImg;
private TextView perStatus;
private TextView sageStatus;
@Override
protected int getLayoutId() {
return R.layout.activity_auth_blogger_inlet;
}
@Override
protected void main() {
setTitle("達人認證");
personLayout = findViewById(R.id.personLayout);
sageLayout = findViewById(R.id.sageLayout);
personImg = findViewById(R.id.personStatus);
sageImg = findViewById(R.id.sageStatus);
perStatus = findViewById(R.id.personBt);
sageStatus = findViewById(R.id.sageBt);
dialog = DialogUitl.loadingDialog(mContext, "查询中");
getAuthInfo();
}
AuthBean authBean;
AuthBloggerBean authBloggerBean;
Dialog dialog;
private void getAuthInfo() {
dialog.show();
OTONetManager.getInstance(AuthBloggerInletActivity.this).getAuthInfo(new HttpCallback<AuthBean>() {
@SuppressLint("UseCompatLoadingForDrawables")
@Override
public void onSuccess(AuthBean data) {
authBean = data;
if (data.getName_auth() == 2) {//已通过
personLayout.setBackground(getResources().getDrawable(R.drawable.bg_auth_submit_4));
personImg.setImageDrawable(getResources().getDrawable(R.mipmap.icon_suc));
perStatus.setText("已完成");
perStatus.setBackground(getResources().getDrawable(R.drawable.bg_auth_submit_3));
} else if (data.getName_auth() == 3) {//已提交
personLayout.setBackground(getResources().getDrawable(R.drawable.bg_auth_submit_1));
personImg.setImageDrawable(getResources().getDrawable(R.mipmap.icon_fail));
perStatus.setText("審核中,請耐心等待");
perStatus.setBackground(getResources().getDrawable(R.drawable.bg_auth_submit_3));
} else if (data.getName_auth() == 4) {
personLayout.setBackground(getResources().getDrawable(R.drawable.bg_auth_submit_1));
personImg.setImageDrawable(getResources().getDrawable(R.mipmap.icon_fail));
perStatus.setText("審核失敗,去提交");
perStatus.setBackground(getResources().getDrawable(R.drawable.bg_auth_submit_5));
findViewById(R.id.personBt).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
RouteManager.forwaradAuthActivity();
}
});
} else {
personLayout.setBackground(getResources().getDrawable(R.drawable.bg_auth_submit_1));
personImg.setImageDrawable(getResources().getDrawable(R.mipmap.icon_suc));
perStatus.setText("去上傳");
perStatus.setBackground(getResources().getDrawable(R.drawable.bg_auth_submit_5));
findViewById(R.id.personBt).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
RouteManager.forwaradAuthActivity();
}
});
}
OTONetManager.getInstance(AuthBloggerInletActivity.this).getAuthBloggerInfo(new HttpCallback<AuthBloggerBean>() {
@SuppressLint("UseCompatLoadingForDrawables")
@Override
public void onSuccess(AuthBloggerBean data) {
authBloggerBean = data;
if (data.getStatus() == 2) {//已通过
sageLayout.setBackground(getResources().getDrawable(R.drawable.bg_auth_submit_3));
sageImg.setImageDrawable(getResources().getDrawable(R.mipmap.icon_suc));
sageStatus.setText("已完成");
sageStatus.setBackground(getResources().getDrawable(R.drawable.bg_auth_submit_3));
} else if (data.getStatus() == 3) {//已提交
sageLayout.setBackground(getResources().getDrawable(R.drawable.bg_auth_submit_1));
sageImg.setImageDrawable(getResources().getDrawable(R.mipmap.icon_fail));
sageStatus.setText("審核中,請耐心等待");
sageStatus.setBackground(getResources().getDrawable(R.drawable.bg_auth_submit_3));
} else if (data.getStatus() == 4) {
sageLayout.setBackground(getResources().getDrawable(R.drawable.bg_auth_submit_1));
sageImg.setImageDrawable(getResources().getDrawable(R.mipmap.icon_fail));
sageStatus.setText("審核失敗,去提交");
sageStatus.setBackground(getResources().getDrawable(R.drawable.bg_auth_submit_5));
findViewById(R.id.sageBt).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
RouteManager.forwardAuthBloggerActivity();
}
});
} else {
sageLayout.setBackground(getResources().getDrawable(R.drawable.bg_auth_submit_1));
sageImg.setImageDrawable(getResources().getDrawable(R.mipmap.icon_fail));
sageStatus.setText("去上傳");
sageStatus.setBackground(getResources().getDrawable(R.drawable.bg_auth_submit_5));
findViewById(R.id.sageBt).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
RouteManager.forwardAuthBloggerActivity();
}
});
}
dialog.hide();
}
@Override
public void onError(String error) {
dialog.hide();
}
});
}
@Override
public void onError(String error) {
dialog.hide();
}
});
}
@Override
protected void onDestroy() {
Bus.getOff(this);
super.onDestroy();
}
@Override
protected void onResume() {
super.onResume();
if (Constants.isShowPage != -1) {
finish();
}
}
}