11111
This commit is contained in:
parent
701f1c6dc1
commit
a97dcbbb5b
@ -0,0 +1,9 @@
|
|||||||
|
package com.yunbao.common.event;
|
||||||
|
|
||||||
|
import com.yunbao.common.bean.BaseModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 融云连接状态监听通知
|
||||||
|
*/
|
||||||
|
public class RongIMConnectionStatusEvent extends BaseModel {
|
||||||
|
}
|
@ -14,6 +14,7 @@ import com.yunbao.common.Constants;
|
|||||||
import com.yunbao.common.CommonAppConfig;
|
import com.yunbao.common.CommonAppConfig;
|
||||||
import com.yunbao.common.bean.BaseModel;
|
import com.yunbao.common.bean.BaseModel;
|
||||||
import com.yunbao.common.bean.IMLoginModel;
|
import com.yunbao.common.bean.IMLoginModel;
|
||||||
|
import com.yunbao.common.event.RongIMConnectionStatusEvent;
|
||||||
import com.yunbao.common.manager.IMLoginManager;
|
import com.yunbao.common.manager.IMLoginManager;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
@ -173,7 +174,7 @@ public class RongcloudIMManager {
|
|||||||
break;
|
break;
|
||||||
//用户账号在其它设备登录,此设备被踢下线
|
//用户账号在其它设备登录,此设备被踢下线
|
||||||
case KICKED_OFFLINE_BY_OTHER_CLIENT:
|
case KICKED_OFFLINE_BY_OTHER_CLIENT:
|
||||||
// EventBus.getDefault().post(new BaseModel());
|
EventBus.getDefault().post(new RongIMConnectionStatusEvent());
|
||||||
break;
|
break;
|
||||||
//连接暂时挂起(多是由于网络问题导致),SDK 会在合适时机进行自动重连
|
//连接暂时挂起(多是由于网络问题导致),SDK 会在合适时机进行自动重连
|
||||||
case SUSPEND:
|
case SUSPEND:
|
||||||
|
@ -9,9 +9,9 @@ ext {
|
|||||||
]
|
]
|
||||||
manifestPlaceholders = [
|
manifestPlaceholders = [
|
||||||
//正式
|
//正式
|
||||||
serverHost : "https://napi.yaoulive.com",
|
// serverHost : "https://napi.yaoulive.com",
|
||||||
//測試
|
//測試
|
||||||
// serverHost : "https://ceshi.yaoulive.com",
|
serverHost : "https://ceshi.yaoulive.com",
|
||||||
|
|
||||||
//腾讯地图
|
//腾讯地图
|
||||||
txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB",
|
txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB",
|
||||||
|
@ -50,10 +50,13 @@ public class EditNameRemarksActivity extends AbsActivity implements View.OnClick
|
|||||||
mEditText.setFilters(new InputFilter[]{
|
mEditText.setFilters(new InputFilter[]{
|
||||||
new InputFilter.LengthFilter(10)
|
new InputFilter.LengthFilter(10)
|
||||||
});
|
});
|
||||||
String content = InstructorRemarkManager.get(mContext).getInstructorRemark().get(userId);
|
|
||||||
findViewById(R.id.btn_save).setOnClickListener(this);
|
findViewById(R.id.btn_save).setOnClickListener(this);
|
||||||
mEditText.setText(content);
|
String content = InstructorRemarkManager.get(mContext).getInstructorRemark().get(userId);
|
||||||
mEditText.setSelection(content.length());
|
if (!TextUtils.isEmpty(content)){
|
||||||
|
mEditText.setText(content);
|
||||||
|
mEditText.setSelection(content.length());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -93,7 +96,7 @@ public class EditNameRemarksActivity extends AbsActivity implements View.OnClick
|
|||||||
if (code == 0 && info.length > 0) {
|
if (code == 0 && info.length > 0) {
|
||||||
JSONObject obj = JSON.parseObject(info[0]);
|
JSONObject obj = JSON.parseObject(info[0]);
|
||||||
SearchUserBean userBean = JSON.toJavaObject(obj, SearchUserBean.class);
|
SearchUserBean userBean = JSON.toJavaObject(obj, SearchUserBean.class);
|
||||||
String userNiceName = userBean.getUserNiceName() + "(" + remark + ")";
|
String userNiceName = remark;
|
||||||
UserInfo userInfo = new UserInfo(userId, userNiceName, Uri.parse(userBean.getAvatar()));
|
UserInfo userInfo = new UserInfo(userId, userNiceName, Uri.parse(userBean.getAvatar()));
|
||||||
//使用空白字段存储自己服务器用户的所有的信息
|
//使用空白字段存储自己服务器用户的所有的信息
|
||||||
userInfo.setExtra(GsonUtils.toJson(userBean));
|
userInfo.setExtra(GsonUtils.toJson(userBean));
|
||||||
|
@ -35,7 +35,6 @@ import org.greenrobot.eventbus.ThreadMode;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import io.rong.imkit.conversation.ConversationFragment;
|
|
||||||
import io.rong.imkit.userinfo.RongUserInfoManager;
|
import io.rong.imkit.userinfo.RongUserInfoManager;
|
||||||
import io.rong.imlib.model.UserInfo;
|
import io.rong.imlib.model.UserInfo;
|
||||||
|
|
||||||
@ -66,7 +65,7 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl
|
|||||||
super.main();
|
super.main();
|
||||||
EventBus.getDefault().register(this);
|
EventBus.getDefault().register(this);
|
||||||
mContext = this;
|
mContext = this;
|
||||||
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
|
// getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
|
||||||
initView();
|
initView();
|
||||||
initData();
|
initData();
|
||||||
}
|
}
|
||||||
@ -100,33 +99,37 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl
|
|||||||
* 初始化布局
|
* 初始化布局
|
||||||
*/
|
*/
|
||||||
private void initView() {
|
private void initView() {
|
||||||
// 添加会话界面
|
try {
|
||||||
conversationFragment = new PDLiveConversationFragment();
|
// 添加会话界面
|
||||||
FragmentManager manager = getSupportFragmentManager();
|
conversationFragment = new PDLiveConversationFragment();
|
||||||
FragmentTransaction transaction = manager.beginTransaction();
|
FragmentManager manager = getSupportFragmentManager();
|
||||||
transaction.replace(R.id.container, conversationFragment);
|
FragmentTransaction transaction = manager.beginTransaction();
|
||||||
transaction.commit();
|
transaction.replace(R.id.container, conversationFragment);
|
||||||
inputPanel = findViewById(R.id.input_panel);
|
transaction.commit();
|
||||||
titleView = findViewById(R.id.titleView);
|
inputPanel = findViewById(R.id.input_panel);
|
||||||
imgMore = findViewById(R.id.img_more);
|
titleView = findViewById(R.id.titleView);
|
||||||
imBack = findViewById(R.id.btn_back);
|
imgMore = findViewById(R.id.img_more);
|
||||||
findViewById(R.id.root_layout).setOnClickListener(new View.OnClickListener() {
|
imBack = findViewById(R.id.btn_back);
|
||||||
@Override
|
findViewById(R.id.root_layout).setOnClickListener(new View.OnClickListener() {
|
||||||
public void onClick(View v) {
|
@Override
|
||||||
InputMethodManager imm = (InputMethodManager)
|
public void onClick(View v) {
|
||||||
getSystemService(Context.INPUT_METHOD_SERVICE);
|
InputMethodManager imm = (InputMethodManager)
|
||||||
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
|
getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
}
|
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
|
||||||
});
|
}
|
||||||
imgMore.setOnClickListener(this);
|
});
|
||||||
imBack.setOnClickListener(this);
|
imgMore.setOnClickListener(this);
|
||||||
|
imBack.setOnClickListener(this);
|
||||||
|
|
||||||
inputPanel.addMediaMessageCallback(new InputPanelViewHolder.MediaMessageCallback() {
|
inputPanel.addMediaMessageCallback(new InputPanelViewHolder.MediaMessageCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void choosePic(int intoIndex) {
|
public void choosePic(int intoIndex) {
|
||||||
jumpPic(intoIndex);
|
jumpPic(intoIndex);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,12 +28,15 @@ public class PDLiveMessageListAdapter extends MessageListAdapter {
|
|||||||
Message.SentStatus sentStatus = mDataList.get(position).getMessage().getSentStatus();
|
Message.SentStatus sentStatus = mDataList.get(position).getMessage().getSentStatus();
|
||||||
ImageView readReceipt = holder.getConvertView().findViewById(R.id.rc_read_receipt);
|
ImageView readReceipt = holder.getConvertView().findViewById(R.id.rc_read_receipt);
|
||||||
ImageView readReceiptNew = holder.getConvertView().findViewById(R.id.rc_read_receipt_new);
|
ImageView readReceiptNew = holder.getConvertView().findViewById(R.id.rc_read_receipt_new);
|
||||||
if (readReceipt.getVisibility() == View.VISIBLE) {
|
if (readReceipt!=null&&readReceiptNew!=null){
|
||||||
readReceipt.setVisibility(View.GONE);
|
if (readReceipt.getVisibility() == View.VISIBLE) {
|
||||||
readReceiptNew.setBackgroundResource(R.mipmap.icon_message_read);
|
readReceipt.setVisibility(View.GONE);
|
||||||
} else {
|
readReceiptNew.setBackgroundResource(R.mipmap.icon_message_read);
|
||||||
if (messageDirection.equals(Message.MessageDirection.SEND)&&sentStatus.equals(Message.SentStatus.SENT))
|
} else {
|
||||||
readReceiptNew.setBackgroundResource(R.mipmap.icon_message_unread);
|
if (messageDirection.equals(Message.MessageDirection.SEND)&&sentStatus.equals(Message.SentStatus.SENT))
|
||||||
|
readReceiptNew.setBackgroundResource(R.mipmap.icon_message_unread);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -163,7 +163,7 @@ public class InputPanelViewHolder extends LinearLayout implements View.OnClickLi
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Message message, RongIMClient.ErrorCode errorCode) {
|
public void onError(Message message, RongIMClient.ErrorCode errorCode) {
|
||||||
|
ToastUtil.show(errorCode.msg);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -50,10 +50,12 @@ import com.yunbao.common.bean.UpdataListBean;
|
|||||||
import com.yunbao.common.bean.UserBean;
|
import com.yunbao.common.bean.UserBean;
|
||||||
import com.yunbao.common.custom.TabButtonGroup;
|
import com.yunbao.common.custom.TabButtonGroup;
|
||||||
import com.yunbao.common.event.MessageIMEvent;
|
import com.yunbao.common.event.MessageIMEvent;
|
||||||
|
import com.yunbao.common.event.RongIMConnectionStatusEvent;
|
||||||
import com.yunbao.common.event.UpdateTablePointMe;
|
import com.yunbao.common.event.UpdateTablePointMe;
|
||||||
import com.yunbao.common.http.CommonHttpConsts;
|
import com.yunbao.common.http.CommonHttpConsts;
|
||||||
import com.yunbao.common.http.HttpCallback;
|
import com.yunbao.common.http.HttpCallback;
|
||||||
import com.yunbao.common.interfaces.CommonCallback;
|
import com.yunbao.common.interfaces.CommonCallback;
|
||||||
|
import com.yunbao.common.manager.IMLoginManager;
|
||||||
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
|
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
|
||||||
import com.yunbao.common.utils.DialogUitl;
|
import com.yunbao.common.utils.DialogUitl;
|
||||||
import com.yunbao.common.utils.DpUtil;
|
import com.yunbao.common.utils.DpUtil;
|
||||||
@ -81,6 +83,7 @@ import com.yunbao.live.views.ChatListViewHolder;
|
|||||||
import com.yunbao.main.R;
|
import com.yunbao.main.R;
|
||||||
import com.yunbao.main.dialog.MainStartDialogFragment;
|
import com.yunbao.main.dialog.MainStartDialogFragment;
|
||||||
import com.yunbao.main.dialog.SigninDialog;
|
import com.yunbao.main.dialog.SigninDialog;
|
||||||
|
import com.yunbao.main.event.MainHomeCommunityToChatEvent;
|
||||||
import com.yunbao.main.event.PDLiveConversationListEvent;
|
import com.yunbao.main.event.PDLiveConversationListEvent;
|
||||||
import com.yunbao.main.http.MainHttpConsts;
|
import com.yunbao.main.http.MainHttpConsts;
|
||||||
import com.yunbao.main.http.MainHttpUtil;
|
import com.yunbao.main.http.MainHttpUtil;
|
||||||
@ -361,19 +364,19 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
|||||||
RongcloudIMManager.addRongcloudIMOnReceiveMessageListener(new RongIMClient.OnReceiveMessageWrapperListener() {
|
RongcloudIMManager.addRongcloudIMOnReceiveMessageListener(new RongIMClient.OnReceiveMessageWrapperListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onReceived(io.rong.imlib.model.Message message, int i, boolean b, boolean b1) {
|
public boolean onReceived(io.rong.imlib.model.Message message, int i, boolean b, boolean b1) {
|
||||||
Log.e("wewe",message.getConversationType() +"112121");
|
Log.e("wewe", message.getConversationType() + "112121");
|
||||||
//融云直播间聊天
|
//融云直播间聊天
|
||||||
Message msg = Message.obtain();
|
Message msg = Message.obtain();
|
||||||
msg.what = Constants.SOCKET_WHAT_BROADCAST;
|
msg.what = Constants.SOCKET_WHAT_BROADCAST;
|
||||||
if (!"".equals(message.getContent()) && message.getContent() != null) {
|
if (!"".equals(message.getContent()) && message.getContent() != null) {
|
||||||
TextMessage content = (TextMessage) message.getContent();
|
TextMessage content = (TextMessage) message.getContent();
|
||||||
if(content.getContent().contains("_method_")) {
|
if (content.getContent().contains("_method_")) {
|
||||||
msg.obj = content.getContent();
|
msg.obj = content.getContent();
|
||||||
if (SocketRyClient.mSocketHandler != null) {
|
if (SocketRyClient.mSocketHandler != null) {
|
||||||
SocketRyClient.mSocketHandler.sendMessage(msg);
|
SocketRyClient.mSocketHandler.sendMessage(msg);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -1096,9 +1099,21 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
|||||||
* @param model
|
* @param model
|
||||||
*/
|
*/
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
public void userSignOut(BaseModel model) {
|
public void userSignOut(RongIMConnectionStatusEvent model) {
|
||||||
// IMLoginManager.get(mContext).logout();
|
IMLoginManager.get(mContext).logout();
|
||||||
// CommonAppConfig.getInstance().clearLoginInfo();
|
CommonAppConfig.getInstance().clearLoginInfo();
|
||||||
// LoginActivity.forward();
|
LoginActivity.forward();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户被踢下线
|
||||||
|
*
|
||||||
|
* @param model
|
||||||
|
*/
|
||||||
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
|
public void onMainHomeCommunityToChatEvent(MainHomeCommunityToChatEvent model) {
|
||||||
|
ConversationIMListManager.get(mContext).jumpConversation(mContext, model.getTargetId());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,89 @@
|
|||||||
|
package com.yunbao.main.dialog;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.graphics.drawable.BitmapDrawable;
|
||||||
|
import android.view.Gravity;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.PopupWindow;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
|
import com.yunbao.main.R;
|
||||||
|
|
||||||
|
import io.rong.imkit.IMCenter;
|
||||||
|
import io.rong.imlib.RongIMClient;
|
||||||
|
import io.rong.imlib.model.Conversation;
|
||||||
|
|
||||||
|
public class ConversationPopuwWindow implements View.OnClickListener {
|
||||||
|
private Activity mContext;
|
||||||
|
private String userId;
|
||||||
|
private View popupView;
|
||||||
|
private TextView tvBlack;
|
||||||
|
private PopupWindow popupWindow;
|
||||||
|
|
||||||
|
public ConversationPopuwWindow(Activity context) {
|
||||||
|
this.mContext = context;
|
||||||
|
popupView = LayoutInflater.from(mContext).inflate(R.layout.popwindow_chat_list, null);
|
||||||
|
initView();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConversationPopuwWindow setIsAdmin(String userId) {
|
||||||
|
this.userId = userId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化组件
|
||||||
|
*/
|
||||||
|
private void initView() {
|
||||||
|
tvBlack = popupView.findViewById(com.yunbao.live.R.id.tv_black);
|
||||||
|
tvBlack.setOnClickListener(this);
|
||||||
|
tvBlack.setText("删除");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 展示弹窗
|
||||||
|
*
|
||||||
|
* @param view 显示在什么组件的下面
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public void show(View view) {
|
||||||
|
popupWindow = new PopupWindow(popupView, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, true);
|
||||||
|
int[] location = new int[2];
|
||||||
|
view.getLocationOnScreen(location);
|
||||||
|
popupWindow.setBackgroundDrawable(new BitmapDrawable());
|
||||||
|
popupView.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
|
||||||
|
|
||||||
|
int popupWidth = popupView.getMeasuredWidth();
|
||||||
|
int popupHeight = popupView.getMeasuredHeight();
|
||||||
|
|
||||||
|
popupWindow.showAtLocation(view, Gravity.NO_GRAVITY, (location[0]+view.getWidth()/2)-popupWidth/2,
|
||||||
|
location[1]-popupHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
int id = v.getId();
|
||||||
|
//拉黑
|
||||||
|
if (id == com.yunbao.live.R.id.tv_black) {
|
||||||
|
Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE;
|
||||||
|
IMCenter.getInstance().removeConversation(conversationType, userId, new RongIMClient.ResultCallback<Boolean>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Boolean aBoolean) {
|
||||||
|
ToastUtil.show("删除成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(RongIMClient.ErrorCode errorCode) {
|
||||||
|
ToastUtil.show(errorCode.msg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
popupWindow.dismiss();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
package com.yunbao.main.event;
|
||||||
|
|
||||||
|
import com.yunbao.common.bean.BaseModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* web跳转聊天页面
|
||||||
|
*/
|
||||||
|
public class MainHomeCommunityToChatEvent extends BaseModel {
|
||||||
|
private String targetId = "";
|
||||||
|
|
||||||
|
public String getTargetId() {
|
||||||
|
return targetId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MainHomeCommunityToChatEvent setTargetId(String targetId) {
|
||||||
|
this.targetId = targetId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
@ -6,6 +6,8 @@ import android.content.Intent;
|
|||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
@ -13,19 +15,24 @@ import com.blankj.utilcode.util.GsonUtils;
|
|||||||
import com.yunbao.common.http.CommonHttpUtil;
|
import com.yunbao.common.http.CommonHttpUtil;
|
||||||
import com.yunbao.common.http.HttpCallback;
|
import com.yunbao.common.http.HttpCallback;
|
||||||
import com.yunbao.common.manager.InstructorRemarkManager;
|
import com.yunbao.common.manager.InstructorRemarkManager;
|
||||||
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
import com.yunbao.live.activity.PDLIiveChatActivity;
|
import com.yunbao.live.activity.PDLIiveChatActivity;
|
||||||
import com.yunbao.live.activity.PDLiveConversationActivity;
|
import com.yunbao.live.activity.PDLiveConversationActivity;
|
||||||
import com.yunbao.live.bean.SearchUserBean;
|
import com.yunbao.live.bean.SearchUserBean;
|
||||||
import com.yunbao.main.activity.PDLiveConversationListActivity;
|
import com.yunbao.main.activity.PDLiveConversationListActivity;
|
||||||
|
import com.yunbao.main.dialog.ConversationPopuwWindow;
|
||||||
import com.yunbao.main.utils.PDLiveCustomConversationProvider;
|
import com.yunbao.main.utils.PDLiveCustomConversationProvider;
|
||||||
import com.yunbao.main.utils.PDLiveMessageProcessor;
|
import com.yunbao.main.utils.PDLiveMessageProcessor;
|
||||||
|
|
||||||
|
import io.rong.imkit.RongIM;
|
||||||
|
import io.rong.imkit.config.ConversationListBehaviorListener;
|
||||||
import io.rong.imkit.config.RongConfigCenter;
|
import io.rong.imkit.config.RongConfigCenter;
|
||||||
import io.rong.imkit.conversationlist.model.BaseUiConversation;
|
import io.rong.imkit.conversationlist.model.BaseUiConversation;
|
||||||
import io.rong.imkit.conversationlist.provider.PrivateConversationProvider;
|
import io.rong.imkit.conversationlist.provider.PrivateConversationProvider;
|
||||||
import io.rong.imkit.userinfo.RongUserInfoManager;
|
import io.rong.imkit.userinfo.RongUserInfoManager;
|
||||||
import io.rong.imkit.utils.RouteUtils;
|
import io.rong.imkit.utils.RouteUtils;
|
||||||
import io.rong.imkit.widget.adapter.ProviderManager;
|
import io.rong.imkit.widget.adapter.ProviderManager;
|
||||||
|
import io.rong.imlib.model.Conversation;
|
||||||
import io.rong.imlib.model.UserInfo;
|
import io.rong.imlib.model.UserInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -47,6 +54,8 @@ public class ConversationIMListManager {
|
|||||||
ProviderManager<BaseUiConversation> providerManager = RongConfigCenter.conversationListConfig().getProviderManager();
|
ProviderManager<BaseUiConversation> providerManager = RongConfigCenter.conversationListConfig().getProviderManager();
|
||||||
//用自定义模板替换 SDK 原有模板
|
//用自定义模板替换 SDK 原有模板
|
||||||
providerManager.replaceProvider(PrivateConversationProvider.class, new PDLiveCustomConversationProvider());
|
providerManager.replaceProvider(PrivateConversationProvider.class, new PDLiveCustomConversationProvider());
|
||||||
|
//会话列表监听事件
|
||||||
|
RongIM.setConversationListBehaviorListener(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -98,10 +107,12 @@ public class ConversationIMListManager {
|
|||||||
* @param targetId 用户id
|
* @param targetId 用户id
|
||||||
*/
|
*/
|
||||||
public void jumpConversation(Activity context, String targetId) {
|
public void jumpConversation(Activity context, String targetId) {
|
||||||
|
// RouteUtils.registerActivity(RouteUtils.RongActivityType.ConversationActivity, PDLiveConversationActivity.class);
|
||||||
Intent intent = new Intent(context, PDLiveConversationActivity.class);
|
// Intent intent = new Intent(context, PDLiveConversationActivity.class);
|
||||||
intent.putExtra(RouteUtils.TARGET_ID, targetId);
|
// intent.putExtra(RouteUtils.TARGET_ID, targetId);
|
||||||
context.startActivity(intent);
|
// context.startActivity(intent);
|
||||||
|
Conversation.ConversationType type = Conversation.ConversationType.PRIVATE;
|
||||||
|
RouteUtils.routeToConversationActivity(context, type, targetId, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -119,7 +130,7 @@ public class ConversationIMListManager {
|
|||||||
String userNiceName = "";
|
String userNiceName = "";
|
||||||
String remark = InstructorRemarkManager.get(mContext).getInstructorRemark().get(userId);
|
String remark = InstructorRemarkManager.get(mContext).getInstructorRemark().get(userId);
|
||||||
if (!TextUtils.isEmpty(remark)) {
|
if (!TextUtils.isEmpty(remark)) {
|
||||||
userNiceName = userBean.getUserNiceName() + "(" + remark + ")";
|
userNiceName = remark;
|
||||||
} else {
|
} else {
|
||||||
userNiceName = userBean.getUserNiceName();
|
userNiceName = userBean.getUserNiceName();
|
||||||
}
|
}
|
||||||
@ -137,5 +148,29 @@ public class ConversationIMListManager {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ConversationListBehaviorListener listener = new ConversationListBehaviorListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onConversationPortraitClick(Context context, Conversation.ConversationType conversationType, String s) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onConversationPortraitLongClick(Context context, Conversation.ConversationType conversationType, String s) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onConversationLongClick(Context context, View view, BaseUiConversation baseUiConversation) {
|
||||||
|
new ConversationPopuwWindow((Activity) context)
|
||||||
|
.setIsAdmin(baseUiConversation.mCore.getTargetId())
|
||||||
|
.show(view);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onConversationClick(Context context, View view, BaseUiConversation baseUiConversation) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -45,9 +45,9 @@ public class PDLiveCustomConversationProvider extends BaseConversationProvider {
|
|||||||
Message.ReceivedStatus receivedStatus = list.get(position).mCore.getReceivedStatus();
|
Message.ReceivedStatus receivedStatus = list.get(position).mCore.getReceivedStatus();
|
||||||
ImageView readReceipt = holder.itemView.findViewById(com.yunbao.live.R.id.rc_read_receipt_new);
|
ImageView readReceipt = holder.itemView.findViewById(com.yunbao.live.R.id.rc_read_receipt_new);
|
||||||
if (receivedStatus.isRead()) {
|
if (receivedStatus.isRead()) {
|
||||||
readReceipt.setBackgroundResource(com.yunbao.live.R.mipmap.icon_message_read);
|
|
||||||
}else {
|
|
||||||
readReceipt.setBackgroundResource(com.yunbao.live.R.mipmap.icon_message_unread);
|
readReceipt.setBackgroundResource(com.yunbao.live.R.mipmap.icon_message_unread);
|
||||||
|
}else {
|
||||||
|
readReceipt.setBackgroundResource(com.yunbao.live.R.mipmap.icon_message_read);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,9 @@ import android.os.Build;
|
|||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.provider.MediaStore;
|
import android.provider.MediaStore;
|
||||||
|
|
||||||
import androidx.annotation.RequiresApi;
|
import androidx.annotation.RequiresApi;
|
||||||
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -49,11 +51,15 @@ import com.yunbao.main.R;
|
|||||||
import com.yunbao.main.activity.FansActivity;
|
import com.yunbao.main.activity.FansActivity;
|
||||||
import com.yunbao.main.activity.MainActivity;
|
import com.yunbao.main.activity.MainActivity;
|
||||||
import com.yunbao.main.dialog.EncourageDialog;
|
import com.yunbao.main.dialog.EncourageDialog;
|
||||||
|
import com.yunbao.main.event.MainHomeCommunityToChatEvent;
|
||||||
|
import com.yunbao.main.manager.imrongcloud.ConversationIMListManager;
|
||||||
import com.yunbao.main.utils.BottomBarUtil;
|
import com.yunbao.main.utils.BottomBarUtil;
|
||||||
import com.yunbao.video.activity.VideoPlayActivity;
|
import com.yunbao.video.activity.VideoPlayActivity;
|
||||||
import com.yunbao.video.bean.VideoBean;
|
import com.yunbao.video.bean.VideoBean;
|
||||||
import com.yunbao.video.utils.VideoStorge;
|
import com.yunbao.video.utils.VideoStorge;
|
||||||
|
|
||||||
|
import org.greenrobot.eventbus.EventBus;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -209,12 +215,6 @@ public class MainHomeCommunityViewHolder extends AbsMainHomeChildViewHolder impl
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void loadNewUrl() {
|
public void loadNewUrl() {
|
||||||
// new Handler().postDelayed(new Runnable() {
|
|
||||||
// @Override
|
|
||||||
// public void run() {
|
|
||||||
// mWebView.reload();
|
|
||||||
// }
|
|
||||||
// },100);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//js调用原生
|
//js调用原生
|
||||||
@ -294,8 +294,10 @@ public class MainHomeCommunityViewHolder extends AbsMainHomeChildViewHolder impl
|
|||||||
|
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
public void androidClickSayHiBack(String uid, String name, String img) {
|
public void androidClickSayHiBack(String uid, String name, String img) {
|
||||||
SystemMessageActivity.forward(mContext, "-1", uid, name, img);
|
EventBus.getDefault().post(new MainHomeCommunityToChatEvent().setTargetId(uid));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
public void androidMethodLookToLive(String liveId) {
|
public void androidMethodLookToLive(String liveId) {
|
||||||
//看直播
|
//看直播
|
||||||
@ -321,6 +323,7 @@ public class MainHomeCommunityViewHolder extends AbsMainHomeChildViewHolder impl
|
|||||||
}
|
}
|
||||||
|
|
||||||
private LiveRoomCheckLivePresenter mCheckLivePresenter;
|
private LiveRoomCheckLivePresenter mCheckLivePresenter;
|
||||||
|
|
||||||
private void gotoLive(final String live_id) {
|
private void gotoLive(final String live_id) {
|
||||||
LiveHttpUtil.getLiveInfo(live_id, new HttpCallback() {
|
LiveHttpUtil.getLiveInfo(live_id, new HttpCallback() {
|
||||||
@Override
|
@Override
|
||||||
@ -343,7 +346,7 @@ public class MainHomeCommunityViewHolder extends AbsMainHomeChildViewHolder impl
|
|||||||
}
|
}
|
||||||
mCheckLivePresenter.checkLive(liveBean);
|
mCheckLivePresenter.checkLive(liveBean);
|
||||||
} else {
|
} else {
|
||||||
RouteUtil.forwardUserHome(mContext, live_id,0);
|
RouteUtil.forwardUserHome(mContext, live_id, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
18
main/src/main/res/layout/popwindow_chat_list.xml
Normal file
18
main/src/main/res/layout/popwindow_chat_list.xml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_black"
|
||||||
|
android:layout_width="150dp"
|
||||||
|
android:layout_height="70dp"
|
||||||
|
android:background="@mipmap/chat_back"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/delete"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="17sp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
BIN
main/src/main/res/mipmap-xxhdpi/chat_back.png
Normal file
BIN
main/src/main/res/mipmap-xxhdpi/chat_back.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.7 KiB |
Loading…
Reference in New Issue
Block a user