update
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user