This commit is contained in:
zlzw 2023-11-02 15:23:38 +08:00
parent 43362d3800
commit c530db25d5
12 changed files with 349 additions and 248 deletions

View File

@ -126,6 +126,7 @@
android:screenOrientation="portrait" /> android:screenOrientation="portrait" />
<activity <activity
android:name=".activity.message.ChatActivity" android:name=".activity.message.ChatActivity"
android:launchMode="singleTask"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustResize" /> android:windowSoftInputMode="stateHidden|adjustResize" />
<activity <activity

View File

@ -45,6 +45,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import io.rong.callkit.CallEndMessageItemProvider; import io.rong.callkit.CallEndMessageItemProvider;
import io.rong.imkit.IMCenter;
import io.rong.imkit.RongIM; import io.rong.imkit.RongIM;
import io.rong.imkit.config.RongConfigCenter; import io.rong.imkit.config.RongConfigCenter;
import io.rong.imkit.conversation.extension.RongExtension; import io.rong.imkit.conversation.extension.RongExtension;
@ -55,6 +56,7 @@ import io.rong.imkit.utils.RouteUtils;
import io.rong.imkit.widget.adapter.ProviderManager; import io.rong.imkit.widget.adapter.ProviderManager;
import io.rong.imlib.IMLibRTCClient; import io.rong.imlib.IMLibRTCClient;
import io.rong.imlib.RongIMClient; import io.rong.imlib.RongIMClient;
import io.rong.imlib.model.InitOption;
import io.rong.imlib.model.Message; import io.rong.imlib.model.Message;
import io.rong.imlib.model.MessageContent; import io.rong.imlib.model.MessageContent;
import io.rong.message.CommandMessage; import io.rong.message.CommandMessage;

View File

@ -64,6 +64,7 @@ import com.yunbao.common.utils.ProcessImageUtil;
import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.Subscribe;
@ -289,7 +290,9 @@ public class ChatMessageFragment extends AbsConversationFragment {
} }
}); });
video.setOnClickListener(v -> { ViewClicksAntiShake.clicksAntiShake(video, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
if (call.getTag() != null) { if (call.getTag() != null) {
ToastUtil.show(R.string.toast_call_not_unlock); ToastUtil.show(R.string.toast_call_not_unlock);
return; return;
@ -349,8 +352,11 @@ public class ChatMessageFragment extends AbsConversationFragment {
} }
} }
}); });
}
}); });
call.setOnClickListener(v -> { ViewClicksAntiShake.clicksAntiShake(call, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
if (call.getTag() != null) { if (call.getTag() != null) {
ToastUtil.show(R.string.toast_call_not_unlock); ToastUtil.show(R.string.toast_call_not_unlock);
return; return;
@ -411,8 +417,11 @@ public class ChatMessageFragment extends AbsConversationFragment {
} }
} }
}); });
}
}); });
img.setOnClickListener(v -> { ViewClicksAntiShake.clicksAntiShake(img, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
new BottomListDialog(mContext) new BottomListDialog(mContext)
.setStrings(Arrays.asList(WordUtil.getNewString(R.string.album), WordUtil.getNewString(R.string.camera))) .setStrings(Arrays.asList(WordUtil.getNewString(R.string.album), WordUtil.getNewString(R.string.camera)))
.setSelect(new OnItemClickListener<String>() { .setSelect(new OnItemClickListener<String>() {
@ -466,7 +475,9 @@ public class ChatMessageFragment extends AbsConversationFragment {
}); });
} }
}).showDialog(); }).showDialog();
}
}); });
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
throw new RuntimeException(e); throw new RuntimeException(e);

View File

@ -174,6 +174,11 @@ public class MsgFriendFragment extends BaseFragment implements BaseAdapter.OnIte
} }
public void getNewData(List<HomeItemBean> data) { public void getNewData(List<HomeItemBean> data) {
if(data==null){
page=1;
initData();
return;
}
for (int i = 0; i < data.size(); i++) { for (int i = 0; i < data.size(); i++) {
HomeItemBean item = data.get(i); HomeItemBean item = data.get(i);
boolean over = i == data.size() - 1; boolean over = i == data.size() - 1;

View File

@ -416,9 +416,7 @@ public class CallVideoActivity extends AbsOTOActivity {
}); });
windowListener = new WindowCallStatusListener(view); windowListener = new WindowCallStatusListener(view);
CallClientManager.getManager().addOnVoIPCallListener(EasyFloat.class, windowListener); CallClientManager.getManager().addOnVoIPCallListener(EasyFloat.class, windowListener);
if (toPay) {
RouteManager.forwardWebViewActivity(null, HtmlUrlUtils.getPayUrl(mContext, false, HtmlUrlUtils.URL_PAY_COIN));
}
} }
@Override @Override
@ -447,6 +445,9 @@ public class CallVideoActivity extends AbsOTOActivity {
} }
}).show(); }).show();
if (toPay) {
RouteManager.forwardWebViewActivity(null, HtmlUrlUtils.getPayUrl(mContext, false, HtmlUrlUtils.URL_PAY_COIN));
}
if (toChatView) { if (toChatView) {
ConversationUtils.startConversation(mContext, targetId); ConversationUtils.startConversation(mContext, targetId);
} }
@ -516,7 +517,7 @@ public class CallVideoActivity extends AbsOTOActivity {
} else if (id == R.id.follow) { } else if (id == R.id.follow) {
follow(); follow();
} else if (id == R.id.money) { } else if (id == R.id.money) {
showWindow(true, false); showWindow(false, true);
} }
} }
}; };

View File

@ -20,9 +20,11 @@ import com.sahooz.library.OnPick;
import com.shayu.onetoone.R; import com.shayu.onetoone.R;
import com.shayu.onetoone.bean.AuthBean; import com.shayu.onetoone.bean.AuthBean;
import com.shayu.onetoone.bean.AvatarBean; import com.shayu.onetoone.bean.AvatarBean;
import com.shayu.onetoone.bean.UserBean;
import com.shayu.onetoone.manager.OTONetManager; import com.shayu.onetoone.manager.OTONetManager;
import com.shayu.onetoone.manager.RouteManager; import com.shayu.onetoone.manager.RouteManager;
import com.shayu.onetoone.utils.MainHttpUtil; import com.shayu.onetoone.utils.MainHttpUtil;
import com.shayu.onetoone.utils.UserManager;
import com.shayu.onetoone.view.UserAvatarPopup; import com.shayu.onetoone.view.UserAvatarPopup;
import com.tencent.imsdk.v2.V2TIMCallback; import com.tencent.imsdk.v2.V2TIMCallback;
import com.tencent.imsdk.v2.V2TIMManager; import com.tencent.imsdk.v2.V2TIMManager;
@ -32,7 +34,6 @@ import com.yunbao.common.Constants;
import com.yunbao.common.activity.AbsActivity; import com.yunbao.common.activity.AbsActivity;
import com.yunbao.common.activity.WebViewActivity; import com.yunbao.common.activity.WebViewActivity;
import com.yunbao.common.bean.HttpCallbackModel; import com.yunbao.common.bean.HttpCallbackModel;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.event.UpdateFieldEvent; import com.yunbao.common.event.UpdateFieldEvent;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
@ -58,11 +59,13 @@ import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.List;
import cn.qqtheme.framework.entity.City; import cn.qqtheme.framework.entity.City;
import cn.qqtheme.framework.entity.County; import cn.qqtheme.framework.entity.County;
import cn.qqtheme.framework.entity.Province; import cn.qqtheme.framework.entity.Province;
import cn.qqtheme.framework.picker.AddressPicker; import cn.qqtheme.framework.picker.AddressPicker;
import io.rong.imkit.userinfo.db.model.User;
/** /**
* 我的 编辑资料 * 我的 编辑资料
@ -78,6 +81,7 @@ public class EditProfileActivity extends AbsActivity {
private TextView mCity; private TextView mCity;
private TextView tv_bind_phone; private TextView tv_bind_phone;
private TextView auth_status; private TextView auth_status;
private TextView tag;
private ProcessImageUtil cameraUtil; private ProcessImageUtil cameraUtil;
private UserBean mUserBean; private UserBean mUserBean;
private String mProvinceVal; private String mProvinceVal;
@ -109,12 +113,19 @@ public class EditProfileActivity extends AbsActivity {
mSex = (TextView) findViewById(R.id.sex); mSex = (TextView) findViewById(R.id.sex);
mCity = (TextView) findViewById(R.id.city); mCity = (TextView) findViewById(R.id.city);
tv_bind_phone = (TextView) findViewById(R.id.tv_bind_phone); tv_bind_phone = (TextView) findViewById(R.id.tv_bind_phone);
mUserBean = CommonAppConfig.getInstance().getUserBean(); tag = findViewById(R.id.u_tag);
MainHttpUtil.getBaseInfo(new CommonCallback<UserBean>() { mUserBean = UserManager.getUserBean();
OTONetManager.getInstance(mContext)
.getBaseInfos(false, new com.yunbao.common.http.base.HttpCallback<UserBean>() {
@Override @Override
public void callback(UserBean u) { public void onSuccess(UserBean data) {
mUserBean = u; mUserBean = data;
showData(u); showData(mUserBean);
}
@Override
public void onError(String error) {
} }
}); });
findViewById(R.id.btn_person).setOnClickListener(new View.OnClickListener() { findViewById(R.id.btn_person).setOnClickListener(new View.OnClickListener() {
@ -135,7 +146,12 @@ public class EditProfileActivity extends AbsActivity {
}); });
}*/ }*/
initCamera(); initCamera();
com.shayu.onetoone.bean.UserBean bean = UserManager.getUserBean();
if (bean != null) {
tag.setText(bean.getInfo().getCn_label());
} }
}
private void initCamera() { private void initCamera() {
cameraUtil = new ProcessImageUtil(this, getPackageName() + ".fileprovider"); cameraUtil = new ProcessImageUtil(this, getPackageName() + ".fileprovider");
@ -202,7 +218,7 @@ public class EditProfileActivity extends AbsActivity {
@Override @Override
public void onBackPressed() { public void onBackPressed() {
if (userModel.getUserInfoComplete() == 1) { if (userModel.getUser().getUserInfoComplete() == 1) {
finish(); finish();
} else { } else {
new XPopup.Builder(mContext).asCustom(new CompleteInformationPopup(mContext, true, new CompleteInformationPopup.CompleteInformationCallBack() { new XPopup.Builder(mContext).asCustom(new CompleteInformationPopup(mContext, true, new CompleteInformationPopup.CompleteInformationCallBack() {
@ -303,15 +319,15 @@ public class EditProfileActivity extends AbsActivity {
public void onSuccess(HttpCallbackModel data) { public void onSuccess(HttpCallbackModel data) {
if (data.getCode() == 0) { if (data.getCode() == 0) {
ToastUtil.show(data.getMsg()); ToastUtil.show(data.getMsg());
UserBean u = CommonAppConfig.getInstance().getUserBean(); UserBean u = UserManager.getUserBean();
if (u != null) { if (u != null) {
u.setLocation(country.name); u.getUser().setLocation(country.name);
} }
if (userModel != null) { if (userModel != null) {
userModel.setLocation(country.name); userModel.getUser().setLocation(country.name);
showData(userModel);
} }
showData(userModel);
EventBus.getDefault().post(new UpdateFieldEvent()); EventBus.getDefault().post(new UpdateFieldEvent());
} }
} }
@ -340,13 +356,13 @@ public class EditProfileActivity extends AbsActivity {
private void editName() { private void editName() {
Intent intent = new Intent(mContext, EditNameActivity.class); Intent intent = new Intent(mContext, EditNameActivity.class);
intent.putExtra(Constants.NICK_NAME, mUserBean.getUserNiceName()); intent.putExtra(Constants.NICK_NAME, mUserBean.getUser().getUserNicename());
cameraUtil.startActivityForResult(intent, new ActivityResultCallback() { cameraUtil.startActivityForResult(intent, new ActivityResultCallback() {
@Override @Override
public void onSuccess(Intent intent) { public void onSuccess(Intent intent) {
if (intent != null) { if (intent != null) {
String nickName = intent.getStringExtra(Constants.NICK_NAME); String nickName = intent.getStringExtra(Constants.NICK_NAME);
mUserBean.setSignature(nickName); mUserBean.getUser().setSignature(nickName);
mName.setText(nickName); mName.setText(nickName);
EventBus.getDefault().post(new UpdateFieldEvent()); EventBus.getDefault().post(new UpdateFieldEvent());
} }
@ -422,13 +438,13 @@ public class EditProfileActivity extends AbsActivity {
return; return;
} }
Intent intent = new Intent(mContext, EditSignActivity.class); Intent intent = new Intent(mContext, EditSignActivity.class);
intent.putExtra(Constants.SIGN, mUserBean.getSignature()); intent.putExtra(Constants.SIGN, mUserBean.getUser().getSignature());
cameraUtil.startActivityForResult(intent, new ActivityResultCallback() { cameraUtil.startActivityForResult(intent, new ActivityResultCallback() {
@Override @Override
public void onSuccess(Intent intent) { public void onSuccess(Intent intent) {
if (intent != null) { if (intent != null) {
String sign = intent.getStringExtra(Constants.SIGN); String sign = intent.getStringExtra(Constants.SIGN);
mUserBean.setSignature(sign); mUserBean.getUser().setSignature(sign);
mSign.setText(sign); mSign.setText(sign);
EventBus.getDefault().post(new UpdateFieldEvent()); EventBus.getDefault().post(new UpdateFieldEvent());
} }
@ -447,7 +463,7 @@ public class EditProfileActivity extends AbsActivity {
return; return;
} }
String[] times = mUserBean.getBirthday().split("-"); String[] times = mUserBean.getUser().getBirthday().split("-");
year = Integer.parseInt(times[0]); year = Integer.parseInt(times[0]);
month = Integer.parseInt(times[1]) - 1; month = Integer.parseInt(times[1]) - 1;
day = Integer.parseInt(times[2]); day = Integer.parseInt(times[2]);
@ -474,11 +490,11 @@ public class EditProfileActivity extends AbsActivity {
@Override @Override
public void onSuccess(HttpCallbackModel data) { public void onSuccess(HttpCallbackModel data) {
if (data.getCode() == 0) { if (data.getCode() == 0) {
mUserBean.setBirthday(strbir); mUserBean.getUser().setBirthday(strbir);
mBirthday.setText(strbir); mBirthday.setText(strbir);
if (userModel != null) { if (userModel != null) {
userModel.setBirthday(strbir); userModel.getUser().setBirthday(strbir);
} }
showData(userModel); showData(userModel);
@ -535,10 +551,16 @@ public class EditProfileActivity extends AbsActivity {
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
public void onEditProfileEvent(/*EditProfileEvent event*/) { public void onEditProfileEvent(/*EditProfileEvent event*/) {
MainHttpUtil.getBaseInfo(new CommonCallback<UserBean>() { OTONetManager.getInstance(mContext)
.getBaseInfos(false, new com.yunbao.common.http.base.HttpCallback<UserBean>() {
@Override @Override
public void callback(UserBean u) { public void onSuccess(UserBean data) {
showData(u); showData(data);
}
@Override
public void onError(String error) {
} }
}); });
} }
@ -548,13 +570,13 @@ public class EditProfileActivity extends AbsActivity {
private void showData(UserBean u) { private void showData(UserBean u) {
userModel = u; userModel = u;
int index = 0; int index = 0;
String birthday = u.getBirthday(); String birthday = u.getUser().getBirthday();
String location = u.getLocation(); String location = u.getUser().getLocation();
String bindPhone = u.getMobile(); String bindPhone = u.getUser().getMobile();
String sex = ""; String sex = "";
if (u.getSex() == 1) { if (u.getUser().getSex() == 1) {
sex = mContext.getString(R.string.sex_male); sex = mContext.getString(R.string.sex_male);
} else if (u.getSex() == 2) { } else if (u.getUser().getSex() == 2) {
sex = mContext.getString(R.string.sex_female); sex = mContext.getString(R.string.sex_female);
} }
if (!TextUtils.isEmpty(bindPhone)) { if (!TextUtils.isEmpty(bindPhone)) {
@ -641,21 +663,21 @@ public class EditProfileActivity extends AbsActivity {
submit.setTextColor(Color.parseColor("#935902")); submit.setTextColor(Color.parseColor("#935902"));
submit.setEnabled(true); submit.setEnabled(true);
}*/ }*/
ImgLoader.displayAvatar(mContext, u.getAvatar(), mAvatar); ImgLoader.displayAvatar(mContext, u.getUser().getAvatar(), mAvatar);
mName.setText(u.getUserNiceName()); mName.setText(u.getUser().getUserNicename());
mSign.setText(u.getSignature()); mSign.setText(u.getUser().getSignature());
mBirthday.setText(u.getBirthday()); mBirthday.setText(u.getUser().getBirthday());
if (u.getSex() == 0) { if (u.getUser().getSex() == 0) {
mSex.setText(""); mSex.setText("");
} else if (u.getSex() == 1) { } else if (u.getUser().getSex() == 1) {
mSex.setText(R.string.sex_male); mSex.setText(R.string.sex_male);
} else if (u.getSex() == 2) { } else if (u.getUser().getSex() == 2) {
mSex.setText(R.string.sex_female); mSex.setText(R.string.sex_female);
} }
mCity.setText(u.getLocation()); mCity.setText(u.getUser().getCity());
if ("1".equals(u.getIs_bind())) { if (u.getUser().getLoginType().equals("phone")) {
mobile = u.getMobile(); mobile = u.getUser().getMobile();
tv_bind_phone.setText(mobile); tv_bind_phone.setText(mobile);
isBind = "1"; isBind = "1";
} else { } else {
@ -766,9 +788,9 @@ public class EditProfileActivity extends AbsActivity {
public void onSuccess(HttpCallbackModel data) { public void onSuccess(HttpCallbackModel data) {
ToastUtil.show(data.getMsg()); ToastUtil.show(data.getMsg());
if (data.getCode() == 0) { if (data.getCode() == 0) {
UserBean u = CommonAppConfig.getInstance().getUserBean(); UserBean u = UserManager.getUserBean();
if (u != null) { if (u != null) {
u.setLocation(location); u.getUser().setLocation(location);
} }
EventBus.getDefault().post(new UpdateFieldEvent()); EventBus.getDefault().post(new UpdateFieldEvent());
} }
@ -789,31 +811,33 @@ public class EditProfileActivity extends AbsActivity {
if (Constants.isShowPage != -1) { if (Constants.isShowPage != -1) {
finish(); finish();
} }
MainHttpUtil.getBaseInfo(new CommonCallback<UserBean>() { if (mUserBean.getUser().getLoginType().equals("phone")) {
@Override mobile = mUserBean.getUser().getMobile();
public void callback(UserBean u) {
if (u != null && "1".equals(u.getIs_bind())) {
mobile = u.getMobile();
tv_bind_phone.setText(mobile); tv_bind_phone.setText(mobile);
isBind = "1"; isBind = "1";
} else { } else {
tv_bind_phone.setHint(getResources().getString(R.string.bind_phone_text)); tv_bind_phone.setHint(getResources().getString(R.string.bind_phone_text));
isBind = "0"; isBind = "0";
} }
}
});
// getTaskType(); // getTaskType();
if (isName) { if (isName) {
isName = false; isName = false;
MainHttpUtil.getBaseInfo(CommonAppConfig.getInstance().getUid(), CommonAppConfig.getInstance().getToken(), new CommonCallback<UserBean>() { OTONetManager.getInstance(mContext)
.getBaseInfos(false, new com.yunbao.common.http.base.HttpCallback<UserBean>() {
@Override @Override
public void callback(UserBean bean) { public void onSuccess(UserBean data) {
if (bean != null) { if (data != null) {
CommonAppConfig.getInstance().setLoginInfo(CommonAppConfig.getInstance().getUid(), CommonAppConfig.getInstance().getToken(), false); CommonAppConfig.getInstance().setLoginInfo(CommonAppConfig.getInstance().getUid(), CommonAppConfig.getInstance().getToken(), false);
mUserBean = CommonAppConfig.getInstance().getUserBean(); mUserBean = data;
mName.setText(mUserBean.getUserNiceName()); mName.setText(mUserBean.getUser().getUserNicename());
} }
} }
@Override
public void onError(String error) {
}
}); });
} }
} }

View File

@ -943,6 +943,7 @@ public class OTONetManager {
@Override @Override
public void accept(ResponseModel<List<LabelBean>> objectResponseModel) throws Exception { public void accept(ResponseModel<List<LabelBean>> objectResponseModel) throws Exception {
if (objectResponseModel.getData().getCode() == 0) { if (objectResponseModel.getData().getCode() == 0) {
UserManager.saveUserTag(objectResponseModel.getData().getInfo());
callback.onSuccess(objectResponseModel.getData().getInfo()); callback.onSuccess(objectResponseModel.getData().getInfo());
} else { } else {
callback.onError(objectResponseModel.getData().getMsg()); callback.onError(objectResponseModel.getData().getMsg());

View File

@ -226,10 +226,9 @@ public interface OneToOneApi {
/** /**
* 设置标签 * 设置标签
*/ */
@FormUrlEncoded @GET("/api/public/?service=Friendappinfos.setLabel")
@POST("/api/public/?service=Friendappinfos.setLabel")
Observable<ResponseModel<List<BaseModel>>> setLabels( Observable<ResponseModel<List<BaseModel>>> setLabels(
@Field("labels") String avatar @Query("labels") String avatar
); );
/** /**

View File

@ -3,14 +3,18 @@ package com.shayu.onetoone.utils;
import android.content.Context; import android.content.Context;
import android.view.View; import android.view.View;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.shayu.onetoone.R; import com.shayu.onetoone.R;
import com.shayu.onetoone.bean.FollowBean; import com.shayu.onetoone.bean.FollowBean;
import com.shayu.onetoone.bean.LabelBean;
import com.shayu.onetoone.bean.MessageConsumeConfigBean; import com.shayu.onetoone.bean.MessageConsumeConfigBean;
import com.shayu.onetoone.bean.PurseBean;
import com.shayu.onetoone.bean.UserBean; import com.shayu.onetoone.bean.UserBean;
import com.shayu.onetoone.listener.OnDialogClickListener; import com.shayu.onetoone.listener.OnDialogClickListener;
import com.shayu.onetoone.listener.OnSendMessageListener; import com.shayu.onetoone.listener.OnSendMessageListener;
import com.shayu.onetoone.manager.OTONetManager; import com.shayu.onetoone.manager.OTONetManager;
import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.IMLoginManager;
@ -19,6 +23,9 @@ import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;
import java.util.ArrayList;
import java.util.List;
public class UserManager { public class UserManager {
public static UserBean userBean; public static UserBean userBean;
@ -32,6 +39,11 @@ public class UserManager {
public static void saveUserBean(Context mContext, UserBean bean) { public static void saveUserBean(Context mContext, UserBean bean) {
userBean = bean; userBean = bean;
if(StringUtil.isEmpty(bean.getUser().getTokenRong())){
IMLoginModel model = IMLoginManager.get(mContext).getUserInfo();;
bean.getUser().setTokenRong(model.getTokenRong());
bean.getUser().setToken(model.getToken());
}
System.out.println("保存用户信息" + JSONObject.toJSONString(bean)); System.out.println("保存用户信息" + JSONObject.toJSONString(bean));
IMLoginManager.get(mContext).setupLoginUser(bean.getUser()); IMLoginManager.get(mContext).setupLoginUser(bean.getUser());
SpUtil.setStringValue("oto_user_info", JSONObject.toJSONString(bean)); SpUtil.setStringValue("oto_user_info", JSONObject.toJSONString(bean));
@ -70,14 +82,33 @@ public class UserManager {
money = null; money = null;
} }
if (money == null) { if (money == null) {
MsgCheckUtils.checkPrice(null, targetId, new OnItemClickListener<MessageConsumeConfigBean>() { OTONetManager.getInstance(mContext)
.getPurseInfo(new HttpCallback<PurseBean>() {
@Override @Override
public void onItemClick(MessageConsumeConfigBean bean, int position) { public void onSuccess(PurseBean data) {
listener.onItemClick(bean.getPrice() + "", 0); listener.onItemClick(data.getStart() + "", 0);
saveMoney(data.getStart() + "");
}
@Override
public void onError(String error) {
} }
}); });
} else { } else {
listener.onItemClick(money, 1); listener.onItemClick(money, 1);
} }
} }
public static void saveUserTag(List<LabelBean> info) {
SpUtil.setStringValue("oto_user_info_tag", JSONArray.toJSONString(info));
}
public static List<LabelBean> getUserTag() {
String info = SpUtil.getStringValue("oto_user_info_tag");
if (StringUtil.isEmpty(info)) {
return new ArrayList<>();
}
return JSONArray.parseArray(info, LabelBean.class);
}
} }

View File

@ -398,6 +398,7 @@
android:textSize="14sp" /> android:textSize="14sp" />
<TextView <TextView
android:id="@+id/u_tag"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"

View File

@ -261,6 +261,26 @@ public class IMLoginModel extends BaseModel {
private String online; private String online;
@SerializedName("isAttention") @SerializedName("isAttention")
private int isAttention;//0 未关注 1被关注 2已关注 3互相关注 private int isAttention;//0 未关注 1被关注 2已关注 3互相关注
@SerializedName("user_info_complete")
private int userInfoComplete;
@SerializedName("login_type")
private String loginType;
public String getLoginType() {
return loginType;
}
public void setLoginType(String loginType) {
this.loginType = loginType;
}
public int getUserInfoComplete() {
return userInfoComplete;
}
public void setUserInfoComplete(int userInfoComplete) {
this.userInfoComplete = userInfoComplete;
}
public int getIsAttention() { public int getIsAttention() {
return isAttention; return isAttention;

View File

@ -377,12 +377,16 @@ public class IMLoginManager extends BaseCacheManager {
netHandler.post(isInstructorRunnable); netHandler.post(isInstructorRunnable);
} }
boolean initInstructor = false;
/** /**
* 获取是不是新手指导员的身份 * 获取是不是新手指导员的身份
*/ */
private Runnable isInstructorRunnable = new Runnable() { private Runnable isInstructorRunnable = new Runnable() {
@Override @Override
public void run() { public void run() {
if (initInstructor) {
return;
}
HttpClient.getInstance().get("User.isInstructor", "isInstructor") HttpClient.getInstance().get("User.isInstructor", "isInstructor")
.params("uid", userInfo.getId(), true) .params("uid", userInfo.getId(), true)
.params("token", userInfo.getToken(), true) .params("token", userInfo.getToken(), true)
@ -397,6 +401,7 @@ public class IMLoginManager extends BaseCacheManager {
userInfo.setIsAdmin("0"); userInfo.setIsAdmin("0");
} }
} }
initInstructor = true;
put(KEY_USER_INFO, new Gson().toJson(userInfo)); put(KEY_USER_INFO, new Gson().toJson(userInfo));
//兼容老模块(之后要把用户维护的类更换掉 //兼容老模块(之后要把用户维护的类更换掉
SpUtil.getInstance().setStringValue(SpUtil.USER_INFO, new Gson().toJson(userInfo)); SpUtil.getInstance().setStringValue(SpUtil.USER_INFO, new Gson().toJson(userInfo));