update
This commit is contained in:
@@ -96,9 +96,8 @@ public class AppContext extends CommonAppContext {
|
||||
RongConfigCenter.conversationConfig().addMessageProvider(new MessageChatReceiveGiftItemProvider(getApplicationContext()));
|
||||
RongConfigCenter.conversationConfig().addMessageProvider(new MessageChatAutoItemProvider(getApplicationContext()));
|
||||
|
||||
String appKey = "lmxuhwagl7s1d";
|
||||
boolean enablePush = true;
|
||||
RongIM.init(this, appKey, enablePush);
|
||||
RongcloudIMManager.initRongIM(this);
|
||||
|
||||
RongIM.setConnectionStatusListener(new RongIMClient.ConnectionStatusListener() {
|
||||
@Override
|
||||
public void onChanged(ConnectionStatus status) {
|
||||
@@ -107,7 +106,7 @@ public class AppContext extends CommonAppContext {
|
||||
});
|
||||
|
||||
|
||||
RongcloudIMManager.initRongIM(this);
|
||||
|
||||
RongcloudIMManager.addRongcloudIMOnReceiveMessageListener(new RongIMClient.OnReceiveMessageWrapperListener() {
|
||||
@Override
|
||||
public boolean onReceived(Message message, int left, boolean hasPackage, boolean offline) {
|
||||
|
||||
@@ -20,6 +20,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.activity.message.ChatActivity;
|
||||
import com.shayu.onetoone.bean.JoinAnchorBean;
|
||||
import com.shayu.onetoone.bean.MatchingItemSizeBean;
|
||||
import com.shayu.onetoone.bean.OfficialNoticeBean;
|
||||
@@ -127,7 +128,6 @@ public class MainActivity extends AbsOTOActivity {
|
||||
}
|
||||
});
|
||||
CallClientManager.getManager();
|
||||
initFirstLoginTips();
|
||||
}
|
||||
|
||||
private void initFirstLoginTips() {
|
||||
@@ -141,16 +141,18 @@ public class MainActivity extends AbsOTOActivity {
|
||||
boolean isShow = true;
|
||||
if (data.getLogin() == 0) {
|
||||
isHome = true;
|
||||
} else if (data.getChat() == 0) {
|
||||
}
|
||||
if (data.getChat() == 0) {
|
||||
isMan = IMLoginManager.get(mContext).getUserInfo().getSex() == 1;
|
||||
} else {
|
||||
}
|
||||
if (!isHome && data.getChat() != 0) {
|
||||
isShow = false;
|
||||
}
|
||||
Bus.get().post(new HomeBusEvent(HomeBusEvent.TYPE_UPDATE_MATCHING, data.getNum()));
|
||||
if (isShow) {
|
||||
new FirstTipsDialog(mContext)
|
||||
.setHome(isMan)
|
||||
.setMan(isHome)
|
||||
.setHome(isHome)
|
||||
.setMan(isMan)
|
||||
.setOnItemClickListener(new OnItemClickListener<FirstTipsDialog>() {
|
||||
@Override
|
||||
public void onItemClick(FirstTipsDialog dialog, int position) {
|
||||
@@ -160,6 +162,7 @@ public class MainActivity extends AbsOTOActivity {
|
||||
public void onSuccess(String token, SendConsumeBean bean) {
|
||||
super.onSuccess(token, bean);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putInt("type", ChatActivity.CALL_CHAT_TYPE_MATCH);
|
||||
bundle.putString("data", JSONObject.toJSONString(bean));
|
||||
RouteManager.forwardActivity(RouteManager.ACTIVITY_MATCHING, bundle);
|
||||
}
|
||||
@@ -170,8 +173,10 @@ public class MainActivity extends AbsOTOActivity {
|
||||
RouteManager.forwardActivity(RouteManager.ACTIVITY_MATCHING);
|
||||
}
|
||||
});
|
||||
OTONetManager.getInstance(mContext).setFiled("is_login","1",null);
|
||||
} else {
|
||||
viewPager.setCurrentItem(2);
|
||||
OTONetManager.getInstance(mContext).setFiled("is_chat","1",null);
|
||||
}
|
||||
dialog.dismiss();
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import androidx.annotation.NonNull;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.shayu.onetoone.R;
|
||||
import com.shayu.onetoone.activity.fragments.BaseFragment;
|
||||
import com.shayu.onetoone.activity.message.ChatActivity;
|
||||
import com.shayu.onetoone.adapter.HomeRecommendListAdapter;
|
||||
import com.shayu.onetoone.bean.HomeItemBean;
|
||||
import com.shayu.onetoone.bean.MatchingItemSizeBean;
|
||||
@@ -90,6 +91,7 @@ public class RecommendFragment extends BaseFragment {
|
||||
public void onSuccess(String token, SendConsumeBean bean) {
|
||||
super.onSuccess(token, bean);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putInt("type", ChatActivity.CALL_CHAT_TYPE_MATCH);
|
||||
bundle.putString("data", JSONObject.toJSONString(bean));
|
||||
RouteManager.forwardActivity(RouteManager.ACTIVITY_MATCHING, bundle);
|
||||
}
|
||||
|
||||
@@ -237,6 +237,7 @@ public class ChatMessageFragment extends AbsConversationFragment {
|
||||
|
||||
video.setOnClickListener(v -> {
|
||||
if (call.getTag() != null) {
|
||||
ToastUtil.show(R.string.toast_call_not_unlock);
|
||||
return;
|
||||
}
|
||||
checkAuth(new OnSendMessageListener() {
|
||||
@@ -262,14 +263,14 @@ public class ChatMessageFragment extends AbsConversationFragment {
|
||||
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()))
|
||||
.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())))
|
||||
}).setStrings(Collections.singletonList(String.format(WordUtil.getNewString(R.string.chat_video_tips), configBean.getVideoPrice())))
|
||||
.showDialog();
|
||||
|
||||
|
||||
@@ -284,6 +285,7 @@ public class ChatMessageFragment extends AbsConversationFragment {
|
||||
});
|
||||
call.setOnClickListener(v -> {
|
||||
if (call.getTag() != null) {
|
||||
ToastUtil.show(R.string.toast_call_not_unlock);
|
||||
return;
|
||||
}
|
||||
checkAuth(new OnSendMessageListener() {
|
||||
@@ -309,7 +311,7 @@ public class ChatMessageFragment extends AbsConversationFragment {
|
||||
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()))
|
||||
.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();
|
||||
@@ -317,7 +319,7 @@ public class ChatMessageFragment extends AbsConversationFragment {
|
||||
});
|
||||
|
||||
}
|
||||
}).setStrings(Collections.singletonList(String.format(WordUtil.getNewString(R.string.chat_audio_tips),configBean.getMp3Price())))
|
||||
}).setStrings(Collections.singletonList(String.format(WordUtil.getNewString(R.string.chat_audio_tips), configBean.getMp3Price())))
|
||||
.showDialog();
|
||||
}
|
||||
|
||||
@@ -584,7 +586,7 @@ public class ChatMessageFragment extends AbsConversationFragment {
|
||||
String[] list;
|
||||
if (isTextMessage) {
|
||||
if (isMy) {
|
||||
list = new String[]{WordUtil.getNewString(R.string.copy),WordUtil.getNewString(R.string.delete)};
|
||||
list = new String[]{WordUtil.getNewString(R.string.copy), WordUtil.getNewString(R.string.delete)};
|
||||
} else {
|
||||
list = new String[]{WordUtil.getNewString(R.string.copy)};
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.utils.RandomUtil;
|
||||
import com.yunbao.common.utils.SpUtil;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
@@ -187,7 +188,7 @@ public class MsgMessageFragment extends BaseFragment implements BaseAdapter.OnIt
|
||||
mAdapter.add(setTopData(datum.getTitle(),
|
||||
datum.getContent(),
|
||||
datum.getAddtime() * 1000,
|
||||
datum.getNew_image(),
|
||||
datum.getImage(),
|
||||
datum.getNum(),
|
||||
datum.getType(),
|
||||
JSONObject.toJSONString(datum)
|
||||
@@ -208,6 +209,9 @@ public class MsgMessageFragment extends BaseFragment implements BaseAdapter.OnIt
|
||||
}
|
||||
|
||||
private SingleConversation setTopData(String title, String content, long time, String avatar, int num, int id, String exp) {
|
||||
if(StringUtil.isEmpty(content)){
|
||||
content = "";
|
||||
}
|
||||
SingleConversation conversation = new SingleConversation(getContext(), new Conversation());
|
||||
conversation.mCore.setConversationType(Conversation.ConversationType.PRIVATE);
|
||||
conversation.mCore.setSenderUserName(title);
|
||||
@@ -218,6 +222,7 @@ public class MsgMessageFragment extends BaseFragment implements BaseAdapter.OnIt
|
||||
conversation.mCore.setUnreadMessageCount(num);
|
||||
conversation.mCore.setTargetId(id + "");
|
||||
conversation.mCore.setLatestMessageExtra(exp);
|
||||
conversation.mCore.setPortraitUrl(avatar);
|
||||
UserInfo info = new UserInfo(id + "", title, Uri.parse(avatar));
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("sex", -1);
|
||||
@@ -236,7 +241,7 @@ public class MsgMessageFragment extends BaseFragment implements BaseAdapter.OnIt
|
||||
* 全部标记已读
|
||||
*/
|
||||
public void allRead() {
|
||||
clearTopData();
|
||||
// clearTopData();
|
||||
RongCoreClient.getInstance().getUnreadConversationList(new IRongCoreCallback.ResultCallback<List<Conversation>>() {
|
||||
@Override
|
||||
public void onSuccess(List<Conversation> conversations) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.shayu.onetoone.activity.message;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
@@ -77,7 +78,7 @@ public class CallVideoActivity extends AbsOTOActivity {
|
||||
private String targetId;
|
||||
private String callId;
|
||||
private String model;
|
||||
|
||||
private SurfaceView localVideo, remoteVideo;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
@@ -156,10 +157,31 @@ public class CallVideoActivity extends AbsOTOActivity {
|
||||
private void initView() {
|
||||
rootView = findViewById(R.id.rootView);
|
||||
myView = findViewById(R.id.my_view);
|
||||
targetView = findViewById(R.id.target_view);
|
||||
callLayout = findViewById(R.id.rc_voip_two_btn);
|
||||
buttonView = LayoutInflater.from(mContext).inflate(R.layout.view_call_video_item, rootView, false);
|
||||
callWaitLayout = LayoutInflater.from(mContext).inflate(R.layout.view_call_video_wait, rootView, false);
|
||||
targetView = buttonView.findViewById(R.id.target_view);
|
||||
targetView.setTag(true);
|
||||
targetView.setBackgroundColor(Color.YELLOW);
|
||||
targetView.setOnClickListener(v -> {
|
||||
ToastUtil.show("点击");
|
||||
myView.removeAllViews();
|
||||
targetView.removeAllViews();
|
||||
if (targetView.getTag() == null) {
|
||||
myView.addView(remoteVideo);
|
||||
myView.addView(buttonView);
|
||||
targetView.addView(localVideo);
|
||||
targetView.setTag(true);
|
||||
} else {
|
||||
ImageView imageView=new ImageView(mContext);
|
||||
imageView.setImageResource(R.mipmap.bg_message_msg_title_heartbeat);
|
||||
myView.addView(localVideo);
|
||||
myView.addView(buttonView);
|
||||
targetView.addView(imageView);
|
||||
targetView.setTag(null);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@@ -193,7 +215,7 @@ public class CallVideoActivity extends AbsOTOActivity {
|
||||
// 为所有View设置点击事件监听器
|
||||
setClickListeners();
|
||||
|
||||
if(model.equals(CallClientManager.VIDEO_RECEIVED_CALL)){
|
||||
if (model.equals(CallClientManager.VIDEO_RECEIVED_CALL)) {
|
||||
gift.setVisibility(View.INVISIBLE);
|
||||
money.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
@@ -243,7 +265,7 @@ public class CallVideoActivity extends AbsOTOActivity {
|
||||
}
|
||||
|
||||
private void showWindow(boolean toChatView) {
|
||||
if(!PermissionUtils.checkPermission(this)){
|
||||
if (!PermissionUtils.checkPermission(this)) {
|
||||
new TipsDialog(mContext)
|
||||
.setTitle(WordUtil.getNewString(R.string.permission_hint))
|
||||
.setApplyText(WordUtil.getNewString(R.string.permission_setting))
|
||||
@@ -255,7 +277,7 @@ public class CallVideoActivity extends AbsOTOActivity {
|
||||
PermissionUtils.requestPermission(CallVideoActivity.this, new OnPermissionResult() {
|
||||
@Override
|
||||
public void permissionResult(boolean b) {
|
||||
if(b){
|
||||
if (b) {
|
||||
showWindow(toChatView);
|
||||
}
|
||||
}
|
||||
@@ -397,7 +419,8 @@ public class CallVideoActivity extends AbsOTOActivity {
|
||||
@Override
|
||||
public void onCallWait(SurfaceView surfaceView) {
|
||||
myView.removeAllViews();
|
||||
myView.addView(surfaceView);
|
||||
localVideo = surfaceView;
|
||||
myView.addView(localVideo);
|
||||
if (model.equals(CallClientManager.VIDEO_CALL)) {
|
||||
myView.addView(callWaitLayout);
|
||||
}
|
||||
@@ -416,8 +439,9 @@ public class CallVideoActivity extends AbsOTOActivity {
|
||||
surfaceView.setZOrderMediaOverlay(false);
|
||||
surfaceView.invalidate();
|
||||
});
|
||||
remoteVideo = surfaceView;
|
||||
myView.removeAllViews();
|
||||
myView.addView(surfaceView);
|
||||
myView.addView(remoteVideo);
|
||||
targetView.removeAllViews();
|
||||
targetView.addView(CallClientManager.getManager().getLocalVideo());
|
||||
myView.addView(buttonView);
|
||||
@@ -445,7 +469,7 @@ public class CallVideoActivity extends AbsOTOActivity {
|
||||
public void onTime(String time) {
|
||||
super.onTime(time);
|
||||
if (callTime != null) {
|
||||
callTime.setText(WordUtil.getNewString(R.string.call_time)+""+ time);
|
||||
callTime.setText(WordUtil.getNewString(R.string.call_time) + "" + time);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -464,7 +488,7 @@ public class CallVideoActivity extends AbsOTOActivity {
|
||||
}
|
||||
|
||||
void createShow(long msg) {
|
||||
if(model.equals(CallClientManager.VIDEO_RECEIVED_CALL)){
|
||||
if (model.equals(CallClientManager.VIDEO_RECEIVED_CALL)) {
|
||||
return;
|
||||
}
|
||||
tipsDialog = new TipsTextDialog(mContext)
|
||||
|
||||
@@ -29,6 +29,7 @@ import com.shayu.onetoone.event.MessageMsgBusEvent;
|
||||
import com.shayu.onetoone.listener.OnDialogClickListener;
|
||||
import com.shayu.onetoone.manager.OTONetManager;
|
||||
import com.shayu.onetoone.manager.RouteManager;
|
||||
import com.shayu.onetoone.manager.SendMessageManager;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
@@ -40,8 +41,13 @@ import org.greenrobot.eventbus.Subscribe;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import io.rong.imkit.IMCenter;
|
||||
import io.rong.imkit.conversation.ConversationFragment;
|
||||
import io.rong.imlib.IRongCallback;
|
||||
import io.rong.imlib.RongIMClient;
|
||||
import io.rong.imlib.model.Conversation;
|
||||
import io.rong.imlib.model.Message;
|
||||
import io.rong.message.TextMessage;
|
||||
|
||||
/**
|
||||
* 聊天界面
|
||||
@@ -77,34 +83,61 @@ public class ChatActivity extends AbsOTOActivity {
|
||||
FragmentTransaction transaction = manager.beginTransaction();
|
||||
transaction.replace(R.id.container, conversationFragment);
|
||||
transaction.commit();
|
||||
|
||||
initChatUpData();
|
||||
Bundle bundle = getIntent().getExtras();
|
||||
if (bundle != null) {
|
||||
int bundleInt = bundle.getInt("type", -1);
|
||||
if (bundleInt == CALL_CHAT_TYPE_GIFT) {
|
||||
String data = bundle.getString("data");
|
||||
if (data != null) {
|
||||
SendConsumeBean bean = JSONObject.parseObject(data, SendConsumeBean.class);
|
||||
if (bean.getProp().getId() == 0) {
|
||||
return;
|
||||
}
|
||||
ImageView imageView = new ImageView(this);
|
||||
String data = bundle.getString("data");
|
||||
SendConsumeBean bean = JSONObject.parseObject(data, SendConsumeBean.class);
|
||||
if (bean == null) {
|
||||
return;
|
||||
}
|
||||
if (bundleInt == CALL_CHAT_TYPE_GIFT || bundleInt == CALL_CHAT_TYPE_MATCH) {
|
||||
System.out.println("匹配數據:" + data);
|
||||
if (bean.getProp().getId() == 0) {
|
||||
return;
|
||||
}
|
||||
ImageView imageView = new ImageView(this);
|
||||
|
||||
new TipsDialog(mContext)
|
||||
.setTitle(WordUtil.getNewString(R.string.dialog_normal_title))
|
||||
.setContent(WordUtil.getNewString(R.string.dialog_normal_content) + bean.getProp().getCnTitle() + "*" + bean.getProp().getNum())
|
||||
.setContentView(imageView)
|
||||
.setApplyText(WordUtil.getNewString(R.string.dialog_call_prop_apply))
|
||||
.setOnDialogClickListener(new OnDialogClickListener() {
|
||||
@Override
|
||||
public void onCreateView(View itemView) {
|
||||
super.onCreateView(itemView);
|
||||
ImgLoader.display(ChatActivity.this, bean.getProp().getIcon(), (ImageView) itemView);
|
||||
}
|
||||
}).showDialog();
|
||||
} else if (bundleInt == CALL_CHAT_TYPE_CHAT_UP) {
|
||||
String token = bundle.getString("token", "");
|
||||
if (!StringUtil.isEmpty(bean.getAccostMsg())) {
|
||||
Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE;
|
||||
TextMessage messageContent = TextMessage.obtain(bean.getAccostMsg());
|
||||
Message message = Message.obtain(targetId, conversationType, messageContent);
|
||||
IMCenter.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
|
||||
@Override
|
||||
public void onAttached(Message message) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Message message) {
|
||||
SendMessageManager.onCallSuccess(token, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Message message, RongIMClient.ErrorCode errorCode) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
new TipsDialog(mContext)
|
||||
.setTitle(WordUtil.getNewString(R.string.dialog_normal_title))
|
||||
.setContent(WordUtil.getNewString(R.string.dialog_normal_content) + bean.getProp().getCnTitle() + "*" + bean.getProp().getNum())
|
||||
.setContentView(imageView)
|
||||
.setOnDialogClickListener(new OnDialogClickListener() {
|
||||
@Override
|
||||
public void onCreateView(View itemView) {
|
||||
super.onCreateView(itemView);
|
||||
ImgLoader.display(ChatActivity.this, bean.getProp().getIcon(), (ImageView) itemView);
|
||||
}
|
||||
}).showDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
initChatUpData();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.shayu.onetoone.adapter;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -10,11 +12,20 @@ import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.makeramen.roundedimageview.RoundedImageView;
|
||||
import com.shayu.onetoone.R;
|
||||
import com.shayu.onetoone.activity.message.ChatActivity;
|
||||
import com.shayu.onetoone.bean.HomeItemBean;
|
||||
import com.shayu.onetoone.bean.SendConsumeBean;
|
||||
import com.shayu.onetoone.dialog.TipsDialog;
|
||||
import com.shayu.onetoone.listener.OnDialogClickListener;
|
||||
import com.shayu.onetoone.listener.OnSendMessageListener;
|
||||
import com.shayu.onetoone.manager.SendMessageManager;
|
||||
import com.shayu.onetoone.utils.ConversationUtils;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -105,7 +116,45 @@ public class HomeHotListAdapter extends RecyclerView.Adapter<HomeHotListAdapter.
|
||||
itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
ConversationUtils.startConversation(mContext, bean.getId() + "");
|
||||
if (bean.getIs_accost() == 0) {
|
||||
ConversationUtils.startConversation(mContext, bean.getId() + "");
|
||||
return;
|
||||
}
|
||||
SendMessageManager.chatUp(bean.getId() + "", new OnSendMessageListener() {
|
||||
@Override
|
||||
public void onSuccess(String token, SendConsumeBean sb) {
|
||||
super.onSuccess(token, sb);
|
||||
System.out.println("搭讪回调:" + JSONObject.toJSONString(sb));
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("token", token);
|
||||
bundle.putInt("type", ChatActivity.CALL_CHAT_TYPE_CHAT_UP);
|
||||
bundle.putString("data", JSONObject.toJSONString(sb));
|
||||
ConversationUtils.startConversation(mContext, bean.getId() + "", bundle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int status, String msg, SendConsumeBean bean) {
|
||||
super.onError(status, msg, bean);
|
||||
if (status == OnSendMessageListener.STATUS_NOT_PRICE) {
|
||||
new TipsDialog(mContext)
|
||||
.setTitle(WordUtil.getNewString(R.string.money_title))
|
||||
.setApplyText(WordUtil.getNewString(R.string.money_apply))
|
||||
.setOnDialogClickListener(new OnDialogClickListener() {
|
||||
@Override
|
||||
public void onApply(Dialog dialog) {
|
||||
super.onApply(dialog);
|
||||
ToastUtil.showDebug("跳充值页面");
|
||||
}
|
||||
})
|
||||
.setCancelText(WordUtil.getNewString(R.string.money_cancel))
|
||||
.showDialog();
|
||||
} else {
|
||||
new TipsDialog(mContext)
|
||||
.setTitle(msg)
|
||||
.showDialog();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -102,7 +102,8 @@ public class HomeRankListAdapter extends RecyclerView.Adapter<HomeRankListAdapte
|
||||
follow.setVisibility(View.VISIBLE);
|
||||
}
|
||||
ImgLoader.display(mContext, bean.getAvatar(), avatar);
|
||||
follow.setText(bean.getUid());
|
||||
follow.setText(R.string.layout_home_ranking_tips1);
|
||||
follow.setTag(bean.getUid());
|
||||
follow.setOnClickListener(v -> {
|
||||
OTONetManager.getInstance(mContext)
|
||||
.follow(v.getTag().toString(), new HttpCallback<FollowBean>() {
|
||||
|
||||
@@ -104,25 +104,31 @@ public class HomeRecommendListAdapter extends RecyclerView.Adapter<HomeRecommend
|
||||
} else {
|
||||
sex.setImageResource(R.mipmap.ic_message_tab_woman);
|
||||
}
|
||||
if (itemBean.getName_auth() == 1) {
|
||||
if (itemBean.getName_auth() == 2) {
|
||||
auth.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
auth.setVisibility(View.GONE);
|
||||
}
|
||||
if(itemBean.getIs_accost()==1){
|
||||
if (itemBean.getIs_accost() == 1) {
|
||||
chat.setImageResource(R.mipmap.ic_home_recommend_chat_up);
|
||||
}else{
|
||||
} else {
|
||||
chat.setImageResource(R.mipmap.ic_home_recommend_chat);
|
||||
}
|
||||
ImgLoader.display(mContext, itemBean.getAvatar(), avatar);
|
||||
chat.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (itemBean.getIs_accost() == 0) {
|
||||
ConversationUtils.startConversation(mContext, itemBean.getId() + "");
|
||||
return;
|
||||
}
|
||||
SendMessageManager.chatUp(itemBean.getId() + "", new OnSendMessageListener() {
|
||||
@Override
|
||||
public void onSuccess(String token, SendConsumeBean bean) {
|
||||
super.onSuccess(token, bean);
|
||||
System.out.println("搭讪回调:" + JSONObject.toJSONString(bean));
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("token", token);
|
||||
bundle.putInt("type", ChatActivity.CALL_CHAT_TYPE_CHAT_UP);
|
||||
bundle.putString("data", JSONObject.toJSONString(bean));
|
||||
ConversationUtils.startConversation(mContext, itemBean.getId() + "", bundle);
|
||||
@@ -144,7 +150,7 @@ public class HomeRecommendListAdapter extends RecyclerView.Adapter<HomeRecommend
|
||||
})
|
||||
.setCancelText(WordUtil.getNewString(R.string.money_cancel))
|
||||
.showDialog();
|
||||
}else{
|
||||
} else {
|
||||
new TipsDialog(mContext)
|
||||
.setTitle(msg)
|
||||
.showDialog();
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.shayu.onetoone.R;
|
||||
import com.shayu.onetoone.bean.MessageChatAuthContent;
|
||||
import com.shayu.onetoone.bean.MessageChatGiftContent;
|
||||
import com.yanzhenjie.recyclerview.SwipeRecyclerView;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
@@ -16,12 +16,12 @@ public class HomeItemBean extends BaseModel {
|
||||
private int b_y;
|
||||
private int b_ym;
|
||||
private int b_ymd;
|
||||
private int name_auth;
|
||||
private int name_auth;//1未认证 2已认证 3审核中 4被拒绝
|
||||
private long name_auth_time;
|
||||
private String auth_front;
|
||||
private String auth_back;
|
||||
private String auth_remark;
|
||||
private int sage_auth;
|
||||
private int sage_auth;//1未认证 2已认证 3审核中 4被拒绝
|
||||
private long sage_auth_time;
|
||||
private int is_hot;
|
||||
private String vodie_price;
|
||||
|
||||
@@ -13,10 +13,19 @@ public class SendConsumeBean extends BaseModel {
|
||||
private long mp3Time;
|
||||
private int code;
|
||||
private String msg;
|
||||
private String accostMsg;
|
||||
|
||||
public SendConsumeBean() {
|
||||
}
|
||||
|
||||
public String getAccostMsg() {
|
||||
return accostMsg;
|
||||
}
|
||||
|
||||
public void setAccostMsg(String accostMsg) {
|
||||
this.accostMsg = accostMsg;
|
||||
}
|
||||
|
||||
public UserBean getMateUser() {
|
||||
return mateUser;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.shayu.onetoone.bean;
|
||||
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
|
||||
@@ -8,6 +9,7 @@ public class UserBean extends BaseModel {
|
||||
IMLoginModel user;
|
||||
UserInfo info;
|
||||
UserLevel level;
|
||||
@SerializedName("gift_num")
|
||||
int giftNum;
|
||||
|
||||
int status; //0 需要跳转到 编辑资料页面
|
||||
|
||||
@@ -52,7 +52,9 @@ public class FirstTipsDialog extends AbsFullDialogPopupWindow {
|
||||
}
|
||||
|
||||
private void setModel() {
|
||||
if(isHome){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -8,11 +8,13 @@ import android.text.TextUtils;
|
||||
import android.view.SurfaceView;
|
||||
|
||||
import com.blankj.utilcode.util.PermissionUtils;
|
||||
import com.shayu.onetoone.AppContext;
|
||||
import com.shayu.onetoone.R;
|
||||
import com.shayu.onetoone.bean.SendConsumeBean;
|
||||
import com.shayu.onetoone.listener.OnCallStatusListener;
|
||||
import com.shayu.onetoone.listener.OnSendMessageListener;
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
|
||||
@@ -24,6 +26,7 @@ import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import io.rong.callkit.util.CallKitUtils;
|
||||
import io.rong.calllib.CallUserProfile;
|
||||
import io.rong.calllib.IRongCallListener;
|
||||
import io.rong.calllib.IRongReceivedCallListener;
|
||||
import io.rong.calllib.RongCallClient;
|
||||
@@ -65,6 +68,13 @@ public class CallClientManager {
|
||||
}
|
||||
|
||||
public SurfaceView getRemoteVideo() {
|
||||
if (RongCallClient.getInstance() != null) {
|
||||
for (CallUserProfile profile : RongCallClient.getInstance().getCallSession().getParticipantProfileList()) {
|
||||
if (!profile.getUserId().equals(IMLoginManager.get(AppContext.getTopActivity()).getUserInfo().getId() + "")) {
|
||||
return profile.getVideoView();
|
||||
}
|
||||
}
|
||||
}
|
||||
return remoteVideo;
|
||||
}
|
||||
|
||||
@@ -522,12 +532,12 @@ public class CallClientManager {
|
||||
* 如果对端调用{@link RongCallClient#startCall(int, boolean, Conversation.ConversationType, String, List, List, RongCallCommon.CallMediaType, String, StartCameraCallback)} 或
|
||||
* {@link RongCallClient#acceptCall(String, int, boolean, StartCameraCallback)}开始的音视频通话,则可以使用如下设置改变对端视频流的镜像显示:<br />
|
||||
* <pre class="prettyprint">
|
||||
* public void onRemoteUserJoined(String userId, RongCallCommon.CallMediaType mediaType, int userType, SurfaceView remoteVideo) {
|
||||
* if (null != remoteVideo) {
|
||||
* ((RongRTCVideoView) remoteVideo).setMirror( boolean);//观看对方视频流是否镜像处理
|
||||
* }
|
||||
* }
|
||||
* </pre>
|
||||
* public void onRemoteUserJoined(String userId, RongCallCommon.CallMediaType mediaType, int userType, SurfaceView remoteVideo) {
|
||||
* if (null != remoteVideo) {
|
||||
* ((RongRTCVideoView) remoteVideo).setMirror( boolean);//观看对方视频流是否镜像处理
|
||||
* }
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
@Override
|
||||
public void onRemoteUserJoined(String userId, RongCallCommon.CallMediaType mediaType, int userType, SurfaceView remoteVideo) {
|
||||
|
||||
@@ -88,6 +88,11 @@ public class OTONetManager {
|
||||
@Override
|
||||
public void accept(ResponseModel<IMLoginModel> imLoginModelResponseModel) throws Exception {
|
||||
if (callback != null) {
|
||||
if(imLoginModelResponseModel.isError()){
|
||||
JSONObject jsonSrc = imLoginModelResponseModel.getSrcJSONOBject();
|
||||
callback.onError(jsonSrc.getJSONObject("data").getString("msg"));
|
||||
return;
|
||||
}
|
||||
IMLoginModel model = imLoginModelResponseModel.getData().getInfo();
|
||||
callback.onSuccess(model);
|
||||
}
|
||||
@@ -941,7 +946,6 @@ public class OTONetManager {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void getMatchingInfo(HttpCallback<MatchingInfoBean> callback) {
|
||||
|
||||
API.get().otoApi(mContext)
|
||||
@@ -1004,6 +1008,7 @@ public class OTONetManager {
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置基本资料
|
||||
*/
|
||||
@@ -1033,6 +1038,7 @@ public class OTONetManager {
|
||||
|
||||
/**
|
||||
* 设置
|
||||
*
|
||||
* @param key 'signature' => "签名",
|
||||
* 'sex' => "性别",
|
||||
* 'user_nicename' => "昵称",
|
||||
@@ -1054,9 +1060,13 @@ public class OTONetManager {
|
||||
@Override
|
||||
public void accept(ResponseModel<List<BaseModel>> listResponseModel) throws Exception {
|
||||
if (listResponseModel.getData().getCode() == 0) {
|
||||
callback.onSuccess(new HttpCallbackModel(listResponseModel.getData().getCode(), listResponseModel.getData().getMsg()));
|
||||
if (callback != null) {
|
||||
callback.onSuccess(new HttpCallbackModel(listResponseModel.getData().getCode(), listResponseModel.getData().getMsg()));
|
||||
}
|
||||
} else {
|
||||
callback.onError(listResponseModel.getData().getMsg());
|
||||
if (callback != null) {
|
||||
callback.onError(listResponseModel.getData().getMsg());
|
||||
}
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@@ -1125,7 +1135,7 @@ public class OTONetManager {
|
||||
*/
|
||||
public void getFriendAppMoneyLogModel(String currencyType, String income, int page, HttpCallback<List<FriendAppMoneyLogModel>> callback) {
|
||||
API.get().otoApi(mContext).
|
||||
getFriendAppMoneyLogModel(currencyType, income,page)
|
||||
getFriendAppMoneyLogModel(currencyType, income, page)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<List<FriendAppMoneyLogModel>>>() {
|
||||
@@ -1287,9 +1297,9 @@ public class OTONetManager {
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void getFriends(int page,HttpCallback<List<HomeItemBean>> callback) {
|
||||
public void getFriends(int page, HttpCallback<List<HomeItemBean>> callback) {
|
||||
API.get().otoApi(mContext).
|
||||
getFriends(page+"")
|
||||
getFriends(page + "")
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(listResponseModel -> {
|
||||
@@ -1304,9 +1314,10 @@ public class OTONetManager {
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
public void getFollows(int page,HttpCallback<List<HomeItemBean>> callback) {
|
||||
|
||||
public void getFollows(int page, HttpCallback<List<HomeItemBean>> callback) {
|
||||
API.get().otoApi(mContext).
|
||||
getFollows(page+"")
|
||||
getFollows(page + "")
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(listResponseModel -> {
|
||||
@@ -1321,9 +1332,10 @@ public class OTONetManager {
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
public void getFans(int page,HttpCallback<List<HomeItemBean>> callback) {
|
||||
|
||||
public void getFans(int page, HttpCallback<List<HomeItemBean>> callback) {
|
||||
API.get().otoApi(mContext).
|
||||
getFans(page+"")
|
||||
getFans(page + "")
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(listResponseModel -> {
|
||||
@@ -1338,6 +1350,7 @@ public class OTONetManager {
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void getPeopleNum(HttpCallback<PeopleNum> callback) {
|
||||
API.get().otoApi(mContext).
|
||||
getPeopleNum()
|
||||
|
||||
@@ -113,8 +113,7 @@ public class SendMessageManager {
|
||||
"搭讪消息",
|
||||
"1",
|
||||
1,
|
||||
"after",
|
||||
false
|
||||
true
|
||||
);
|
||||
send(sendData, listener);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user