update
This commit is contained in:
parent
43362d3800
commit
c530db25d5
@ -126,6 +126,7 @@
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activity.message.ChatActivity"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="stateHidden|adjustResize" />
|
||||
<activity
|
||||
|
@ -45,6 +45,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.rong.callkit.CallEndMessageItemProvider;
|
||||
import io.rong.imkit.IMCenter;
|
||||
import io.rong.imkit.RongIM;
|
||||
import io.rong.imkit.config.RongConfigCenter;
|
||||
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.imlib.IMLibRTCClient;
|
||||
import io.rong.imlib.RongIMClient;
|
||||
import io.rong.imlib.model.InitOption;
|
||||
import io.rong.imlib.model.Message;
|
||||
import io.rong.imlib.model.MessageContent;
|
||||
import io.rong.message.CommandMessage;
|
||||
|
@ -64,6 +64,7 @@ import com.yunbao.common.utils.ProcessImageUtil;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
|
||||
@ -289,184 +290,194 @@ public class ChatMessageFragment extends AbsConversationFragment {
|
||||
}
|
||||
});
|
||||
|
||||
video.setOnClickListener(v -> {
|
||||
if (call.getTag() != null) {
|
||||
ToastUtil.show(R.string.toast_call_not_unlock);
|
||||
return;
|
||||
}
|
||||
if (CallClientManager.getManager().isCalling()) {
|
||||
ToastUtil.show(R.string.now_call_tips);
|
||||
return;
|
||||
}
|
||||
|
||||
MsgCheckUtils.checkAuth(mContext, targetId, new OnSendMessageListener() {
|
||||
@Override
|
||||
public void onSuccess(String token, SendConsumeBean bean) {
|
||||
super.onSuccess(token, bean);
|
||||
MsgCheckUtils.checkPrice(mContext, targetId, new OnItemClickListener<MessageConsumeConfigBean>() {
|
||||
@Override
|
||||
public void onItemClick(MessageConsumeConfigBean configBean, int position) {
|
||||
new BottomListDialog(mContext).setSelect(new OnItemClickListener<String>() {
|
||||
@Override
|
||||
public void onItemClick(String bean, int position) {
|
||||
CallClientManager.getManager().checkMoney(targetId, true, new OnSendMessageListener() {
|
||||
@Override
|
||||
public void onSuccess(String token, SendConsumeBean bean) {
|
||||
super.onSuccess(token, bean);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("model", CallClientManager.VIDEO_CALL);
|
||||
bundle.putString("targetId", targetId);
|
||||
bundle.putString("callId", targetId);
|
||||
RouteManager.forwardActivity(RouteManager.ACTIVITY_CALL_VIDEO, bundle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int status, String msg) {
|
||||
super.onError(status, msg);
|
||||
new TipsDialog(mContext)
|
||||
.setTitle(WordUtil.getNewString(R.string.not_money))
|
||||
.setContent(String.format(WordUtil.getNewString(R.string.not_money_video_tips), configBean.getVideoPrice()))
|
||||
.setCancelText(WordUtil.getNewString(R.string.dialog_cancel_tip))
|
||||
.setApplyText(WordUtil.getNewString(R.string.dialog_to_money_tip))
|
||||
.showDialog();
|
||||
}
|
||||
});
|
||||
}
|
||||
}).setStrings(Collections.singletonList(String.format(WordUtil.getNewString(R.string.chat_video_tips), configBean.getVideoPrice())))
|
||||
.showDialog();
|
||||
}
|
||||
});
|
||||
|
||||
ViewClicksAntiShake.clicksAntiShake(video, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
if (call.getTag() != null) {
|
||||
ToastUtil.show(R.string.toast_call_not_unlock);
|
||||
return;
|
||||
}
|
||||
if (CallClientManager.getManager().isCalling()) {
|
||||
ToastUtil.show(R.string.now_call_tips);
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int status, String msg) {
|
||||
super.onError(status, msg);
|
||||
if (status == 1) {
|
||||
sendAuthRequest();
|
||||
} else if (!StringUtil.isEmpty(msg)) {
|
||||
ToastUtil.show(msg);
|
||||
MsgCheckUtils.checkAuth(mContext, targetId, new OnSendMessageListener() {
|
||||
@Override
|
||||
public void onSuccess(String token, SendConsumeBean bean) {
|
||||
super.onSuccess(token, bean);
|
||||
MsgCheckUtils.checkPrice(mContext, targetId, new OnItemClickListener<MessageConsumeConfigBean>() {
|
||||
@Override
|
||||
public void onItemClick(MessageConsumeConfigBean configBean, int position) {
|
||||
new BottomListDialog(mContext).setSelect(new OnItemClickListener<String>() {
|
||||
@Override
|
||||
public void onItemClick(String bean, int position) {
|
||||
CallClientManager.getManager().checkMoney(targetId, true, new OnSendMessageListener() {
|
||||
@Override
|
||||
public void onSuccess(String token, SendConsumeBean bean) {
|
||||
super.onSuccess(token, bean);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("model", CallClientManager.VIDEO_CALL);
|
||||
bundle.putString("targetId", targetId);
|
||||
bundle.putString("callId", targetId);
|
||||
RouteManager.forwardActivity(RouteManager.ACTIVITY_CALL_VIDEO, bundle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int status, String msg) {
|
||||
super.onError(status, msg);
|
||||
new TipsDialog(mContext)
|
||||
.setTitle(WordUtil.getNewString(R.string.not_money))
|
||||
.setContent(String.format(WordUtil.getNewString(R.string.not_money_video_tips), configBean.getVideoPrice()))
|
||||
.setCancelText(WordUtil.getNewString(R.string.dialog_cancel_tip))
|
||||
.setApplyText(WordUtil.getNewString(R.string.dialog_to_money_tip))
|
||||
.showDialog();
|
||||
}
|
||||
});
|
||||
}
|
||||
}).setStrings(Collections.singletonList(String.format(WordUtil.getNewString(R.string.chat_video_tips), configBean.getVideoPrice())))
|
||||
.showDialog();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
call.setOnClickListener(v -> {
|
||||
if (call.getTag() != null) {
|
||||
ToastUtil.show(R.string.toast_call_not_unlock);
|
||||
return;
|
||||
}
|
||||
if (CallClientManager.getManager().isCalling() || isFloatWindows()) {
|
||||
ToastUtil.show(R.string.now_call_tips);
|
||||
return;
|
||||
}
|
||||
|
||||
MsgCheckUtils.checkAuth(mContext, targetId, new OnSendMessageListener() {
|
||||
@Override
|
||||
public void onSuccess(String token, SendConsumeBean bean) {
|
||||
super.onSuccess(token, bean);
|
||||
MsgCheckUtils.checkPrice(mContext, targetId, new OnItemClickListener<MessageConsumeConfigBean>() {
|
||||
@Override
|
||||
public void onItemClick(MessageConsumeConfigBean configBean, int position) {
|
||||
new BottomListDialog(mContext).setSelect(new OnItemClickListener<String>() {
|
||||
@Override
|
||||
public void onItemClick(String bean, int position) {
|
||||
CallClientManager.getManager().checkMoney(targetId, false, new OnSendMessageListener() {
|
||||
@Override
|
||||
public void onSuccess(String token, SendConsumeBean bean) {
|
||||
super.onSuccess(token, bean);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("model", CallClientManager.AUDIO_CALL);
|
||||
bundle.putString("targetId", targetId);
|
||||
bundle.putString("callId", targetId);
|
||||
RouteManager.forwardActivity(RouteManager.ACTIVITY_CALL_AUDIO, bundle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int status, String msg) {
|
||||
super.onError(status, msg);
|
||||
new TipsDialog(mContext)
|
||||
.setTitle(WordUtil.getNewString(R.string.not_money))
|
||||
.setContent(String.format(WordUtil.getNewString(R.string.not_money_audio_tips), configBean.getMp3Price()))
|
||||
.setCancelText(WordUtil.getNewString(R.string.dialog_cancel_tip))
|
||||
.setApplyText(WordUtil.getNewString(R.string.dialog_to_money_tip))
|
||||
.showDialog();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}).setStrings(Collections.singletonList(String.format(WordUtil.getNewString(R.string.chat_audio_tips), configBean.getMp3Price())))
|
||||
.showDialog();
|
||||
@Override
|
||||
public void onError(int status, String msg) {
|
||||
super.onError(status, msg);
|
||||
if (status == 1) {
|
||||
sendAuthRequest();
|
||||
} else if (!StringUtil.isEmpty(msg)) {
|
||||
ToastUtil.show(msg);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int status, String msg) {
|
||||
super.onError(status, msg);
|
||||
if (status == 1) {
|
||||
sendAuthRequest();
|
||||
} else if (!StringUtil.isEmpty(msg)) {
|
||||
ToastUtil.show(msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
img.setOnClickListener(v -> {
|
||||
new BottomListDialog(mContext)
|
||||
.setStrings(Arrays.asList(WordUtil.getNewString(R.string.album), WordUtil.getNewString(R.string.camera)))
|
||||
.setSelect(new OnItemClickListener<String>() {
|
||||
@Override
|
||||
public void onItemClick(String bean, int position) {
|
||||
boolean isCamera = position == 1;
|
||||
ViewClicksAntiShake.clicksAntiShake(call, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
if (call.getTag() != null) {
|
||||
ToastUtil.show(R.string.toast_call_not_unlock);
|
||||
return;
|
||||
}
|
||||
if (CallClientManager.getManager().isCalling() || isFloatWindows()) {
|
||||
ToastUtil.show(R.string.now_call_tips);
|
||||
return;
|
||||
}
|
||||
|
||||
MsgCheckUtils.checkAuth(mContext, targetId, new OnSendMessageListener() {
|
||||
@Override
|
||||
public void onSuccess(String token, SendConsumeBean bean) {
|
||||
super.onSuccess(token, bean);
|
||||
MsgCheckUtils.checkPrice(mContext, targetId, new OnItemClickListener<MessageConsumeConfigBean>() {
|
||||
@Override
|
||||
public void onItemClick(MessageConsumeConfigBean configBean, int position) {
|
||||
new BottomListDialog(mContext).setSelect(new OnItemClickListener<String>() {
|
||||
@Override
|
||||
public void onItemClick(String bean, int position) {
|
||||
CallClientManager.getManager().checkMoney(targetId, false, new OnSendMessageListener() {
|
||||
@Override
|
||||
public void onSuccess(String token, SendConsumeBean bean) {
|
||||
super.onSuccess(token, bean);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("model", CallClientManager.AUDIO_CALL);
|
||||
bundle.putString("targetId", targetId);
|
||||
bundle.putString("callId", targetId);
|
||||
RouteManager.forwardActivity(RouteManager.ACTIVITY_CALL_AUDIO, bundle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int status, String msg) {
|
||||
super.onError(status, msg);
|
||||
new TipsDialog(mContext)
|
||||
.setTitle(WordUtil.getNewString(R.string.not_money))
|
||||
.setContent(String.format(WordUtil.getNewString(R.string.not_money_audio_tips), configBean.getMp3Price()))
|
||||
.setCancelText(WordUtil.getNewString(R.string.dialog_cancel_tip))
|
||||
.setApplyText(WordUtil.getNewString(R.string.dialog_to_money_tip))
|
||||
.showDialog();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}).setStrings(Collections.singletonList(String.format(WordUtil.getNewString(R.string.chat_audio_tips), configBean.getMp3Price())))
|
||||
.showDialog();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int status, String msg) {
|
||||
super.onError(status, msg);
|
||||
if (status == 1) {
|
||||
sendAuthRequest();
|
||||
} else if (!StringUtil.isEmpty(msg)) {
|
||||
ToastUtil.show(msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
ViewClicksAntiShake.clicksAntiShake(img, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
new BottomListDialog(mContext)
|
||||
.setStrings(Arrays.asList(WordUtil.getNewString(R.string.album), WordUtil.getNewString(R.string.camera)))
|
||||
.setSelect(new OnItemClickListener<String>() {
|
||||
@Override
|
||||
public void onItemClick(String bean, int position) {
|
||||
boolean isCamera = position == 1;
|
||||
|
||||
SendMessageManager.sendMessageForText(targetId, WordUtil.getNewString(R.string.photo_info), new OnSendMessageListener() {
|
||||
@Override
|
||||
public void onSuccess(String token, SendConsumeBean bean) {
|
||||
super.onSuccess(token, bean);
|
||||
ChatMessageFragment.this.token = token;
|
||||
if (isCamera) {
|
||||
cameraUtil.getImageByCamera(false);
|
||||
} else {
|
||||
PictureSelector.create(ChatMessageFragment.this)
|
||||
.openGallery(PictureMimeType.ofImage())
|
||||
.loadImageEngine(RongConfigCenter.featureConfig().getKitImageEngine())
|
||||
.setRequestedOrientation(1)
|
||||
.videoDurationLimit(RongIMClient.getInstance().getVideoLimitTime())
|
||||
.maxSelectNum(9)
|
||||
.imageSpanCount(3)
|
||||
.isGif(true)
|
||||
.forResult(110);
|
||||
}
|
||||
|
||||
SendMessageManager.sendMessageForText(targetId, WordUtil.getNewString(R.string.photo_info), new OnSendMessageListener() {
|
||||
@Override
|
||||
public void onSuccess(String token, SendConsumeBean bean) {
|
||||
super.onSuccess(token, bean);
|
||||
ChatMessageFragment.this.token = token;
|
||||
if (isCamera) {
|
||||
cameraUtil.getImageByCamera(false);
|
||||
} else {
|
||||
PictureSelector.create(ChatMessageFragment.this)
|
||||
.openGallery(PictureMimeType.ofImage())
|
||||
.loadImageEngine(RongConfigCenter.featureConfig().getKitImageEngine())
|
||||
.setRequestedOrientation(1)
|
||||
.videoDurationLimit(RongIMClient.getInstance().getVideoLimitTime())
|
||||
.maxSelectNum(9)
|
||||
.imageSpanCount(3)
|
||||
.isGif(true)
|
||||
.forResult(110);
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public void onError(int status, String msg) {
|
||||
super.onError(status, msg);
|
||||
MsgCheckUtils.checkPrice(mContext, targetId, new OnItemClickListener<MessageConsumeConfigBean>() {
|
||||
@Override
|
||||
public void onItemClick(MessageConsumeConfigBean bean, int position) {
|
||||
new TipsDialog(mContext)
|
||||
.setTitle(WordUtil.getNewString(R.string.not_money))
|
||||
.setContent(String.format(WordUtil.getNewString(R.string.not_money_tips), bean.getPrice()))
|
||||
.setCancelText(WordUtil.getNewString(R.string.dialog_cancel_tip))
|
||||
.setApplyText(WordUtil.getNewString(R.string.dialog_to_money_tip))
|
||||
.setOnDialogClickListener(new OnDialogClickListener() {
|
||||
|
||||
@Override
|
||||
public void onError(int status, String msg) {
|
||||
super.onError(status, msg);
|
||||
MsgCheckUtils.checkPrice(mContext, targetId, new OnItemClickListener<MessageConsumeConfigBean>() {
|
||||
@Override
|
||||
public void onItemClick(MessageConsumeConfigBean bean, int position) {
|
||||
new TipsDialog(mContext)
|
||||
.setTitle(WordUtil.getNewString(R.string.not_money))
|
||||
.setContent(String.format(WordUtil.getNewString(R.string.not_money_tips), bean.getPrice()))
|
||||
.setCancelText(WordUtil.getNewString(R.string.dialog_cancel_tip))
|
||||
.setApplyText(WordUtil.getNewString(R.string.dialog_to_money_tip))
|
||||
.setOnDialogClickListener(new OnDialogClickListener() {
|
||||
@Override
|
||||
public void onApply(Dialog dialog) {
|
||||
super.onApply(dialog);
|
||||
}
|
||||
}).showDialog();
|
||||
}
|
||||
});
|
||||
|
||||
@Override
|
||||
public void onApply(Dialog dialog) {
|
||||
super.onApply(dialog);
|
||||
}
|
||||
}).showDialog();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}).showDialog();
|
||||
}
|
||||
});
|
||||
}
|
||||
}).showDialog();
|
||||
}
|
||||
});
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
|
@ -174,6 +174,11 @@ public class MsgFriendFragment extends BaseFragment implements BaseAdapter.OnIte
|
||||
}
|
||||
|
||||
public void getNewData(List<HomeItemBean> data) {
|
||||
if(data==null){
|
||||
page=1;
|
||||
initData();
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
HomeItemBean item = data.get(i);
|
||||
boolean over = i == data.size() - 1;
|
||||
|
@ -416,9 +416,7 @@ public class CallVideoActivity extends AbsOTOActivity {
|
||||
});
|
||||
windowListener = new WindowCallStatusListener(view);
|
||||
CallClientManager.getManager().addOnVoIPCallListener(EasyFloat.class, windowListener);
|
||||
if (toPay) {
|
||||
RouteManager.forwardWebViewActivity(null, HtmlUrlUtils.getPayUrl(mContext, false, HtmlUrlUtils.URL_PAY_COIN));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -447,6 +445,9 @@ public class CallVideoActivity extends AbsOTOActivity {
|
||||
|
||||
}
|
||||
}).show();
|
||||
if (toPay) {
|
||||
RouteManager.forwardWebViewActivity(null, HtmlUrlUtils.getPayUrl(mContext, false, HtmlUrlUtils.URL_PAY_COIN));
|
||||
}
|
||||
if (toChatView) {
|
||||
ConversationUtils.startConversation(mContext, targetId);
|
||||
}
|
||||
@ -516,7 +517,7 @@ public class CallVideoActivity extends AbsOTOActivity {
|
||||
} else if (id == R.id.follow) {
|
||||
follow();
|
||||
} else if (id == R.id.money) {
|
||||
showWindow(true, false);
|
||||
showWindow(false, true);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -20,9 +20,11 @@ import com.sahooz.library.OnPick;
|
||||
import com.shayu.onetoone.R;
|
||||
import com.shayu.onetoone.bean.AuthBean;
|
||||
import com.shayu.onetoone.bean.AvatarBean;
|
||||
import com.shayu.onetoone.bean.UserBean;
|
||||
import com.shayu.onetoone.manager.OTONetManager;
|
||||
import com.shayu.onetoone.manager.RouteManager;
|
||||
import com.shayu.onetoone.utils.MainHttpUtil;
|
||||
import com.shayu.onetoone.utils.UserManager;
|
||||
import com.shayu.onetoone.view.UserAvatarPopup;
|
||||
import com.tencent.imsdk.v2.V2TIMCallback;
|
||||
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.WebViewActivity;
|
||||
import com.yunbao.common.bean.HttpCallbackModel;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.event.UpdateFieldEvent;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
@ -58,11 +59,13 @@ import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import cn.qqtheme.framework.entity.City;
|
||||
import cn.qqtheme.framework.entity.County;
|
||||
import cn.qqtheme.framework.entity.Province;
|
||||
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 tv_bind_phone;
|
||||
private TextView auth_status;
|
||||
private TextView tag;
|
||||
private ProcessImageUtil cameraUtil;
|
||||
private UserBean mUserBean;
|
||||
private String mProvinceVal;
|
||||
@ -109,14 +113,21 @@ public class EditProfileActivity extends AbsActivity {
|
||||
mSex = (TextView) findViewById(R.id.sex);
|
||||
mCity = (TextView) findViewById(R.id.city);
|
||||
tv_bind_phone = (TextView) findViewById(R.id.tv_bind_phone);
|
||||
mUserBean = CommonAppConfig.getInstance().getUserBean();
|
||||
MainHttpUtil.getBaseInfo(new CommonCallback<UserBean>() {
|
||||
@Override
|
||||
public void callback(UserBean u) {
|
||||
mUserBean = u;
|
||||
showData(u);
|
||||
}
|
||||
});
|
||||
tag = findViewById(R.id.u_tag);
|
||||
mUserBean = UserManager.getUserBean();
|
||||
OTONetManager.getInstance(mContext)
|
||||
.getBaseInfos(false, new com.yunbao.common.http.base.HttpCallback<UserBean>() {
|
||||
@Override
|
||||
public void onSuccess(UserBean data) {
|
||||
mUserBean = data;
|
||||
showData(mUserBean);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
findViewById(R.id.btn_person).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@ -135,10 +146,15 @@ public class EditProfileActivity extends AbsActivity {
|
||||
});
|
||||
}*/
|
||||
initCamera();
|
||||
com.shayu.onetoone.bean.UserBean bean = UserManager.getUserBean();
|
||||
if (bean != null) {
|
||||
tag.setText(bean.getInfo().getCn_label());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void initCamera() {
|
||||
cameraUtil = new ProcessImageUtil(this, getPackageName()+".fileprovider");
|
||||
cameraUtil = new ProcessImageUtil(this, getPackageName() + ".fileprovider");
|
||||
cameraUtil.setImageResultCallback(new ImageResultCallback() {
|
||||
@Override
|
||||
public void beforeCamera() {
|
||||
@ -202,7 +218,7 @@ public class EditProfileActivity extends AbsActivity {
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if (userModel.getUserInfoComplete() == 1) {
|
||||
if (userModel.getUser().getUserInfoComplete() == 1) {
|
||||
finish();
|
||||
} else {
|
||||
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) {
|
||||
if (data.getCode() == 0) {
|
||||
ToastUtil.show(data.getMsg());
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
UserBean u = UserManager.getUserBean();
|
||||
if (u != null) {
|
||||
u.setLocation(country.name);
|
||||
u.getUser().setLocation(country.name);
|
||||
}
|
||||
if (userModel != null) {
|
||||
userModel.setLocation(country.name);
|
||||
userModel.getUser().setLocation(country.name);
|
||||
showData(userModel);
|
||||
}
|
||||
|
||||
showData(userModel);
|
||||
EventBus.getDefault().post(new UpdateFieldEvent());
|
||||
}
|
||||
}
|
||||
@ -340,13 +356,13 @@ public class EditProfileActivity extends AbsActivity {
|
||||
|
||||
private void editName() {
|
||||
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() {
|
||||
@Override
|
||||
public void onSuccess(Intent intent) {
|
||||
if (intent != null) {
|
||||
String nickName = intent.getStringExtra(Constants.NICK_NAME);
|
||||
mUserBean.setSignature(nickName);
|
||||
mUserBean.getUser().setSignature(nickName);
|
||||
mName.setText(nickName);
|
||||
EventBus.getDefault().post(new UpdateFieldEvent());
|
||||
}
|
||||
@ -422,13 +438,13 @@ public class EditProfileActivity extends AbsActivity {
|
||||
return;
|
||||
}
|
||||
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() {
|
||||
@Override
|
||||
public void onSuccess(Intent intent) {
|
||||
if (intent != null) {
|
||||
String sign = intent.getStringExtra(Constants.SIGN);
|
||||
mUserBean.setSignature(sign);
|
||||
mUserBean.getUser().setSignature(sign);
|
||||
mSign.setText(sign);
|
||||
EventBus.getDefault().post(new UpdateFieldEvent());
|
||||
}
|
||||
@ -447,7 +463,7 @@ public class EditProfileActivity extends AbsActivity {
|
||||
return;
|
||||
}
|
||||
|
||||
String[] times = mUserBean.getBirthday().split("-");
|
||||
String[] times = mUserBean.getUser().getBirthday().split("-");
|
||||
year = Integer.parseInt(times[0]);
|
||||
month = Integer.parseInt(times[1]) - 1;
|
||||
day = Integer.parseInt(times[2]);
|
||||
@ -474,11 +490,11 @@ public class EditProfileActivity extends AbsActivity {
|
||||
@Override
|
||||
public void onSuccess(HttpCallbackModel data) {
|
||||
if (data.getCode() == 0) {
|
||||
mUserBean.setBirthday(strbir);
|
||||
mUserBean.getUser().setBirthday(strbir);
|
||||
mBirthday.setText(strbir);
|
||||
|
||||
if (userModel != null) {
|
||||
userModel.setBirthday(strbir);
|
||||
userModel.getUser().setBirthday(strbir);
|
||||
}
|
||||
|
||||
showData(userModel);
|
||||
@ -535,12 +551,18 @@ public class EditProfileActivity extends AbsActivity {
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onEditProfileEvent(/*EditProfileEvent event*/) {
|
||||
MainHttpUtil.getBaseInfo(new CommonCallback<UserBean>() {
|
||||
@Override
|
||||
public void callback(UserBean u) {
|
||||
showData(u);
|
||||
}
|
||||
});
|
||||
OTONetManager.getInstance(mContext)
|
||||
.getBaseInfos(false, new com.yunbao.common.http.base.HttpCallback<UserBean>() {
|
||||
@Override
|
||||
public void onSuccess(UserBean data) {
|
||||
showData(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private UserBean userModel;
|
||||
@ -548,13 +570,13 @@ public class EditProfileActivity extends AbsActivity {
|
||||
private void showData(UserBean u) {
|
||||
userModel = u;
|
||||
int index = 0;
|
||||
String birthday = u.getBirthday();
|
||||
String location = u.getLocation();
|
||||
String bindPhone = u.getMobile();
|
||||
String birthday = u.getUser().getBirthday();
|
||||
String location = u.getUser().getLocation();
|
||||
String bindPhone = u.getUser().getMobile();
|
||||
String sex = "";
|
||||
if (u.getSex() == 1) {
|
||||
if (u.getUser().getSex() == 1) {
|
||||
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);
|
||||
}
|
||||
if (!TextUtils.isEmpty(bindPhone)) {
|
||||
@ -641,21 +663,21 @@ public class EditProfileActivity extends AbsActivity {
|
||||
submit.setTextColor(Color.parseColor("#935902"));
|
||||
submit.setEnabled(true);
|
||||
}*/
|
||||
ImgLoader.displayAvatar(mContext, u.getAvatar(), mAvatar);
|
||||
mName.setText(u.getUserNiceName());
|
||||
mSign.setText(u.getSignature());
|
||||
mBirthday.setText(u.getBirthday());
|
||||
if (u.getSex() == 0) {
|
||||
ImgLoader.displayAvatar(mContext, u.getUser().getAvatar(), mAvatar);
|
||||
mName.setText(u.getUser().getUserNicename());
|
||||
mSign.setText(u.getUser().getSignature());
|
||||
mBirthday.setText(u.getUser().getBirthday());
|
||||
if (u.getUser().getSex() == 0) {
|
||||
mSex.setText("");
|
||||
} else if (u.getSex() == 1) {
|
||||
} else if (u.getUser().getSex() == 1) {
|
||||
mSex.setText(R.string.sex_male);
|
||||
} else if (u.getSex() == 2) {
|
||||
} else if (u.getUser().getSex() == 2) {
|
||||
mSex.setText(R.string.sex_female);
|
||||
}
|
||||
|
||||
mCity.setText(u.getLocation());
|
||||
if ("1".equals(u.getIs_bind())) {
|
||||
mobile = u.getMobile();
|
||||
mCity.setText(u.getUser().getCity());
|
||||
if (u.getUser().getLoginType().equals("phone")) {
|
||||
mobile = u.getUser().getMobile();
|
||||
tv_bind_phone.setText(mobile);
|
||||
isBind = "1";
|
||||
} else {
|
||||
@ -766,9 +788,9 @@ public class EditProfileActivity extends AbsActivity {
|
||||
public void onSuccess(HttpCallbackModel data) {
|
||||
ToastUtil.show(data.getMsg());
|
||||
if (data.getCode() == 0) {
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
UserBean u = UserManager.getUserBean();
|
||||
if (u != null) {
|
||||
u.setLocation(location);
|
||||
u.getUser().setLocation(location);
|
||||
}
|
||||
EventBus.getDefault().post(new UpdateFieldEvent());
|
||||
}
|
||||
@ -789,32 +811,34 @@ public class EditProfileActivity extends AbsActivity {
|
||||
if (Constants.isShowPage != -1) {
|
||||
finish();
|
||||
}
|
||||
MainHttpUtil.getBaseInfo(new CommonCallback<UserBean>() {
|
||||
@Override
|
||||
public void callback(UserBean u) {
|
||||
if (u != null && "1".equals(u.getIs_bind())) {
|
||||
mobile = u.getMobile();
|
||||
tv_bind_phone.setText(mobile);
|
||||
isBind = "1";
|
||||
} else {
|
||||
tv_bind_phone.setHint(getResources().getString(R.string.bind_phone_text));
|
||||
isBind = "0";
|
||||
}
|
||||
}
|
||||
});
|
||||
if (mUserBean.getUser().getLoginType().equals("phone")) {
|
||||
mobile = mUserBean.getUser().getMobile();
|
||||
tv_bind_phone.setText(mobile);
|
||||
isBind = "1";
|
||||
} else {
|
||||
tv_bind_phone.setHint(getResources().getString(R.string.bind_phone_text));
|
||||
isBind = "0";
|
||||
}
|
||||
|
||||
// getTaskType();
|
||||
if (isName) {
|
||||
isName = false;
|
||||
MainHttpUtil.getBaseInfo(CommonAppConfig.getInstance().getUid(), CommonAppConfig.getInstance().getToken(), new CommonCallback<UserBean>() {
|
||||
@Override
|
||||
public void callback(UserBean bean) {
|
||||
if (bean != null) {
|
||||
CommonAppConfig.getInstance().setLoginInfo(CommonAppConfig.getInstance().getUid(), CommonAppConfig.getInstance().getToken(), false);
|
||||
mUserBean = CommonAppConfig.getInstance().getUserBean();
|
||||
mName.setText(mUserBean.getUserNiceName());
|
||||
}
|
||||
}
|
||||
});
|
||||
OTONetManager.getInstance(mContext)
|
||||
.getBaseInfos(false, new com.yunbao.common.http.base.HttpCallback<UserBean>() {
|
||||
@Override
|
||||
public void onSuccess(UserBean data) {
|
||||
if (data != null) {
|
||||
CommonAppConfig.getInstance().setLoginInfo(CommonAppConfig.getInstance().getUid(), CommonAppConfig.getInstance().getToken(), false);
|
||||
mUserBean = data;
|
||||
mName.setText(mUserBean.getUser().getUserNicename());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -943,6 +943,7 @@ public class OTONetManager {
|
||||
@Override
|
||||
public void accept(ResponseModel<List<LabelBean>> objectResponseModel) throws Exception {
|
||||
if (objectResponseModel.getData().getCode() == 0) {
|
||||
UserManager.saveUserTag(objectResponseModel.getData().getInfo());
|
||||
callback.onSuccess(objectResponseModel.getData().getInfo());
|
||||
} else {
|
||||
callback.onError(objectResponseModel.getData().getMsg());
|
||||
|
@ -226,10 +226,9 @@ public interface OneToOneApi {
|
||||
/**
|
||||
* 设置标签
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/api/public/?service=Friendappinfos.setLabel")
|
||||
@GET("/api/public/?service=Friendappinfos.setLabel")
|
||||
Observable<ResponseModel<List<BaseModel>>> setLabels(
|
||||
@Field("labels") String avatar
|
||||
@Query("labels") String avatar
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -3,14 +3,18 @@ package com.shayu.onetoone.utils;
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.shayu.onetoone.R;
|
||||
import com.shayu.onetoone.bean.FollowBean;
|
||||
import com.shayu.onetoone.bean.LabelBean;
|
||||
import com.shayu.onetoone.bean.MessageConsumeConfigBean;
|
||||
import com.shayu.onetoone.bean.PurseBean;
|
||||
import com.shayu.onetoone.bean.UserBean;
|
||||
import com.shayu.onetoone.listener.OnDialogClickListener;
|
||||
import com.shayu.onetoone.listener.OnSendMessageListener;
|
||||
import com.shayu.onetoone.manager.OTONetManager;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
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.WordUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class UserManager {
|
||||
public static UserBean userBean;
|
||||
|
||||
@ -26,12 +33,17 @@ public class UserManager {
|
||||
if (userBean == null) {
|
||||
userBean = JSONObject.parseObject(SpUtil.getStringValue("oto_user_info"), UserBean.class);
|
||||
}
|
||||
System.out.println("读取用户信息+"+userBean);
|
||||
System.out.println("读取用户信息+" + userBean);
|
||||
return userBean;
|
||||
}
|
||||
|
||||
public static void saveUserBean(Context mContext, 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));
|
||||
IMLoginManager.get(mContext).setupLoginUser(bean.getUser());
|
||||
SpUtil.setStringValue("oto_user_info", JSONObject.toJSONString(bean));
|
||||
@ -64,20 +76,39 @@ public class UserManager {
|
||||
SpUtil.setStringValue("oto_user_money", money);
|
||||
}
|
||||
|
||||
public static void getMoney(Context mContext,String targetId, OnItemClickListener<String> listener) {
|
||||
public static void getMoney(Context mContext, String targetId, OnItemClickListener<String> listener) {
|
||||
String money = SpUtil.getStringValue("oto_user_money");
|
||||
if (StringUtil.isEmpty(money)) {
|
||||
money = null;
|
||||
}
|
||||
if (money == null) {
|
||||
MsgCheckUtils.checkPrice(null, targetId, new OnItemClickListener<MessageConsumeConfigBean>() {
|
||||
@Override
|
||||
public void onItemClick(MessageConsumeConfigBean bean, int position) {
|
||||
listener.onItemClick(bean.getPrice() + "", 0);
|
||||
}
|
||||
});
|
||||
OTONetManager.getInstance(mContext)
|
||||
.getPurseInfo(new HttpCallback<PurseBean>() {
|
||||
@Override
|
||||
public void onSuccess(PurseBean data) {
|
||||
listener.onItemClick(data.getStart() + "", 0);
|
||||
saveMoney(data.getStart() + "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -398,6 +398,7 @@
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/u_tag"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
|
@ -261,6 +261,26 @@ public class IMLoginModel extends BaseModel {
|
||||
private String online;
|
||||
@SerializedName("isAttention")
|
||||
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() {
|
||||
return isAttention;
|
||||
|
@ -377,12 +377,16 @@ public class IMLoginManager extends BaseCacheManager {
|
||||
netHandler.post(isInstructorRunnable);
|
||||
}
|
||||
|
||||
boolean initInstructor = false;
|
||||
/**
|
||||
* 获取是不是新手指导员的身份
|
||||
*/
|
||||
private Runnable isInstructorRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (initInstructor) {
|
||||
return;
|
||||
}
|
||||
HttpClient.getInstance().get("User.isInstructor", "isInstructor")
|
||||
.params("uid", userInfo.getId(), true)
|
||||
.params("token", userInfo.getToken(), true)
|
||||
@ -397,6 +401,7 @@ public class IMLoginManager extends BaseCacheManager {
|
||||
userInfo.setIsAdmin("0");
|
||||
}
|
||||
}
|
||||
initInstructor = true;
|
||||
put(KEY_USER_INFO, new Gson().toJson(userInfo));
|
||||
//兼容老模块(之后要把用户维护的类更换掉)
|
||||
SpUtil.getInstance().setStringValue(SpUtil.USER_INFO, new Gson().toJson(userInfo));
|
||||
|
Loading…
x
Reference in New Issue
Block a user