设置标签
This commit is contained in:
parent
d2639ceb6a
commit
1f0cdd86a4
@ -120,6 +120,8 @@ public class MainActivity extends AbsOTOActivity {
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
checkUserInfoIsSet();
|
||||
//测试
|
||||
//RouteManager.forwardChooseActivity();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.shayu.onetoone.activity.fragments;
|
||||
|
||||
|
||||
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@ -32,6 +31,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;
|
||||
@ -442,7 +442,7 @@ public class MyFragment extends BaseFragment implements OnItemClickListener<User
|
||||
forwardCoin();
|
||||
break;
|
||||
case 13:
|
||||
// forwardSetting();
|
||||
forwardSetting();
|
||||
break;
|
||||
case 19:
|
||||
forwardMyVideo();
|
||||
@ -559,7 +559,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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,251 +1,184 @@
|
||||
package com.shayu.onetoone.activity.login;
|
||||
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.bigkoo.pickerview.builder.TimePickerBuilder;
|
||||
import com.bigkoo.pickerview.listener.OnTimeSelectListener;
|
||||
import com.bigkoo.pickerview.view.TimePickerView;
|
||||
import com.blankj.utilcode.util.StringUtils;
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.shayu.onetoone.R;
|
||||
import com.shayu.onetoone.activity.AbsOTOActivity;
|
||||
import com.shayu.onetoone.activity.MainActivity;
|
||||
import com.shayu.onetoone.bean.AvatarBean;
|
||||
import com.shayu.onetoone.adapter.LabelTagAdapter;
|
||||
import com.shayu.onetoone.adapter.LableChooseAdapter;
|
||||
import com.shayu.onetoone.bean.LabelBean;
|
||||
import com.shayu.onetoone.manager.OTONetManager;
|
||||
import com.shayu.onetoone.manager.RouteManager;
|
||||
import com.shayu.onetoone.view.UserAvatarPopup;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.xuexiang.xui.widget.flowlayout.FlowTagLayout;
|
||||
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.L;
|
||||
import com.yunbao.common.utils.ProcessImageUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 完善个人资料
|
||||
* 设置标签
|
||||
*/
|
||||
@Route(path = RouteManager.ACTIVITY_COMPLETE)
|
||||
@Route(path = RouteManager.ACTIVITY_CHOOSE_LABEL)
|
||||
public class ChooseLabelActivity extends AbsOTOActivity {
|
||||
|
||||
private RelativeLayout editHead; //头像点击事件
|
||||
private ImageView userAvatar; //头像
|
||||
private TextView txtChoose;
|
||||
private EditText userNickName; //昵称
|
||||
private TextView userSex1; //性别
|
||||
private TextView userSex2; //性别
|
||||
private TextView userBirthday; //年龄
|
||||
private Button btnRegister; //提交资料
|
||||
FlowTagLayout myFlowTag; //我的标签
|
||||
|
||||
private int sex = -1;
|
||||
RecyclerView recyclerView; //系统分类标签
|
||||
|
||||
ProcessImageUtil cameraUtil;
|
||||
TextView next; //跳过
|
||||
|
||||
private File mAvatarFile;
|
||||
LableChooseAdapter lableChooseAdapter;
|
||||
|
||||
int year;
|
||||
int month;
|
||||
int day;
|
||||
List<LabelBean.Children> myLabelList = new ArrayList<>();
|
||||
|
||||
private String avatarUrl;
|
||||
LabelTagAdapter myAdapter;
|
||||
|
||||
Button submit; //提交
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_complete;
|
||||
return R.layout.activity_choose_label;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void main(Bundle savedInstanceState) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
year = calendar.get(Calendar.YEAR) - 18;
|
||||
month = calendar.get(Calendar.MONTH);
|
||||
day = calendar.get(Calendar.DAY_OF_MONTH);
|
||||
|
||||
initView();
|
||||
initCamera();
|
||||
initDate();
|
||||
}
|
||||
|
||||
private void initCamera() {
|
||||
cameraUtil = new ProcessImageUtil(this, "com.shayu.onetoone.fileprovider");
|
||||
cameraUtil.setImageResultCallback(new ImageResultCallback() {
|
||||
private void initDate() {
|
||||
OTONetManager.getInstance(mContext).getSysLabel(new HttpCallback<List<LabelBean>>() {
|
||||
@Override
|
||||
public void beforeCamera() {
|
||||
|
||||
public void onSuccess(List<LabelBean> data) {
|
||||
lableChooseAdapter.setList(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(File file) {
|
||||
L.e("cameraUtil.setImageResultCallback:");
|
||||
if (file != null) {
|
||||
mAvatarFile = file;
|
||||
OTONetManager.getInstance(ChooseLabelActivity.this).updateFile(mAvatarFile, new HttpCallback<AvatarBean>() {
|
||||
@Override
|
||||
public void onSuccess(AvatarBean data) {
|
||||
ImgLoader.display(mContext, file, userAvatar);
|
||||
//txtChoose.setVisibility(View.GONE);
|
||||
avatarUrl = data.getAvatar();
|
||||
ToastUtil.show("上传成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show("上传失败");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure() {
|
||||
|
||||
public void onError(String error) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
private void initView() {
|
||||
editHead = findViewById(R.id.editHead);
|
||||
userAvatar = findViewById(R.id.userAvatar);
|
||||
txtChoose = findViewById(R.id.text_choose);
|
||||
userNickName = findViewById(R.id.userNickName);
|
||||
userSex1 = findViewById(R.id.user_sex_1);
|
||||
userSex2 = findViewById(R.id.user_sex_2);
|
||||
userBirthday = findViewById(R.id.userBirthday);
|
||||
btnRegister = findViewById(R.id.btn_register);
|
||||
avatarUrl = CommonAppConfig.getInstance().getUserBean().getAvatar();
|
||||
if (!StringUtils.isEmpty(avatarUrl)) {
|
||||
ImgLoader.display(ChooseLabelActivity.this, avatarUrl, userAvatar);
|
||||
}
|
||||
if (!StringUtils.isEmpty(CommonAppConfig.getInstance().getUserBean().getUserNiceName())) {
|
||||
userNickName.setText(CommonAppConfig.getInstance().getUserBean().getUserNiceName());
|
||||
}
|
||||
editHead.setOnClickListener(new View.OnClickListener() {
|
||||
submit = findViewById(R.id.submit);
|
||||
myFlowTag = findViewById(R.id.myFlowTag);
|
||||
recyclerView = findViewById(R.id.recyclerView);
|
||||
next = findViewById(R.id.next);
|
||||
|
||||
myLabelList = new ArrayList<>();
|
||||
|
||||
myAdapter = new LabelTagAdapter(mContext, new LabelTagAdapter.OnSureOnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
chooseImage();
|
||||
public void sure(LabelBean.Children labelBean) {
|
||||
|
||||
}
|
||||
});
|
||||
myFlowTag.setAdapter(myAdapter);
|
||||
myFlowTag.setTagCheckedMode(FlowTagLayout.FLOW_TAG_CHECKED_NONE);
|
||||
myAdapter.setData(myLabelList);
|
||||
|
||||
userBirthday.setText(year + " 年 " + (month + 1) + " 月 " + day + " 日 ");
|
||||
recyclerView.setHasFixedSize(true);
|
||||
LinearLayoutManager layoutManager1 = new LinearLayoutManager(ChooseLabelActivity.this);
|
||||
layoutManager1.setOrientation(LinearLayoutManager.VERTICAL);
|
||||
recyclerView.setLayoutManager(layoutManager1);
|
||||
|
||||
userSex1.setOnClickListener(new View.OnClickListener() {
|
||||
lableChooseAdapter = new LableChooseAdapter(ChooseLabelActivity.this, new LableChooseAdapter.onItemLabelClicklistener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
changeSex(0);
|
||||
public void onChoose(LabelBean.Children children) {
|
||||
addLabel(children);
|
||||
}
|
||||
});
|
||||
userSex2.setOnClickListener(new View.OnClickListener() {
|
||||
recyclerView.setAdapter(lableChooseAdapter);
|
||||
|
||||
next.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
changeSex(1);
|
||||
finish();
|
||||
}
|
||||
});
|
||||
userBirthday.setOnClickListener(new View.OnClickListener() {
|
||||
submit.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
//时间选择器
|
||||
Calendar selectedDate = Calendar.getInstance();
|
||||
selectedDate.set(year, month, day);
|
||||
TimePickerView pvTime = new TimePickerBuilder(ChooseLabelActivity.this, new OnTimeSelectListener() {
|
||||
@Override
|
||||
public void onTimeSelect(Date date, View v) {
|
||||
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
|
||||
year = calendar.get(Calendar.YEAR);
|
||||
month = calendar.get(Calendar.MONTH);
|
||||
day = calendar.get(Calendar.DAY_OF_MONTH);
|
||||
|
||||
userBirthday.setText(year + " 年 " + (month + 1) + " 月 " + day + " 日 ");
|
||||
}
|
||||
}).setCancelText("生日").setSubmitColor(getResources().getColor(R.color.blue01)).setSubmitText("完成").setContentTextSize(20).setDate(selectedDate).build();
|
||||
pvTime.show();
|
||||
}
|
||||
});
|
||||
btnRegister.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (StringUtils.isEmpty(userNickName.getText().toString())) {
|
||||
Toast.makeText(mContext, "请填写昵称", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
if (sex == -1) {
|
||||
Toast.makeText(mContext, "请选择性别", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
OTONetManager.getInstance(mContext).setInfo(avatarUrl, userNickName.getText().toString(), sex, year + "-" + month + "-" + day, new HttpCallback<HttpCallbackModel>() {
|
||||
@Override
|
||||
public void onSuccess(HttpCallbackModel data) {
|
||||
Toast.makeText(mContext, data.getMsg(), Toast.LENGTH_SHORT).show();
|
||||
if (data.getCode() == 0) {
|
||||
Intent intent = new Intent(ChooseLabelActivity.this, MainActivity.class);
|
||||
intent.putExtra(Constants.SHOW_INVITE, false);
|
||||
startActivity(intent);
|
||||
|
||||
RouteManager.forwardMainActivity();
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
setLabel();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 选择图片
|
||||
* 设置标签
|
||||
*/
|
||||
private void chooseImage() {
|
||||
UserAvatarPopup userAvatarPopup = new UserAvatarPopup(this, userAvatar1 -> {
|
||||
avatarUrl = userAvatar1;
|
||||
ImgLoader.display(ChooseLabelActivity.this, avatarUrl, userAvatar);
|
||||
//txtChoose.setVisibility(View.GONE);
|
||||
}, isCamera -> {
|
||||
if (isCamera) {
|
||||
cameraUtil.getImageByCamera();
|
||||
private void setLabel() {
|
||||
StringBuffer labels = new StringBuffer();
|
||||
for (int i = 0; i < myLabelList.size(); i++) {
|
||||
if (i == 0) {
|
||||
labels.append(myLabelList.get(i).getId());
|
||||
} else {
|
||||
cameraUtil.getImageByAlumb();
|
||||
labels.append("," + myLabelList.get(i).getId());
|
||||
}
|
||||
}
|
||||
OTONetManager.getInstance(mContext).setLabels(labels.toString(), new HttpCallback<HttpCallbackModel>() {
|
||||
@Override
|
||||
public void onSuccess(HttpCallbackModel data) {
|
||||
Toast.makeText(mContext, data.getMsg(), Toast.LENGTH_SHORT).show();
|
||||
if (data.getCode() == 0) {
|
||||
RouteManager.forwardMainActivity();
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
new XPopup.Builder(mContext).asCustom(userAvatarPopup).show();
|
||||
|
||||
}
|
||||
|
||||
private void changeSex(int i) {
|
||||
sex = i;
|
||||
if (sex == 0) {
|
||||
userSex1.setTextColor(getResources().getColor(R.color.white));
|
||||
userSex2.setTextColor(getResources().getColor(R.color.text_gray));
|
||||
userSex1.setBackgroundResource(R.mipmap.icon_user_sex_02);
|
||||
userSex2.setBackgroundResource(R.mipmap.icon_user_sex_00);
|
||||
/**
|
||||
* 处理标签 +-
|
||||
*
|
||||
* @param children
|
||||
*/
|
||||
private void addLabel(LabelBean.Children children) {
|
||||
if (children.isSelect()) {
|
||||
boolean isAdd = true;
|
||||
for (int i = 0; i < myLabelList.size(); i++) {
|
||||
if (myLabelList.get(i).getId() == children.getId()) {
|
||||
isAdd = false;
|
||||
}
|
||||
}
|
||||
if (isAdd) {
|
||||
myLabelList.add(children);
|
||||
myAdapter.setData(myLabelList);
|
||||
}
|
||||
} else {
|
||||
userSex1.setTextColor(getResources().getColor(R.color.text_gray));
|
||||
userSex2.setTextColor(getResources().getColor(R.color.white));
|
||||
userSex1.setBackgroundResource(R.mipmap.icon_user_sex_00);
|
||||
userSex2.setBackgroundResource(R.mipmap.icon_user_sex_01);
|
||||
int index = -1;
|
||||
for (int i = 0; i < myLabelList.size(); i++) {
|
||||
if (myLabelList.get(i).getId() == children.getId()) {
|
||||
index = i;
|
||||
}
|
||||
}
|
||||
if (index != -1) {
|
||||
myLabelList.remove(index);
|
||||
myAdapter.setData(myLabelList);
|
||||
}
|
||||
}
|
||||
if (myLabelList.size() > 0) {
|
||||
findViewById(R.id.notitle).setVisibility(View.GONE);
|
||||
} else {
|
||||
findViewById(R.id.notitle).setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
@ -197,11 +197,7 @@ public class CompleteActivity extends AbsOTOActivity {
|
||||
public void onSuccess(HttpCallbackModel data) {
|
||||
Toast.makeText(mContext, data.getMsg(), Toast.LENGTH_SHORT).show();
|
||||
if (data.getCode() == 0) {
|
||||
Intent intent = new Intent(CompleteActivity.this, MainActivity.class);
|
||||
intent.putExtra(Constants.SHOW_INVITE, false);
|
||||
startActivity(intent);
|
||||
|
||||
RouteManager.forwardMainActivity();
|
||||
RouteManager.forwardChooseActivity();
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,57 @@
|
||||
package com.shayu.onetoone.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.shayu.onetoone.R;
|
||||
import com.shayu.onetoone.bean.LabelBean;
|
||||
import com.xuexiang.xui.widget.flowlayout.BaseTagAdapter;
|
||||
|
||||
public class LabelChooseTagAdapter extends BaseTagAdapter<LabelBean.Children, TextView> {
|
||||
|
||||
OnSureOnClickListener onSureOnClickListener;
|
||||
|
||||
Context mContext;
|
||||
|
||||
public LabelChooseTagAdapter(Context context, OnSureOnClickListener onSureOnClickListener) {
|
||||
super(context);
|
||||
this.onSureOnClickListener = onSureOnClickListener;
|
||||
this.mContext = context;
|
||||
}
|
||||
|
||||
public LabelChooseTagAdapter(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TextView newViewHolder(View convertView) {
|
||||
return (TextView) convertView.findViewById(R.id.tv_tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.adapter_item_tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(TextView textView, LabelBean.Children item, int position) {
|
||||
textView.setText(item.getCn_title());
|
||||
if (item.isSelect()) {
|
||||
textView.setBackground(getDrawable(R.drawable.bg_rect_round_tag_btn1));
|
||||
textView.setTextColor(mContext.getResources().getColor(R.color.white));
|
||||
} else {
|
||||
textView.setBackground(getDrawable(R.drawable.bg_rect_round_tag_btn));
|
||||
textView.setTextColor(mContext.getResources().getColor(R.color.black2));
|
||||
}
|
||||
textView.setOnClickListener(v -> {
|
||||
item.setSelect(!item.isSelect());
|
||||
onSureOnClickListener.sure(item);
|
||||
notifyDataSetChanged();
|
||||
});
|
||||
}
|
||||
|
||||
public interface OnSureOnClickListener {
|
||||
void sure(LabelBean.Children labelBean);
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package com.shayu.onetoone.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.shayu.onetoone.R;
|
||||
import com.shayu.onetoone.bean.LabelBean;
|
||||
import com.xuexiang.xui.widget.flowlayout.BaseTagAdapter;
|
||||
|
||||
public class LabelTagAdapter extends BaseTagAdapter<LabelBean.Children, TextView> {
|
||||
|
||||
OnSureOnClickListener onSureOnClickListener;
|
||||
|
||||
Context mContext;
|
||||
|
||||
public LabelTagAdapter(Context context, OnSureOnClickListener onSureOnClickListener) {
|
||||
super(context);
|
||||
this.onSureOnClickListener = onSureOnClickListener;
|
||||
this.mContext = context;
|
||||
}
|
||||
|
||||
public LabelTagAdapter(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TextView newViewHolder(View convertView) {
|
||||
return (TextView) convertView.findViewById(R.id.tv_tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.adapter_item_tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(TextView textView, LabelBean.Children item, int position) {
|
||||
textView.setText(item.getCn_title());
|
||||
textView.setBackground(getDrawable(R.drawable.bg_rect_round_tag_btn));
|
||||
textView.setTextColor(mContext.getResources().getColor(R.color.black2));
|
||||
}
|
||||
|
||||
public interface OnSureOnClickListener {
|
||||
void sure(LabelBean.Children labelBean);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
package com.shayu.onetoone.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.shayu.onetoone.R;
|
||||
import com.shayu.onetoone.bean.LabelBean;
|
||||
import com.xuexiang.xui.widget.flowlayout.FlowTagLayout;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class LableChooseAdapter extends RecyclerView.Adapter<LableChooseAdapter.ViewHolder> {
|
||||
private Context mContext;
|
||||
private List<LabelBean> list;
|
||||
private int selectPosition = 0;
|
||||
|
||||
public onItemLabelClicklistener onItemLabelClicklistener;
|
||||
|
||||
public LableChooseAdapter(Context mContext, onItemLabelClicklistener onItemLabelClicklistener) {
|
||||
this.mContext = mContext;
|
||||
list = new ArrayList<>();
|
||||
this.onItemLabelClicklistener = onItemLabelClicklistener;
|
||||
}
|
||||
|
||||
public void setList(List<LabelBean> list) {
|
||||
this.list = list;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new ViewHolder(LayoutInflater.from(mContext).inflate(R.layout.adapter_choose_label, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
holder.setData(list.get(position), position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return list.size();
|
||||
}
|
||||
|
||||
public LabelBean getItem() {
|
||||
return list.get(selectPosition);
|
||||
}
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder {
|
||||
private FlowTagLayout flowTagLayout;
|
||||
private TextView title;
|
||||
|
||||
public ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
flowTagLayout = itemView.findViewById(R.id.myFlowTag);
|
||||
title = itemView.findViewById(R.id.title);
|
||||
}
|
||||
|
||||
private void setData(LabelBean labelBean, int position) {
|
||||
LabelChooseTagAdapter tagAdapter1 = new LabelChooseTagAdapter(mContext, new LabelChooseTagAdapter.OnSureOnClickListener() {
|
||||
@Override
|
||||
public void sure(LabelBean.Children labelBean) {
|
||||
if (onItemLabelClicklistener != null) {
|
||||
onItemLabelClicklistener.onChoose(labelBean);
|
||||
}
|
||||
}
|
||||
});
|
||||
flowTagLayout.setAdapter(tagAdapter1);
|
||||
flowTagLayout.setTagCheckedMode(FlowTagLayout.FLOW_TAG_CHECKED_NONE);
|
||||
tagAdapter1.setData(labelBean.getChildren());
|
||||
title.setText(labelBean.getCn_title());
|
||||
title.setTag(labelBean);
|
||||
}
|
||||
}
|
||||
|
||||
public interface onItemLabelClicklistener {
|
||||
void onChoose(LabelBean.Children children);
|
||||
}
|
||||
}
|
124
OneToOne/src/main/java/com/shayu/onetoone/bean/LabelBean.java
Normal file
124
OneToOne/src/main/java/com/shayu/onetoone/bean/LabelBean.java
Normal file
@ -0,0 +1,124 @@
|
||||
package com.shayu.onetoone.bean;
|
||||
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class LabelBean extends BaseModel {
|
||||
private int id;
|
||||
private int pid;
|
||||
private String cn_title;
|
||||
private String en_title;
|
||||
private List<Children> children;
|
||||
|
||||
public class Children {
|
||||
private int id;
|
||||
private int pid;
|
||||
private String cn_title;
|
||||
private String en_title;
|
||||
private List<Children> children;
|
||||
|
||||
private boolean isSelect;
|
||||
|
||||
public boolean isSelect() {
|
||||
return isSelect;
|
||||
}
|
||||
|
||||
public void setSelect(boolean select) {
|
||||
isSelect = select;
|
||||
}
|
||||
|
||||
public Children() {
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getPid() {
|
||||
return pid;
|
||||
}
|
||||
|
||||
public void setPid(int pid) {
|
||||
this.pid = pid;
|
||||
}
|
||||
|
||||
public String getCn_title() {
|
||||
return cn_title;
|
||||
}
|
||||
|
||||
public void setCn_title(String cn_title) {
|
||||
this.cn_title = cn_title;
|
||||
}
|
||||
|
||||
public String getEn_title() {
|
||||
return en_title;
|
||||
}
|
||||
|
||||
public void setEn_title(String en_title) {
|
||||
this.en_title = en_title;
|
||||
}
|
||||
|
||||
public List<Children> getChildren() {
|
||||
return children;
|
||||
}
|
||||
|
||||
public void setChildren(List<Children> children) {
|
||||
this.children = children;
|
||||
}
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getPid() {
|
||||
return pid;
|
||||
}
|
||||
|
||||
public void setPid(int pid) {
|
||||
this.pid = pid;
|
||||
}
|
||||
|
||||
public String getCn_title() {
|
||||
return cn_title;
|
||||
}
|
||||
|
||||
public void setCn_title(String cn_title) {
|
||||
this.cn_title = cn_title;
|
||||
}
|
||||
|
||||
public String getEn_title() {
|
||||
return en_title;
|
||||
}
|
||||
|
||||
public void setEn_title(String en_title) {
|
||||
this.en_title = en_title;
|
||||
}
|
||||
|
||||
public List<Children> getChildren() {
|
||||
return children;
|
||||
}
|
||||
|
||||
|
||||
public List<String> getStringChildren() {
|
||||
List<String> stringList = new ArrayList<>();
|
||||
for (int i = 0; i < children.size(); i++) {
|
||||
stringList.add(children.get(i).getCn_title());
|
||||
}
|
||||
return stringList;
|
||||
}
|
||||
|
||||
public void setChildren(List<Children> children) {
|
||||
this.children = children;
|
||||
}
|
||||
}
|
@ -13,6 +13,7 @@ import com.shayu.onetoone.bean.GreetBean;
|
||||
import com.shayu.onetoone.bean.HomeItemBean;
|
||||
import com.shayu.onetoone.bean.HomeRankBean;
|
||||
import com.shayu.onetoone.bean.JoinAnchorBean;
|
||||
import com.shayu.onetoone.bean.LabelBean;
|
||||
import com.shayu.onetoone.bean.MessageConsumeConfigBean;
|
||||
import com.shayu.onetoone.bean.OfficialNoticeBean;
|
||||
import com.shayu.onetoone.bean.PurseBean;
|
||||
@ -467,7 +468,7 @@ public class OTONetManager {
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void getHomeHot(String page,HttpCallback<List<HomeItemBean>> callback) {
|
||||
public void getHomeHot(String page, HttpCallback<List<HomeItemBean>> callback) {
|
||||
|
||||
API.get().otoApi(mContext)
|
||||
.getHomeHot(page)
|
||||
@ -491,7 +492,7 @@ public class OTONetManager {
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void getHomeRecommend(String page,HttpCallback<List<HomeItemBean>> callback) {
|
||||
public void getHomeRecommend(String page, HttpCallback<List<HomeItemBean>> callback) {
|
||||
|
||||
API.get().otoApi(mContext)
|
||||
.getHomeRecommend(page)
|
||||
@ -683,7 +684,7 @@ public class OTONetManager {
|
||||
HttpCallback<List<HomeItemBean>> callback) {
|
||||
|
||||
API.get().otoApi(mContext)
|
||||
.search(keyword, age, name_auth, sex, "",page)
|
||||
.search(keyword, age, name_auth, sex, "", page)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(model -> {
|
||||
@ -700,6 +701,7 @@ public class OTONetManager {
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void getSearchRecommend(HttpCallback<List<HomeItemBean>> callback) {
|
||||
|
||||
API.get().otoApi(mContext)
|
||||
@ -723,6 +725,7 @@ public class OTONetManager {
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
private MultipartBody.Part createUploadFile(File file) {
|
||||
RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file);
|
||||
return MultipartBody.Part.createFormData("file", file.getName(), requestBody);
|
||||
@ -785,6 +788,65 @@ public class OTONetManager {
|
||||
|
||||
}
|
||||
}).isDisposed();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取系统 Label
|
||||
*
|
||||
* @param callback
|
||||
*/
|
||||
public void getSysLabel(HttpCallback<List<LabelBean>> callback) {
|
||||
API.get().otoApi(mContext)
|
||||
.getSysLabel()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<List<LabelBean>>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<List<LabelBean>> objectResponseModel) throws Exception {
|
||||
if (objectResponseModel.getData().getCode() == 0) {
|
||||
callback.onSuccess(objectResponseModel.getData().getInfo());
|
||||
} else {
|
||||
callback.onError(objectResponseModel.getData().getMsg());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(com.yunbao.common.R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 设置基本资料
|
||||
*/
|
||||
public void setLabels(
|
||||
String labels,
|
||||
HttpCallback<HttpCallbackModel> callback) {
|
||||
|
||||
API.get().otoApi(mContext).setLabels(labels)
|
||||
.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();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ public class RouteManager {
|
||||
public static final String ACTIVITY_HOME_RANK = "/activity/HomepageRankingActivity";
|
||||
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 ACTIVITY_CALL_VIDEO = "/activity/CallVideoActivity";
|
||||
public static final String PATH_EDITPROFILE = "/main/EditProfileActivity";
|
||||
|
||||
//设置基本资料
|
||||
@ -26,7 +26,6 @@ public class RouteManager {
|
||||
//选择标签
|
||||
public static final String ACTIVITY_CHOOSE_LABEL = "/activity/ChooseLabelActivity";
|
||||
|
||||
|
||||
/**
|
||||
* 选择标签
|
||||
*/
|
||||
@ -48,51 +47,40 @@ public class RouteManager {
|
||||
ARouter.getInstance().build(ACTIVITY_COMPLETE).navigation();
|
||||
}
|
||||
|
||||
|
||||
public static void forwardMainActivity() {
|
||||
ARouter.getInstance().build(ACTIVITY_MAIN)
|
||||
.navigation();
|
||||
ARouter.getInstance().build(ACTIVITY_MAIN).navigation();
|
||||
}
|
||||
|
||||
public static void forwardMainActivityForScreen(Bundle bundle) {
|
||||
ARouter.getInstance().build(ACTIVITY_MAIN)
|
||||
.withBundle("screen",bundle)
|
||||
.navigation();
|
||||
ARouter.getInstance().build(ACTIVITY_MAIN).withBundle("screen", bundle).navigation();
|
||||
}
|
||||
|
||||
public static void forwardMsgMoreConfigActivity() {
|
||||
ARouter.getInstance().build(ACTIVITY_MSG_MORE_CONFIG_ACTIVITY)
|
||||
.navigation();
|
||||
ARouter.getInstance().build(ACTIVITY_MSG_MORE_CONFIG_ACTIVITY).navigation();
|
||||
}
|
||||
|
||||
public static void forwardMsgChatActivity() {
|
||||
ARouter.getInstance().build(ACTIVITY_MSG_CHAT)
|
||||
.navigation();
|
||||
ARouter.getInstance().build(ACTIVITY_MSG_CHAT).navigation();
|
||||
}
|
||||
|
||||
public static void forwardEntryActivity() {
|
||||
ARouter.getInstance().build(ACTIVITY_ENTRY)
|
||||
.navigation();
|
||||
ARouter.getInstance().build(ACTIVITY_ENTRY).navigation();
|
||||
}
|
||||
|
||||
public static void forwardLoginActivity() {
|
||||
ARouter.getInstance().build(ACTIVITY_LOGIN)
|
||||
.navigation();
|
||||
ARouter.getInstance().build(ACTIVITY_LOGIN).navigation();
|
||||
}
|
||||
|
||||
public static void forwardWebViewActivity(String title, String url) {
|
||||
ARouter.getInstance().build(ACTIVITY_WEB_VIEW)
|
||||
.withString("title", title)
|
||||
.withString("url", url)
|
||||
.navigation();
|
||||
ARouter.getInstance().build(ACTIVITY_WEB_VIEW).withString("title", title).withString("url", url).navigation();
|
||||
}
|
||||
|
||||
public static void forwardActivity(String path) {
|
||||
ARouter.getInstance().build(path)
|
||||
.navigation();
|
||||
ARouter.getInstance().build(path).navigation();
|
||||
}
|
||||
public static void forwardActivity(String path,Bundle bundle) {
|
||||
ARouter.getInstance().build(path)
|
||||
.withBundle("bundle",bundle)
|
||||
.navigation();
|
||||
|
||||
public static void forwardActivity(String path, Bundle bundle) {
|
||||
ARouter.getInstance().build(path).withBundle("bundle", bundle).navigation();
|
||||
}
|
||||
|
||||
|
||||
|
@ -8,6 +8,7 @@ import com.shayu.onetoone.bean.GreetBean;
|
||||
import com.shayu.onetoone.bean.HomeItemBean;
|
||||
import com.shayu.onetoone.bean.HomeRankBean;
|
||||
import com.shayu.onetoone.bean.JoinAnchorBean;
|
||||
import com.shayu.onetoone.bean.LabelBean;
|
||||
import com.shayu.onetoone.bean.MessageConsumeConfigBean;
|
||||
import com.shayu.onetoone.bean.OfficialNoticeBean;
|
||||
import com.shayu.onetoone.bean.PurseBean;
|
||||
@ -175,7 +176,6 @@ public interface OneToOneApi {
|
||||
Observable<ResponseModel<List<HomeItemBean>>> getSearchRecommend();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 设置基本信息
|
||||
*/
|
||||
@ -188,7 +188,6 @@ public interface OneToOneApi {
|
||||
@Field("birthday") String birthday
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* 获取系统默认头像列表
|
||||
*/
|
||||
@ -200,7 +199,17 @@ public interface OneToOneApi {
|
||||
* 获取系统标签
|
||||
*/
|
||||
@GET("/api/public/?service=Friendapplable.get")
|
||||
Observable<ResponseModel<List<HomeRankBean>>> getSysLabel(
|
||||
Observable<ResponseModel<List<LabelBean>>> getSysLabel(
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* 设置基本信息
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/api/public/?service=Friendappinfos.setLabel")
|
||||
Observable<ResponseModel<List<BaseModel>>> setLabels(
|
||||
@Field("labels") String avatar
|
||||
);
|
||||
|
||||
}
|
||||
|
25
OneToOne/src/main/res/drawable/bg_rect_round_tag_btn.xml
Normal file
25
OneToOne/src/main/res/drawable/bg_rect_round_tag_btn.xml
Normal file
@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:state_pressed="true">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#F1F1F1" />
|
||||
<corners android:radius="20dp" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item android:state_selected="true">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#F1F1F1" />
|
||||
<corners android:radius="20dp" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#F1F1F1" />
|
||||
<corners android:radius="20dp" />
|
||||
<stroke android:width="1dp" android:color="#F1F1F1" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
10
OneToOne/src/main/res/drawable/bg_rect_round_tag_btn1.xml
Normal file
10
OneToOne/src/main/res/drawable/bg_rect_round_tag_btn1.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#A279E4" />
|
||||
<corners android:radius="20dp" />
|
||||
<stroke android:width="1dp" android:color="#A279E4" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
@ -3,6 +3,7 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white"
|
||||
android:orientation="vertical"
|
||||
android:padding="15dp">
|
||||
|
||||
@ -11,6 +12,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right"
|
||||
android:layout_marginTop="15dp"
|
||||
android:padding="10dp"
|
||||
android:text="跳过"
|
||||
android:textColor="@color/black2"
|
||||
@ -18,7 +20,8 @@
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
@ -31,24 +34,44 @@
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="我的标签"
|
||||
android:textColor="@color/black2"
|
||||
android:textSize="16sp" />
|
||||
android:textSize="18sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/notitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="暂无标签"
|
||||
android:textColor="@color/gray1"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<com.xuexiang.xui.widget.flowlayout.FlowTagLayout
|
||||
android:id="@+id/myLabel"
|
||||
android:id="@+id/myFlowTag"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
app:ftl_check_mode="none" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</ScrollView>
|
||||
|
||||
<Button
|
||||
android:id="@+id/submit"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center|bottom"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:background="@drawable/bg_rect_round_tag_btn1"
|
||||
android:padding="10dp"
|
||||
android:text="完成"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="18sp" />
|
||||
|
||||
</LinearLayout>
|
25
OneToOne/src/main/res/layout/adapter_choose_label.xml
Normal file
25
OneToOne/src/main/res/layout/adapter_choose_label.xml
Normal file
@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="我的标签"
|
||||
android:textColor="@color/black2"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<com.xuexiang.xui.widget.flowlayout.FlowTagLayout
|
||||
android:id="@+id/myFlowTag"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
app:ftl_check_mode="none" />
|
||||
|
||||
</LinearLayout>
|
21
OneToOne/src/main/res/layout/adapter_item_tag.xml
Normal file
21
OneToOne/src/main/res/layout/adapter_item_tag.xml
Normal file
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_tag"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="32dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="@drawable/bg_rect_round_tag_btn"
|
||||
android:paddingStart="15dp"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingEnd="15dp"
|
||||
android:paddingBottom="5dp"
|
||||
android:text="活泼"
|
||||
android:textColor="@color/black2" />
|
||||
|
||||
</LinearLayout>
|
Loading…
x
Reference in New Issue
Block a user