设置基本资料
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package com.shayu.onetoone.activity;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
@@ -19,6 +18,7 @@ import com.shayu.onetoone.activity.fragments.DynamicFragment;
|
||||
import com.shayu.onetoone.activity.fragments.FriendsFragment;
|
||||
import com.shayu.onetoone.activity.fragments.MessageFragment;
|
||||
import com.shayu.onetoone.activity.fragments.MyFragment;
|
||||
import com.shayu.onetoone.bean.JoinAnchorBean;
|
||||
import com.shayu.onetoone.bean.OfficialNoticeBean;
|
||||
import com.shayu.onetoone.event.MessageMsgBusEvent;
|
||||
import com.shayu.onetoone.manager.OTONetManager;
|
||||
@@ -27,8 +27,10 @@ import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.manager.NoviceInstructorManager;
|
||||
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
@@ -114,39 +116,63 @@ public class MainActivity extends AbsOTOActivity {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
checkUserInfoIsSet();
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测用户是否设置个人信息
|
||||
*/
|
||||
private void checkUserInfoIsSet() {
|
||||
OTONetManager.getInstance(mContext).getBaseInfos(true, new com.yunbao.common.http.base.HttpCallback<com.shayu.onetoone.bean.UserBean>() {
|
||||
@Override
|
||||
public void onSuccess(com.shayu.onetoone.bean.UserBean data) {
|
||||
if (data.getStatus() == 0) {
|
||||
RouteManager.forwardCompleteActivity();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void showRedPoint(int count) {
|
||||
OTONetManager.getInstance(mContext)
|
||||
.getMessageSystemLists(new HttpCallback<List<OfficialNoticeBean>>() {
|
||||
int point = 0;
|
||||
OTONetManager.getInstance(mContext).getMessageSystemLists(new HttpCallback<List<OfficialNoticeBean>>() {
|
||||
int point = 0;
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<OfficialNoticeBean> data) {
|
||||
for (OfficialNoticeBean datum : data) {
|
||||
point += datum.getNum();
|
||||
}
|
||||
//大于0则是通过会话未读监听器获取到的数,则不用再调用获取未读数接口了
|
||||
if (count >= 0) {
|
||||
updateUnreadCount(point + count);
|
||||
return;
|
||||
}
|
||||
RongIMClient.getInstance().getTotalUnreadCount(new RongIMClient.ResultCallback<Integer>() {
|
||||
@Override
|
||||
public void onSuccess(List<OfficialNoticeBean> data) {
|
||||
for (OfficialNoticeBean datum : data) {
|
||||
point += datum.getNum();
|
||||
}
|
||||
//大于0则是通过会话未读监听器获取到的数,则不用再调用获取未读数接口了
|
||||
if (count >= 0) {
|
||||
updateUnreadCount(point + count);
|
||||
return;
|
||||
}
|
||||
RongIMClient.getInstance().getTotalUnreadCount(new RongIMClient.ResultCallback<Integer>() {
|
||||
@Override
|
||||
public void onSuccess(Integer integer) {
|
||||
updateUnreadCount(point + integer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(RongIMClient.ErrorCode e) {
|
||||
|
||||
}
|
||||
});
|
||||
public void onSuccess(Integer integer) {
|
||||
updateUnreadCount(point + integer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
public void onError(RongIMClient.ErrorCode e) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void updateUnreadCount(int count) {
|
||||
|
||||
@@ -34,6 +34,7 @@ import com.opensource.svgaplayer.SVGAVideoEntity;
|
||||
import com.shayu.onetoone.R;
|
||||
import com.shayu.onetoone.adapter.MainMeAdapter;
|
||||
import com.shayu.onetoone.bean.SlideBean;
|
||||
import com.shayu.onetoone.manager.RouteManager;
|
||||
import com.shayu.onetoone.utils.MainHttpConsts;
|
||||
import com.shayu.onetoone.utils.MainHttpUtil;
|
||||
import com.shayu.onetoone.view.CustomMyViewHolder;
|
||||
@@ -114,7 +115,6 @@ public class MyFragment extends BaseFragment implements OnItemClickListener<User
|
||||
private LinearLayout lt_advertisement;
|
||||
private View redPoint;
|
||||
|
||||
|
||||
@Override
|
||||
public View createView(LayoutInflater inflater, ViewGroup container, Bundle
|
||||
savedInstanceState) {
|
||||
@@ -129,7 +129,8 @@ public class MyFragment extends BaseFragment implements OnItemClickListener<User
|
||||
ViewClicksAntiShake.clicksAntiShake(mAvatar, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
RouteUtil.forwardUserHome(mContext, CommonAppConfig.getInstance().getUid(), 2);
|
||||
//RouteUtil.forwardUserHome(mContext, CommonAppConfig.getInstance().getUid(), 2);
|
||||
RouteManager.forwardEditProfileActivity();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -139,7 +140,8 @@ public class MyFragment extends BaseFragment implements OnItemClickListener<User
|
||||
ViewClicksAntiShake.clicksAntiShake(gift_svga, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
RouteUtil.forwardUserHome(mContext, CommonAppConfig.getInstance().getUid(), 2);
|
||||
//RouteUtil.forwardUserHome(mContext, CommonAppConfig.getInstance().getUid(), 2);
|
||||
RouteManager.forwardEditProfileActivity();
|
||||
}
|
||||
});
|
||||
user_noble_ico = (ImageView) itemView.findViewById(R.id.user_noble_ico);
|
||||
|
||||
@@ -0,0 +1,251 @@
|
||||
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 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.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.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;
|
||||
|
||||
|
||||
/**
|
||||
* 完善个人资料
|
||||
*/
|
||||
@Route(path = RouteManager.ACTIVITY_COMPLETE)
|
||||
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; //提交资料
|
||||
|
||||
private int sex = -1;
|
||||
|
||||
ProcessImageUtil cameraUtil;
|
||||
|
||||
private File mAvatarFile;
|
||||
|
||||
int year;
|
||||
int month;
|
||||
int day;
|
||||
|
||||
private String avatarUrl;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_complete;
|
||||
}
|
||||
|
||||
@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();
|
||||
}
|
||||
|
||||
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 (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() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@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() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
chooseImage();
|
||||
}
|
||||
});
|
||||
|
||||
userBirthday.setText(year + " 年 " + (month + 1) + " 月 " + day + " 日 ");
|
||||
|
||||
userSex1.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
changeSex(0);
|
||||
}
|
||||
});
|
||||
userSex2.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
changeSex(1);
|
||||
}
|
||||
});
|
||||
userBirthday.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) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 选择图片
|
||||
*/
|
||||
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();
|
||||
} else {
|
||||
cameraUtil.getImageByAlumb();
|
||||
}
|
||||
});
|
||||
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);
|
||||
} 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,71 @@
|
||||
package com.shayu.onetoone.activity.login;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
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 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.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.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;
|
||||
|
||||
|
||||
/**
|
||||
* 完善个人资料
|
||||
*/
|
||||
@Route(path = RouteManager.ACTIVITY_COMPLETE)
|
||||
public class CompleteActivity 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; //提交资料
|
||||
|
||||
private int sex = -1;
|
||||
|
||||
ProcessImageUtil cameraUtil;
|
||||
|
||||
private File mAvatarFile;
|
||||
|
||||
int year;
|
||||
int month;
|
||||
int day;
|
||||
|
||||
private String avatarUrl;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
@@ -20,6 +74,178 @@ public class CompleteActivity extends AbsOTOActivity {
|
||||
|
||||
@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();
|
||||
}
|
||||
|
||||
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 (file != null) {
|
||||
mAvatarFile = file;
|
||||
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();
|
||||
ToastUtil.show("上传成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show("上传失败");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@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(CompleteActivity.this, avatarUrl, userAvatar);
|
||||
}
|
||||
if (!StringUtils.isEmpty(CommonAppConfig.getInstance().getUserBean().getUserNiceName())) {
|
||||
userNickName.setText(CommonAppConfig.getInstance().getUserBean().getUserNiceName());
|
||||
}
|
||||
editHead.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
chooseImage();
|
||||
}
|
||||
});
|
||||
|
||||
userBirthday.setText(year + " 年 " + (month + 1) + " 月 " + day + " 日 ");
|
||||
|
||||
userSex1.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
changeSex(0);
|
||||
}
|
||||
});
|
||||
userSex2.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
changeSex(1);
|
||||
}
|
||||
});
|
||||
userBirthday.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
//时间选择器
|
||||
Calendar selectedDate = Calendar.getInstance();
|
||||
selectedDate.set(year, month, day);
|
||||
TimePickerView pvTime = new TimePickerBuilder(CompleteActivity.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(CompleteActivity.this, MainActivity.class);
|
||||
intent.putExtra(Constants.SHOW_INVITE, false);
|
||||
startActivity(intent);
|
||||
|
||||
RouteManager.forwardMainActivity();
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 选择图片
|
||||
*/
|
||||
private void chooseImage() {
|
||||
UserAvatarPopup userAvatarPopup = new UserAvatarPopup(this, userAvatar1 -> {
|
||||
avatarUrl = userAvatar1;
|
||||
ImgLoader.display(CompleteActivity.this, avatarUrl, userAvatar);
|
||||
//txtChoose.setVisibility(View.GONE);
|
||||
}, isCamera -> {
|
||||
if (isCamera) {
|
||||
cameraUtil.getImageByCamera();
|
||||
} else {
|
||||
cameraUtil.getImageByAlumb();
|
||||
}
|
||||
});
|
||||
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);
|
||||
} 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -201,12 +201,12 @@ public class LoginActivity extends AbsOTOActivity {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
//注册
|
||||
private void register() {
|
||||
startActivity(new Intent(mContext, RegisterActivity.class));
|
||||
//RouteManager.forwardCompleteActivity();
|
||||
}
|
||||
|
||||
//忘记密码
|
||||
@@ -235,19 +235,18 @@ public class LoginActivity extends AbsOTOActivity {
|
||||
loadingDialog = new LoadingDialog();
|
||||
loadingDialog.show(getSupportFragmentManager(), "LoadingDialog");
|
||||
loadingDialog.setShowText(getString(R.string.login_ing));
|
||||
OTONetManager.getInstance(mContext)
|
||||
.login(phoneNum, pwd, uuid, new com.yunbao.common.http.base.HttpCallback<IMLoginModel>() {
|
||||
@Override
|
||||
public void onSuccess(IMLoginModel data) {
|
||||
onLoginSuccess(data);
|
||||
}
|
||||
OTONetManager.getInstance(mContext).login(phoneNum, pwd, uuid, new com.yunbao.common.http.base.HttpCallback<IMLoginModel>() {
|
||||
@Override
|
||||
public void onSuccess(IMLoginModel data) {
|
||||
onLoginSuccess(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(error);
|
||||
loadingDialog.dismiss();
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(error);
|
||||
loadingDialog.dismiss();
|
||||
}
|
||||
});
|
||||
hideKeyboard(mEditPwd);
|
||||
}
|
||||
|
||||
@@ -283,46 +282,44 @@ public class LoginActivity extends AbsOTOActivity {
|
||||
* 获取用户信息
|
||||
*/
|
||||
private void getBaseUserInfo() {
|
||||
OTONetManager.getInstance(mContext)
|
||||
.getBaseInfos(true, new com.yunbao.common.http.base.HttpCallback<com.shayu.onetoone.bean.UserBean>() {
|
||||
OTONetManager.getInstance(mContext).getBaseInfos(true, new com.yunbao.common.http.base.HttpCallback<com.shayu.onetoone.bean.UserBean>() {
|
||||
@Override
|
||||
public void onSuccess(com.shayu.onetoone.bean.UserBean data) {
|
||||
RongcloudIMManager.connectIM(mContext);
|
||||
OTONetManager.getInstance(mContext).getRandJoinAnchor(new com.yunbao.common.http.base.HttpCallback<JoinAnchorBean>() {
|
||||
@Override
|
||||
public void onSuccess(com.shayu.onetoone.bean.UserBean data) {
|
||||
RongcloudIMManager.connectIM(mContext);
|
||||
OTONetManager.getInstance(mContext)
|
||||
.getRandJoinAnchor(new com.yunbao.common.http.base.HttpCallback<JoinAnchorBean>() {
|
||||
@Override
|
||||
public void onSuccess(JoinAnchorBean data) {
|
||||
if (mFirstLogin) {
|
||||
IMLoginManager.get(mContext).setNewUserGif(true);
|
||||
IMLoginManager.get(mContext).setisNewUserOne(true);
|
||||
public void onSuccess(JoinAnchorBean data) {
|
||||
if (mFirstLogin) {
|
||||
IMLoginManager.get(mContext).setNewUserGif(true);
|
||||
IMLoginManager.get(mContext).setisNewUserOne(true);
|
||||
// MainActivity.forward(EntryActivity.this, false);
|
||||
if (!StringUtil.isEmpty(data.getHome_zdy_img_us())) {
|
||||
home_zdy_img_us = data.getHome_zdy_img_us();
|
||||
home_zdy_img_cn = data.getHome_zdy_img_cn();
|
||||
}
|
||||
if (!StringUtil.isEmpty(data.getHome_zdy_pop())) {
|
||||
NoviceInstructorManager.get(mContext).setHomeZdyPop(data.getHome_zdy_pop());
|
||||
}
|
||||
IMLoginManager.get(mContext).setisNewUserOne(true);
|
||||
IMLoginManager.get(mContext).setNewUserGif(true);
|
||||
}
|
||||
loadingDialog.dismiss();
|
||||
RouteManager.forwardMainActivity();
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(error);
|
||||
}
|
||||
});
|
||||
if (!StringUtil.isEmpty(data.getHome_zdy_img_us())) {
|
||||
home_zdy_img_us = data.getHome_zdy_img_us();
|
||||
home_zdy_img_cn = data.getHome_zdy_img_cn();
|
||||
}
|
||||
if (!StringUtil.isEmpty(data.getHome_zdy_pop())) {
|
||||
NoviceInstructorManager.get(mContext).setHomeZdyPop(data.getHome_zdy_pop());
|
||||
}
|
||||
IMLoginManager.get(mContext).setisNewUserOne(true);
|
||||
IMLoginManager.get(mContext).setNewUserGif(true);
|
||||
}
|
||||
loadingDialog.dismiss();
|
||||
RouteManager.forwardMainActivity();
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
ToastUtil.show(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.blankj.utilcode.util.DeviceUtils;
|
||||
import com.blankj.utilcode.util.GsonUtils;
|
||||
import com.blankj.utilcode.util.StringUtils;
|
||||
import com.fm.openinstall.OpenInstall;
|
||||
import com.fm.openinstall.listener.AppInstallAdapter;
|
||||
import com.fm.openinstall.model.AppData;
|
||||
@@ -33,6 +34,7 @@ import com.sahooz.library.CountryPicker;
|
||||
import com.sahooz.library.OnPick;
|
||||
import com.shayu.onetoone.R;
|
||||
import com.shayu.onetoone.activity.MainActivity;
|
||||
import com.shayu.onetoone.manager.RouteManager;
|
||||
import com.shayu.onetoone.utils.MainHttpUtil;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
@@ -52,6 +54,7 @@ import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
import com.yunbao.common.utils.LiveRoomCheckLivePresenter;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.common.utils.SpUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
@@ -121,8 +124,8 @@ public class RegisterActivity extends AbsActivity {
|
||||
getUuidDevice();
|
||||
getPromoCode();
|
||||
|
||||
mGetCode =mContext.getString(R.string.reg_get_code);
|
||||
mGetCodeAgain =mContext.getString(R.string.reg_get_code_again);
|
||||
mGetCode = mContext.getString(R.string.reg_get_code);
|
||||
mGetCodeAgain = mContext.getString(R.string.reg_get_code_again);
|
||||
mTvCountryCodeClick();
|
||||
mEditPhone.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
@@ -280,9 +283,9 @@ public class RegisterActivity extends AbsActivity {
|
||||
} else if (i == R.id.btn_register) {
|
||||
register();
|
||||
} else if (i == R.id.btn_tip2) {
|
||||
WebViewActivity.forward(mContext, HtmlConfig.REG_PRIVCAY1,false);
|
||||
WebViewActivity.forward(mContext, HtmlConfig.REG_PRIVCAY1, false);
|
||||
} else if (i == R.id.btn_tip3) {
|
||||
WebViewActivity.forward(mContext, HtmlConfig.REG_PRIVCAY2,false);
|
||||
WebViewActivity.forward(mContext, HtmlConfig.REG_PRIVCAY2, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -362,12 +365,12 @@ public class RegisterActivity extends AbsActivity {
|
||||
mDialog.show();
|
||||
}
|
||||
String ti = "";
|
||||
if (edit_invitecode_2.getText().toString().trim().equals("此設備已註冊")){
|
||||
if (edit_invitecode_2.getText().toString().trim().equals("此設備已註冊")) {
|
||||
ti = "";
|
||||
}else{
|
||||
} else {
|
||||
ti = edit_invitecode_2.getText().toString().trim();
|
||||
}
|
||||
MainHttpUtil.register(UserID,ti, phoneNum, mPromoCode, mUuidDevice, mCountryCode, pwd, pwd2, code, new HttpCallback() {
|
||||
MainHttpUtil.register(UserID, ti, phoneNum, mPromoCode, mUuidDevice, mCountryCode, pwd, pwd2, code, new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0) {
|
||||
@@ -402,25 +405,25 @@ public class RegisterActivity extends AbsActivity {
|
||||
//获取自定义数据
|
||||
if (appData.getData() != null && !appData.getData().equals("")) {
|
||||
JSONObject data = JSON.parseObject(appData.getData());
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == true) {
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == true) {
|
||||
yqm_view.setVisibility(View.VISIBLE);
|
||||
MainHttpUtil.getDeviceLoginType(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if(code == 201){
|
||||
if (code == 201) {
|
||||
edit_invitecode_2.setText("此設備已註冊");
|
||||
edit_invitecode_2.setEnabled(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
yqm_view.setVisibility(View.GONE);
|
||||
//推广的码
|
||||
} else {
|
||||
yqm_view.setVisibility(View.GONE);
|
||||
//推广的码
|
||||
mPromoCode = data.getString("admin_id") + "";
|
||||
//用户的码
|
||||
UserID = data.getString("user_id") + "";
|
||||
}
|
||||
Log.d("OpenInstall", UserID+"appData.getData()1111= " + mPromoCode);
|
||||
Log.d("OpenInstall", UserID + "appData.getData()1111= " + mPromoCode);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -483,41 +486,35 @@ public class RegisterActivity extends AbsActivity {
|
||||
@Override
|
||||
public void run() {
|
||||
IMLoginModel userInfo = IMLoginManager.get(activity).getUserInfo();
|
||||
HttpClient.getInstance().post("Home.getRandJoinAnchor", "Home.getRandJoinAnchor")
|
||||
.params("uid", userInfo.getId())
|
||||
.params("token", userInfo.getToken())
|
||||
.execute(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (info[0] != null) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
IMLoginManager.get(activity).setisNewUserOne(true);
|
||||
IMLoginManager.get(activity).setNewUserGif(true);
|
||||
if (obj.containsKey("home_zdy_img_us")) {
|
||||
home_zdy_img_us = obj.getString("home_zdy_img_us");
|
||||
home_zdy_img_cn = obj.getString("home_zdy_img_cn");
|
||||
}
|
||||
gotoLive(obj.getString("anchor_id"));
|
||||
if (obj.containsKey("home_zdy_pop")) {
|
||||
NoviceInstructorManager.get(mContext).setHomeZdyPop(obj.getString("home_zdy_pop"));
|
||||
}
|
||||
jumpMain(false);
|
||||
} else {
|
||||
jumpMain(false);
|
||||
}
|
||||
// EventBus.getDefault().post(new RegSuccessEvent());
|
||||
HttpClient.getInstance().post("Home.getRandJoinAnchor", "Home.getRandJoinAnchor").params("uid", userInfo.getId()).params("token", userInfo.getToken()).execute(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (info[0] != null) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
IMLoginManager.get(activity).setisNewUserOne(true);
|
||||
IMLoginManager.get(activity).setNewUserGif(true);
|
||||
if (obj.containsKey("home_zdy_img_us")) {
|
||||
home_zdy_img_us = obj.getString("home_zdy_img_us");
|
||||
home_zdy_img_cn = obj.getString("home_zdy_img_cn");
|
||||
}
|
||||
});
|
||||
gotoLive(obj.getString("anchor_id"));
|
||||
if (obj.containsKey("home_zdy_pop")) {
|
||||
NoviceInstructorManager.get(mContext).setHomeZdyPop(obj.getString("home_zdy_pop"));
|
||||
}
|
||||
jumpMain(false);
|
||||
} else {
|
||||
jumpMain(false);
|
||||
}
|
||||
// EventBus.getDefault().post(new RegSuccessEvent());
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
private void jumpMain(boolean showInvite) {
|
||||
Intent intent = new Intent(activity, MainActivity.class);
|
||||
intent.putExtra(Constants.SHOW_INVITE, showInvite);
|
||||
startActivity(intent);
|
||||
RouteManager.forwardCompleteActivity();
|
||||
}
|
||||
|
||||
|
||||
private void gotoLive(final String live_id) {
|
||||
LiveHttpUtil.getLiveInfo(live_id, new HttpCallback() {
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user