Browse Source

删除融云模块修改学生端一些报错问题

Pq 1 year ago
parent
commit
7faf5b405c
57 changed files with 6313 additions and 6460 deletions
  1. 1 1
      chatModule/build.gradle
  2. 1 1
      classRoom/src/main/res/layout/layout_accompaniment_list_item.xml
  3. 3 3
      live_teaching/build.gradle
  4. 3 3
      student/build.gradle
  5. 0 62
      student/src/main/java/com/cooleshow/student/App.java
  6. 0 1
      student/src/main/java/com/cooleshow/student/adapter/HomeTeacherStyleAdapter.java
  7. 422 422
      student/src/main/java/com/cooleshow/student/adapter/MessageAdapter.java
  8. 193 205
      student/src/main/java/com/cooleshow/student/contract/LiveRoomContract.java
  9. 0 27
      student/src/main/java/com/cooleshow/student/helper/ShareHelper.java
  10. 1117 1117
      student/src/main/java/com/cooleshow/student/presenter/live/LiveRoomPresenter.java
  11. 2 2
      student/src/main/java/com/cooleshow/student/push/CustomMiMessageReceiver.java
  12. 2 2
      student/src/main/java/com/cooleshow/student/push/MyHWPushService.java
  13. 15 18
      student/src/main/java/com/cooleshow/student/push/SealNotificationReceiver.java
  14. 2 2
      student/src/main/java/com/cooleshow/student/push/VivoPushReceiver.java
  15. 0 8
      student/src/main/java/com/cooleshow/student/push/XiaomiRongYunReceiver.java
  16. 2 2
      student/src/main/java/com/cooleshow/student/ui/course/MineCourseActivity.java
  17. 0 1
      student/src/main/java/com/cooleshow/student/ui/course/MinePracticeCourseFragment.java
  18. 0 2
      student/src/main/java/com/cooleshow/student/ui/course/PianoRoomCourseDetailActivity.java
  19. 0 1
      student/src/main/java/com/cooleshow/student/ui/course/PianoRoomCourseFragment.java
  20. 0 1
      student/src/main/java/com/cooleshow/student/ui/course/PracticeCourseDetailActivity.java
  21. 0 2
      student/src/main/java/com/cooleshow/student/ui/course/SparringCourseDetailActivity.java
  22. 2286 2286
      student/src/main/java/com/cooleshow/student/ui/live/LiveRoomActivity.java
  23. 321 321
      student/src/main/java/com/cooleshow/student/ui/live/floatPop/FloatWindowHelper.java
  24. 94 94
      student/src/main/java/com/cooleshow/student/ui/live/floatPop/FloatingWindowService.java
  25. 0 1
      student/src/main/java/com/cooleshow/student/ui/main/CourseTableFragment.kt
  26. 1 2
      student/src/main/java/com/cooleshow/student/ui/main/HomeFragment.java
  27. 6 15
      student/src/main/java/com/cooleshow/student/ui/main/MainActivity.java
  28. 1 1
      student/src/main/java/com/cooleshow/student/ui/main/MallFragment.java
  29. 0 1
      student/src/main/java/com/cooleshow/student/ui/main/TalentStyleFragment.java
  30. 2 2
      student/src/main/java/com/cooleshow/student/ui/message/MessageBoxActivity.java
  31. 2 2
      student/src/main/java/com/cooleshow/student/ui/mine/CheckModifyPhoneNumActivity.java
  32. 2 2
      student/src/main/java/com/cooleshow/student/ui/mine/EquipmentTestActivity.java
  33. 2 2
      student/src/main/java/com/cooleshow/student/ui/mine/FeedBackActivity.java
  34. 2 2
      student/src/main/java/com/cooleshow/student/ui/mine/ModifyNickNameActivity.java
  35. 2 2
      student/src/main/java/com/cooleshow/student/ui/mine/ModifyPasswordActivity.java
  36. 2 2
      student/src/main/java/com/cooleshow/student/ui/mine/ModifyPhoneNumActivity.java
  37. 2 2
      student/src/main/java/com/cooleshow/student/ui/mine/NetworkMonitoringActivity.java
  38. 2 2
      student/src/main/java/com/cooleshow/student/ui/mine/PayTestActivity.java
  39. 2 2
      student/src/main/java/com/cooleshow/student/ui/mine/PersonalCertificationActivity.java
  40. 3 4
      student/src/main/java/com/cooleshow/student/ui/mine/PersonalSettingActivity.java
  41. 2 2
      student/src/main/java/com/cooleshow/student/ui/mine/SettingActivity.java
  42. 2 2
      student/src/main/java/com/cooleshow/student/ui/mine/TeachableInstrumentActivity.java
  43. 2 2
      student/src/main/java/com/cooleshow/student/ui/splash/GuideActivity.java
  44. 2 2
      student/src/main/java/com/cooleshow/student/ui/splash/SplashActivity.kt
  45. 2 4
      student/src/main/java/com/cooleshow/student/ui/web/HtmlActivity.java
  46. 1 1
      student/src/main/java/com/cooleshow/student/ui/web/HtmlHorizontalScreenActivity.java
  47. 1 1
      student/src/main/java/com/cooleshow/student/ui/web/WebActivity.java
  48. 2 2
      student/src/main/java/com/cooleshow/student/ui/work/HomeWorkActivity.java
  49. 0 1
      student/src/main/java/com/cooleshow/student/ui/work/HomeWorkDetailActivity.java
  50. 0 1
      student/src/main/java/com/cooleshow/student/ui/work/HomeWorkFragment.java
  51. 0 1
      student/src/main/java/com/cooleshow/student/widgets/DialogUtils.java
  52. 144 144
      student/src/main/java/com/cooleshow/student/widgets/dialog/LiveRoomMicManagerDialog.java
  53. 0 2
      student/src/main/java/com/cooleshow/student/widgets/helper/JsInterfaceAccomPanyUtils.java
  54. 0 2
      student/src/main/java/com/cooleshow/student/widgets/helper/JsInterfaceUtils.java
  55. 17 22
      student/src/main/java/com/cooleshow/student/widgets/helper/VideoViewManager.java
  56. 12 12
      student/src/main/res/layout/activity_liveroom_layout.xml
  57. 1631 1631
      teacher/src/main/java/com/cooleshow/teacher/ui/live/TeacherLiveRoomActivity.java

+ 1 - 1
chatModule/build.gradle

@@ -58,7 +58,7 @@ dependencies {
     api project(':tuichat')
     api project(':tuisearch')
     api project(':tuigroup')
-//    api project(':tuiofflinepush')
+    api project(':tuiofflinepush')
     api project(':tuicontact')
 //    api project(':tuicallkit')
     //ARouter

+ 1 - 1
classRoom/src/main/res/layout/layout_accompaniment_list_item.xml

@@ -37,5 +37,5 @@
         android:layout_marginTop="@dimen/dp_10"
         android:layout_marginEnd="@dimen/dp_35"
         android:layout_marginBottom="@dimen/dp_10"
-        android:src="@drawable/tc_ic_live_teaching_accompaniment" />
+        android:src="@drawable/tc_icon_live_teaching_accompaniment" />
 </LinearLayout>

+ 3 - 3
live_teaching/build.gradle

@@ -76,9 +76,9 @@ dependencies {
     implementation 'androidx.lifecycle:lifecycle-viewmodel:2.1.0-alpha04'
     implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
     implementation 'com.github.netless-io:whiteboard-android:2.15.18'
-    api project(path: ':rong_im:kit')
-    api project(path: ':rong_im:live')
-    api project(path: ':rong_im:sight')
+    implementation project(path: ':rong_im:kit')
+    implementation project(path: ':rong_im:live')
+    implementation project(path: ':rong_im:sight')
     implementation project(path: ':usercenter')
     implementation project(path: ':BaseLibrary')
     implementation 'com.h6ah4i.android.widget.verticalseekbar:verticalseekbar:1.0.0'

+ 3 - 3
student/build.gradle

@@ -113,9 +113,9 @@ dependencies {
 
     implementation project(path: ':BaseLibrary')
     api project(path: ':usercenter')
-    implementation project(path: ':rong_im:kit')
-    implementation project(path: ':rong_im:common_im_ui')
-    implementation project(path: ':live_teaching')
+//    implementation project(path: ':rong_im:kit')
+//    implementation project(path: ':rong_im:common_im_ui')
+//    implementation project(path: ':live_teaching')
     implementation project(path: ':metronome')
     implementation project(path: ':musictuner')
     implementation project(path: ':ffmpegCmd')

+ 0 - 62
student/src/main/java/com/cooleshow/student/App.java

@@ -17,28 +17,6 @@ import com.cooleshow.base.utils.ProcessUtils;
 import com.cooleshow.base.utils.Utils;
 import com.cooleshow.base.widgets.CustomRefreshHeader;
 import com.cooleshow.usercenter.helper.UserHelper;
-import com.daya.live_teaching.im.IMManager;
-import com.rong.io.live.message.RCChatJoinRoomMessage;
-import com.rong.io.live.message.RCChatModeMessage;
-import com.rong.io.live.message.RCChatRoomCloseMessage;
-import com.rong.io.live.message.RCChatRoomMemberNumMessage;
-import com.rong.io.live.message.RCChatroomLocationMessage;
-import com.rong.io.live.message.RCLiveBlackUserBlockMessage;
-import com.rong.io.live.message.RCLiveBlackUserUnBlockMessage;
-import com.rong.io.live.message.RCLiveGoodsChangeMessage;
-import com.rong.io.live.message.RCLiveRefuseAllMicApplyMessage;
-import com.rong.io.live.message.RCLiveUnderAllMicMessage;
-import com.rong.io.live.message.RCOnSnappingUpMessage;
-import com.rong.io.live.message.RCPauseLiveMessage;
-import com.rong.io.live.message.RCUserAddLikeMessage;
-import com.rong.io.live.message.RCUserKickOutMessage;
-import com.rong.io.live.message.RCUserLeaveRoomMessage;
-import com.rong.io.live.message.RCUserLogOutUnusualMessage;
-import com.rong.io.live.message.RCUserMicLeaveMessage;
-import com.rong.io.live.message.RCUserSeatApplyMessage;
-import com.rong.io.live.message.RCUserSeatResponseMessage;
-import com.rong.io.live.message.RCUserSeatsCtrlMessage;
-import com.rong.io.live.message.RCUserSyncAddLikeCountMessage;
 import com.scwang.smart.refresh.footer.ClassicsFooter;
 import com.scwang.smart.refresh.layout.SmartRefreshLayout;
 import com.scwang.smart.refresh.layout.api.RefreshFooter;
@@ -47,7 +25,6 @@ import com.scwang.smart.refresh.layout.api.RefreshLayout;
 import com.scwang.smart.refresh.layout.listener.DefaultRefreshFooterCreator;
 import com.scwang.smart.refresh.layout.listener.DefaultRefreshHeaderCreator;
 import com.tencent.bugly.crashreport.CrashReport;
-import com.rong.io.live.helper.LiveRTCEngineInitHelper;
 import com.tencent.tauth.Tencent;
 import com.umeng.commonsdk.UMConfigure;
 import com.umeng.socialize.PlatformConfig;
@@ -63,9 +40,6 @@ import io.reactivex.rxjava3.core.ObservableEmitter;
 import io.reactivex.rxjava3.core.ObservableOnSubscribe;
 import io.reactivex.rxjava3.functions.Consumer;
 import io.reactivex.rxjava3.schedulers.Schedulers;
-import io.rong.imlib.RongIMClient;
-import io.rong.push.RongPushClient;
-import io.rong.push.pushconfig.PushConfig;
 
 /**
  * 创建日期:2022/5/25 17:16
@@ -137,42 +111,6 @@ public class App extends BaseApplication {
     }
 
     private void initRong() {
-        PushConfig config = new PushConfig.Builder()
-                .enableMiPush("2882303761520172242", "5692017221242")
-                .enableOppoPush("5b2b716e774c45f2bd9a90b242b295e9", "3f1d849d8bce4273be48ca08a2ce320b")
-                .enableHWPush(true)
-                .enableVivoPush(true)
-                .build();
-        RongPushClient.setPushConfig(config);
-
-        if (BuildConfig.DEBUG) {
-            IMManager.init(this, "0vnjpoad0jbdz");
-        } else {
-            IMManager.init(this, "e5t4ouvpe42pa");
-        }
-        // RTCLib 初始化
-        RongIMClient.registerMessageType(RCChatJoinRoomMessage.class);//加入直播房间消息
-        RongIMClient.registerMessageType(RCChatModeMessage.class);//直播间聊天模式控制消息
-        RongIMClient.registerMessageType(RCChatRoomCloseMessage.class);//直播间关闭消息
-        RongIMClient.registerMessageType(RCChatroomLocationMessage.class);//本地消息
-        RongIMClient.registerMessageType(RCChatRoomMemberNumMessage.class);//观众数量
-        RongIMClient.registerMessageType(RCUserAddLikeMessage.class);//用户点赞消息
-        RongIMClient.registerMessageType(RCUserKickOutMessage.class);//用户被踢出房间消息
-        RongIMClient.registerMessageType(RCUserLeaveRoomMessage.class);//退出直播间消息
-        RongIMClient.registerMessageType(RCUserLogOutUnusualMessage.class);//用户异常退出消息
-        RongIMClient.registerMessageType(RCUserMicLeaveMessage.class);//观众下麦发送消息
-        RongIMClient.registerMessageType(RCUserSeatApplyMessage.class);//申请连麦消息
-        RongIMClient.registerMessageType(RCUserSeatResponseMessage.class);//连麦回复消息
-        RongIMClient.registerMessageType(RCUserSeatsCtrlMessage.class);//连麦控制
-        RongIMClient.registerMessageType(RCUserSyncAddLikeCountMessage.class);//连麦控制
-        RongIMClient.registerMessageType(RCLiveGoodsChangeMessage.class);//直播间商品变化
-        RongIMClient.registerMessageType(RCPauseLiveMessage.class);//直播间商品变化
-        RongIMClient.registerMessageType(RCOnSnappingUpMessage.class);//XXX正在抢购
-        RongIMClient.registerMessageType(RCLiveBlackUserBlockMessage.class);//添加黑名单
-        RongIMClient.registerMessageType(RCLiveBlackUserUnBlockMessage.class);//解除黑名单
-        RongIMClient.registerMessageType(RCLiveUnderAllMicMessage.class);//全部下麦消息
-        RongIMClient.registerMessageType(RCLiveRefuseAllMicApplyMessage.class);//拒绝全部连麦申请消息
-        LiveRTCEngineInitHelper.initRTC();
         EmojiManager.install(new IosEmojiProvider());
         /**
          * liveClass 相关开始

+ 0 - 1
student/src/main/java/com/cooleshow/student/adapter/HomeTeacherStyleAdapter.java

@@ -14,7 +14,6 @@ import com.cooleshow.student.bean.HomeStyleBean;
 
 import java.util.List;
 
-import io.rong.imkit.picture.tools.MediaUtils;
 
 /**
  * 创建日期:2022/5/27 16:13

+ 422 - 422
student/src/main/java/com/cooleshow/student/adapter/MessageAdapter.java

@@ -1,422 +1,422 @@
-package com.cooleshow.student.adapter;
-
-import android.content.Context;
-import android.text.SpannableString;
-import android.text.TextUtils;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-import com.cooleshow.base.utils.SizeUtils;
-import com.cooleshow.base.utils.UiUtils;
-import com.cooleshow.student.R;
-import com.cooleshow.usercenter.helper.UserHelper;
-import com.rong.io.live.LiveRoomMsgConstants;
-import com.rong.io.live.message.RCChatJoinRoomMessage;
-import com.rong.io.live.message.RCChatModeMessage;
-import com.rong.io.live.message.RCChatroomLocationMessage;
-import com.rong.io.live.message.RCOnSnappingUpMessage;
-import com.rong.io.live.message.RCUserAddLikeMessage;
-import com.rong.io.live.message.RCUserSeatApplyMessage;
-import com.rong.io.live.message.RCUserSeatResponseMessage;
-import com.rong.io.live.message.RCUserSeatsCtrlMessage;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import androidx.annotation.NonNull;
-import androidx.recyclerview.widget.RecyclerView;
-import io.rong.imlib.model.Message;
-import io.rong.imlib.model.MessageContent;
-import io.rong.imlib.model.UserInfo;
-import io.rong.message.TextMessage;
-
-/**
- * Author by pq, Date on 2022/3/31.
- */
-public class MessageAdapter extends RecyclerView.Adapter {
-    private Context context;
-    private String roomAuthorId = "";
-    private ArrayList<Message> mMessageList;
-    public static final int MESSAGE_TYPE_TEXT = -1;//文本消息
-    public static final int MESSAGE_TYPE_JOIN_ROOM = -2;//加入直播间
-    public static final int MESSAGE_TYPE_LOCAL_MSG = -3;//本地消息
-    public static final int MESSAGE_TYPE_ADD_LIKE_MSG = -4;//点赞消息
-    public static final int MESSAGE_TYPE_SEAT_CTRL_MSG = -5;//连麦控制消息
-    public static final int MESSAGE_TYPE_CHAT_CTRL_MSG = -6;//聊天控制消息
-    public static final int MESSAGE_TYPE_SEAT_APPLY_MSG = -7;//观众连麦申请
-    public static final int MESSAGE_TYPE_SEAT_RESPONSE_MSG = -8;//连麦响应消息
-    public static final int MESSAGE_TYPE_ON_SNAP_UP_MSG = -9;//xxx正在抢购
-    public static final String[] MSG_TAGS = new String[]{LiveRoomMsgConstants.TAG_TXT, LiveRoomMsgConstants.TAG_CHAT_ROOM_ENTER
-            , LiveRoomMsgConstants.TAG_CHAT_ROOM_LOCAL_MSG, LiveRoomMsgConstants.TAG_CHAT_ROOM_ADD_LIKE, LiveRoomMsgConstants.TAG_CHAT_ROOM_SEAT_CTRL
-            , LiveRoomMsgConstants.TAG_CHAT_ROOM_CHAT_MODE_CTRL, LiveRoomMsgConstants.TAG_CHAT_ROOM_SEAT_APPLY,
-            LiveRoomMsgConstants.TAG_CHAT_ROOM_SEAT_RESPONSE, LiveRoomMsgConstants.TAG_LIVE_ON_SNAP_UP};
-    public List<String> msgTags;
-
-    public MessageAdapter(Context context) {
-        this.context = context;
-        mMessageList = new ArrayList();
-        msgTags = Arrays.asList(MSG_TAGS);
-
-    }
-
-    public int getMessageSize() {
-        return mMessageList == null ? 0 : mMessageList.size();
-    }
-
-    public void addMessage(Message message) {
-        if (message == null) {
-            return;
-        }
-        if (TextUtils.isEmpty(message.getObjectName())) {
-            return;
-        }
-        if (!msgTags.contains(message.getObjectName())) {
-            return;
-        }
-        if (message.getContent() instanceof RCUserSeatResponseMessage) {
-            RCUserSeatResponseMessage responseMessage = (RCUserSeatResponseMessage) message.getContent();
-            if (!TextUtils.equals(responseMessage.getAudienceId(), UserHelper.getImUserId())) {
-                return;
-            }
-        }
-        if (message.getContent() instanceof RCUserSeatApplyMessage) {
-            RCUserSeatApplyMessage applyMessage = (RCUserSeatApplyMessage) message.getContent();
-            if (!TextUtils.equals(applyMessage.getAudienceId(), UserHelper.getImUserId())) {
-                return;
-            }
-        }
-        mMessageList.add(message);
-        notifyDataSetChanged();
-    }
-
-    public void setRoomAuthorId(String roomAuthorId) {
-        this.roomAuthorId = roomAuthorId;
-    }
-
-    @NonNull
-    @Override
-    public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
-        switch (viewType) {
-            case MESSAGE_TYPE_TEXT:
-            case MESSAGE_TYPE_LOCAL_MSG:
-                View view = LayoutInflater.from(context).inflate(R.layout.item_live_room_message_text, parent, false);
-                return new TextMessageHolder(view);
-            case MESSAGE_TYPE_ON_SNAP_UP_MSG:
-            case MESSAGE_TYPE_ADD_LIKE_MSG:
-            case MESSAGE_TYPE_JOIN_ROOM:
-                View joinView = LayoutInflater.from(context).inflate(R.layout.item_live_room_join_message_text, parent, false);
-                return new JoinRoomMessageHolder(joinView);
-            case MESSAGE_TYPE_SEAT_APPLY_MSG:
-            case MESSAGE_TYPE_SEAT_RESPONSE_MSG:
-            case MESSAGE_TYPE_CHAT_CTRL_MSG:
-            case MESSAGE_TYPE_SEAT_CTRL_MSG:
-                View modechangeView = LayoutInflater.from(context).inflate(R.layout.item_live_room_message_mode_change, parent, false);
-                return new ModeChangeMessageHolder(modechangeView);
-        }
-        return null;
-    }
-
-    @Override
-    public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
-        Message message = mMessageList.get(position);
-        String nickNameShow = "用户" + message != null ? message.getSenderUserId() : "";
-        switch (getItemViewType(position)) {
-            case MESSAGE_TYPE_LOCAL_MSG:
-                TextMessageHolder localMsgHolder = (TextMessageHolder) holder;
-                RCChatroomLocationMessage localMsgContent = (RCChatroomLocationMessage) message.getContent();
-                localMsgHolder.mTvText.setText(localMsgContent.getContent());
-                localMsgHolder.mTvText.setTextColor(context.getResources().getColor(com.cooleshow.base.R.color.color_00d6c9));
-                break;
-            case MESSAGE_TYPE_TEXT:
-                TextMessageHolder textMessageHolder = (TextMessageHolder) holder;
-                TextMessage content = (TextMessage) message.getContent();
-                Log.i("pq", "textMessage:" + content.toString());
-                //昵称
-                String authorName = "用户" + message.getUId();
-                SpannableString spannableString;
-                if (content.getUserInfo() != null) {
-                    UserInfo userInfo = content.getUserInfo();
-                    if (!TextUtils.isEmpty(userInfo.getName())) {
-                        authorName = content.getUserInfo().getName();
-                    }
-                    if (TextUtils.equals(message.getSenderUserId(), roomAuthorId)) {
-                        //房间主讲人
-                        spannableString = getRoomAuthorTextStyleSpan(context.getString(R.string.live_msg_text_nickname, authorName), content.getContent());
-                    } else {
-                        //其他
-                        spannableString = getNormalTextStyleSpan(context.getString(R.string.live_msg_text_nickname, authorName), content.getContent());
-                    }
-                } else {
-                    spannableString = getNormalTextStyleSpan(context.getString(R.string.live_msg_text_nickname, authorName), content.getContent());
-                }
-                textMessageHolder.mTvText.setText(spannableString);
-                break;
-
-            case MESSAGE_TYPE_JOIN_ROOM:
-                JoinRoomMessageHolder joinRoomMessageHolder = (JoinRoomMessageHolder) holder;
-                Message joinMessage = mMessageList.get(position);
-                RCChatJoinRoomMessage content1 = (RCChatJoinRoomMessage) joinMessage.getContent();
-                String name = "用户" + joinMessage.getSenderUserId();
-                if (content1.getUserInfo() != null && !TextUtils.isEmpty(content1.getUserInfo().getName())) {
-                    name = content1.getUserInfo().getName();
-                }
-                joinRoomMessageHolder.mTvText.setText(getNormalTextStyleSpan(name, "进入直播间"));
-                break;
-            case MESSAGE_TYPE_ADD_LIKE_MSG:
-                JoinRoomMessageHolder addLikeMessageHolder = (JoinRoomMessageHolder) holder;
-                Message addLikeMessage = mMessageList.get(position);
-                RCUserAddLikeMessage addLikeContent = (RCUserAddLikeMessage) addLikeMessage.getContent();
-                String nick = "用户" + addLikeMessage.getSenderUserId();
-                if (addLikeContent.getUserInfo() != null && !TextUtils.isEmpty(addLikeContent.getUserInfo().getName())) {
-                    nick = addLikeContent.getUserInfo().getName();
-                }
-                int counts = addLikeContent.getCounts();
-                addLikeMessageHolder.mTvText.setText(getNormalTextStyleSpan(nick, context.getString(R.string.live_room_add_like_count_text_str, counts)));
-                break;
-            case MESSAGE_TYPE_SEAT_CTRL_MSG:
-                //连麦控制
-                ModeChangeMessageHolder seatModeChangeHolder = (ModeChangeMessageHolder) holder;
-                Message modeChangeMsg = mMessageList.get(position);
-                RCUserSeatsCtrlMessage ctrlContent = (RCUserSeatsCtrlMessage) modeChangeMsg.getContent();
-                String nickName = "用户" + modeChangeMsg != null ? modeChangeMsg.getSenderUserId() : "";
-                if (!TextUtils.isEmpty(ctrlContent.getUserName())) {
-                    nickName = ctrlContent.getUserName();
-                }
-                boolean isEnableSeat = ctrlContent.isSeatBan();
-                String afterContent = isEnableSeat ? "关闭连麦" : "开启连麦";
-                seatModeChangeHolder.mIvIcon.setVisibility(View.VISIBLE);
-                seatModeChangeHolder.mTvText.setText(getNormalTextStyleSpan(nickName, afterContent));
-                break;
-            case MESSAGE_TYPE_CHAT_CTRL_MSG:
-                //聊天控制
-                ModeChangeMessageHolder chatModeChangeHolder = (ModeChangeMessageHolder) holder;
-                Message chatModeChangeMsg = mMessageList.get(position);
-                RCChatModeMessage chatModeContent = (RCChatModeMessage) chatModeChangeMsg.getContent();
-                String nickName2 = "用户" + chatModeChangeMsg != null ? chatModeChangeMsg.getSenderUserId() : "";
-                if (!TextUtils.isEmpty(chatModeContent.getUserName())) {
-                    nickName2 = chatModeContent.getUserName();
-                }
-                boolean isEnableChat = chatModeContent.isChatBan();
-                String afterContent2 = isEnableChat ? "关闭聊天" : "开启聊天";
-                chatModeChangeHolder.mIvIcon.setVisibility(View.VISIBLE);
-                chatModeChangeHolder.mTvText.setText(getNormalTextStyleSpan(nickName2, afterContent2));
-                break;
-            case MESSAGE_TYPE_SEAT_APPLY_MSG:
-                ModeChangeMessageHolder seatApplyMsgHolder = (ModeChangeMessageHolder) holder;
-                RCUserSeatApplyMessage content2 = (RCUserSeatApplyMessage) message.getContent();
-                int type = content2.getType();
-                if (type == LiveRoomMsgConstants.MIC_ACTION_SEAT_BY_USER
-                        || type == LiveRoomMsgConstants.MIC_ACTION_CANCEL_SEAT_BY_USER) {
-                    seatApplyMsgHolder.mIvIcon.setVisibility(View.GONE);
-                    seatApplyMsgHolder.mTvText.setPadding(SizeUtils.dp2px(10), 0, SizeUtils.dp2px(10), 0);
-                    if (!TextUtils.isEmpty(content2.getAudienceName())) {
-                        nickNameShow = content2.getAudienceName();
-                    }
-                } else {
-                    seatApplyMsgHolder.mIvIcon.setVisibility(View.VISIBLE);
-                    seatApplyMsgHolder.mTvText.setPadding(SizeUtils.dp2px(5), 0, SizeUtils.dp2px(10), 0);
-                    if (!TextUtils.isEmpty(content2.getTeacherName())) {
-                        nickNameShow = content2.getTeacherName();
-                    }
-                }
-                String contentText = "";
-                if (type == LiveRoomMsgConstants.MIC_ACTION_SEAT_BY_USER) {
-                    //观众发起连麦申请
-                    contentText = "发起了连麦申请";
-                }
-                if (type == LiveRoomMsgConstants.MIC_ACTION_CANCEL_SEAT_BY_USER) {
-                    //观众取消连麦申请
-                    contentText = "取消了连麦申请";
-                }
-
-                if (type == LiveRoomMsgConstants.MIC_ACTION_CANCEL_SEAT_BY_CREATE) {
-                    //主讲人将观众抱下麦
-                    contentText = "将你抱下麦";
-                }
-
-                if (type == LiveRoomMsgConstants.MIC_ACTION_INVITE_SEAT_BY_CREATE) {
-                    //主讲人发起了连麦邀请
-                    contentText = "发起了连麦邀请";
-                }
-                if (type == LiveRoomMsgConstants.MIC_ACTION_CANCEL_INVITE_SEAT_BY_CREATE) {
-                    //主讲人取消了连麦邀请
-                    contentText = "取消了连麦邀请";
-                }
-                seatApplyMsgHolder.mTvText.setText(getNormalTextStyleSpan(nickNameShow, contentText));
-                break;
-            case MESSAGE_TYPE_SEAT_RESPONSE_MSG:
-                ModeChangeMessageHolder seatResponseMsgHolder = (ModeChangeMessageHolder) holder;
-                RCUserSeatResponseMessage responseContent = (RCUserSeatResponseMessage) message.getContent();
-                int responseType = responseContent.getType();
-                if (responseType == LiveRoomMsgConstants.MIC_RESPONSE_AGREE_BY_USER
-                        || responseType == LiveRoomMsgConstants.MIC_RESPONSE_DISAGREE_BY_USER) {
-                    seatResponseMsgHolder.mIvIcon.setVisibility(View.GONE);
-                    seatResponseMsgHolder.mTvText.setPadding(SizeUtils.dp2px(10), 0, SizeUtils.dp2px(10), 0);
-                    if (!TextUtils.isEmpty(responseContent.getAudienceName())) {
-                        nickNameShow = responseContent.getAudienceName();
-                    }
-                } else {
-                    seatResponseMsgHolder.mIvIcon.setVisibility(View.VISIBLE);
-                    seatResponseMsgHolder.mTvText.setPadding(SizeUtils.dp2px(5), 0, SizeUtils.dp2px(10), 0);
-                    if (!TextUtils.isEmpty(responseContent.getTeacherName())) {
-                        nickNameShow = responseContent.getTeacherName();
-                    }
-                }
-                String responseContentText = "";
-                if (responseType == LiveRoomMsgConstants.MIC_RESPONSE_AGREE) {
-                    //主讲人同意观众上麦申请
-                    responseContentText = "同意了连麦申请";
-                }
-                if (responseType == LiveRoomMsgConstants.MIC_RESPONSE_DISAGREE) {
-                    //主讲人不同意观众上麦申请
-                    responseContentText = "拒绝了您的连麦申请";
-                }
-                if (responseType == LiveRoomMsgConstants.MIC_RESPONSE_AGREE_BY_USER) {
-                    //观众同意了连麦邀请
-                    responseContentText = "同意了连麦邀请";
-                }
-                if (responseType == LiveRoomMsgConstants.MIC_RESPONSE_DISAGREE_BY_USER) {
-                    //观众取消了连麦邀请
-                    responseContentText = "取消了连麦邀请";
-                }
-                seatResponseMsgHolder.mTvText.setText(getNormalTextStyleSpan(nickNameShow, responseContentText));
-                break;
-            case MESSAGE_TYPE_ON_SNAP_UP_MSG:
-                JoinRoomMessageHolder onSnapUpHolder = (JoinRoomMessageHolder) holder;
-                Message onSnapUpMessage = mMessageList.get(position);
-                RCOnSnappingUpMessage onSnapUpContent = (RCOnSnappingUpMessage) onSnapUpMessage.getContent();
-                String lastName = getNickName(onSnapUpMessage, onSnapUpContent != null ? onSnapUpContent.getUserName() : "");
-                onSnapUpHolder.mTvText.setText(getNormalTextStyleSpan(lastName, " 正在抢购"));
-                break;
-
-        }
-    }
-
-    private void setDefaultInfo(Message message) {
-
-    }
-
-    private String getNickName(Message message, String defaultName) {
-        if (!TextUtils.isEmpty(defaultName)) {
-            return defaultName;
-        }
-        return getNickName(message);
-    }
-
-    private String getNickName(Message message) {
-        //昵称
-        String name = "用户" + message.getSenderUserId();
-        MessageContent content = message.getContent();
-        if (content.getUserInfo() != null && !TextUtils.isEmpty(content.getUserInfo().getName())) {
-            name = content.getUserInfo().getName();
-        }
-        return name;
-    }
-
-    @Override
-    public int getItemCount() {
-        return mMessageList != null ? mMessageList.size() : 0;
-    }
-
-    @Override
-    public int getItemViewType(int position) {
-        Message message = mMessageList.get(position);
-        String objectName = message.getObjectName();
-        if (TextUtils.equals(objectName, LiveRoomMsgConstants.TAG_TXT)) {
-            //文本消息
-            return MESSAGE_TYPE_TEXT;
-        }
-        if (TextUtils.equals(objectName, LiveRoomMsgConstants.TAG_CHAT_ROOM_ENTER)) {
-            //进入房间消息
-            return MESSAGE_TYPE_JOIN_ROOM;
-        }
-
-        if (TextUtils.equals(objectName, LiveRoomMsgConstants.TAG_CHAT_ROOM_LOCAL_MSG)) {
-            //本地消息
-            return MESSAGE_TYPE_LOCAL_MSG;
-        }
-
-        if (TextUtils.equals(objectName, LiveRoomMsgConstants.TAG_CHAT_ROOM_ADD_LIKE)) {
-            //点赞消息
-            return MESSAGE_TYPE_ADD_LIKE_MSG;
-        }
-
-        if (TextUtils.equals(objectName, LiveRoomMsgConstants.TAG_CHAT_ROOM_SEAT_CTRL)) {
-            //连麦控制
-            return MESSAGE_TYPE_SEAT_CTRL_MSG;
-        }
-
-        if (TextUtils.equals(objectName, LiveRoomMsgConstants.TAG_CHAT_ROOM_CHAT_MODE_CTRL)) {
-            //聊天控制
-            return MESSAGE_TYPE_CHAT_CTRL_MSG;
-        }
-
-        if (TextUtils.equals(objectName, LiveRoomMsgConstants.TAG_CHAT_ROOM_SEAT_APPLY)) {
-            //连麦相关
-            return MESSAGE_TYPE_SEAT_APPLY_MSG;
-        }
-        if (TextUtils.equals(objectName, LiveRoomMsgConstants.TAG_CHAT_ROOM_SEAT_RESPONSE)) {
-            //连麦响应相关
-            return MESSAGE_TYPE_SEAT_RESPONSE_MSG;
-        }
-
-        if (TextUtils.equals(objectName, LiveRoomMsgConstants.TAG_LIVE_ON_SNAP_UP)) {
-            //正在抢购
-            return MESSAGE_TYPE_ON_SNAP_UP_MSG;
-        }
-        return super.getItemViewType(position);
-    }
-
-
-    private static class TextMessageHolder extends RecyclerView.ViewHolder {
-
-        private final TextView mTvText;
-
-        public TextMessageHolder(@NonNull View itemView) {
-            super(itemView);
-            mTvText = itemView.findViewById(R.id.tv_text);
-        }
-    }
-
-    private static class ModeChangeMessageHolder extends RecyclerView.ViewHolder {
-
-        private final TextView mTvText;
-        private final ImageView mIvIcon;
-
-        public ModeChangeMessageHolder(@NonNull View itemView) {
-            super(itemView);
-            mTvText = itemView.findViewById(R.id.tv_text);
-            mIvIcon = itemView.findViewById(R.id.iv_icon);
-        }
-    }
-
-    private static class JoinRoomMessageHolder extends RecyclerView.ViewHolder {
-
-        private final TextView mTvText;
-
-        public JoinRoomMessageHolder(@NonNull View itemView) {
-            super(itemView);
-            mTvText = itemView.findViewById(R.id.tv_text);
-        }
-    }
-
-    private SpannableString getNormalTextStyleSpan(String startStr, String contentText) {
-        return UiUtils.diffColorString(startStr
-                , contentText
-                , context.getResources().getColor(com.cooleshow.base.R.color.color_00d6c9)
-                , context.getResources().getColor(R.color.white));
-    }
-
-    private SpannableString getRoomAuthorTextStyleSpan(String nickName, String contentText) {
-        return UiUtils.diffColorString(nickName
-                , contentText
-                , context.getResources().getColor(com.cooleshow.base.R.color.color_00d6c9)
-                , context.getResources().getColor(R.color.white)
-                , context.getResources().getDrawable(R.drawable.icon_live_msg_room_author));
-    }
-}
+//package com.cooleshow.student.adapter;
+//
+//import android.content.Context;
+//import android.text.SpannableString;
+//import android.text.TextUtils;
+//import android.util.Log;
+//import android.view.LayoutInflater;
+//import android.view.View;
+//import android.view.ViewGroup;
+//import android.widget.ImageView;
+//import android.widget.TextView;
+//
+//import com.cooleshow.base.utils.SizeUtils;
+//import com.cooleshow.base.utils.UiUtils;
+//import com.cooleshow.student.R;
+//import com.cooleshow.usercenter.helper.UserHelper;
+//import com.rong.io.live.LiveRoomMsgConstants;
+//import com.rong.io.live.message.RCChatJoinRoomMessage;
+//import com.rong.io.live.message.RCChatModeMessage;
+//import com.rong.io.live.message.RCChatroomLocationMessage;
+//import com.rong.io.live.message.RCOnSnappingUpMessage;
+//import com.rong.io.live.message.RCUserAddLikeMessage;
+//import com.rong.io.live.message.RCUserSeatApplyMessage;
+//import com.rong.io.live.message.RCUserSeatResponseMessage;
+//import com.rong.io.live.message.RCUserSeatsCtrlMessage;
+//
+//import java.util.ArrayList;
+//import java.util.Arrays;
+//import java.util.List;
+//
+//import androidx.annotation.NonNull;
+//import androidx.recyclerview.widget.RecyclerView;
+//import io.rong.imlib.model.Message;
+//import io.rong.imlib.model.MessageContent;
+//import io.rong.imlib.model.UserInfo;
+//import io.rong.message.TextMessage;
+//
+///**
+// * Author by pq, Date on 2022/3/31.
+// */
+//public class MessageAdapter extends RecyclerView.Adapter {
+//    private Context context;
+//    private String roomAuthorId = "";
+//    private ArrayList<Message> mMessageList;
+//    public static final int MESSAGE_TYPE_TEXT = -1;//文本消息
+//    public static final int MESSAGE_TYPE_JOIN_ROOM = -2;//加入直播间
+//    public static final int MESSAGE_TYPE_LOCAL_MSG = -3;//本地消息
+//    public static final int MESSAGE_TYPE_ADD_LIKE_MSG = -4;//点赞消息
+//    public static final int MESSAGE_TYPE_SEAT_CTRL_MSG = -5;//连麦控制消息
+//    public static final int MESSAGE_TYPE_CHAT_CTRL_MSG = -6;//聊天控制消息
+//    public static final int MESSAGE_TYPE_SEAT_APPLY_MSG = -7;//观众连麦申请
+//    public static final int MESSAGE_TYPE_SEAT_RESPONSE_MSG = -8;//连麦响应消息
+//    public static final int MESSAGE_TYPE_ON_SNAP_UP_MSG = -9;//xxx正在抢购
+//    public static final String[] MSG_TAGS = new String[]{LiveRoomMsgConstants.TAG_TXT, LiveRoomMsgConstants.TAG_CHAT_ROOM_ENTER
+//            , LiveRoomMsgConstants.TAG_CHAT_ROOM_LOCAL_MSG, LiveRoomMsgConstants.TAG_CHAT_ROOM_ADD_LIKE, LiveRoomMsgConstants.TAG_CHAT_ROOM_SEAT_CTRL
+//            , LiveRoomMsgConstants.TAG_CHAT_ROOM_CHAT_MODE_CTRL, LiveRoomMsgConstants.TAG_CHAT_ROOM_SEAT_APPLY,
+//            LiveRoomMsgConstants.TAG_CHAT_ROOM_SEAT_RESPONSE, LiveRoomMsgConstants.TAG_LIVE_ON_SNAP_UP};
+//    public List<String> msgTags;
+//
+//    public MessageAdapter(Context context) {
+//        this.context = context;
+//        mMessageList = new ArrayList();
+//        msgTags = Arrays.asList(MSG_TAGS);
+//
+//    }
+//
+//    public int getMessageSize() {
+//        return mMessageList == null ? 0 : mMessageList.size();
+//    }
+//
+//    public void addMessage(Message message) {
+//        if (message == null) {
+//            return;
+//        }
+//        if (TextUtils.isEmpty(message.getObjectName())) {
+//            return;
+//        }
+//        if (!msgTags.contains(message.getObjectName())) {
+//            return;
+//        }
+//        if (message.getContent() instanceof RCUserSeatResponseMessage) {
+//            RCUserSeatResponseMessage responseMessage = (RCUserSeatResponseMessage) message.getContent();
+//            if (!TextUtils.equals(responseMessage.getAudienceId(), UserHelper.getImUserId())) {
+//                return;
+//            }
+//        }
+//        if (message.getContent() instanceof RCUserSeatApplyMessage) {
+//            RCUserSeatApplyMessage applyMessage = (RCUserSeatApplyMessage) message.getContent();
+//            if (!TextUtils.equals(applyMessage.getAudienceId(), UserHelper.getImUserId())) {
+//                return;
+//            }
+//        }
+//        mMessageList.add(message);
+//        notifyDataSetChanged();
+//    }
+//
+//    public void setRoomAuthorId(String roomAuthorId) {
+//        this.roomAuthorId = roomAuthorId;
+//    }
+//
+//    @NonNull
+//    @Override
+//    public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+//        switch (viewType) {
+//            case MESSAGE_TYPE_TEXT:
+//            case MESSAGE_TYPE_LOCAL_MSG:
+//                View view = LayoutInflater.from(context).inflate(R.layout.item_live_room_message_text, parent, false);
+//                return new TextMessageHolder(view);
+//            case MESSAGE_TYPE_ON_SNAP_UP_MSG:
+//            case MESSAGE_TYPE_ADD_LIKE_MSG:
+//            case MESSAGE_TYPE_JOIN_ROOM:
+//                View joinView = LayoutInflater.from(context).inflate(R.layout.item_live_room_join_message_text, parent, false);
+//                return new JoinRoomMessageHolder(joinView);
+//            case MESSAGE_TYPE_SEAT_APPLY_MSG:
+//            case MESSAGE_TYPE_SEAT_RESPONSE_MSG:
+//            case MESSAGE_TYPE_CHAT_CTRL_MSG:
+//            case MESSAGE_TYPE_SEAT_CTRL_MSG:
+//                View modechangeView = LayoutInflater.from(context).inflate(R.layout.item_live_room_message_mode_change, parent, false);
+//                return new ModeChangeMessageHolder(modechangeView);
+//        }
+//        return null;
+//    }
+//
+//    @Override
+//    public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
+//        Message message = mMessageList.get(position);
+//        String nickNameShow = "用户" + message != null ? message.getSenderUserId() : "";
+//        switch (getItemViewType(position)) {
+//            case MESSAGE_TYPE_LOCAL_MSG:
+//                TextMessageHolder localMsgHolder = (TextMessageHolder) holder;
+//                RCChatroomLocationMessage localMsgContent = (RCChatroomLocationMessage) message.getContent();
+//                localMsgHolder.mTvText.setText(localMsgContent.getContent());
+//                localMsgHolder.mTvText.setTextColor(context.getResources().getColor(com.cooleshow.base.R.color.color_00d6c9));
+//                break;
+//            case MESSAGE_TYPE_TEXT:
+//                TextMessageHolder textMessageHolder = (TextMessageHolder) holder;
+//                TextMessage content = (TextMessage) message.getContent();
+//                Log.i("pq", "textMessage:" + content.toString());
+//                //昵称
+//                String authorName = "用户" + message.getUId();
+//                SpannableString spannableString;
+//                if (content.getUserInfo() != null) {
+//                    UserInfo userInfo = content.getUserInfo();
+//                    if (!TextUtils.isEmpty(userInfo.getName())) {
+//                        authorName = content.getUserInfo().getName();
+//                    }
+//                    if (TextUtils.equals(message.getSenderUserId(), roomAuthorId)) {
+//                        //房间主讲人
+//                        spannableString = getRoomAuthorTextStyleSpan(context.getString(R.string.live_msg_text_nickname, authorName), content.getContent());
+//                    } else {
+//                        //其他
+//                        spannableString = getNormalTextStyleSpan(context.getString(R.string.live_msg_text_nickname, authorName), content.getContent());
+//                    }
+//                } else {
+//                    spannableString = getNormalTextStyleSpan(context.getString(R.string.live_msg_text_nickname, authorName), content.getContent());
+//                }
+//                textMessageHolder.mTvText.setText(spannableString);
+//                break;
+//
+//            case MESSAGE_TYPE_JOIN_ROOM:
+//                JoinRoomMessageHolder joinRoomMessageHolder = (JoinRoomMessageHolder) holder;
+//                Message joinMessage = mMessageList.get(position);
+//                RCChatJoinRoomMessage content1 = (RCChatJoinRoomMessage) joinMessage.getContent();
+//                String name = "用户" + joinMessage.getSenderUserId();
+//                if (content1.getUserInfo() != null && !TextUtils.isEmpty(content1.getUserInfo().getName())) {
+//                    name = content1.getUserInfo().getName();
+//                }
+//                joinRoomMessageHolder.mTvText.setText(getNormalTextStyleSpan(name, "进入直播间"));
+//                break;
+//            case MESSAGE_TYPE_ADD_LIKE_MSG:
+//                JoinRoomMessageHolder addLikeMessageHolder = (JoinRoomMessageHolder) holder;
+//                Message addLikeMessage = mMessageList.get(position);
+//                RCUserAddLikeMessage addLikeContent = (RCUserAddLikeMessage) addLikeMessage.getContent();
+//                String nick = "用户" + addLikeMessage.getSenderUserId();
+//                if (addLikeContent.getUserInfo() != null && !TextUtils.isEmpty(addLikeContent.getUserInfo().getName())) {
+//                    nick = addLikeContent.getUserInfo().getName();
+//                }
+//                int counts = addLikeContent.getCounts();
+//                addLikeMessageHolder.mTvText.setText(getNormalTextStyleSpan(nick, context.getString(R.string.live_room_add_like_count_text_str, counts)));
+//                break;
+//            case MESSAGE_TYPE_SEAT_CTRL_MSG:
+//                //连麦控制
+//                ModeChangeMessageHolder seatModeChangeHolder = (ModeChangeMessageHolder) holder;
+//                Message modeChangeMsg = mMessageList.get(position);
+//                RCUserSeatsCtrlMessage ctrlContent = (RCUserSeatsCtrlMessage) modeChangeMsg.getContent();
+//                String nickName = "用户" + modeChangeMsg != null ? modeChangeMsg.getSenderUserId() : "";
+//                if (!TextUtils.isEmpty(ctrlContent.getUserName())) {
+//                    nickName = ctrlContent.getUserName();
+//                }
+//                boolean isEnableSeat = ctrlContent.isSeatBan();
+//                String afterContent = isEnableSeat ? "关闭连麦" : "开启连麦";
+//                seatModeChangeHolder.mIvIcon.setVisibility(View.VISIBLE);
+//                seatModeChangeHolder.mTvText.setText(getNormalTextStyleSpan(nickName, afterContent));
+//                break;
+//            case MESSAGE_TYPE_CHAT_CTRL_MSG:
+//                //聊天控制
+//                ModeChangeMessageHolder chatModeChangeHolder = (ModeChangeMessageHolder) holder;
+//                Message chatModeChangeMsg = mMessageList.get(position);
+//                RCChatModeMessage chatModeContent = (RCChatModeMessage) chatModeChangeMsg.getContent();
+//                String nickName2 = "用户" + chatModeChangeMsg != null ? chatModeChangeMsg.getSenderUserId() : "";
+//                if (!TextUtils.isEmpty(chatModeContent.getUserName())) {
+//                    nickName2 = chatModeContent.getUserName();
+//                }
+//                boolean isEnableChat = chatModeContent.isChatBan();
+//                String afterContent2 = isEnableChat ? "关闭聊天" : "开启聊天";
+//                chatModeChangeHolder.mIvIcon.setVisibility(View.VISIBLE);
+//                chatModeChangeHolder.mTvText.setText(getNormalTextStyleSpan(nickName2, afterContent2));
+//                break;
+//            case MESSAGE_TYPE_SEAT_APPLY_MSG:
+//                ModeChangeMessageHolder seatApplyMsgHolder = (ModeChangeMessageHolder) holder;
+//                RCUserSeatApplyMessage content2 = (RCUserSeatApplyMessage) message.getContent();
+//                int type = content2.getType();
+//                if (type == LiveRoomMsgConstants.MIC_ACTION_SEAT_BY_USER
+//                        || type == LiveRoomMsgConstants.MIC_ACTION_CANCEL_SEAT_BY_USER) {
+//                    seatApplyMsgHolder.mIvIcon.setVisibility(View.GONE);
+//                    seatApplyMsgHolder.mTvText.setPadding(SizeUtils.dp2px(10), 0, SizeUtils.dp2px(10), 0);
+//                    if (!TextUtils.isEmpty(content2.getAudienceName())) {
+//                        nickNameShow = content2.getAudienceName();
+//                    }
+//                } else {
+//                    seatApplyMsgHolder.mIvIcon.setVisibility(View.VISIBLE);
+//                    seatApplyMsgHolder.mTvText.setPadding(SizeUtils.dp2px(5), 0, SizeUtils.dp2px(10), 0);
+//                    if (!TextUtils.isEmpty(content2.getTeacherName())) {
+//                        nickNameShow = content2.getTeacherName();
+//                    }
+//                }
+//                String contentText = "";
+//                if (type == LiveRoomMsgConstants.MIC_ACTION_SEAT_BY_USER) {
+//                    //观众发起连麦申请
+//                    contentText = "发起了连麦申请";
+//                }
+//                if (type == LiveRoomMsgConstants.MIC_ACTION_CANCEL_SEAT_BY_USER) {
+//                    //观众取消连麦申请
+//                    contentText = "取消了连麦申请";
+//                }
+//
+//                if (type == LiveRoomMsgConstants.MIC_ACTION_CANCEL_SEAT_BY_CREATE) {
+//                    //主讲人将观众抱下麦
+//                    contentText = "将你抱下麦";
+//                }
+//
+//                if (type == LiveRoomMsgConstants.MIC_ACTION_INVITE_SEAT_BY_CREATE) {
+//                    //主讲人发起了连麦邀请
+//                    contentText = "发起了连麦邀请";
+//                }
+//                if (type == LiveRoomMsgConstants.MIC_ACTION_CANCEL_INVITE_SEAT_BY_CREATE) {
+//                    //主讲人取消了连麦邀请
+//                    contentText = "取消了连麦邀请";
+//                }
+//                seatApplyMsgHolder.mTvText.setText(getNormalTextStyleSpan(nickNameShow, contentText));
+//                break;
+//            case MESSAGE_TYPE_SEAT_RESPONSE_MSG:
+//                ModeChangeMessageHolder seatResponseMsgHolder = (ModeChangeMessageHolder) holder;
+//                RCUserSeatResponseMessage responseContent = (RCUserSeatResponseMessage) message.getContent();
+//                int responseType = responseContent.getType();
+//                if (responseType == LiveRoomMsgConstants.MIC_RESPONSE_AGREE_BY_USER
+//                        || responseType == LiveRoomMsgConstants.MIC_RESPONSE_DISAGREE_BY_USER) {
+//                    seatResponseMsgHolder.mIvIcon.setVisibility(View.GONE);
+//                    seatResponseMsgHolder.mTvText.setPadding(SizeUtils.dp2px(10), 0, SizeUtils.dp2px(10), 0);
+//                    if (!TextUtils.isEmpty(responseContent.getAudienceName())) {
+//                        nickNameShow = responseContent.getAudienceName();
+//                    }
+//                } else {
+//                    seatResponseMsgHolder.mIvIcon.setVisibility(View.VISIBLE);
+//                    seatResponseMsgHolder.mTvText.setPadding(SizeUtils.dp2px(5), 0, SizeUtils.dp2px(10), 0);
+//                    if (!TextUtils.isEmpty(responseContent.getTeacherName())) {
+//                        nickNameShow = responseContent.getTeacherName();
+//                    }
+//                }
+//                String responseContentText = "";
+//                if (responseType == LiveRoomMsgConstants.MIC_RESPONSE_AGREE) {
+//                    //主讲人同意观众上麦申请
+//                    responseContentText = "同意了连麦申请";
+//                }
+//                if (responseType == LiveRoomMsgConstants.MIC_RESPONSE_DISAGREE) {
+//                    //主讲人不同意观众上麦申请
+//                    responseContentText = "拒绝了您的连麦申请";
+//                }
+//                if (responseType == LiveRoomMsgConstants.MIC_RESPONSE_AGREE_BY_USER) {
+//                    //观众同意了连麦邀请
+//                    responseContentText = "同意了连麦邀请";
+//                }
+//                if (responseType == LiveRoomMsgConstants.MIC_RESPONSE_DISAGREE_BY_USER) {
+//                    //观众取消了连麦邀请
+//                    responseContentText = "取消了连麦邀请";
+//                }
+//                seatResponseMsgHolder.mTvText.setText(getNormalTextStyleSpan(nickNameShow, responseContentText));
+//                break;
+//            case MESSAGE_TYPE_ON_SNAP_UP_MSG:
+//                JoinRoomMessageHolder onSnapUpHolder = (JoinRoomMessageHolder) holder;
+//                Message onSnapUpMessage = mMessageList.get(position);
+//                RCOnSnappingUpMessage onSnapUpContent = (RCOnSnappingUpMessage) onSnapUpMessage.getContent();
+//                String lastName = getNickName(onSnapUpMessage, onSnapUpContent != null ? onSnapUpContent.getUserName() : "");
+//                onSnapUpHolder.mTvText.setText(getNormalTextStyleSpan(lastName, " 正在抢购"));
+//                break;
+//
+//        }
+//    }
+//
+//    private void setDefaultInfo(Message message) {
+//
+//    }
+//
+//    private String getNickName(Message message, String defaultName) {
+//        if (!TextUtils.isEmpty(defaultName)) {
+//            return defaultName;
+//        }
+//        return getNickName(message);
+//    }
+//
+//    private String getNickName(Message message) {
+//        //昵称
+//        String name = "用户" + message.getSenderUserId();
+//        MessageContent content = message.getContent();
+//        if (content.getUserInfo() != null && !TextUtils.isEmpty(content.getUserInfo().getName())) {
+//            name = content.getUserInfo().getName();
+//        }
+//        return name;
+//    }
+//
+//    @Override
+//    public int getItemCount() {
+//        return mMessageList != null ? mMessageList.size() : 0;
+//    }
+//
+//    @Override
+//    public int getItemViewType(int position) {
+//        Message message = mMessageList.get(position);
+//        String objectName = message.getObjectName();
+//        if (TextUtils.equals(objectName, LiveRoomMsgConstants.TAG_TXT)) {
+//            //文本消息
+//            return MESSAGE_TYPE_TEXT;
+//        }
+//        if (TextUtils.equals(objectName, LiveRoomMsgConstants.TAG_CHAT_ROOM_ENTER)) {
+//            //进入房间消息
+//            return MESSAGE_TYPE_JOIN_ROOM;
+//        }
+//
+//        if (TextUtils.equals(objectName, LiveRoomMsgConstants.TAG_CHAT_ROOM_LOCAL_MSG)) {
+//            //本地消息
+//            return MESSAGE_TYPE_LOCAL_MSG;
+//        }
+//
+//        if (TextUtils.equals(objectName, LiveRoomMsgConstants.TAG_CHAT_ROOM_ADD_LIKE)) {
+//            //点赞消息
+//            return MESSAGE_TYPE_ADD_LIKE_MSG;
+//        }
+//
+//        if (TextUtils.equals(objectName, LiveRoomMsgConstants.TAG_CHAT_ROOM_SEAT_CTRL)) {
+//            //连麦控制
+//            return MESSAGE_TYPE_SEAT_CTRL_MSG;
+//        }
+//
+//        if (TextUtils.equals(objectName, LiveRoomMsgConstants.TAG_CHAT_ROOM_CHAT_MODE_CTRL)) {
+//            //聊天控制
+//            return MESSAGE_TYPE_CHAT_CTRL_MSG;
+//        }
+//
+//        if (TextUtils.equals(objectName, LiveRoomMsgConstants.TAG_CHAT_ROOM_SEAT_APPLY)) {
+//            //连麦相关
+//            return MESSAGE_TYPE_SEAT_APPLY_MSG;
+//        }
+//        if (TextUtils.equals(objectName, LiveRoomMsgConstants.TAG_CHAT_ROOM_SEAT_RESPONSE)) {
+//            //连麦响应相关
+//            return MESSAGE_TYPE_SEAT_RESPONSE_MSG;
+//        }
+//
+//        if (TextUtils.equals(objectName, LiveRoomMsgConstants.TAG_LIVE_ON_SNAP_UP)) {
+//            //正在抢购
+//            return MESSAGE_TYPE_ON_SNAP_UP_MSG;
+//        }
+//        return super.getItemViewType(position);
+//    }
+//
+//
+//    private static class TextMessageHolder extends RecyclerView.ViewHolder {
+//
+//        private final TextView mTvText;
+//
+//        public TextMessageHolder(@NonNull View itemView) {
+//            super(itemView);
+//            mTvText = itemView.findViewById(R.id.tv_text);
+//        }
+//    }
+//
+//    private static class ModeChangeMessageHolder extends RecyclerView.ViewHolder {
+//
+//        private final TextView mTvText;
+//        private final ImageView mIvIcon;
+//
+//        public ModeChangeMessageHolder(@NonNull View itemView) {
+//            super(itemView);
+//            mTvText = itemView.findViewById(R.id.tv_text);
+//            mIvIcon = itemView.findViewById(R.id.iv_icon);
+//        }
+//    }
+//
+//    private static class JoinRoomMessageHolder extends RecyclerView.ViewHolder {
+//
+//        private final TextView mTvText;
+//
+//        public JoinRoomMessageHolder(@NonNull View itemView) {
+//            super(itemView);
+//            mTvText = itemView.findViewById(R.id.tv_text);
+//        }
+//    }
+//
+//    private SpannableString getNormalTextStyleSpan(String startStr, String contentText) {
+//        return UiUtils.diffColorString(startStr
+//                , contentText
+//                , context.getResources().getColor(com.cooleshow.base.R.color.color_00d6c9)
+//                , context.getResources().getColor(R.color.white));
+//    }
+//
+//    private SpannableString getRoomAuthorTextStyleSpan(String nickName, String contentText) {
+//        return UiUtils.diffColorString(nickName
+//                , contentText
+//                , context.getResources().getColor(com.cooleshow.base.R.color.color_00d6c9)
+//                , context.getResources().getColor(R.color.white)
+//                , context.getResources().getDrawable(R.drawable.icon_live_msg_room_author));
+//    }
+//}

+ 193 - 205
student/src/main/java/com/cooleshow/student/contract/LiveRoomContract.java

@@ -1,205 +1,193 @@
-package com.cooleshow.student.contract;
-
-import android.view.View;
-
-import com.cooleshow.base.presenter.view.BaseView;
-import com.cooleshow.student.bean.FriendInfoBean;
-import com.cooleshow.student.bean.LiveRoomInfoBean;
-import com.rong.io.live.message.RCChatJoinRoomMessage;
-import com.rong.io.live.message.RCOnSnappingUpMessage;
-import com.rong.io.live.message.RCUserKickOutMessage;
-import com.rong.io.live.message.RCUserLogOutUnusualMessage;
-import com.rong.io.live.message.RCUserSeatApplyMessage;
-import com.rong.io.live.message.RCUserSeatResponseMessage;
-import com.rong.io.live.message.RCUserSyncAddLikeCountMessage;
-
-import java.util.List;
-
-import cn.rongcloud.rtc.api.RCRTCRemoteUser;
-import cn.rongcloud.rtc.api.stream.RCRTCInputStream;
-import cn.rongcloud.rtc.base.RCRTCLiveRole;
-import io.rong.imlib.model.Message;
-import io.rong.imlib.model.MessageContent;
-
-/**
- * Author by pq, Date on 2022/3/29.
- */
-public interface LiveRoomContract {
-    interface view extends BaseView {
-        void getRoomInfoSuccess(LiveRoomInfoBean roomInfoBean);
-
-        void getRoomInfoError(Throwable t);
-
-        void showFinishView();
-
-        void syncAudioStatus(boolean isCloseAudioStream);
-
-        //显示休息一下再回来状态图
-        void showRestView();
-
-        //显示主播关闭的视频状态图
-        void showCloseVideoView();
-
-        void showEmptyStatusView();
-
-        View getContentView();
-
-        /**
-         * 添加多条公屏消息
-         */
-        void addMessageList(List<MessageContent> messageContents, boolean isReset);
-
-        /**
-         * 添加单条公屏消息
-         */
-        void addMessageContent(Message message, boolean isReset);
-
-
-        /**
-         * 聊天模式控制消息
-         *
-         * @param isEnableChat
-         */
-        void switchChatMode(boolean isEnableChat);
-
-        /**
-         * 关闭直播间
-         */
-        void liveRoomOffline();
-
-        /**
-         * 直播间商品
-         *
-         * @param goodsStr
-         */
-        void liveGoodsChange(String goodsStr);
-
-        /**
-         * 连麦回复
-         *
-         * @param rcUserSeatResponseMessage
-         */
-        void seatResponse(RCUserSeatResponseMessage rcUserSeatResponseMessage);
-
-
-        void onSwitchRole(String id, RCRTCLiveRole role);
-
-        void onUserJoinRoom(RCRTCRemoteUser rcrtcRemoteUser);
-
-        /**
-         * 观众下麦(身份从主播切换到观众)
-         */
-        void onUserLeftRoomMic(RCRTCRemoteUser rcrtcRemoteUser);
-
-        /**
-         * 观众下麦(身份从主播切换到观众)
-         */
-        void onUserOfflineRoomMic(RCRTCRemoteUser rcrtcRemoteUser);
-
-        /**
-         * 同步成员数量
-         *
-         * @param count
-         */
-        void syncMemberCount(String count);
-
-        /**
-         * 用户被踢出房间消息
-         *
-         * @param userKickOutMessage
-         */
-        void onUserKickOutMsg(RCUserKickOutMessage userKickOutMessage);
-
-        //连麦模式控制消息
-        void changeMicControlMode(boolean isEnableMic);
-
-        /**
-         * 拿到RCRTCRoom用于显示直播view
-         */
-        void subscribeAVStreamSuccess(List<RCRTCInputStream> inputStreams);
-
-        void onSubscribeFailed();
-
-        /**
-         * 设置房间数据
-         */
-        void setRoomData(LiveRoomInfoBean roomInfoBean);
-
-        //连麦成功(身份切换成功)
-        void onSeatMicSuccess();
-
-        //连麦失败
-        void onSeatMicFail();
-
-        //取消连麦成功(身份切换观众成功)
-        void onExitSeatMicSuccess();
-
-        //邀请上麦
-        void onInviteSeatMic(RCUserSeatApplyMessage seatApplyMessage);
-
-        //用户异常退出消息
-        void onUserUnusualLogout(RCUserLogOutUnusualMessage loginOutUnusualMessage);
-
-        /**
-         * 暂停直播
-         */
-        void onLivePause();
-
-        void onAddLikeMessage(Message message, RCUserSyncAddLikeCountMessage addLikeMessage);
-
-        void getFriendInfoSuccess(FriendInfoBean friendInfoBean);
-
-        void onPublishSuccess();
-
-        /**
-         * 黑名单用户状态切换
-         *
-         * @param userId
-         * @param isAddBlack
-         */
-        void changeBlackUserStatus(String userId, boolean isAddBlack);
-
-        /**
-         * 加入房间消息
-         *
-         * @param joinRoomMessage
-         */
-        void receiveJoinMessage(RCChatJoinRoomMessage joinRoomMessage);
-
-        /**
-         * 抢购消息
-         *
-         * @param
-         */
-        void receiveSnapUpMessage(RCOnSnappingUpMessage snappingUpMessage);
-
-        /**
-         * 远端有用户推流
-         *
-         * @param remoteUserId
-         */
-        void onRemoteUserPublishResource(String remoteUserId);
-
-        /**
-         * 拒绝全部连麦申请
-         */
-        void onRefuseAllMicApply();
-
-        /**
-         * 全部下麦
-         */
-        void onUnderAllMic();
-    }
-
-    interface Presenter {
-        void getRoomInfo(String roomId);
-
-        void notifyJoinRoomAction(String roomId, String userId);
-
-        void notifyLeaveRoomAction();
-
-        void handleAction(int action);
-
-        void getUserInfoByUserId(String friendUserId);
-    }
-}
+//package com.cooleshow.student.contract;
+//
+//import android.view.View;
+//
+//import com.cooleshow.base.presenter.view.BaseView;
+//import com.cooleshow.student.bean.FriendInfoBean;
+//import com.cooleshow.student.bean.LiveRoomInfoBean;
+//
+//import java.util.List;
+//
+//
+///**
+// * Author by pq, Date on 2022/3/29.
+// */
+//public interface LiveRoomContract {
+//    interface view extends BaseView {
+//        void getRoomInfoSuccess(LiveRoomInfoBean roomInfoBean);
+//
+//        void getRoomInfoError(Throwable t);
+//
+//        void showFinishView();
+//
+//        void syncAudioStatus(boolean isCloseAudioStream);
+//
+//        //显示休息一下再回来状态图
+//        void showRestView();
+//
+//        //显示主播关闭的视频状态图
+//        void showCloseVideoView();
+//
+//        void showEmptyStatusView();
+//
+//        View getContentView();
+//
+//        /**
+//         * 添加多条公屏消息
+//         */
+//        void addMessageList(List<MessageContent> messageContents, boolean isReset);
+//
+//        /**
+//         * 添加单条公屏消息
+//         */
+//        void addMessageContent(Message message, boolean isReset);
+//
+//
+//        /**
+//         * 聊天模式控制消息
+//         *
+//         * @param isEnableChat
+//         */
+//        void switchChatMode(boolean isEnableChat);
+//
+//        /**
+//         * 关闭直播间
+//         */
+//        void liveRoomOffline();
+//
+//        /**
+//         * 直播间商品
+//         *
+//         * @param goodsStr
+//         */
+//        void liveGoodsChange(String goodsStr);
+//
+//        /**
+//         * 连麦回复
+//         *
+//         * @param rcUserSeatResponseMessage
+//         */
+//        void seatResponse(RCUserSeatResponseMessage rcUserSeatResponseMessage);
+//
+//
+//        void onSwitchRole(String id, RCRTCLiveRole role);
+//
+//        void onUserJoinRoom(RCRTCRemoteUser rcrtcRemoteUser);
+//
+//        /**
+//         * 观众下麦(身份从主播切换到观众)
+//         */
+//        void onUserLeftRoomMic(RCRTCRemoteUser rcrtcRemoteUser);
+//
+//        /**
+//         * 观众下麦(身份从主播切换到观众)
+//         */
+//        void onUserOfflineRoomMic(RCRTCRemoteUser rcrtcRemoteUser);
+//
+//        /**
+//         * 同步成员数量
+//         *
+//         * @param count
+//         */
+//        void syncMemberCount(String count);
+//
+//        /**
+//         * 用户被踢出房间消息
+//         *
+//         * @param userKickOutMessage
+//         */
+//        void onUserKickOutMsg(RCUserKickOutMessage userKickOutMessage);
+//
+//        //连麦模式控制消息
+//        void changeMicControlMode(boolean isEnableMic);
+//
+//        /**
+//         * 拿到RCRTCRoom用于显示直播view
+//         */
+//        void subscribeAVStreamSuccess(List<RCRTCInputStream> inputStreams);
+//
+//        void onSubscribeFailed();
+//
+//        /**
+//         * 设置房间数据
+//         */
+//        void setRoomData(LiveRoomInfoBean roomInfoBean);
+//
+//        //连麦成功(身份切换成功)
+//        void onSeatMicSuccess();
+//
+//        //连麦失败
+//        void onSeatMicFail();
+//
+//        //取消连麦成功(身份切换观众成功)
+//        void onExitSeatMicSuccess();
+//
+//        //邀请上麦
+//        void onInviteSeatMic(RCUserSeatApplyMessage seatApplyMessage);
+//
+//        //用户异常退出消息
+//        void onUserUnusualLogout(RCUserLogOutUnusualMessage loginOutUnusualMessage);
+//
+//        /**
+//         * 暂停直播
+//         */
+//        void onLivePause();
+//
+//        void onAddLikeMessage(Message message, RCUserSyncAddLikeCountMessage addLikeMessage);
+//
+//        void getFriendInfoSuccess(FriendInfoBean friendInfoBean);
+//
+//        void onPublishSuccess();
+//
+//        /**
+//         * 黑名单用户状态切换
+//         *
+//         * @param userId
+//         * @param isAddBlack
+//         */
+//        void changeBlackUserStatus(String userId, boolean isAddBlack);
+//
+//        /**
+//         * 加入房间消息
+//         *
+//         * @param joinRoomMessage
+//         */
+//        void receiveJoinMessage(RCChatJoinRoomMessage joinRoomMessage);
+//
+//        /**
+//         * 抢购消息
+//         *
+//         * @param
+//         */
+//        void receiveSnapUpMessage(RCOnSnappingUpMessage snappingUpMessage);
+//
+//        /**
+//         * 远端有用户推流
+//         *
+//         * @param remoteUserId
+//         */
+//        void onRemoteUserPublishResource(String remoteUserId);
+//
+//        /**
+//         * 拒绝全部连麦申请
+//         */
+//        void onRefuseAllMicApply();
+//
+//        /**
+//         * 全部下麦
+//         */
+//        void onUnderAllMic();
+//    }
+//
+//    interface Presenter {
+//        void getRoomInfo(String roomId);
+//
+//        void notifyJoinRoomAction(String roomId, String userId);
+//
+//        void notifyLeaveRoomAction();
+//
+//        void handleAction(int action);
+//
+//        void getUserInfoByUserId(String friendUserId);
+//    }
+//}

+ 0 - 27
student/src/main/java/com/cooleshow/student/helper/ShareHelper.java

@@ -30,13 +30,6 @@ import io.reactivex.rxjava3.core.ObservableOnSubscribe;
 import io.reactivex.rxjava3.core.Observer;
 import io.reactivex.rxjava3.disposables.Disposable;
 import io.reactivex.rxjava3.schedulers.Schedulers;
-import io.rong.imkit.IMCenter;
-import io.rong.imkit.utils.helper.OpenChatHelper;
-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.ImageMessage;
 
 /**
  * Author by pq, Date on 2022/5/31.
@@ -140,16 +133,6 @@ public class ShareHelper {
     }
 
 
-    private static Message createImageMessage(String base64, Conversation conversation) {
-        ImageMessage imageMessage = ImageMessage.obtain();
-        imageMessage.setBase64(base64);
-        Message message = new Message();
-        message.setTargetId(conversation.getTargetId());
-        message.setContent(imageMessage);
-        message.setConversationType(conversation.getConversationType());
-        return message;
-    }
-
     private static File saveImgToLocalFile(String base64) {
         byte[] bytes;
         if (base64.startsWith("data:image/png;base64")) {
@@ -163,16 +146,6 @@ public class ShareHelper {
         return new File(file.getAbsolutePath());
     }
 
-    private static Message createImageMessage(File file, String targetId, Conversation.ConversationType conversationType) {
-        Uri uri = Uri.fromFile(file);
-        ImageMessage imageMessage = ImageMessage.obtain(uri, uri, true);
-        Message message = new Message();
-        message.setTargetId(targetId);
-        message.setContent(imageMessage);
-        message.setConversationType(conversationType);
-        return message;
-    }
-
     public interface ResultCallBack {
         void onResult(boolean isSuccess);
     }

+ 1117 - 1117
student/src/main/java/com/cooleshow/student/presenter/live/LiveRoomPresenter.java

@@ -1,1133 +1,1133 @@
-package com.cooleshow.student.presenter.live;
-
-import android.text.TextUtils;
-import android.util.Log;
-
-import com.cooleshow.base.data.net.BaseResponse;
-import com.cooleshow.base.presenter.BasePresenter;
-import com.cooleshow.base.rx.BaseObserver;
-import com.cooleshow.base.utils.LogUtils;
-import com.cooleshow.base.utils.RequestBodyUtil;
-import com.cooleshow.student.api.APIService;
-import com.cooleshow.student.bean.FriendInfoBean;
-import com.daya.live_teaching.common.ErrorCode;
-import com.daya.live_teaching.common.ResultCallback;
-import com.rong.io.live.bean.ImUserState;
-import com.cooleshow.student.bean.LiveRoomInfoBean;
-import com.cooleshow.student.contract.LiveRoomContract;
-import com.rong.io.live.helper.LiveRTCEngineInitHelper;
-import com.cooleshow.usercenter.helper.UserHelper;
-import com.google.gson.Gson;
-import com.rong.io.live.LiveRoomMsgConstants;
-import com.rong.io.live.callback.ClickCallback;
-import com.rong.io.live.callback.IRoomCallBack;
-import com.rong.io.live.helper.LiveEventHelper;
-import com.rong.io.live.manager.RCChatRoomMessageManager;
-import com.rong.io.live.message.RCChatJoinRoomMessage;
-import com.rong.io.live.message.RCChatModeMessage;
-import com.rong.io.live.message.RCChatRoomCloseMessage;
-import com.rong.io.live.message.RCChatRoomMemberNumMessage;
-import com.rong.io.live.message.RCChatroomLocationMessage;
-import com.rong.io.live.message.RCLiveBlackUserBlockMessage;
-import com.rong.io.live.message.RCLiveBlackUserUnBlockMessage;
-import com.rong.io.live.message.RCLiveGoodsChangeMessage;
-import com.rong.io.live.message.RCOnSnappingUpMessage;
-import com.rong.io.live.message.RCUserAddLikeMessage;
-import com.rong.io.live.message.RCUserKickOutMessage;
-import com.rong.io.live.message.RCUserLeaveRoomMessage;
-import com.rong.io.live.message.RCUserLogOutUnusualMessage;
-import com.rong.io.live.message.RCUserMicLeaveMessage;
-import com.rong.io.live.message.RCUserSeatApplyMessage;
-import com.rong.io.live.message.RCUserSeatResponseMessage;
-import com.rong.io.live.message.RCUserSeatsCtrlMessage;
-import com.rong.io.live.message.RCUserSyncAddLikeCountMessage;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import cn.rongcloud.rtc.api.RCRTCEngine;
-import cn.rongcloud.rtc.api.RCRTCRemoteUser;
-import cn.rongcloud.rtc.api.RCRTCRoom;
-import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback;
-import cn.rongcloud.rtc.api.callback.IRCRTCResultDataCallback;
-import cn.rongcloud.rtc.api.callback.IRCRTCRoomEventsListener;
-import cn.rongcloud.rtc.api.callback.IRCRTCSwitchRoleCallback;
-import cn.rongcloud.rtc.api.callback.IRCRTCSwitchRoleDataCallback;
-import cn.rongcloud.rtc.api.stream.RCRTCAudioInputStream;
-import cn.rongcloud.rtc.api.stream.RCRTCAudioOutputStream;
-import cn.rongcloud.rtc.api.stream.RCRTCInputStream;
-import cn.rongcloud.rtc.api.stream.RCRTCLiveInfo;
-import cn.rongcloud.rtc.api.stream.RCRTCOutputStream;
-import cn.rongcloud.rtc.api.stream.RCRTCVideoInputStream;
-import cn.rongcloud.rtc.api.stream.RCRTCVideoOutputStream;
-import cn.rongcloud.rtc.base.RCRTCLiveRole;
-import cn.rongcloud.rtc.base.RCRTCMediaType;
-import cn.rongcloud.rtc.base.RTCErrorCode;
-import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
-import io.reactivex.rxjava3.core.Observer;
-import io.reactivex.rxjava3.disposables.Disposable;
-import io.reactivex.rxjava3.functions.Consumer;
-import io.reactivex.rxjava3.observers.DisposableObserver;
-import io.reactivex.rxjava3.schedulers.Schedulers;
-import io.rong.imkit.IMCenter;
-import io.rong.imlib.IRongCoreCallback;
-import io.rong.imlib.RongIMClient;
-import io.rong.imlib.model.Message;
-import io.rong.imlib.model.MessageContent;
-import okhttp3.RequestBody;
-
-/**
- * Author by pq, Date on 2022/3/29.
- */
-public class LiveRoomPresenter extends BasePresenter<LiveRoomContract.view> implements LiveRoomContract.Presenter {
-    private boolean isInRoom;//是否已经在房间
-    private LiveRoomInfoBean currentRoomInfo;
-    private int addLikeCount = 0;
-    private List<String> shields = new ArrayList<>();//当前屏蔽词
-    private List<Disposable> disposablesManager = new ArrayList<>();//监听管理器
-    private final IRCRTCRoomEventsListener mRoomEventsListener = new IRCRTCRoomEventsListener() {
-        @Override
-        public void onRemoteUserPublishResource(RCRTCRemoteUser rcrtcRemoteUser, List<RCRTCInputStream> list) {
-            Log.i("pq", "onRemoteUserPublishResource:");
-            if (currentRoomInfo != null && TextUtils.equals(currentRoomInfo.speakerId, rcrtcRemoteUser.getUserId())) {
-                subscribeAVStream();
-            } else {
-                subscribeTargetStream(rcrtcRemoteUser.getUserId(), list, new ResultCallback<String>() {
-                    @Override
-                    public void onSuccess(String s) {
-                        if (getView() != null) {
-                            getView().onRemoteUserPublishResource(rcrtcRemoteUser.getUserId());
-                        }
-                    }
-
-                    @Override
-                    public void onFail(int errorCode, String errorStr) {
-                        LogUtils.i("pq", "subscribeTargetStream fail:errorCode:" + errorCode + "errorStr:" + errorStr);
-                    }
-                });
-            }
-        }
-
-        @Override
-        public void onRemoteUserMuteAudio(RCRTCRemoteUser rcrtcRemoteUser, RCRTCInputStream rcrtcInputStream, boolean b) {
-            Log.i("pq", "onRemoteUserMuteAudio:" + b);
-            if (getView() != null) {
-                getView().syncAudioStatus(b);
-            }
-        }
-
-        @Override
-        public void onRemoteUserMuteVideo(RCRTCRemoteUser rcrtcRemoteUser, RCRTCInputStream rcrtcInputStream, boolean b) {
-        }
-
-        @Override
-        public void onRemoteUserUnpublishResource(RCRTCRemoteUser rcrtcRemoteUser, List<RCRTCInputStream> list) {
-            Log.i("pq", "onRemoteUserUnpublishResource");
-            if (getView() != null) {
-                getView().showCloseVideoView();
-            }
-        }
-
-        @Override
-        public void onUserJoined(RCRTCRemoteUser rcrtcRemoteUser) {
-            //当房间中用户使用RCRTCLocalUser#switchToBroadcaster 方法上麦成功时
-            // ,房间中观众会收到IRCRTCRoomEventsListener#onUserJoined 回调。
-            if (null != getView()) {
-                getView().onUserJoinRoom(rcrtcRemoteUser);
-            }
-        }
-
-        @Override
-        public void onSwitchRole(String userId, RCRTCLiveRole role) {
-            super.onSwitchRole(userId, role);
-            //当房间内的用户使用 RCRTCLocalUser#switchToBroadcaster 或 RCRTCLocalUser#switchToAudience 方法上下麦时
-            // ,同房间内的其他主播会收到 IRCRTCRoomEventsListener#onSwitchRole 回调。
-            if (getView() != null) {
-                getView().onSwitchRole(userId, role);
-            }
-        }
-
-        @Override
-        public void onUserLeft(RCRTCRemoteUser rcrtcRemoteUser) {
-            if (getView() != null) {
-                getView().onUserLeftRoomMic(rcrtcRemoteUser);
-            }
-        }
-
-        @Override
-        public void onUserOffline(RCRTCRemoteUser rcrtcRemoteUser) {
-            if (getView() != null) {
-                getView().onUserOfflineRoomMic(rcrtcRemoteUser);
-            }
-        }
-
-        @Override
-        public void onPublishLiveStreams(List<RCRTCInputStream> list) {
-            Log.i("pq", "onPublishLiveStreams");
-        }
-
-        @Override
-        public void onUnpublishLiveStreams(List<RCRTCInputStream> list) {
-            Log.i("pq", "onUnpublishLiveStreams");
-            if (getView() != null) {
-                getView().showRestView();
-            }
-        }
-
-
-        /**
-         * 自己退出房间。 例如断网退出等
-         * @param i 状态码
-         */
-        @Override
-        public void onLeaveRoom(int i) {
-            Log.i("pq", "onLeaveRoom:" + i);
-        }
-    };
-
-    public void init(String roomId, boolean isCreate) {
-//        LiveEventHelper.getInstance().addLiveRoomListeners(this);
-        isInRoom = TextUtils.equals(LiveEventHelper.getInstance().getRoomId(), roomId);
-        RongIMClient.ConnectionStatusListener.ConnectionStatus currentConnectionStatus = RongIMClient.getInstance().getCurrentConnectionStatus();
-        if (currentConnectionStatus == RongIMClient.ConnectionStatusListener.ConnectionStatus.CONNECTED) {
-            Log.i("pq", "LiveRoomActivity init getRoomInfo");
-            getRoomInfo(roomId);
-        } else {
-            connectIM();
-        }
-
-    }
-
-    public void connectIM() {
-        String imtoken = UserHelper.getUserIMToken();
-        Log.i("pq", "im未连接,申请连接token:" + imtoken);
-        if (TextUtils.isEmpty(imtoken)) {
-            return;
-        }
-        IMCenter.getInstance().connect(imtoken, new RongIMClient.ConnectCallback() {
-            @Override
-            public void onSuccess(String t) {
-                Log.i("pq", "连接成功");
-            }
-
-            @Override
-            public void onError(RongIMClient.ConnectionErrorCode e) {
-                Log.i("pq", "connect error" + e);
-            }
-
-            @Override
-            public void onDatabaseOpened(RongIMClient.DatabaseOpenStatus code) {
-
-            }
-        });
-    }
-
-    public void setAddLikeCount(int addLikeCount) {
-        this.addLikeCount = addLikeCount;
-    }
-
-
-    /**
-     * 获取房间信息
-     *
-     * @param roomId
-     */
-    @Override
-    public void getRoomInfo(String roomId) {
-        addSubscribe(create(APIService.class).getLiveRoomInfo(roomId), new BaseObserver<LiveRoomInfoBean>(getView()) {
-            @Override
-            protected void onSuccess(LiveRoomInfoBean data) {
-                Log.i("pq", "getRoomInfo success" + data);
-                currentRoomInfo = data;
-                setObMessageListener(data.roomUid);
-                if (getView() != null) {
-                    getView().getRoomInfoSuccess(data);
-                }
-            }
-
-            @Override
-            public void onError(Throwable e) {
-                super.onError(e);
-                e.printStackTrace();
-                if (getView() != null) {
-                    getView().getRoomInfoError(e);
-                }
-            }
-        });
-    }
-
-    @Override
-    public void notifyJoinRoomAction(String roomId, String userId) {
-        //主进程调用,因为BaseObserver onStart show了loading控件,防止在子线程创建
-        addSubscribe(create(APIService.class).notifyJoinRoomAction(roomId, userId), new DisposableObserver() {
-            @Override
-            public void onNext(Object o) {
-                //通知服务端加入成功即可,无须关注结果
-            }
-
-            @Override
-            public void onError(Throwable e) {
-                e.printStackTrace();
-            }
-
-            @Override
-            public void onComplete() {
-
-            }
-        });
-    }
-
-    @Override
-    public void notifyLeaveRoomAction() {
-        handleAction(LiveRoomMsgConstants.ACTION_SEND_LEAVE_ROOM);
-        ImUserState imUserState = new ImUserState();
-        imUserState.setStatus(ImUserState.ACTION_LEAVE_LIVE_ROOM);
-        imUserState.setUserid(UserHelper.getUserId());
-        ArrayList<ImUserState> imUserStates = new ArrayList();
-        imUserStates.add(imUserState);
-        RequestBody body = RequestBodyUtil.convertToRequestBodyJson(new Gson().toJson(imUserStates));
-        create(APIService.class).notifyLeaveRoomAction(body)
-                .subscribeOn(Schedulers.io())
-                .observeOn(AndroidSchedulers.mainThread())
-                .subscribe(new Observer<BaseResponse<Object>>() {
-                    @Override
-                    public void onSubscribe(Disposable d) {
-
-                    }
-
-                    @Override
-                    public void onNext(BaseResponse<Object> objectBaseResponse) {
-                        //通知服务端离开即可,无须关注结果
-                    }
-
-                    @Override
-                    public void onError(Throwable e) {
-
-                    }
-
-                    @Override
-                    public void onComplete() {
-                        //通知服务端离开即可,无须关注结果
-                    }
-                });
-    }
-
-    @Override
-    public void getUserInfoByUserId(String userId) {
-        addSubscribe(create(APIService.class).queryFriendDetail(userId), new DisposableObserver<BaseResponse<FriendInfoBean>>() {
-            @Override
-            public void onNext(BaseResponse<FriendInfoBean> friendInfoBeanBaseResponse) {
-                if (getView() != null && friendInfoBeanBaseResponse != null) {
-                    getView().getFriendInfoSuccess(friendInfoBeanBaseResponse.getData());
-                }
-            }
-
-            @Override
-            public void onError(Throwable e) {
-                e.printStackTrace();
-            }
-
-            @Override
-            public void onComplete() {
-
-            }
-        });
-    }
-
-    /**
-     * 处理直播间的行为
-     *
-     * @param action
-     */
-    @Override
-    public void handleAction(int action) {
-        switch (action) {
-            case LiveRoomMsgConstants.ACTION_SEND_JOIN_ROOM:
-                //发送加入房间成功消息
-                RCChatJoinRoomMessage rcChatJoinRoomMessage = new RCChatJoinRoomMessage();
-                sendMessage(rcChatJoinRoomMessage, true);
-                break;
-            case LiveRoomMsgConstants.ACTION_SEND_ADD_LIKE_COUNT:
-                //发送点赞数量
-                RCUserAddLikeMessage addLikeMessage = new RCUserAddLikeMessage();
-                addLikeMessage.setCounts(addLikeCount);
-                sendMessage(addLikeMessage, false);
-                break;
-            case LiveRoomMsgConstants.ACTION_SEND_LEAVE_ROOM:
-                //退出直播间消息
-                RCUserLeaveRoomMessage rcUserLeaveRoomMessage = new RCUserLeaveRoomMessage();
-                rcUserLeaveRoomMessage.setUserId(UserHelper.getImUserId());
-                rcUserLeaveRoomMessage.setUserName(UserHelper.getUserName());
-                sendMessage(rcUserLeaveRoomMessage, false);
-                break;
-            case LiveRoomMsgConstants.ACTION_SEND_SEAT_APPLY:
-                //申请连麦
-                RCUserSeatApplyMessage rcUserSeatApplyMessage = new RCUserSeatApplyMessage();
-                rcUserSeatApplyMessage.setType(LiveRoomMsgConstants.MIC_ACTION_SEAT_BY_USER);
-                if (currentRoomInfo != null) {
-                    rcUserSeatApplyMessage.setTeacherId(currentRoomInfo.speakerId);
-                    rcUserSeatApplyMessage.setTeacherName(currentRoomInfo.speakerName);
-                }
-                rcUserSeatApplyMessage.setAudienceId(UserHelper.getImUserId());
-                rcUserSeatApplyMessage.setAudienceName(UserHelper.getUserName());
-                rcUserSeatApplyMessage.setAudienceAvatar(UserHelper.getUserAvatar());
-                sendMessage(rcUserSeatApplyMessage, true);
-                break;
-            case LiveRoomMsgConstants.ACTION_SEND_CANCEL_SEAT_APPLY:
-                //取消连麦申请
-                RCUserSeatApplyMessage cancelApplyMessage = new RCUserSeatApplyMessage();
-                cancelApplyMessage.setType(LiveRoomMsgConstants.MIC_ACTION_CANCEL_SEAT_BY_USER);
-                if (currentRoomInfo != null) {
-                    cancelApplyMessage.setTeacherId(currentRoomInfo.speakerId);
-                    cancelApplyMessage.setTeacherName(currentRoomInfo.speakerName);
-                }
-                cancelApplyMessage.setAudienceId(UserHelper.getImUserId());
-                cancelApplyMessage.setAudienceName(UserHelper.getUserName());
-                sendMessage(cancelApplyMessage, true);
-                break;
-            case LiveRoomMsgConstants.ACTION_SEND_DOWN_SEAT_MIC:
-                //观众下麦消息
-                RCUserMicLeaveMessage rcUserMicLeaveMessage = new RCUserMicLeaveMessage();
-                rcUserMicLeaveMessage.setAudienceId(UserHelper.getImUserId());
-                rcUserMicLeaveMessage.setAudienceName(UserHelper.getUserName());
-                sendMessage(rcUserMicLeaveMessage, false);
-                break;
-            case LiveRoomMsgConstants.ACTION_SEND_CANCEL_SEAT_AGREE_RESPONSE:
-                //被邀请上麦->观众同意上麦
-                RCUserSeatResponseMessage rcUserSeatResponseMessage = new RCUserSeatResponseMessage();
-                rcUserSeatResponseMessage.setType(LiveRoomMsgConstants.MIC_RESPONSE_AGREE_BY_USER);
-                if (currentRoomInfo != null) {
-                    rcUserSeatResponseMessage.setTeacherId(currentRoomInfo.speakerId);
-                    rcUserSeatResponseMessage.setTeacherName(currentRoomInfo.speakerName);
-                }
-                rcUserSeatResponseMessage.setAudienceId(UserHelper.getImUserId());
-                rcUserSeatResponseMessage.setAudienceName(UserHelper.getUserName());
-                sendMessage(rcUserSeatResponseMessage, true);
-                break;
-            case LiveRoomMsgConstants.ACTION_SEND_CANCEL_SEAT_DISAGREE_RESPONSE:
-                //被邀请上麦->观众不同意上麦
-                RCUserSeatResponseMessage disAgreeSeatResponseMessage = new RCUserSeatResponseMessage();
-                disAgreeSeatResponseMessage.setType(LiveRoomMsgConstants.MIC_RESPONSE_DISAGREE_BY_USER);
-                if (currentRoomInfo != null) {
-                    disAgreeSeatResponseMessage.setTeacherId(currentRoomInfo.speakerId);
-                    disAgreeSeatResponseMessage.setTeacherName(currentRoomInfo.speakerName);
-                }
-                disAgreeSeatResponseMessage.setAudienceId(UserHelper.getImUserId());
-                disAgreeSeatResponseMessage.setAudienceName(UserHelper.getUserName());
-                sendMessage(disAgreeSeatResponseMessage, true);
-                break;
-            case LiveRoomMsgConstants.ACTION_SEND_ON_SNAP_UP:
-                //发送正在抢购消息
-                RCOnSnappingUpMessage rcOnSnappingUpMessage = new RCOnSnappingUpMessage();
-                rcOnSnappingUpMessage.setUserId(UserHelper.getImUserId());
-                rcOnSnappingUpMessage.setUserName(UserHelper.getUserName());
-                sendMessage(rcOnSnappingUpMessage, true);
-                break;
-        }
-    }
-
-    public void joinChartRoom(String chatroomId, final IRongCoreCallback.OperationCallback callback) {
-        LiveEventHelper.getInstance().joinChatRoom(chatroomId, callback);
-    }
-
-    /**
-     * 先退出上次房间,再加入房间
-     *
-     * @param roomId
-     * @param isCreate
-     * @param isExit
-     */
-    public void leaveRoom(String roomId, boolean isCreate, boolean isExit) {
-        LiveEventHelper.getInstance().leaveRoom(new IRoomCallBack() {
-            @Override
-            public void onSuccess() {
-                if (isExit) {
-                    getView().getContentView().postDelayed(new Runnable() {
-                        @Override
-                        public void run() {
-                            joinRoom(roomId, isCreate);
-                        }
-                    }, 1000);
-                }
-            }
-
-            @Override
-            public void onError(int code, String message) {
-                Log.i("pq", "leaveRoom onError:" + code + "-msg:" + message);
-                if (isExit) {
-                    joinRoom(roomId, isCreate);
-                }
-            }
-        });
-    }
-
-    /**
-     * 加入房间
-     *
-     * @param roomId
-     * @param isCreate
-     */
-    private void joinRoom(String roomId, boolean isCreate) {
-        //如果是观众就直接加入房间
-        Log.i("pq", "joinRoom");
-        LiveEventHelper.getInstance().joinRoom(roomId, RCRTCLiveRole.AUDIENCE, new ClickCallback<Boolean>() {
-            @Override
-            public void onResult(Boolean result, String msg) {
-                Log.i("pq", "joinRoom onResult:" + result + "->" + msg);
-                if (result) {
-                    setCurrentRoom(currentRoomInfo, isCreate);
-                    refreshMusicView(true);
-                } else {
-                    //加入直播房间失败
-                    if (getView() != null) {
-                        getView().showFinishView();
-                    }
-                    leaveRoom(roomId, isCreate, false);
-                }
-            }
-        });
-    }
-
-    /**
-     * 下麦
-     */
-    public void exitMic() {
-        // 开始切换为观众身份
-        RCRTCRoom room = RCRTCEngine.getInstance().getRoom();
-        if (room == null || room.getLocalUser() == null) {
-            return;
-        }
-        RCRTCEngine.getInstance().getRoom().getLocalUser().switchToAudience(new IRCRTCSwitchRoleCallback() {
-
-            /**
-             * 当切换失败且SDK处于无法回退状态时回调,该角色已经无法使用当前角色继续进行音视频。
-             * SDK内部会退出房间并清理所有资源,该用户只能重新加入房间才能继续音视频。
-             */
-            @Override
-            public void onKicked() {
-                Log.i("pq", "下麦身份切换onKicked");
-            }
-
-            @Override
-            public void onSuccess() {
-                // 该用户切换为观众成功,可以以观众身份进行音视频
-                Log.i("pq", "下麦身份切换成功");
-                if (getView() != null) {
-                    getView().onExitSeatMicSuccess();
-                    subscribeAVStream();
-                }
-            }
-
-            /**
-             * 当切换失败且不影响当前角色继续音视频时回调
-             * @param errorCode 失败错误码
-             */
-            @Override
-            public void onFailed(RTCErrorCode errorCode) {
-                Log.i("pq", "下麦身份切换failed" + errorCode);
-            }
-        });
-    }
-
-    /**
-     * 上麦
-     */
-    public void joinMic() {
-        RCRTCRoom room = RCRTCEngine.getInstance().getRoom();
-        if (room == null || room.getLocalUser() == null) {
-            return;
-        }
-        //连麦
-        ArrayList<RCRTCOutputStream> streams = new ArrayList<>();
-        streams.add(RCRTCEngine.getInstance().getDefaultAudioStream());
-        // 开始切换为主播身份
-        RCRTCEngine.getInstance().getRoom().getLocalUser().switchToBroadcaster(streams, new IRCRTCSwitchRoleDataCallback<RCRTCLiveInfo>() {
-            /**
-             * 当切换失败且SDK处于无法回退状态时回调,该角色已经无法使用当前角色继续进行音视频。
-             * SDK内部会退出房间并清理所有资源,该用户只能重新加入房间才能继续音视频。
-             */
-            @Override
-            public void onKicked() {
-                Log.i("pq", "上麦身份切换kick");
-            }
-
-            @Override
-            public void onSuccess(RCRTCLiveInfo data) {
-                //该用户切换为主播成功,可以以主播身份进行音视频
-                Log.i("pq", "上麦身份切换成功");
-                if (getView() != null) {
-                    getView().onSeatMicSuccess();
-                    subscribeAVStream();
-                }
-            }
-
-            /**
-             * 当切换失败且不影响当前角色继续音视频时回调
-             * @param errorCode 失败错误码
-             */
-            @Override
-            public void onFailed(RTCErrorCode errorCode) {
-                Log.i("pq", "上麦身份切换失败:" + errorCode);
-                if (getView() != null) {
-                    getView().onSeatMicFail();
-                }
-            }
-        });
-    }
-
-    /**
-     * 设置当前房间
-     *
-     * @param roomInfo
-     * @param isCreate
-     */
-    public void setCurrentRoom(LiveRoomInfoBean roomInfo, boolean isCreate) {
-        initLiveRoomListener(roomInfo.roomUid);
-        if (isInRoom) {
-            //恢复一下当前信息就可以了
-            List<MessageContent> messageList = LiveEventHelper.getInstance().getMessageList();
-            getView().addMessageList(messageList, true);
-        } else {
-            // 发送默认消息
-            sendDefaultMessage();
-        }
-        //初次进入的时候,获取房间内的人数信息
-//        MemberCache.getInstance().fetchData(currentRoomInfo.getRoomId());
-        //设置创建者id
-        LiveEventHelper.getInstance().setCreateUserId(roomInfo.speakerId);
-        //最好在订阅流之前再设置一次扬声器模式,不然可能有部分手机有问题,
-        // 在初始化的时候设置扬声器的状态相当于给扬声器一个初始值,时机过于早,
-        // 很可能硬件层还没有准备好。在需要用到扬声器的时候,再设置一下就好了
-        LiveRTCEngineInitHelper.setRTCSpeakerMode(true);
-//        getShield();获取敏感词汇
-        subscribeAVStream();
-        getView().setRoomData(currentRoomInfo);
-    }
-
-    /**
-     * 加入房间后,开始摄像头采集并发布音视频流。
-     */
-    private void startPublish() {
-        RCRTCRoom rcrtcRoom = LiveEventHelper.getInstance().getRtcRoom();
-        RCRTCEngine.getInstance().getDefaultVideoStream().startCamera(null);
-        rcrtcRoom.getLocalUser().publishDefaultLiveStreams(new IRCRTCResultDataCallback<RCRTCLiveInfo>() {
-            @Override
-            public void onSuccess(RCRTCLiveInfo liveInfo) {
-                if (getView() != null) {
-                    getView().onPublishSuccess();
-                }
-            }
-
-            @Override
-            public void onFailed(RTCErrorCode code) {
-                Log.i("pq", "publishDefaultLiveStreamError:" + code);
-            }
-        });
-    }
-
-    /**
-     * 进入房间后发送默认的消息
-     */
-    private void sendDefaultMessage() {
-        if (currentRoomInfo != null) {
-//            getView().addMessageContent(null, true);
-            // 默认消息
-//            RCChatroomLocationMessage welcome = new RCChatroomLocationMessage();
-//            welcome.setContent(String.format("欢迎来到 %s", currentRoomInfo.roomTitle));
-//            sendMessage(welcome);
-            RCChatroomLocationMessage tips = new RCChatroomLocationMessage();
-            tips.setContent("欢迎进入直播课堂,请遵守相关法规,禁止传播低俗、暴力等不良信息。为孩子创造健康绿色的学习环境。");
-            sendMessage(tips);
-        }
-    }
-
-    /**
-     * 发送消息
-     * 默认显示在本地
-     *
-     * @param messageContent
-     */
-    public void sendMessage(MessageContent messageContent) {
-        sendMessage(messageContent, true);
-    }
-
-    /**
-     * 发送消息
-     *
-     * @param messageContent 消息体
-     * @param isShowLocation 是否显示在本地
-     */
-    public void sendMessage(MessageContent messageContent, boolean isShowLocation) {
-        if (!isContainsShield(messageContent)) {
-            LiveEventHelper.getInstance().sendMessage(messageContent, isShowLocation);
-        }
-    }
-
-    /**
-     * 是否包含屏蔽词
-     *
-     * @return
-     */
-    private boolean isContainsShield(MessageContent messageContent) {
-        boolean isContains = false;
-//        if (shields != null) {
-//            for (String shield : shields) {
-//                if (messageContent instanceof RCChatroomBarrage) {
-//                    if (((RCChatroomBarrage) messageContent).getContent().contains(shield)) {
-//                        isContains = true;
-//                        break;
+//package com.cooleshow.student.presenter.live;
+//
+//import android.text.TextUtils;
+//import android.util.Log;
+//
+//import com.cooleshow.base.data.net.BaseResponse;
+//import com.cooleshow.base.presenter.BasePresenter;
+//import com.cooleshow.base.rx.BaseObserver;
+//import com.cooleshow.base.utils.LogUtils;
+//import com.cooleshow.base.utils.RequestBodyUtil;
+//import com.cooleshow.student.api.APIService;
+//import com.cooleshow.student.bean.FriendInfoBean;
+//import com.daya.live_teaching.common.ErrorCode;
+//import com.daya.live_teaching.common.ResultCallback;
+//import com.rong.io.live.bean.ImUserState;
+//import com.cooleshow.student.bean.LiveRoomInfoBean;
+//import com.cooleshow.student.contract.LiveRoomContract;
+//import com.rong.io.live.helper.LiveRTCEngineInitHelper;
+//import com.cooleshow.usercenter.helper.UserHelper;
+//import com.google.gson.Gson;
+//import com.rong.io.live.LiveRoomMsgConstants;
+//import com.rong.io.live.callback.ClickCallback;
+//import com.rong.io.live.callback.IRoomCallBack;
+//import com.rong.io.live.helper.LiveEventHelper;
+//import com.rong.io.live.manager.RCChatRoomMessageManager;
+//import com.rong.io.live.message.RCChatJoinRoomMessage;
+//import com.rong.io.live.message.RCChatModeMessage;
+//import com.rong.io.live.message.RCChatRoomCloseMessage;
+//import com.rong.io.live.message.RCChatRoomMemberNumMessage;
+//import com.rong.io.live.message.RCChatroomLocationMessage;
+//import com.rong.io.live.message.RCLiveBlackUserBlockMessage;
+//import com.rong.io.live.message.RCLiveBlackUserUnBlockMessage;
+//import com.rong.io.live.message.RCLiveGoodsChangeMessage;
+//import com.rong.io.live.message.RCOnSnappingUpMessage;
+//import com.rong.io.live.message.RCUserAddLikeMessage;
+//import com.rong.io.live.message.RCUserKickOutMessage;
+//import com.rong.io.live.message.RCUserLeaveRoomMessage;
+//import com.rong.io.live.message.RCUserLogOutUnusualMessage;
+//import com.rong.io.live.message.RCUserMicLeaveMessage;
+//import com.rong.io.live.message.RCUserSeatApplyMessage;
+//import com.rong.io.live.message.RCUserSeatResponseMessage;
+//import com.rong.io.live.message.RCUserSeatsCtrlMessage;
+//import com.rong.io.live.message.RCUserSyncAddLikeCountMessage;
+//
+//import java.util.ArrayList;
+//import java.util.List;
+//
+//import cn.rongcloud.rtc.api.RCRTCEngine;
+//import cn.rongcloud.rtc.api.RCRTCRemoteUser;
+//import cn.rongcloud.rtc.api.RCRTCRoom;
+//import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback;
+//import cn.rongcloud.rtc.api.callback.IRCRTCResultDataCallback;
+//import cn.rongcloud.rtc.api.callback.IRCRTCRoomEventsListener;
+//import cn.rongcloud.rtc.api.callback.IRCRTCSwitchRoleCallback;
+//import cn.rongcloud.rtc.api.callback.IRCRTCSwitchRoleDataCallback;
+//import cn.rongcloud.rtc.api.stream.RCRTCAudioInputStream;
+//import cn.rongcloud.rtc.api.stream.RCRTCAudioOutputStream;
+//import cn.rongcloud.rtc.api.stream.RCRTCInputStream;
+//import cn.rongcloud.rtc.api.stream.RCRTCLiveInfo;
+//import cn.rongcloud.rtc.api.stream.RCRTCOutputStream;
+//import cn.rongcloud.rtc.api.stream.RCRTCVideoInputStream;
+//import cn.rongcloud.rtc.api.stream.RCRTCVideoOutputStream;
+//import cn.rongcloud.rtc.base.RCRTCLiveRole;
+//import cn.rongcloud.rtc.base.RCRTCMediaType;
+//import cn.rongcloud.rtc.base.RTCErrorCode;
+//import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
+//import io.reactivex.rxjava3.core.Observer;
+//import io.reactivex.rxjava3.disposables.Disposable;
+//import io.reactivex.rxjava3.functions.Consumer;
+//import io.reactivex.rxjava3.observers.DisposableObserver;
+//import io.reactivex.rxjava3.schedulers.Schedulers;
+//import io.rong.imkit.IMCenter;
+//import io.rong.imlib.IRongCoreCallback;
+//import io.rong.imlib.RongIMClient;
+//import io.rong.imlib.model.Message;
+//import io.rong.imlib.model.MessageContent;
+//import okhttp3.RequestBody;
+//
+///**
+// * Author by pq, Date on 2022/3/29.
+// */
+//public class LiveRoomPresenter extends BasePresenter<LiveRoomContract.view> implements LiveRoomContract.Presenter {
+//    private boolean isInRoom;//是否已经在房间
+//    private LiveRoomInfoBean currentRoomInfo;
+//    private int addLikeCount = 0;
+//    private List<String> shields = new ArrayList<>();//当前屏蔽词
+//    private List<Disposable> disposablesManager = new ArrayList<>();//监听管理器
+//    private final IRCRTCRoomEventsListener mRoomEventsListener = new IRCRTCRoomEventsListener() {
+//        @Override
+//        public void onRemoteUserPublishResource(RCRTCRemoteUser rcrtcRemoteUser, List<RCRTCInputStream> list) {
+//            Log.i("pq", "onRemoteUserPublishResource:");
+//            if (currentRoomInfo != null && TextUtils.equals(currentRoomInfo.speakerId, rcrtcRemoteUser.getUserId())) {
+//                subscribeAVStream();
+//            } else {
+//                subscribeTargetStream(rcrtcRemoteUser.getUserId(), list, new ResultCallback<String>() {
+//                    @Override
+//                    public void onSuccess(String s) {
+//                        if (getView() != null) {
+//                            getView().onRemoteUserPublishResource(rcrtcRemoteUser.getUserId());
+//                        }
 //                    }
-//                }
+//
+//                    @Override
+//                    public void onFail(int errorCode, String errorStr) {
+//                        LogUtils.i("pq", "subscribeTargetStream fail:errorCode:" + errorCode + "errorStr:" + errorStr);
+//                    }
+//                });
+//            }
+//        }
+//
+//        @Override
+//        public void onRemoteUserMuteAudio(RCRTCRemoteUser rcrtcRemoteUser, RCRTCInputStream rcrtcInputStream, boolean b) {
+//            Log.i("pq", "onRemoteUserMuteAudio:" + b);
+//            if (getView() != null) {
+//                getView().syncAudioStatus(b);
 //            }
-//            if (isContains) {
-//                //如果是包含了敏感词'
-//                mView.addMessageContent(messageContent, false);
-//                return true;
+//        }
+//
+//        @Override
+//        public void onRemoteUserMuteVideo(RCRTCRemoteUser rcrtcRemoteUser, RCRTCInputStream rcrtcInputStream, boolean b) {
+//        }
+//
+//        @Override
+//        public void onRemoteUserUnpublishResource(RCRTCRemoteUser rcrtcRemoteUser, List<RCRTCInputStream> list) {
+//            Log.i("pq", "onRemoteUserUnpublishResource");
+//            if (getView() != null) {
+//                getView().showCloseVideoView();
+//            }
+//        }
+//
+//        @Override
+//        public void onUserJoined(RCRTCRemoteUser rcrtcRemoteUser) {
+//            //当房间中用户使用RCRTCLocalUser#switchToBroadcaster 方法上麦成功时
+//            // ,房间中观众会收到IRCRTCRoomEventsListener#onUserJoined 回调。
+//            if (null != getView()) {
+//                getView().onUserJoinRoom(rcrtcRemoteUser);
+//            }
+//        }
+//
+//        @Override
+//        public void onSwitchRole(String userId, RCRTCLiveRole role) {
+//            super.onSwitchRole(userId, role);
+//            //当房间内的用户使用 RCRTCLocalUser#switchToBroadcaster 或 RCRTCLocalUser#switchToAudience 方法上下麦时
+//            // ,同房间内的其他主播会收到 IRCRTCRoomEventsListener#onSwitchRole 回调。
+//            if (getView() != null) {
+//                getView().onSwitchRole(userId, role);
+//            }
+//        }
+//
+//        @Override
+//        public void onUserLeft(RCRTCRemoteUser rcrtcRemoteUser) {
+//            if (getView() != null) {
+//                getView().onUserLeftRoomMic(rcrtcRemoteUser);
 //            }
 //        }
-        return false;
-    }
-
-    /**
-     * 设置直播房的各种监听
-     *
-     * @param roomId
-     */
-    public void initLiveRoomListener(String roomId) {
-        LiveEventHelper.getInstance().getRtcRoom().registerRoomListener(mRoomEventsListener);
-        //添加消息监听
-//        setObShieldListener();
-//        //监听房间里面的人
-//        MemberCache.getInstance().getMemberList()
-//                .observe( new Observer<List<User>>() {
+//
+//        @Override
+//        public void onUserOffline(RCRTCRemoteUser rcrtcRemoteUser) {
+//            if (getView() != null) {
+//                getView().onUserOfflineRoomMic(rcrtcRemoteUser);
+//            }
+//        }
+//
+//        @Override
+//        public void onPublishLiveStreams(List<RCRTCInputStream> list) {
+//            Log.i("pq", "onPublishLiveStreams");
+//        }
+//
+//        @Override
+//        public void onUnpublishLiveStreams(List<RCRTCInputStream> list) {
+//            Log.i("pq", "onUnpublishLiveStreams");
+//            if (getView() != null) {
+//                getView().showRestView();
+//            }
+//        }
+//
+//
+//        /**
+//         * 自己退出房间。 例如断网退出等
+//         * @param i 状态码
+//         */
+//        @Override
+//        public void onLeaveRoom(int i) {
+//            Log.i("pq", "onLeaveRoom:" + i);
+//        }
+//    };
+//
+//    public void init(String roomId, boolean isCreate) {
+////        LiveEventHelper.getInstance().addLiveRoomListeners(this);
+//        isInRoom = TextUtils.equals(LiveEventHelper.getInstance().getRoomId(), roomId);
+//        RongIMClient.ConnectionStatusListener.ConnectionStatus currentConnectionStatus = RongIMClient.getInstance().getCurrentConnectionStatus();
+//        if (currentConnectionStatus == RongIMClient.ConnectionStatusListener.ConnectionStatus.CONNECTED) {
+//            Log.i("pq", "LiveRoomActivity init getRoomInfo");
+//            getRoomInfo(roomId);
+//        } else {
+//            connectIM();
+//        }
+//
+//    }
+//
+//    public void connectIM() {
+//        String imtoken = UserHelper.getUserIMToken();
+//        Log.i("pq", "im未连接,申请连接token:" + imtoken);
+//        if (TextUtils.isEmpty(imtoken)) {
+//            return;
+//        }
+//        IMCenter.getInstance().connect(imtoken, new RongIMClient.ConnectCallback() {
+//            @Override
+//            public void onSuccess(String t) {
+//                Log.i("pq", "连接成功");
+//            }
+//
+//            @Override
+//            public void onError(RongIMClient.ConnectionErrorCode e) {
+//                Log.i("pq", "connect error" + e);
+//            }
+//
+//            @Override
+//            public void onDatabaseOpened(RongIMClient.DatabaseOpenStatus code) {
+//
+//            }
+//        });
+//    }
+//
+//    public void setAddLikeCount(int addLikeCount) {
+//        this.addLikeCount = addLikeCount;
+//    }
+//
+//
+//    /**
+//     * 获取房间信息
+//     *
+//     * @param roomId
+//     */
+//    @Override
+//    public void getRoomInfo(String roomId) {
+//        addSubscribe(create(APIService.class).getLiveRoomInfo(roomId), new BaseObserver<LiveRoomInfoBean>(getView()) {
+//            @Override
+//            protected void onSuccess(LiveRoomInfoBean data) {
+//                Log.i("pq", "getRoomInfo success" + data);
+//                currentRoomInfo = data;
+//                setObMessageListener(data.roomUid);
+//                if (getView() != null) {
+//                    getView().getRoomInfoSuccess(data);
+//                }
+//            }
+//
+//            @Override
+//            public void onError(Throwable e) {
+//                super.onError(e);
+//                e.printStackTrace();
+//                if (getView() != null) {
+//                    getView().getRoomInfoError(e);
+//                }
+//            }
+//        });
+//    }
+//
+//    @Override
+//    public void notifyJoinRoomAction(String roomId, String userId) {
+//        //主进程调用,因为BaseObserver onStart show了loading控件,防止在子线程创建
+//        addSubscribe(create(APIService.class).notifyJoinRoomAction(roomId, userId), new DisposableObserver() {
+//            @Override
+//            public void onNext(Object o) {
+//                //通知服务端加入成功即可,无须关注结果
+//            }
+//
+//            @Override
+//            public void onError(Throwable e) {
+//                e.printStackTrace();
+//            }
+//
+//            @Override
+//            public void onComplete() {
+//
+//            }
+//        });
+//    }
+//
+//    @Override
+//    public void notifyLeaveRoomAction() {
+//        handleAction(LiveRoomMsgConstants.ACTION_SEND_LEAVE_ROOM);
+//        ImUserState imUserState = new ImUserState();
+//        imUserState.setStatus(ImUserState.ACTION_LEAVE_LIVE_ROOM);
+//        imUserState.setUserid(UserHelper.getUserId());
+//        ArrayList<ImUserState> imUserStates = new ArrayList();
+//        imUserStates.add(imUserState);
+//        RequestBody body = RequestBodyUtil.convertToRequestBodyJson(new Gson().toJson(imUserStates));
+//        create(APIService.class).notifyLeaveRoomAction(body)
+//                .subscribeOn(Schedulers.io())
+//                .observeOn(AndroidSchedulers.mainThread())
+//                .subscribe(new Observer<BaseResponse<Object>>() {
+//                    @Override
+//                    public void onSubscribe(Disposable d) {
+//
+//                    }
+//
 //                    @Override
-//                    public void onChanged(List<User> users) {
-//                        getView().setOnlineCount(users.size());
-//                        LiveEventHelper.getInstance().getRequestLiveVideoIds(null);
-//                        onInviteLiveVideoIds(users);
+//                    public void onNext(BaseResponse<Object> objectBaseResponse) {
+//                        //通知服务端离开即可,无须关注结果
+//                    }
+//
+//                    @Override
+//                    public void onError(Throwable e) {
+//
+//                    }
+//
+//                    @Override
+//                    public void onComplete() {
+//                        //通知服务端离开即可,无须关注结果
 //                    }
 //                });
-//        //监听管理员变化
-//        MemberCache.getInstance().getAdminList()
-//                .observe(((LiveRoomFragment) mView).getViewLifecycleOwner(), new Observer<List<String>>() {
+//    }
+//
+//    @Override
+//    public void getUserInfoByUserId(String userId) {
+//        addSubscribe(create(APIService.class).queryFriendDetail(userId), new DisposableObserver<BaseResponse<FriendInfoBean>>() {
+//            @Override
+//            public void onNext(BaseResponse<FriendInfoBean> friendInfoBeanBaseResponse) {
+//                if (getView() != null && friendInfoBeanBaseResponse != null) {
+//                    getView().getFriendInfoSuccess(friendInfoBeanBaseResponse.getData());
+//                }
+//            }
+//
+//            @Override
+//            public void onError(Throwable e) {
+//                e.printStackTrace();
+//            }
+//
+//            @Override
+//            public void onComplete() {
+//
+//            }
+//        });
+//    }
+//
+//    /**
+//     * 处理直播间的行为
+//     *
+//     * @param action
+//     */
+//    @Override
+//    public void handleAction(int action) {
+//        switch (action) {
+//            case LiveRoomMsgConstants.ACTION_SEND_JOIN_ROOM:
+//                //发送加入房间成功消息
+//                RCChatJoinRoomMessage rcChatJoinRoomMessage = new RCChatJoinRoomMessage();
+//                sendMessage(rcChatJoinRoomMessage, true);
+//                break;
+//            case LiveRoomMsgConstants.ACTION_SEND_ADD_LIKE_COUNT:
+//                //发送点赞数量
+//                RCUserAddLikeMessage addLikeMessage = new RCUserAddLikeMessage();
+//                addLikeMessage.setCounts(addLikeCount);
+//                sendMessage(addLikeMessage, false);
+//                break;
+//            case LiveRoomMsgConstants.ACTION_SEND_LEAVE_ROOM:
+//                //退出直播间消息
+//                RCUserLeaveRoomMessage rcUserLeaveRoomMessage = new RCUserLeaveRoomMessage();
+//                rcUserLeaveRoomMessage.setUserId(UserHelper.getImUserId());
+//                rcUserLeaveRoomMessage.setUserName(UserHelper.getUserName());
+//                sendMessage(rcUserLeaveRoomMessage, false);
+//                break;
+//            case LiveRoomMsgConstants.ACTION_SEND_SEAT_APPLY:
+//                //申请连麦
+//                RCUserSeatApplyMessage rcUserSeatApplyMessage = new RCUserSeatApplyMessage();
+//                rcUserSeatApplyMessage.setType(LiveRoomMsgConstants.MIC_ACTION_SEAT_BY_USER);
+//                if (currentRoomInfo != null) {
+//                    rcUserSeatApplyMessage.setTeacherId(currentRoomInfo.speakerId);
+//                    rcUserSeatApplyMessage.setTeacherName(currentRoomInfo.speakerName);
+//                }
+//                rcUserSeatApplyMessage.setAudienceId(UserHelper.getImUserId());
+//                rcUserSeatApplyMessage.setAudienceName(UserHelper.getUserName());
+//                rcUserSeatApplyMessage.setAudienceAvatar(UserHelper.getUserAvatar());
+//                sendMessage(rcUserSeatApplyMessage, true);
+//                break;
+//            case LiveRoomMsgConstants.ACTION_SEND_CANCEL_SEAT_APPLY:
+//                //取消连麦申请
+//                RCUserSeatApplyMessage cancelApplyMessage = new RCUserSeatApplyMessage();
+//                cancelApplyMessage.setType(LiveRoomMsgConstants.MIC_ACTION_CANCEL_SEAT_BY_USER);
+//                if (currentRoomInfo != null) {
+//                    cancelApplyMessage.setTeacherId(currentRoomInfo.speakerId);
+//                    cancelApplyMessage.setTeacherName(currentRoomInfo.speakerName);
+//                }
+//                cancelApplyMessage.setAudienceId(UserHelper.getImUserId());
+//                cancelApplyMessage.setAudienceName(UserHelper.getUserName());
+//                sendMessage(cancelApplyMessage, true);
+//                break;
+//            case LiveRoomMsgConstants.ACTION_SEND_DOWN_SEAT_MIC:
+//                //观众下麦消息
+//                RCUserMicLeaveMessage rcUserMicLeaveMessage = new RCUserMicLeaveMessage();
+//                rcUserMicLeaveMessage.setAudienceId(UserHelper.getImUserId());
+//                rcUserMicLeaveMessage.setAudienceName(UserHelper.getUserName());
+//                sendMessage(rcUserMicLeaveMessage, false);
+//                break;
+//            case LiveRoomMsgConstants.ACTION_SEND_CANCEL_SEAT_AGREE_RESPONSE:
+//                //被邀请上麦->观众同意上麦
+//                RCUserSeatResponseMessage rcUserSeatResponseMessage = new RCUserSeatResponseMessage();
+//                rcUserSeatResponseMessage.setType(LiveRoomMsgConstants.MIC_RESPONSE_AGREE_BY_USER);
+//                if (currentRoomInfo != null) {
+//                    rcUserSeatResponseMessage.setTeacherId(currentRoomInfo.speakerId);
+//                    rcUserSeatResponseMessage.setTeacherName(currentRoomInfo.speakerName);
+//                }
+//                rcUserSeatResponseMessage.setAudienceId(UserHelper.getImUserId());
+//                rcUserSeatResponseMessage.setAudienceName(UserHelper.getUserName());
+//                sendMessage(rcUserSeatResponseMessage, true);
+//                break;
+//            case LiveRoomMsgConstants.ACTION_SEND_CANCEL_SEAT_DISAGREE_RESPONSE:
+//                //被邀请上麦->观众不同意上麦
+//                RCUserSeatResponseMessage disAgreeSeatResponseMessage = new RCUserSeatResponseMessage();
+//                disAgreeSeatResponseMessage.setType(LiveRoomMsgConstants.MIC_RESPONSE_DISAGREE_BY_USER);
+//                if (currentRoomInfo != null) {
+//                    disAgreeSeatResponseMessage.setTeacherId(currentRoomInfo.speakerId);
+//                    disAgreeSeatResponseMessage.setTeacherName(currentRoomInfo.speakerName);
+//                }
+//                disAgreeSeatResponseMessage.setAudienceId(UserHelper.getImUserId());
+//                disAgreeSeatResponseMessage.setAudienceName(UserHelper.getUserName());
+//                sendMessage(disAgreeSeatResponseMessage, true);
+//                break;
+//            case LiveRoomMsgConstants.ACTION_SEND_ON_SNAP_UP:
+//                //发送正在抢购消息
+//                RCOnSnappingUpMessage rcOnSnappingUpMessage = new RCOnSnappingUpMessage();
+//                rcOnSnappingUpMessage.setUserId(UserHelper.getImUserId());
+//                rcOnSnappingUpMessage.setUserName(UserHelper.getUserName());
+//                sendMessage(rcOnSnappingUpMessage, true);
+//                break;
+//        }
+//    }
+//
+//    public void joinChartRoom(String chatroomId, final IRongCoreCallback.OperationCallback callback) {
+//        LiveEventHelper.getInstance().joinChatRoom(chatroomId, callback);
+//    }
+//
+//    /**
+//     * 先退出上次房间,再加入房间
+//     *
+//     * @param roomId
+//     * @param isCreate
+//     * @param isExit
+//     */
+//    public void leaveRoom(String roomId, boolean isCreate, boolean isExit) {
+//        LiveEventHelper.getInstance().leaveRoom(new IRoomCallBack() {
+//            @Override
+//            public void onSuccess() {
+//                if (isExit) {
+//                    getView().getContentView().postDelayed(new Runnable() {
+//                        @Override
+//                        public void run() {
+//                            joinRoom(roomId, isCreate);
+//                        }
+//                    }, 1000);
+//                }
+//            }
+//
+//            @Override
+//            public void onError(int code, String message) {
+//                Log.i("pq", "leaveRoom onError:" + code + "-msg:" + message);
+//                if (isExit) {
+//                    joinRoom(roomId, isCreate);
+//                }
+//            }
+//        });
+//    }
+//
+//    /**
+//     * 加入房间
+//     *
+//     * @param roomId
+//     * @param isCreate
+//     */
+//    private void joinRoom(String roomId, boolean isCreate) {
+//        //如果是观众就直接加入房间
+//        Log.i("pq", "joinRoom");
+//        LiveEventHelper.getInstance().joinRoom(roomId, RCRTCLiveRole.AUDIENCE, new ClickCallback<Boolean>() {
+//            @Override
+//            public void onResult(Boolean result, String msg) {
+//                Log.i("pq", "joinRoom onResult:" + result + "->" + msg);
+//                if (result) {
+//                    setCurrentRoom(currentRoomInfo, isCreate);
+//                    refreshMusicView(true);
+//                } else {
+//                    //加入直播房间失败
+//                    if (getView() != null) {
+//                        getView().showFinishView();
+//                    }
+//                    leaveRoom(roomId, isCreate, false);
+//                }
+//            }
+//        });
+//    }
+//
+//    /**
+//     * 下麦
+//     */
+//    public void exitMic() {
+//        // 开始切换为观众身份
+//        RCRTCRoom room = RCRTCEngine.getInstance().getRoom();
+//        if (room == null || room.getLocalUser() == null) {
+//            return;
+//        }
+//        RCRTCEngine.getInstance().getRoom().getLocalUser().switchToAudience(new IRCRTCSwitchRoleCallback() {
+//
+//            /**
+//             * 当切换失败且SDK处于无法回退状态时回调,该角色已经无法使用当前角色继续进行音视频。
+//             * SDK内部会退出房间并清理所有资源,该用户只能重新加入房间才能继续音视频。
+//             */
+//            @Override
+//            public void onKicked() {
+//                Log.i("pq", "下麦身份切换onKicked");
+//            }
+//
+//            @Override
+//            public void onSuccess() {
+//                // 该用户切换为观众成功,可以以观众身份进行音视频
+//                Log.i("pq", "下麦身份切换成功");
+//                if (getView() != null) {
+//                    getView().onExitSeatMicSuccess();
+//                    subscribeAVStream();
+//                }
+//            }
+//
+//            /**
+//             * 当切换失败且不影响当前角色继续音视频时回调
+//             * @param errorCode 失败错误码
+//             */
+//            @Override
+//            public void onFailed(RTCErrorCode errorCode) {
+//                Log.i("pq", "下麦身份切换failed" + errorCode);
+//            }
+//        });
+//    }
+//
+//    /**
+//     * 上麦
+//     */
+//    public void joinMic() {
+//        RCRTCRoom room = RCRTCEngine.getInstance().getRoom();
+//        if (room == null || room.getLocalUser() == null) {
+//            return;
+//        }
+//        //连麦
+//        ArrayList<RCRTCOutputStream> streams = new ArrayList<>();
+//        streams.add(RCRTCEngine.getInstance().getDefaultAudioStream());
+//        // 开始切换为主播身份
+//        RCRTCEngine.getInstance().getRoom().getLocalUser().switchToBroadcaster(streams, new IRCRTCSwitchRoleDataCallback<RCRTCLiveInfo>() {
+//            /**
+//             * 当切换失败且SDK处于无法回退状态时回调,该角色已经无法使用当前角色继续进行音视频。
+//             * SDK内部会退出房间并清理所有资源,该用户只能重新加入房间才能继续音视频。
+//             */
+//            @Override
+//            public void onKicked() {
+//                Log.i("pq", "上麦身份切换kick");
+//            }
+//
+//            @Override
+//            public void onSuccess(RCRTCLiveInfo data) {
+//                //该用户切换为主播成功,可以以主播身份进行音视频
+//                Log.i("pq", "上麦身份切换成功");
+//                if (getView() != null) {
+//                    getView().onSeatMicSuccess();
+//                    subscribeAVStream();
+//                }
+//            }
+//
+//            /**
+//             * 当切换失败且不影响当前角色继续音视频时回调
+//             * @param errorCode 失败错误码
+//             */
+//            @Override
+//            public void onFailed(RTCErrorCode errorCode) {
+//                Log.i("pq", "上麦身份切换失败:" + errorCode);
+//                if (getView() != null) {
+//                    getView().onSeatMicFail();
+//                }
+//            }
+//        });
+//    }
+//
+//    /**
+//     * 设置当前房间
+//     *
+//     * @param roomInfo
+//     * @param isCreate
+//     */
+//    public void setCurrentRoom(LiveRoomInfoBean roomInfo, boolean isCreate) {
+//        initLiveRoomListener(roomInfo.roomUid);
+//        if (isInRoom) {
+//            //恢复一下当前信息就可以了
+//            List<MessageContent> messageList = LiveEventHelper.getInstance().getMessageList();
+//            getView().addMessageList(messageList, true);
+//        } else {
+//            // 发送默认消息
+//            sendDefaultMessage();
+//        }
+//        //初次进入的时候,获取房间内的人数信息
+////        MemberCache.getInstance().fetchData(currentRoomInfo.getRoomId());
+//        //设置创建者id
+//        LiveEventHelper.getInstance().setCreateUserId(roomInfo.speakerId);
+//        //最好在订阅流之前再设置一次扬声器模式,不然可能有部分手机有问题,
+//        // 在初始化的时候设置扬声器的状态相当于给扬声器一个初始值,时机过于早,
+//        // 很可能硬件层还没有准备好。在需要用到扬声器的时候,再设置一下就好了
+//        LiveRTCEngineInitHelper.setRTCSpeakerMode(true);
+////        getShield();获取敏感词汇
+//        subscribeAVStream();
+//        getView().setRoomData(currentRoomInfo);
+//    }
+//
+//    /**
+//     * 加入房间后,开始摄像头采集并发布音视频流。
+//     */
+//    private void startPublish() {
+//        RCRTCRoom rcrtcRoom = LiveEventHelper.getInstance().getRtcRoom();
+//        RCRTCEngine.getInstance().getDefaultVideoStream().startCamera(null);
+//        rcrtcRoom.getLocalUser().publishDefaultLiveStreams(new IRCRTCResultDataCallback<RCRTCLiveInfo>() {
+//            @Override
+//            public void onSuccess(RCRTCLiveInfo liveInfo) {
+//                if (getView() != null) {
+//                    getView().onPublishSuccess();
+//                }
+//            }
+//
+//            @Override
+//            public void onFailed(RTCErrorCode code) {
+//                Log.i("pq", "publishDefaultLiveStreamError:" + code);
+//            }
+//        });
+//    }
+//
+//    /**
+//     * 进入房间后发送默认的消息
+//     */
+//    private void sendDefaultMessage() {
+//        if (currentRoomInfo != null) {
+////            getView().addMessageContent(null, true);
+//            // 默认消息
+////            RCChatroomLocationMessage welcome = new RCChatroomLocationMessage();
+////            welcome.setContent(String.format("欢迎来到 %s", currentRoomInfo.roomTitle));
+////            sendMessage(welcome);
+//            RCChatroomLocationMessage tips = new RCChatroomLocationMessage();
+//            tips.setContent("欢迎进入直播课堂,请遵守相关法规,禁止传播低俗、暴力等不良信息。为孩子创造健康绿色的学习环境。");
+//            sendMessage(tips);
+//        }
+//    }
+//
+//    /**
+//     * 发送消息
+//     * 默认显示在本地
+//     *
+//     * @param messageContent
+//     */
+//    public void sendMessage(MessageContent messageContent) {
+//        sendMessage(messageContent, true);
+//    }
+//
+//    /**
+//     * 发送消息
+//     *
+//     * @param messageContent 消息体
+//     * @param isShowLocation 是否显示在本地
+//     */
+//    public void sendMessage(MessageContent messageContent, boolean isShowLocation) {
+//        if (!isContainsShield(messageContent)) {
+//            LiveEventHelper.getInstance().sendMessage(messageContent, isShowLocation);
+//        }
+//    }
+//
+//    /**
+//     * 是否包含屏蔽词
+//     *
+//     * @return
+//     */
+//    private boolean isContainsShield(MessageContent messageContent) {
+//        boolean isContains = false;
+////        if (shields != null) {
+////            for (String shield : shields) {
+////                if (messageContent instanceof RCChatroomBarrage) {
+////                    if (((RCChatroomBarrage) messageContent).getContent().contains(shield)) {
+////                        isContains = true;
+////                        break;
+////                    }
+////                }
+////            }
+////            if (isContains) {
+////                //如果是包含了敏感词'
+////                mView.addMessageContent(messageContent, false);
+////                return true;
+////            }
+////        }
+//        return false;
+//    }
+//
+//    /**
+//     * 设置直播房的各种监听
+//     *
+//     * @param roomId
+//     */
+//    public void initLiveRoomListener(String roomId) {
+//        LiveEventHelper.getInstance().getRtcRoom().registerRoomListener(mRoomEventsListener);
+//        //添加消息监听
+////        setObShieldListener();
+////        //监听房间里面的人
+////        MemberCache.getInstance().getMemberList()
+////                .observe( new Observer<List<User>>() {
+////                    @Override
+////                    public void onChanged(List<User> users) {
+////                        getView().setOnlineCount(users.size());
+////                        LiveEventHelper.getInstance().getRequestLiveVideoIds(null);
+////                        onInviteLiveVideoIds(users);
+////                    }
+////                });
+////        //监听管理员变化
+////        MemberCache.getInstance().getAdminList()
+////                .observe(((LiveRoomFragment) mView).getViewLifecycleOwner(), new Observer<List<String>>() {
+////                    @Override
+////                    public void onChanged(List<String> strings) {
+////                        mView.refreshMessageList();
+////                    }
+////                });
+//    }
+//
+//    /**
+//     * 监听接收房间的所有信息
+//     *
+//     * @param roomId
+//     */
+//    public void setObMessageListener(String roomId) {
+//        if (disposablesManager.size() != 0) {
+//            return;
+//        }
+//        Disposable subscribe = RCChatRoomMessageManager.
+//                obMessageReceiveByRoomId(roomId)
+//                .observeOn(AndroidSchedulers.mainThread())
+//                .subscribe(new Consumer<Message>() {
 //                    @Override
-//                    public void onChanged(List<String> strings) {
-//                        mView.refreshMessageList();
+//                    public void accept(Message message) {
+////                        //将消息显示到列表上
+//                        if (LiveEventHelper.getInstance().isShowingMessage(message.getContent())) {
+//                            if (null != getView()) {
+//                                getView().addMessageContent(message, false);
+//                            }
+//                        }
+//
+//                        if (TextUtils.equals(message.getObjectName(), LiveRoomMsgConstants.TAG_CHAT_ROOM_ENTER)) {
+//                            //加入房间消息
+//                            if (null != getView() && message.getContent() != null) {
+//                                RCChatJoinRoomMessage joinRoomMessage = (RCChatJoinRoomMessage) message.getContent();
+//                                getView().receiveJoinMessage(joinRoomMessage);
+//                            }
+//                            return;
+//                        }
+//
+//                        if (TextUtils.equals(message.getObjectName(), LiveRoomMsgConstants.TAG_LIVE_ON_SNAP_UP)) {
+//                            //抢购消息
+//                            if (null != getView() && message.getContent() != null) {
+//                                RCOnSnappingUpMessage rcOnSnappingUpMessage = (RCOnSnappingUpMessage) message.getContent();
+//                                getView().receiveSnapUpMessage(rcOnSnappingUpMessage);
+//                            }
+//                            return;
+//                        }
+//
+//
+//                        //以下为行为消息逻辑
+//                        //行为消息
+//                        MessageContent content = message.getContent();
+//                        if (content instanceof RCChatRoomCloseMessage) {
+//                            //关闭直播间
+//                            if (null != getView()) {
+//                                getView().liveRoomOffline();
+//                            }
+//                            return;
+//                        }
+//
+//                        if (TextUtils.equals(message.getObjectName(), LiveRoomMsgConstants.TAG_LIVE_GOODS_CHANGE)) {
+//                            //直播间商品变化
+//                            if (message.getContent() != null) {
+//                                RCLiveGoodsChangeMessage liveGoodsChangeMessage = (RCLiveGoodsChangeMessage) message.getContent();
+//                                if (getView() != null && liveGoodsChangeMessage != null) {
+//                                    getView().liveGoodsChange(liveGoodsChangeMessage.getContent());
+//                                }
+//                            }
+//                            return;
+//                        }
+//
+//                        //连麦模式控制消息
+//                        if (TextUtils.equals(message.getObjectName(), LiveRoomMsgConstants.TAG_CHAT_ROOM_SEAT_CTRL)) {
+//                            if (message.getContent() != null) {
+//                                RCUserSeatsCtrlMessage userSeatsCtrlMessage = (RCUserSeatsCtrlMessage) message.getContent();
+//                                if (getView() != null && userSeatsCtrlMessage != null) {
+//                                    getView().changeMicControlMode(userSeatsCtrlMessage.isSeatBan());
+//                                }
+//                            }
+//                            return;
+//                        }
+//
+//                        //控制聊天模式
+//                        if (TextUtils.equals(message.getObjectName(), LiveRoomMsgConstants.TAG_CHAT_ROOM_CHAT_MODE_CTRL)) {
+//                            if (message.getContent() != null) {
+//                                RCChatModeMessage chatModeMessage = (RCChatModeMessage) message.getContent();
+//                                if (getView() != null && chatModeMessage != null) {
+//                                    getView().switchChatMode(chatModeMessage.isChatBan());
+//                                }
+//                            }
+//                            return;
+//                        }
+//
+//                        if (TextUtils.equals(message.getObjectName(), LiveRoomMsgConstants.TAG_CHAT_ROOM_ADD_LIKE_COUNT)) {
+//                            //同步点赞消息
+//                            RCUserSyncAddLikeCountMessage addLikeMessage = (RCUserSyncAddLikeCountMessage) content;
+//                            if (getView() != null) {
+//                                getView().onAddLikeMessage(message, addLikeMessage);
+//                            }
+//                            return;
+//                        }
+//
+//                        if (content instanceof RCChatRoomMemberNumMessage) {
+//                            //同步成员数量
+//                            if (null != getView()) {
+//                                RCChatRoomMemberNumMessage rcChatRoomMemberNumMessage = (RCChatRoomMemberNumMessage) content;
+//                                getView().syncMemberCount(rcChatRoomMemberNumMessage.getCount());
+//                            }
+//                            return;
+//                        }
+//
+//                        if (content instanceof RCUserKickOutMessage) {
+//                            //用户被踢出房间消息
+//                            if (null != getView()) {
+//                                RCUserKickOutMessage userKickOutMessage = (RCUserKickOutMessage) content;
+//                                getView().onUserKickOutMsg(userKickOutMessage);
+//                            }
+//                            return;
+//                        }
+//
+//                        if (content instanceof RCUserSeatResponseMessage) {
+//                            //连麦回复消息
+//                            if (null != getView()) {
+//                                RCUserSeatResponseMessage rcUserSeatResponseMessage = (RCUserSeatResponseMessage) content;
+//                                if (rcUserSeatResponseMessage == null || TextUtils.isEmpty(rcUserSeatResponseMessage.getAudienceId())) {
+//                                    return;
+//                                }
+//                                if (TextUtils.equals(rcUserSeatResponseMessage.getAudienceId(), UserHelper.getImUserId())) {
+//                                    getView().seatResponse(rcUserSeatResponseMessage);
+//                                }
+//                                return;
+//                            }
+//                        }
+//
+//                        if (TextUtils.equals(message.getObjectName(), LiveRoomMsgConstants.TAG_CHAT_ROOM_MIC_APPLY)) {
+//                            //主播邀请上麦
+//                            RCUserSeatApplyMessage seatApplyMessage = (RCUserSeatApplyMessage) content;
+//                            if (getView() != null) {
+//                                getView().onInviteSeatMic(seatApplyMessage);
+//                            }
+//                            return;
+//                        }
+//
+//                        if (TextUtils.equals(message.getObjectName(), LiveRoomMsgConstants.TAG_CHAT_ROOM_UNUSUAL_LOGOUT)) {
+//                            //观众异常退出消息
+//                            RCUserLogOutUnusualMessage loginOutUnusualMessage = (RCUserLogOutUnusualMessage) content;
+//                            if (getView() != null) {
+//                                getView().onUserUnusualLogout(loginOutUnusualMessage);
+//                            }
+//                            return;
+//                        }
+//
+//                        if (TextUtils.equals(message.getObjectName(), LiveRoomMsgConstants.TAG_LIVE_PAUSE)) {
+//                            //暂停直播,进行下麦操作
+//                            if (getView() != null) {
+//                                getView().onLivePause();
+//                            }
+//                            return;
+//                        }
+//
+//                        if (TextUtils.equals(message.getObjectName(), LiveRoomMsgConstants.TAG_LIVE_ADD_BLACK_USER)) {
+//                            //添加黑名单用户
+//                            RCLiveBlackUserBlockMessage blackUserBlockMessage = (RCLiveBlackUserBlockMessage) content;
+//                            if (getView() != null) {
+//                                getView().changeBlackUserStatus(blackUserBlockMessage.getUserId(), true);
+//                            }
+//                            return;
+//                        }
+//
+//                        if (TextUtils.equals(message.getObjectName(), LiveRoomMsgConstants.TAG_LIVE_REMOVE_BLACK_USER)) {
+//                            //解除黑名单用户
+//                            RCLiveBlackUserUnBlockMessage userUnBlockMessage = (RCLiveBlackUserUnBlockMessage) content;
+//                            if (getView() != null) {
+//                                getView().changeBlackUserStatus(userUnBlockMessage.getUserId(), false);
+//                            }
+//                            return;
+//                        }
+//
+//                        if (TextUtils.equals(message.getObjectName(), LiveRoomMsgConstants.TAG_LIVE_UNDER_ALL_MIC)) {
+//                            //全部下麦消息
+//                            if (getView() != null) {
+//                                getView().onUnderAllMic();
+//                            }
+//                            return;
+//                        }
+//
+//                        if (TextUtils.equals(message.getObjectName(), LiveRoomMsgConstants.TAG_LIVE_REFUSE_ALL_MIC_APPLY)) {
+//                            //拒绝全部连麦
+//                            if (getView() != null) {
+//                                getView().onRefuseAllMicApply();
+//                            }
+//                            return;
+//                        }
 //                    }
 //                });
-    }
-
-    /**
-     * 监听接收房间的所有信息
-     *
-     * @param roomId
-     */
-    public void setObMessageListener(String roomId) {
-        if (disposablesManager.size() != 0) {
-            return;
-        }
-        Disposable subscribe = RCChatRoomMessageManager.
-                obMessageReceiveByRoomId(roomId)
-                .observeOn(AndroidSchedulers.mainThread())
-                .subscribe(new Consumer<Message>() {
-                    @Override
-                    public void accept(Message message) {
-//                        //将消息显示到列表上
-                        if (LiveEventHelper.getInstance().isShowingMessage(message.getContent())) {
-                            if (null != getView()) {
-                                getView().addMessageContent(message, false);
-                            }
-                        }
-
-                        if (TextUtils.equals(message.getObjectName(), LiveRoomMsgConstants.TAG_CHAT_ROOM_ENTER)) {
-                            //加入房间消息
-                            if (null != getView() && message.getContent() != null) {
-                                RCChatJoinRoomMessage joinRoomMessage = (RCChatJoinRoomMessage) message.getContent();
-                                getView().receiveJoinMessage(joinRoomMessage);
-                            }
-                            return;
-                        }
-
-                        if (TextUtils.equals(message.getObjectName(), LiveRoomMsgConstants.TAG_LIVE_ON_SNAP_UP)) {
-                            //抢购消息
-                            if (null != getView() && message.getContent() != null) {
-                                RCOnSnappingUpMessage rcOnSnappingUpMessage = (RCOnSnappingUpMessage) message.getContent();
-                                getView().receiveSnapUpMessage(rcOnSnappingUpMessage);
-                            }
-                            return;
-                        }
-
-
-                        //以下为行为消息逻辑
-                        //行为消息
-                        MessageContent content = message.getContent();
-                        if (content instanceof RCChatRoomCloseMessage) {
-                            //关闭直播间
-                            if (null != getView()) {
-                                getView().liveRoomOffline();
-                            }
-                            return;
-                        }
-
-                        if (TextUtils.equals(message.getObjectName(), LiveRoomMsgConstants.TAG_LIVE_GOODS_CHANGE)) {
-                            //直播间商品变化
-                            if (message.getContent() != null) {
-                                RCLiveGoodsChangeMessage liveGoodsChangeMessage = (RCLiveGoodsChangeMessage) message.getContent();
-                                if (getView() != null && liveGoodsChangeMessage != null) {
-                                    getView().liveGoodsChange(liveGoodsChangeMessage.getContent());
-                                }
-                            }
-                            return;
-                        }
-
-                        //连麦模式控制消息
-                        if (TextUtils.equals(message.getObjectName(), LiveRoomMsgConstants.TAG_CHAT_ROOM_SEAT_CTRL)) {
-                            if (message.getContent() != null) {
-                                RCUserSeatsCtrlMessage userSeatsCtrlMessage = (RCUserSeatsCtrlMessage) message.getContent();
-                                if (getView() != null && userSeatsCtrlMessage != null) {
-                                    getView().changeMicControlMode(userSeatsCtrlMessage.isSeatBan());
-                                }
-                            }
-                            return;
-                        }
-
-                        //控制聊天模式
-                        if (TextUtils.equals(message.getObjectName(), LiveRoomMsgConstants.TAG_CHAT_ROOM_CHAT_MODE_CTRL)) {
-                            if (message.getContent() != null) {
-                                RCChatModeMessage chatModeMessage = (RCChatModeMessage) message.getContent();
-                                if (getView() != null && chatModeMessage != null) {
-                                    getView().switchChatMode(chatModeMessage.isChatBan());
-                                }
-                            }
-                            return;
-                        }
-
-                        if (TextUtils.equals(message.getObjectName(), LiveRoomMsgConstants.TAG_CHAT_ROOM_ADD_LIKE_COUNT)) {
-                            //同步点赞消息
-                            RCUserSyncAddLikeCountMessage addLikeMessage = (RCUserSyncAddLikeCountMessage) content;
-                            if (getView() != null) {
-                                getView().onAddLikeMessage(message, addLikeMessage);
-                            }
-                            return;
-                        }
-
-                        if (content instanceof RCChatRoomMemberNumMessage) {
-                            //同步成员数量
-                            if (null != getView()) {
-                                RCChatRoomMemberNumMessage rcChatRoomMemberNumMessage = (RCChatRoomMemberNumMessage) content;
-                                getView().syncMemberCount(rcChatRoomMemberNumMessage.getCount());
-                            }
-                            return;
-                        }
-
-                        if (content instanceof RCUserKickOutMessage) {
-                            //用户被踢出房间消息
-                            if (null != getView()) {
-                                RCUserKickOutMessage userKickOutMessage = (RCUserKickOutMessage) content;
-                                getView().onUserKickOutMsg(userKickOutMessage);
-                            }
-                            return;
-                        }
-
-                        if (content instanceof RCUserSeatResponseMessage) {
-                            //连麦回复消息
-                            if (null != getView()) {
-                                RCUserSeatResponseMessage rcUserSeatResponseMessage = (RCUserSeatResponseMessage) content;
-                                if (rcUserSeatResponseMessage == null || TextUtils.isEmpty(rcUserSeatResponseMessage.getAudienceId())) {
-                                    return;
-                                }
-                                if (TextUtils.equals(rcUserSeatResponseMessage.getAudienceId(), UserHelper.getImUserId())) {
-                                    getView().seatResponse(rcUserSeatResponseMessage);
-                                }
-                                return;
-                            }
-                        }
-
-                        if (TextUtils.equals(message.getObjectName(), LiveRoomMsgConstants.TAG_CHAT_ROOM_MIC_APPLY)) {
-                            //主播邀请上麦
-                            RCUserSeatApplyMessage seatApplyMessage = (RCUserSeatApplyMessage) content;
-                            if (getView() != null) {
-                                getView().onInviteSeatMic(seatApplyMessage);
-                            }
-                            return;
-                        }
-
-                        if (TextUtils.equals(message.getObjectName(), LiveRoomMsgConstants.TAG_CHAT_ROOM_UNUSUAL_LOGOUT)) {
-                            //观众异常退出消息
-                            RCUserLogOutUnusualMessage loginOutUnusualMessage = (RCUserLogOutUnusualMessage) content;
-                            if (getView() != null) {
-                                getView().onUserUnusualLogout(loginOutUnusualMessage);
-                            }
-                            return;
-                        }
-
-                        if (TextUtils.equals(message.getObjectName(), LiveRoomMsgConstants.TAG_LIVE_PAUSE)) {
-                            //暂停直播,进行下麦操作
-                            if (getView() != null) {
-                                getView().onLivePause();
-                            }
-                            return;
-                        }
-
-                        if (TextUtils.equals(message.getObjectName(), LiveRoomMsgConstants.TAG_LIVE_ADD_BLACK_USER)) {
-                            //添加黑名单用户
-                            RCLiveBlackUserBlockMessage blackUserBlockMessage = (RCLiveBlackUserBlockMessage) content;
-                            if (getView() != null) {
-                                getView().changeBlackUserStatus(blackUserBlockMessage.getUserId(), true);
-                            }
-                            return;
-                        }
-
-                        if (TextUtils.equals(message.getObjectName(), LiveRoomMsgConstants.TAG_LIVE_REMOVE_BLACK_USER)) {
-                            //解除黑名单用户
-                            RCLiveBlackUserUnBlockMessage userUnBlockMessage = (RCLiveBlackUserUnBlockMessage) content;
-                            if (getView() != null) {
-                                getView().changeBlackUserStatus(userUnBlockMessage.getUserId(), false);
-                            }
-                            return;
-                        }
-
-                        if (TextUtils.equals(message.getObjectName(), LiveRoomMsgConstants.TAG_LIVE_UNDER_ALL_MIC)) {
-                            //全部下麦消息
-                            if (getView() != null) {
-                                getView().onUnderAllMic();
-                            }
-                            return;
-                        }
-
-                        if (TextUtils.equals(message.getObjectName(), LiveRoomMsgConstants.TAG_LIVE_REFUSE_ALL_MIC_APPLY)) {
-                            //拒绝全部连麦
-                            if (getView() != null) {
-                                getView().onRefuseAllMicApply();
-                            }
-                            return;
-                        }
-                    }
-                });
-        disposablesManager.add(subscribe);
-    }
-
-    /**
-     * 刷新音乐播放的小窗UI
-     *
-     * @param show 是否显示
-     */
-    private void refreshMusicView(boolean show) {
-//        if (show) {
-//            MusicApi.getPlayingMusic(getRoomId(), new IResultBack<MusicBean>() {
+//        disposablesManager.add(subscribe);
+//    }
+//
+//    /**
+//     * 刷新音乐播放的小窗UI
+//     *
+//     * @param show 是否显示
+//     */
+//    private void refreshMusicView(boolean show) {
+////        if (show) {
+////            MusicApi.getPlayingMusic(getRoomId(), new IResultBack<MusicBean>() {
+////                @Override
+////                public void onResult(MusicBean musicBean) {
+////                    if (musicBean != null) {
+////                        mView.refreshMusicView(true, musicBean.getNameAndAuthor(), musicBean.getBackgroundUrl());
+////                    } else {
+////                        mView.refreshMusicView(false, "", "");
+////                    }
+////                }
+////            });
+////        } else {
+////            mView.refreshMusicView(false, "", "");
+////        }
+//    }
+//
+//    /**
+//     * 获得当前视频流
+//     */
+//    public void getVideoStream(List<RCRTCVideoOutputStream> outputStreams, List<RCRTCVideoInputStream> inputStreams, List<RCRTCAudioInputStream> audioinputstream) {
+//        RCRTCRoom mRtcRoom = LiveEventHelper.getInstance().getRtcRoom();
+//        if (mRtcRoom == null) {
+//            return;
+//        }
+//        for (final RCRTCRemoteUser remoteUser : mRtcRoom.getRemoteUsers()) {
+//            if (remoteUser.getStreams().size() == 0) {
+//                continue;
+//            }
+//            List<RCRTCInputStream> userStreams = remoteUser.getStreams();
+//            for (RCRTCInputStream i : userStreams) {
+//                if (i.getMediaType() == RCRTCMediaType.VIDEO) {
+//                    inputStreams.add((RCRTCVideoInputStream) i);
+//                }
+//                if (i.getMediaType() == RCRTCMediaType.AUDIO) {
+//                    audioinputstream.add((RCRTCAudioInputStream) i);
+//                }
+//            }
+//        }
+//
+//        for (RCRTCOutputStream o : mRtcRoom.getLocalUser().getStreams()) {
+//            if (o.getMediaType() == RCRTCMediaType.VIDEO) {
+//                outputStreams.add((RCRTCVideoOutputStream) o);
+//            }
+//        }
+//    }
+//
+//    /**
+//     * 获得当前房间所有的视频流和音频流
+//     */
+//    public void getAllStreams(List<RCRTCVideoOutputStream> outputStreams, List<RCRTCVideoInputStream> inputStreams, List<RCRTCAudioInputStream> audioinputstream, List<RCRTCAudioOutputStream> audioOutputStreams) {
+//        RCRTCRoom mRtcRoom = LiveEventHelper.getInstance().getRtcRoom();
+//        if (mRtcRoom == null) {
+//            return;
+//        }
+//        for (final RCRTCRemoteUser remoteUser : mRtcRoom.getRemoteUsers()) {
+//            if (remoteUser.getStreams().size() == 0) {
+//                continue;
+//            }
+//            List<RCRTCInputStream> userStreams = remoteUser.getStreams();
+//            for (RCRTCInputStream i : userStreams) {
+//                if (i.getMediaType() == RCRTCMediaType.VIDEO) {
+//                    inputStreams.add((RCRTCVideoInputStream) i);
+//                }
+//                if (i.getMediaType() == RCRTCMediaType.AUDIO) {
+//                    audioinputstream.add((RCRTCAudioInputStream) i);
+//                }
+//            }
+//        }
+//
+//        for (RCRTCOutputStream o : mRtcRoom.getLocalUser().getStreams()) {
+//            if (o.getMediaType() == RCRTCMediaType.VIDEO) {
+//                outputStreams.add((RCRTCVideoOutputStream) o);
+//            }
+//            if (o.getMediaType() == RCRTCMediaType.AUDIO) {
+//                audioOutputStreams.add((RCRTCAudioOutputStream) o);
+//            }
+//        }
+//    }
+//
+//    /**
+//     * 获取房间所有的音频流
+//     *
+//     * @param audioinputstream
+//     * @param audioOutputStreams
+//     */
+//    public void getAudioStreams(List<RCRTCAudioInputStream> audioinputstream, List<RCRTCAudioOutputStream> audioOutputStreams) {
+//        RCRTCRoom mRtcRoom = LiveEventHelper.getInstance().getRtcRoom();
+//        if (mRtcRoom == null) {
+//            return;
+//        }
+//
+//        for (final RCRTCRemoteUser remoteUser : mRtcRoom.getRemoteUsers()) {
+//            if (remoteUser.getStreams().size() == 0) {
+//                continue;
+//            }
+//            List<RCRTCInputStream> userStreams = remoteUser.getStreams();
+//            for (RCRTCInputStream i : userStreams) {
+//                if (i.getMediaType() == RCRTCMediaType.AUDIO) {
+//                    audioinputstream.add((RCRTCAudioInputStream) i);
+//                }
+//            }
+//        }
+//
+//        for (RCRTCOutputStream o : mRtcRoom.getLocalUser().getStreams()) {
+//            if (o.getMediaType() == RCRTCMediaType.AUDIO) {
+//                audioOutputStreams.add((RCRTCAudioOutputStream) o);
+//            }
+//        }
+//    }
+//
+//    /**
+//     * 订阅指定的流
+//     *
+//     * @param userId
+//     * @param list
+//     * @param callback
+//     */
+//    public void subscribeTargetStream(final String userId, List<RCRTCInputStream> list, final ResultCallback<String> callback) {
+//        RCRTCRoom rcrtcRoom = LiveEventHelper.getInstance().getRtcRoom();
+//        if (rcrtcRoom == null) {
+//            Log.i("pq", "unSubscribeStream failed , rcrtcRoom is null");
+//            if (callback != null) {
+//                callback.onFail(ErrorCode.RTC_ERROR.getCode(), null);
+//            }
+//            return;
+//        }
+//        rcrtcRoom.getLocalUser().subscribeStreams(list, new IRCRTCResultCallback() {
+//            @Override
+//            public void onSuccess() {
+//                if (callback != null) {
+//                    callback.onSuccess("");
+//                }
+//            }
+//
+//            @Override
+//            public void onFailed(RTCErrorCode errorCode) {
+//                if (callback != null) {
+//                    callback.onFail(errorCode.getValue(), errorCode.getReason());
+//                }
+//            }
+//        });
+//    }
+//
+//    /**
+//     * 主动订阅远端用户发布的流
+//     * 视频流需要用户设置用于显示载体的videoview
+//     */
+//    public void subscribeAVStream() {
+//        RCRTCRoom rcrtcRoom = LiveEventHelper.getInstance().getRtcRoom();
+//        if (rcrtcRoom == null) {
+//            Log.i("pq", "rcrtcRoom is null");
+//            return;
+//        }
+//        List<RCRTCRemoteUser> remoteUsers = rcrtcRoom.getRemoteUsers();
+//        final List<RCRTCInputStream> inputStreams = new ArrayList<>();
+//        for (int i = 0; i < remoteUsers.size(); i++) {
+//            RCRTCRemoteUser rcrtcRemoteUser = remoteUsers.get(i);
+//            List<RCRTCInputStream> streams = rcrtcRemoteUser.getStreams();
+//            if (streams == null || streams.size() == 0) {
+//                continue;
+//            }
+//            inputStreams.addAll(streams);
+//        }
+//        //合流模式,画面会出现问题,画面放大,裁剪,可能是合流模式布局问题
+////        final List<RCRTCInputStream> otherInputStreams = rcrtcRoom.getLiveStreams();
+//        if (inputStreams != null && inputStreams.size() != 0) {
+//            rcrtcRoom.getLocalUser().subscribeStreams(inputStreams, new IRCRTCResultCallback() {
 //                @Override
-//                public void onResult(MusicBean musicBean) {
-//                    if (musicBean != null) {
-//                        mView.refreshMusicView(true, musicBean.getNameAndAuthor(), musicBean.getBackgroundUrl());
-//                    } else {
-//                        mView.refreshMusicView(false, "", "");
+//                public void onSuccess() {
+//                    Log.i("pq", "subscribeStreams onSuccess:" + inputStreams.size());
+//                    try {
+//                        getView().subscribeAVStreamSuccess(inputStreams);
+//                    } catch (IllegalStateException e) {
+//                        e.printStackTrace();
+//                    }
+//                }
+//
+//                @Override
+//                public void onFailed(RTCErrorCode code) {
+//                    Log.i("pq", "subscribeStreams code:" + code);
+//                    try {
+//                        getView().onSubscribeFailed();
+//                    } catch (Exception e) {
+//                        e.printStackTrace();
 //                    }
 //                }
 //            });
 //        } else {
-//            mView.refreshMusicView(false, "", "");
+//            Log.i("pq", "当前房间还没有主播");
+//            try {
+//                getView().showEmptyStatusView();
+//            } catch (Exception e) {
+//                e.printStackTrace();
+//            }
+//        }
+//    }
+//
+//    @Override
+//    public void detachView() {
+//        super.detachView();
+//        unInitListener();
+//    }
+//
+//    /**
+//     * 回收掉对房间的各种监听
+//     */
+//    public void unInitListener() {
+//        clearDisposables();
+//    }
+//
+//    public void clearDisposables() {
+//        for (Disposable disposable : disposablesManager) {
+//            Log.i("pq", "disposable" + disposable);
+//            disposable.dispose();
 //        }
-    }
-
-    /**
-     * 获得当前视频流
-     */
-    public void getVideoStream(List<RCRTCVideoOutputStream> outputStreams, List<RCRTCVideoInputStream> inputStreams, List<RCRTCAudioInputStream> audioinputstream) {
-        RCRTCRoom mRtcRoom = LiveEventHelper.getInstance().getRtcRoom();
-        if (mRtcRoom == null) {
-            return;
-        }
-        for (final RCRTCRemoteUser remoteUser : mRtcRoom.getRemoteUsers()) {
-            if (remoteUser.getStreams().size() == 0) {
-                continue;
-            }
-            List<RCRTCInputStream> userStreams = remoteUser.getStreams();
-            for (RCRTCInputStream i : userStreams) {
-                if (i.getMediaType() == RCRTCMediaType.VIDEO) {
-                    inputStreams.add((RCRTCVideoInputStream) i);
-                }
-                if (i.getMediaType() == RCRTCMediaType.AUDIO) {
-                    audioinputstream.add((RCRTCAudioInputStream) i);
-                }
-            }
-        }
-
-        for (RCRTCOutputStream o : mRtcRoom.getLocalUser().getStreams()) {
-            if (o.getMediaType() == RCRTCMediaType.VIDEO) {
-                outputStreams.add((RCRTCVideoOutputStream) o);
-            }
-        }
-    }
-
-    /**
-     * 获得当前房间所有的视频流和音频流
-     */
-    public void getAllStreams(List<RCRTCVideoOutputStream> outputStreams, List<RCRTCVideoInputStream> inputStreams, List<RCRTCAudioInputStream> audioinputstream, List<RCRTCAudioOutputStream> audioOutputStreams) {
-        RCRTCRoom mRtcRoom = LiveEventHelper.getInstance().getRtcRoom();
-        if (mRtcRoom == null) {
-            return;
-        }
-        for (final RCRTCRemoteUser remoteUser : mRtcRoom.getRemoteUsers()) {
-            if (remoteUser.getStreams().size() == 0) {
-                continue;
-            }
-            List<RCRTCInputStream> userStreams = remoteUser.getStreams();
-            for (RCRTCInputStream i : userStreams) {
-                if (i.getMediaType() == RCRTCMediaType.VIDEO) {
-                    inputStreams.add((RCRTCVideoInputStream) i);
-                }
-                if (i.getMediaType() == RCRTCMediaType.AUDIO) {
-                    audioinputstream.add((RCRTCAudioInputStream) i);
-                }
-            }
-        }
-
-        for (RCRTCOutputStream o : mRtcRoom.getLocalUser().getStreams()) {
-            if (o.getMediaType() == RCRTCMediaType.VIDEO) {
-                outputStreams.add((RCRTCVideoOutputStream) o);
-            }
-            if (o.getMediaType() == RCRTCMediaType.AUDIO) {
-                audioOutputStreams.add((RCRTCAudioOutputStream) o);
-            }
-        }
-    }
-
-    /**
-     * 获取房间所有的音频流
-     *
-     * @param audioinputstream
-     * @param audioOutputStreams
-     */
-    public void getAudioStreams(List<RCRTCAudioInputStream> audioinputstream, List<RCRTCAudioOutputStream> audioOutputStreams) {
-        RCRTCRoom mRtcRoom = LiveEventHelper.getInstance().getRtcRoom();
-        if (mRtcRoom == null) {
-            return;
-        }
-
-        for (final RCRTCRemoteUser remoteUser : mRtcRoom.getRemoteUsers()) {
-            if (remoteUser.getStreams().size() == 0) {
-                continue;
-            }
-            List<RCRTCInputStream> userStreams = remoteUser.getStreams();
-            for (RCRTCInputStream i : userStreams) {
-                if (i.getMediaType() == RCRTCMediaType.AUDIO) {
-                    audioinputstream.add((RCRTCAudioInputStream) i);
-                }
-            }
-        }
-
-        for (RCRTCOutputStream o : mRtcRoom.getLocalUser().getStreams()) {
-            if (o.getMediaType() == RCRTCMediaType.AUDIO) {
-                audioOutputStreams.add((RCRTCAudioOutputStream) o);
-            }
-        }
-    }
-
-    /**
-     * 订阅指定的流
-     *
-     * @param userId
-     * @param list
-     * @param callback
-     */
-    public void subscribeTargetStream(final String userId, List<RCRTCInputStream> list, final ResultCallback<String> callback) {
-        RCRTCRoom rcrtcRoom = LiveEventHelper.getInstance().getRtcRoom();
-        if (rcrtcRoom == null) {
-            Log.i("pq", "unSubscribeStream failed , rcrtcRoom is null");
-            if (callback != null) {
-                callback.onFail(ErrorCode.RTC_ERROR.getCode(), null);
-            }
-            return;
-        }
-        rcrtcRoom.getLocalUser().subscribeStreams(list, new IRCRTCResultCallback() {
-            @Override
-            public void onSuccess() {
-                if (callback != null) {
-                    callback.onSuccess("");
-                }
-            }
-
-            @Override
-            public void onFailed(RTCErrorCode errorCode) {
-                if (callback != null) {
-                    callback.onFail(errorCode.getValue(), errorCode.getReason());
-                }
-            }
-        });
-    }
-
-    /**
-     * 主动订阅远端用户发布的流
-     * 视频流需要用户设置用于显示载体的videoview
-     */
-    public void subscribeAVStream() {
-        RCRTCRoom rcrtcRoom = LiveEventHelper.getInstance().getRtcRoom();
-        if (rcrtcRoom == null) {
-            Log.i("pq", "rcrtcRoom is null");
-            return;
-        }
-        List<RCRTCRemoteUser> remoteUsers = rcrtcRoom.getRemoteUsers();
-        final List<RCRTCInputStream> inputStreams = new ArrayList<>();
-        for (int i = 0; i < remoteUsers.size(); i++) {
-            RCRTCRemoteUser rcrtcRemoteUser = remoteUsers.get(i);
-            List<RCRTCInputStream> streams = rcrtcRemoteUser.getStreams();
-            if (streams == null || streams.size() == 0) {
-                continue;
-            }
-            inputStreams.addAll(streams);
-        }
-        //合流模式,画面会出现问题,画面放大,裁剪,可能是合流模式布局问题
-//        final List<RCRTCInputStream> otherInputStreams = rcrtcRoom.getLiveStreams();
-        if (inputStreams != null && inputStreams.size() != 0) {
-            rcrtcRoom.getLocalUser().subscribeStreams(inputStreams, new IRCRTCResultCallback() {
-                @Override
-                public void onSuccess() {
-                    Log.i("pq", "subscribeStreams onSuccess:" + inputStreams.size());
-                    try {
-                        getView().subscribeAVStreamSuccess(inputStreams);
-                    } catch (IllegalStateException e) {
-                        e.printStackTrace();
-                    }
-                }
-
-                @Override
-                public void onFailed(RTCErrorCode code) {
-                    Log.i("pq", "subscribeStreams code:" + code);
-                    try {
-                        getView().onSubscribeFailed();
-                    } catch (Exception e) {
-                        e.printStackTrace();
-                    }
-                }
-            });
-        } else {
-            Log.i("pq", "当前房间还没有主播");
-            try {
-                getView().showEmptyStatusView();
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-        }
-    }
-
-    @Override
-    public void detachView() {
-        super.detachView();
-        unInitListener();
-    }
-
-    /**
-     * 回收掉对房间的各种监听
-     */
-    public void unInitListener() {
-        clearDisposables();
-    }
-
-    public void clearDisposables() {
-        for (Disposable disposable : disposablesManager) {
-            Log.i("pq", "disposable" + disposable);
-            disposable.dispose();
-        }
-        disposablesManager.clear();
-    }
-}
+//        disposablesManager.clear();
+//    }
+//}

+ 2 - 2
student/src/main/java/com/cooleshow/student/push/CustomMiMessageReceiver.java

@@ -2,17 +2,17 @@ package com.cooleshow.student.push;
 
 import android.content.Context;
 
+import com.tencent.qcloud.tim.tuiofflinepush.oempush.XiaomiMsgReceiver;
 import com.xiaomi.mipush.sdk.MiPushCommandMessage;
 import com.xiaomi.mipush.sdk.MiPushMessage;
 
 import cn.jpush.android.service.PluginHuaweiPlatformsService;
 import cn.jpush.android.service.PluginXiaomiPlatformsReceiver;
-import io.rong.push.platform.mi.MiMessageReceiver;
 
 /**
  * Author by pq, Date on 2022/7/18.
  */
-public class CustomMiMessageReceiver extends MiMessageReceiver {
+public class CustomMiMessageReceiver extends XiaomiMsgReceiver {
     final PluginXiaomiPlatformsReceiver jpushService = new PluginXiaomiPlatformsReceiver();
 
     @Override

+ 2 - 2
student/src/main/java/com/cooleshow/student/push/MyHWPushService.java

@@ -2,11 +2,11 @@ package com.cooleshow.student.push;
 
 import com.huawei.hms.push.HmsMessageService;
 import com.huawei.hms.push.RemoteMessage;
+import com.tencent.qcloud.tim.tuiofflinepush.oempush.HUAWEIHmsMessageService;
 
 import cn.jpush.android.service.PluginHuaweiPlatformsService;
-import io.rong.push.platform.hms.HMSPushService;
 
-public class MyHWPushService extends HMSPushService {
+public class MyHWPushService extends HUAWEIHmsMessageService {
 
       final PluginHuaweiPlatformsService jpushService = new PluginHuaweiPlatformsService();
 

+ 15 - 18
student/src/main/java/com/cooleshow/student/push/SealNotificationReceiver.java

@@ -6,23 +6,20 @@ import android.os.Build;
 
 import com.cooleshow.base.utils.LogUtils;
 
-import io.rong.push.PushType;
-import io.rong.push.notification.PushMessageReceiver;
-import io.rong.push.notification.PushNotificationMessage;
 
-public class SealNotificationReceiver extends PushMessageReceiver {
-
-    @Override
-    public boolean onNotificationMessageArrived(Context context, PushType pushType, PushNotificationMessage pushNotificationMessage) {
-        return false;// 返回 false, 会弹出融云 SDK 默认通知; 返回 true, 融云 SDK 不会弹通知, 通知需要由您自定义。
-    }
-
-    @Override
-    public boolean onNotificationMessageClicked(Context context, PushType pushType, PushNotificationMessage notificationMessage) {
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
-            return false;
-        }
-        LogUtils.i("pq","SealNotificationReceiver Clicked");
-        return false;// 返回 false, 会走融云 SDK 默认处理逻辑, 即点击该通知会打开会话列表或会话界面; 返回 true, 则由您自定义处理逻辑。
-    }
+public class SealNotificationReceiver {
+//
+//    @Override
+//    public boolean onNotificationMessageArrived(Context context, PushType pushType, PushNotificationMessage pushNotificationMessage) {
+//        return false;// 返回 false, 会弹出融云 SDK 默认通知; 返回 true, 融云 SDK 不会弹通知, 通知需要由您自定义。
+//    }
+//
+//    @Override
+//    public boolean onNotificationMessageClicked(Context context, PushType pushType, PushNotificationMessage notificationMessage) {
+//        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
+//            return false;
+//        }
+//        LogUtils.i("pq","SealNotificationReceiver Clicked");
+//        return false;// 返回 false, 会走融云 SDK 默认处理逻辑, 即点击该通知会打开会话列表或会话界面; 返回 true, 则由您自定义处理逻辑。
+//    }
 }

+ 2 - 2
student/src/main/java/com/cooleshow/student/push/VivoPushReceiver.java

@@ -2,18 +2,18 @@ package com.cooleshow.student.push;
 
 import android.content.Context;
 
+import com.tencent.qcloud.tim.tuiofflinepush.oempush.VIVOPushMessageReceiverImpl;
 import com.vivo.push.model.UPSNotificationMessage;
 import com.vivo.push.model.UnvarnishedMessage;
 
 import cn.jpush.android.service.PluginHuaweiPlatformsService;
 import cn.jpush.android.service.PluginOppoPushService;
 import cn.jpush.android.service.PluginVivoMessageReceiver;
-import io.rong.push.platform.vivo.VivoPushMessageReceiver;
 
 /**
  * Author by pq, Date on 2022/7/18.
  */
-public class VivoPushReceiver extends VivoPushMessageReceiver {
+public class VivoPushReceiver extends VIVOPushMessageReceiverImpl {
     final PluginVivoMessageReceiver mPluginOppoPushService =new PluginVivoMessageReceiver();
     @Override
     public void onNotificationMessageClicked(Context context, UPSNotificationMessage message) {

+ 0 - 8
student/src/main/java/com/cooleshow/student/push/XiaomiRongYunReceiver.java

@@ -1,8 +0,0 @@
-package com.cooleshow.student.push;
-
-import io.rong.push.platform.mi.MiMessageReceiver;
-
-public class XiaomiRongYunReceiver extends MiMessageReceiver {
-
-
-}

+ 2 - 2
student/src/main/java/com/cooleshow/student/ui/course/MineCourseActivity.java

@@ -11,6 +11,7 @@ import com.alibaba.android.arouter.facade.annotation.Route;
 import com.cooleshow.base.router.RouterPath;
 import com.cooleshow.base.ui.activity.BaseMVPActivity;
 import com.cooleshow.base.ui.fragment.BaseMVPFragment;
+import com.cooleshow.base.utils.helper.QMUIStatusBarHelper;
 import com.cooleshow.student.adapter.MineCoursePagerAdapter;
 import com.cooleshow.student.bean.QuerySubjectBean;
 import com.cooleshow.student.contract.MineCourseContract;
@@ -23,7 +24,6 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
-import io.rong.imkit.utils.StatusBarUtil;
 
 /**
  * 创建日期:2022/5/30 9:21
@@ -54,7 +54,7 @@ public class MineCourseActivity extends BaseMVPActivity<ActivityMineCourseBindin
     @Override
     protected void onCreate(@Nullable Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
-        StatusBarUtil.setStatusBarDarkTheme(this, true);
+        QMUIStatusBarHelper.setStatusBarLightMode(this);
     }
 
     @Override

+ 0 - 1
student/src/main/java/com/cooleshow/student/ui/course/MinePracticeCourseFragment.java

@@ -10,7 +10,6 @@ import android.widget.TextView;
 import androidx.annotation.NonNull;
 import androidx.recyclerview.widget.LinearLayoutManager;
 import androidx.recyclerview.widget.RecyclerView;
-import io.rong.imkit.utils.helper.OpenChatHelper;
 
 import com.alibaba.android.arouter.launcher.ARouter;
 import com.bigkoo.pickerview.builder.OptionsPickerBuilder;

+ 0 - 2
student/src/main/java/com/cooleshow/student/ui/course/PianoRoomCourseDetailActivity.java

@@ -25,12 +25,10 @@ import com.cooleshow.student.databinding.ActivityPianoRoomCourseDetailLayoutBind
 import com.cooleshow.student.presenter.course.PianoRoomCourseDetailPresenter;
 import com.cooleshow.base.widgets.VideoThumbnailView;
 import com.cooleshow.student.widgets.helper.CourseHelper;
-import com.daya.live_teaching.utils.helper.CourseEnterHelper;
 import com.dayayuemeng.classroom.helper.OpenClassRoomHelper;
 
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
-import io.rong.imkit.utils.helper.OpenChatHelper;
 
 /**
  * Author by pq, Date on 2022/4/27.

+ 0 - 1
student/src/main/java/com/cooleshow/student/ui/course/PianoRoomCourseFragment.java

@@ -36,7 +36,6 @@ import java.util.List;
 
 import androidx.annotation.NonNull;
 import androidx.recyclerview.widget.LinearLayoutManager;
-import io.rong.imkit.utils.helper.OpenChatHelper;
 
 /**
  * Author by pq, Date on 2022/4/25.

+ 0 - 1
student/src/main/java/com/cooleshow/student/ui/course/PracticeCourseDetailActivity.java

@@ -11,7 +11,6 @@ import androidx.annotation.Nullable;
 import androidx.recyclerview.widget.GridLayoutManager;
 import androidx.recyclerview.widget.LinearLayoutManager;
 import androidx.recyclerview.widget.RecyclerView;
-import io.rong.imkit.utils.helper.OpenChatHelper;
 
 import com.alibaba.android.arouter.facade.annotation.Route;
 import com.alibaba.android.arouter.launcher.ARouter;

+ 0 - 2
student/src/main/java/com/cooleshow/student/ui/course/SparringCourseDetailActivity.java

@@ -7,7 +7,6 @@ import android.widget.LinearLayout;
 
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
-import io.rong.imkit.utils.helper.OpenChatHelper;
 
 import com.alibaba.android.arouter.facade.annotation.Route;
 import com.alibaba.android.arouter.launcher.ARouter;
@@ -31,7 +30,6 @@ import com.cooleshow.student.databinding.ActivitySparringCourseDetailLayoutBindi
 import com.cooleshow.student.presenter.course.SparringCourseDetailPresenter;
 import com.cooleshow.student.widgets.CourseSetCommentDialog;
 import com.cooleshow.base.widgets.VideoThumbnailView;
-import com.daya.live_teaching.utils.helper.CourseEnterHelper;
 import com.dayayuemeng.classroom.helper.OpenClassRoomHelper;
 
 /**

+ 2286 - 2286
student/src/main/java/com/cooleshow/student/ui/live/LiveRoomActivity.java

@@ -1,2286 +1,2286 @@
-package com.cooleshow.student.ui.live;
-
-import android.Manifest;
-import android.animation.ObjectAnimator;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.content.ServiceConnection;
-import android.content.pm.ActivityInfo;
-import android.content.res.Configuration;
-import android.graphics.Color;
-import android.net.Uri;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.IBinder;
-import android.os.Looper;
-import android.provider.Settings;
-import android.text.TextUtils;
-import android.util.Log;
-import android.view.View;
-import android.view.WindowManager;
-import android.widget.FrameLayout;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.RelativeLayout;
-import android.widget.TextView;
-import android.widget.Toast;
-
-import com.airbnb.lottie.LottieAnimationView;
-import com.alibaba.android.arouter.facade.annotation.Route;
-import com.alibaba.android.arouter.launcher.ARouter;
-import com.bumptech.glide.Glide;
-import com.cooleshow.base.common.WebConstants;
-import com.cooleshow.base.constanst.EventConstants;
-import com.cooleshow.base.data.net.ApiException;
-import com.cooleshow.base.router.RouterPath;
-import com.cooleshow.base.ui.activity.BaseMVPActivity;
-import com.cooleshow.base.utils.AppUtils;
-import com.cooleshow.base.utils.PermissionUtils;
-import com.cooleshow.base.utils.SizeUtils;
-import com.cooleshow.base.utils.SoftKeyboardUtil;
-import com.cooleshow.base.utils.ToastUtil;
-import com.cooleshow.base.utils.UiUtils;
-import com.cooleshow.base.utils.Utils;
-import com.cooleshow.base.widgets.InputBar;
-import com.cooleshow.base.widgets.dialog.CommonConfirmDialog;
-import com.cooleshow.chatmodule.constants.TCChatRouterPath;
-import com.cooleshow.student.bean.FriendInfoBean;
-import com.cooleshow.student.helper.EventHelper;
-import com.cooleshow.student.helper.ShareHelper;
-import com.cooleshow.student.ui.live.floatPop.FloatWindowHelper;
-import com.cooleshow.student.ui.live.floatPop.FloatingWindowService;
-import com.cooleshow.student.widgets.dialog.LiveRoomCloseTipDialog;
-import com.cooleshow.student.widgets.dialog.LiveRoomMicManagerDialog;
-import com.cooleshow.student.widgets.dialog.LiveRoomShareDialog;
-import com.cooleshow.student.widgets.dialog.OpenOverlayPermissionTipDialog;
-import com.cooleshow.student.widgets.helper.LiveRoomAddLikeHelper;
-import com.cooleshow.base.widgets.dialog.InputBarDialog;
-import com.cooleshow.student.R;
-import com.cooleshow.student.adapter.MessageAdapter;
-import com.cooleshow.student.bean.LiveRoomInfoBean;
-import com.cooleshow.student.contract.LiveRoomContract;
-import com.cooleshow.student.databinding.ActivityLiveroomLayoutBinding;
-import com.cooleshow.student.presenter.live.LiveRoomPresenter;
-import com.rong.io.live.helper.LiveMemberHelper;
-import com.rong.io.live.helper.LiveMessageHelper;
-import com.rong.io.live.helper.LiveRTCEngineInitHelper;
-import com.cooleshow.student.widgets.dialog.LiveRoomCloseMicTipDialog;
-import com.cooleshow.student.widgets.dialog.LiveRoomClosePageOnMicTipDialog;
-import com.cooleshow.student.widgets.dialog.LiveRoomInviteSeatMicTipDialog;
-import com.cooleshow.student.widgets.dialog.LiveRoomShopCarDialog;
-import com.cooleshow.student.widgets.helper.LiveRoomAnimatorHelper;
-import com.cooleshow.usercenter.helper.UserHelper;
-import com.rong.io.live.LiveRoomMsgConstants;
-import com.rong.io.live.config.LiveConfig;
-import com.rong.io.live.helper.LiveEventHelper;
-import com.rong.io.live.message.RCChatJoinRoomMessage;
-import com.rong.io.live.message.RCOnSnappingUpMessage;
-import com.rong.io.live.message.RCUserKickOutMessage;
-import com.rong.io.live.message.RCUserLogOutUnusualMessage;
-import com.rong.io.live.message.RCUserSeatApplyMessage;
-import com.rong.io.live.message.RCUserSeatResponseMessage;
-import com.rong.io.live.message.RCUserSyncAddLikeCountMessage;
-import com.rong.io.live.widget.LiveRoomMicIconView;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import androidx.constraintlayout.widget.ConstraintLayout;
-import androidx.constraintlayout.widget.ConstraintSet;
-import androidx.constraintlayout.widget.Group;
-import androidx.recyclerview.widget.LinearLayoutManager;
-import androidx.recyclerview.widget.RecyclerView;
-import cn.rongcloud.rtc.api.RCRTCAudioRouteManager;
-import cn.rongcloud.rtc.api.RCRTCRemoteUser;
-import cn.rongcloud.rtc.api.RCRTCRoom;
-import cn.rongcloud.rtc.api.RCRTCVideoStream;
-import cn.rongcloud.rtc.api.stream.RCRTCAudioInputStream;
-import cn.rongcloud.rtc.api.stream.RCRTCAudioOutputStream;
-import cn.rongcloud.rtc.api.stream.RCRTCInputStream;
-import cn.rongcloud.rtc.api.stream.RCRTCVideoInputStream;
-import cn.rongcloud.rtc.api.stream.RCRTCVideoOutputStream;
-import cn.rongcloud.rtc.api.stream.RCRTCVideoView;
-import cn.rongcloud.rtc.base.RCRTCLiveRole;
-import cn.rongcloud.rtc.base.RCRTCMediaType;
-import cn.rongcloud.rtc.base.RCRTCResourceState;
-import de.hdodenhof.circleimageview.CircleImageView;
-import io.reactivex.rxjava3.disposables.Disposable;
-import io.rong.imkit.IMCenter;
-import io.rong.imlib.IRongCoreCallback;
-import io.rong.imlib.IRongCoreEnum;
-import io.rong.imlib.RongIMClient;
-import io.rong.imlib.model.Conversation;
-import io.rong.imlib.model.Message;
-import io.rong.imlib.model.MessageContent;
-import io.rong.imlib.model.UserInfo;
-import io.rong.message.TextMessage;
-
-import com.cooleshow.student.widgets.helper.VideoViewManager;
-import com.tbruyelle.rxpermissions3.RxPermissions;
-import com.umeng.socialize.ShareAction;
-import com.umeng.socialize.UMShareAPI;
-import com.umeng.socialize.UMShareListener;
-import com.umeng.socialize.bean.SHARE_MEDIA;
-import com.umeng.socialize.media.UMImage;
-import com.umeng.socialize.shareboard.SnsPlatform;
-import com.umeng.socialize.utils.ShareBoardlistener;
-
-/**
- * Author by pq, Date on 2022/3/29.
- */
-
-@Route(path = RouterPath.LiveCenter.ACTIVITY_LIVE_ROOM)
-public class LiveRoomActivity extends BaseMVPActivity<ActivityLiveroomLayoutBinding, LiveRoomPresenter> implements View.OnClickListener, LiveRoomContract.view, SoftKeyboardUtil.OnSoftInputChangedListener, UMShareListener {
-    public static final int SEND_SHOW_FLOAT_WINDOW_TIME = 1000;//退到后台以后检查是否显示悬浮窗等待时长
-    public static final int SEND_APP_BACKGROUND_MSG = 1001;//退到后台消息
-    public static final int SEND_JUMP_OTHER_PAGE_MSG = 1002;//页面切换消息(购物车详情页等等)
-    public static final int OPEN_SHOP_CAR_DIALOG = 1003;//打开购物车
-    public static final int LIVE_STATUS_IS_REST = 1;//休息一下,马上回来
-    public static final int LIVE_STATUS_IS_CLOSE_VIDEO = 2;//主持人关闭画面
-    public static final int LIVE_STATUS_IS_OFFLINE = 3;//直播已结束
-    public static final int SHARE_CHAT_REQUEST_CODE = 500;//分享群聊requestcode
-    private File targetShareImgFile = null;
-    ConstraintLayout content_view;
-    RelativeLayout mFlLiveView;
-    LinearLayout ll_like;
-    RecyclerView mRecyclerMsg;
-    TextView mTvNumPeople;
-    ImageView iv_mic;
-    LiveRoomMicIconView mLlMicContainer;
-    TextView mTvAddLikeCount;
-    CircleImageView mIvAvatar;
-    TextView mTvRoomCreateName;
-    Group mGroupViews;
-    ConstraintLayout mViewLiveStatus;
-    ImageView mIvLiveStatusCenterIcon;
-    TextView mTvLiveStatusTipText;
-    ImageView mIvSwitchVideoOrientation;
-    ImageView mIvSwitchVideoOrientationFull;
-    ConstraintLayout cs_header_info;
-    LottieAnimationView mViewShopCarAnim;
-    ImageView mIvShopCar;
-    ImageView mIvClose;
-    TextView tv_input;
-    FrameLayout mFlJoinBarrage;
-    TextView mTvJoinBarrage;
-    FrameLayout mFlSnapUpBarrage;
-    TextView mTvSnapUpBarrage;
-
-    private LiveRoomInfoBean mRoomInfoBean;
-    private String mRoomId;
-    private MessageAdapter mMessageAdapter;
-    private LinearLayoutManager mLinearLayoutManager;
-    private boolean isEnableChat = false;//默认不禁止
-    private boolean isEnableMic = false;//默认不禁止
-    private boolean isEnableAll = false;//默认不禁止 黑名单状态
-    private InputBarDialog mInputBarDialog;
-    private boolean isPcClientLive = true;//默认为PC端直播
-    private int currentSeatStatus = LiveRoomMsgConstants.MIC_STATUS_NORMAL;//1未连麦,2连麦中,3连麦成功
-    private LiveRoomCloseMicTipDialog mRoomCloseMicTipDialog;
-    private LiveRoomInviteSeatMicTipDialog mInviteSeatMicTipDialog;
-    private int currentAddLikeCount = 0;//当前点赞数量
-    private boolean creatorIsCloseAudioStream = false;
-    private boolean creatorIsCloseVideoStream = false;
-    private String createRoomId = "";
-    private static final String ROOMID_KEY = "roomid_key";
-    private String mUserId;
-    private String mImUserId;
-    private boolean connectStatusIsPaused = false;
-    private boolean isNeedRefresh = false;//是否需要重新刷新房间信息
-    private boolean liveIsFinish = false;//直播间是否已结束
-    private boolean liveIsPause = false;//直播间是否已暂停
-    private ServiceConnection serviceConnection;
-    private ObjectAnimator hideHeaderInfoAnim;
-    private ObjectAnimator showHeaderInfoAnim;
-    private boolean isOnResume = true;
-    private boolean isAutoScrollToLast = true;
-    private Handler mHandler = new Handler(Looper.myLooper()) {
-        @Override
-        public void handleMessage(@NonNull android.os.Message msg) {
-            if (msg.what == SEND_APP_BACKGROUND_MSG) {
-                //APP切换后台
-                //开启悬浮窗
-                if (!isOnResume && AppUtils.isApplicationInBackground(LiveRoomActivity.this)) {
-                    startFloatWindowService();
-                }
-                return;
-            }
-            if (msg.what == SEND_JUMP_OTHER_PAGE_MSG) {
-                //跳转其他页面时候
-                //开启悬浮窗
-                if (isOnResume) {
-                    //如果页面onResume了,就不开启service
-                    return;
-                }
-                startFloatWindowService();
-                return;
-            }
-
-            if (msg.what == OPEN_SHOP_CAR_DIALOG) {
-                showShopCarDialog();
-                return;
-            }
-        }
-    };
-    private RongIMClient.ConnectionStatusListener connectStatusListener = new RongIMClient.ConnectionStatusListener() {
-        @Override
-        public void onChanged(ConnectionStatus status) {
-            Log.i("pq", "LiveRoomActivity receive ConnectionStatus:" + status);
-            if (status == ConnectionStatus.KICKED_OFFLINE_BY_OTHER_CLIENT
-                    || status == ConnectionStatus.SIGN_OUT || status == ConnectionStatus.TIMEOUT) {
-                finish();
-            }
-            if (status == ConnectionStatus.CONNECTED) {
-                //IM连接成功
-                if (presenter != null && isNeedRefresh) {
-                    connectStatusIsPaused = false;
-                    presenter.init(mRoomId, false);
-                }
-            } else {
-                //其他状态的时候需要重新刷新房间信息
-                isNeedRefresh = true;
-            }
-            if (status == ConnectionStatus.NETWORK_UNAVAILABLE) {
-                //网络不可用
-                ToastUtil.getInstance().showShort("您的网络已断开,请检查网络~");
-            }
-            if (status == ConnectionStatus.SUSPEND) {
-                connectStatusIsPaused = true;
-            }
-        }
-    };
-    private LiveRoomClosePageOnMicTipDialog mLiveRoomClosePageOnMicTipDialog;
-    private VideoViewManager mVideoViewManager;
-    private LiveRoomShopCarDialog mShopCarDialog;
-    private LiveRoomMicManagerDialog mMicManagerDialog;
-    private LiveRoomShareDialog mLiveRoomShareDialog;
-
-    public static void startLiveRoomActivity(Context context, String roomid) {
-        Intent intent = new Intent(context, LiveRoomActivity.class);
-        intent.putExtra(ROOMID_KEY, roomid);
-        context.startActivity(intent);
-    }
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
-        super.onCreate(savedInstanceState);
-        //事件埋点->进入直播间
-        EventHelper.addEvent(EventConstants.EVENT_ID_LIVE);
-    }
-
-    @Override
-    protected void initView() {
-        content_view = viewBinding.contentView;
-        mFlLiveView = viewBinding.flLiveView;
-        ll_like = viewBinding.llLike;
-        mRecyclerMsg = viewBinding.recyclerMsg;
-        mTvNumPeople = viewBinding.tvNumPeople;
-        iv_mic = viewBinding.ivMic;
-        mLlMicContainer = viewBinding.llMicContainer;
-        mTvAddLikeCount = viewBinding.tvAddLikeCount;
-        mIvAvatar = viewBinding.ivAvatar;
-        mTvRoomCreateName = viewBinding.tvRoomAuthorName;
-        mGroupViews = viewBinding.groupViews;
-        mViewLiveStatus = viewBinding.viewLiveStatus.csRootLiveStatus;
-        mIvLiveStatusCenterIcon = viewBinding.viewLiveStatus.ivCenterIcon;
-        mTvLiveStatusTipText = viewBinding.viewLiveStatus.tvLiveStatusTipText;
-        mIvSwitchVideoOrientation = viewBinding.ivSwitchVideoOrientation;
-        mIvSwitchVideoOrientationFull = viewBinding.ivSwitchVideoOrientationFull;
-        cs_header_info = viewBinding.csHeaderInfo;
-        mViewShopCarAnim = viewBinding.viewShopCarAnim;
-        mIvShopCar = viewBinding.ivShopCar;
-        mIvClose = viewBinding.ivClose;
-        tv_input = viewBinding.tvInput;
-        mFlJoinBarrage = viewBinding.flJoinBarrage;
-        mTvJoinBarrage = viewBinding.tvJoinBarrage;
-        mFlSnapUpBarrage = viewBinding.flSnapUpBarrage;
-        mTvSnapUpBarrage = viewBinding.tvSnapUpBarrage;
-        initListener();
-    }
-
-    private void initListener() {
-        mIvClose.setOnClickListener(this);
-        mIvSwitchVideoOrientation.setOnClickListener(this);
-        mIvSwitchVideoOrientationFull.setOnClickListener(this);
-        tv_input.setOnClickListener(this);
-        iv_mic.setOnClickListener(this);
-        viewBinding.iconAddLike.setOnClickListener(this);
-        mViewLiveStatus.setOnClickListener(this);
-        mViewShopCarAnim.setOnClickListener(this);
-        mFlLiveView.setOnClickListener(this);
-        viewBinding.tvAppointmentCourse.setOnClickListener(this);
-        viewBinding.tvLiveCourse.setOnClickListener(this);
-        viewBinding.tvVideoCourse.setOnClickListener(this);
-        viewBinding.tvMusicSheet.setOnClickListener(this);
-        viewBinding.ivAvatar.setOnClickListener(this);
-        viewBinding.ivShare.setOnClickListener(this);
-
-        mRecyclerMsg.addOnScrollListener(new RecyclerView.OnScrollListener() {
-            @Override
-            public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
-                super.onScrollStateChanged(recyclerView, newState);
-                if (mLinearLayoutManager == null || mMessageAdapter == null) {
-                    return;
-                }
-                int lastCompletelyVisibleItemPosition = mLinearLayoutManager.findLastCompletelyVisibleItemPosition();
-                if (lastCompletelyVisibleItemPosition == mMessageAdapter.getMessageSize() - 1) {
-                    isAutoScrollToLast = true;
-                } else {
-                    isAutoScrollToLast = false;
-                }
-            }
-        });
-    }
-
-    @Override
-    protected ActivityLiveroomLayoutBinding getLayoutView() {
-        return ActivityLiveroomLayoutBinding.inflate(getLayoutInflater());
-    }
-
-
-    @Override
-    public void initData() {
-        super.initData();
-        mRoomId = getIntent().getStringExtra(ROOMID_KEY);
-        if (TextUtils.isEmpty(mRoomId)) {
-            ToastUtil.getInstance().show(this, "房间id不可为空");
-            finish();
-            return;
-        }
-        String userToken = UserHelper.getUserToken();
-        if (TextUtils.isEmpty(userToken)) {
-            finish();
-            return;
-        }
-        if (LiveConfig.isNeedReInitRTC) {
-            //检查是否需要重新初始化RTC
-            LiveRTCEngineInitHelper.initRTC();
-        }
-        // 初始化音频路由管理类
-        RCRTCAudioRouteManager.getInstance().init(Utils.getApp());
-        mFlLiveView.post(new Runnable() {
-            @Override
-            public void run() {
-                checkVideoViewManager();
-            }
-        });
-        mUserId = UserHelper.getUserId();
-        mImUserId = UserHelper.getImUserId();
-        mMessageAdapter = new MessageAdapter(this);
-        mLinearLayoutManager = new LinearLayoutManager(this, RecyclerView.VERTICAL, false);
-        mRecyclerMsg.setLayoutManager(mLinearLayoutManager);
-        mRecyclerMsg.setAdapter(mMessageAdapter);
-        IMCenter.getInstance().addConnectionStatusListener(connectStatusListener);
-        SoftKeyboardUtil.registerSoftInputChangedListener(getWindow(), this);
-        mLlMicContainer.setOnEventListener(new LiveRoomMicIconView.OnEventListener() {
-            @Override
-            public void getUserInfoByUserId(String userId) {
-                if (presenter != null) {
-                    presenter.getUserInfoByUserId(userId);
-                }
-            }
-        });
-        checkNeedPermission();
-    }
-
-    private void checkNeedPermission() {
-        Disposable disposable = new RxPermissions(LiveRoomActivity.this)
-                .request(Manifest.permission.RECORD_AUDIO, Manifest.permission.WRITE_EXTERNAL_STORAGE
-                        , Manifest.permission.CAMERA)
-                .subscribe(permission -> {
-                    if (permission) {
-                        prepareInitRoom();
-                    } else {
-                        CommonConfirmDialog confirmDialog = new CommonConfirmDialog(LiveRoomActivity.this);
-                        confirmDialog.show();
-                        confirmDialog.setContent("直播需要麦克风、摄像头、储存权限,去设置?");
-                        confirmDialog.setConfirmText("去设置");
-                        confirmDialog.setOnConfirmClickListener(new View.OnClickListener() {
-                            @Override
-                            public void onClick(View v) {
-                                PermissionUtils.toSelfSetting(LiveRoomActivity.this);
-                            }
-                        });
-                    }
-                });
-    }
-
-    private void prepareInitRoom() {
-        //根据融云的IM连接状态判断是否需要获取房间信息
-        RongIMClient.ConnectionStatusListener.ConnectionStatus currentConnectionStatus = RongIMClient.getInstance().getCurrentConnectionStatus();
-        if (currentConnectionStatus == RongIMClient.ConnectionStatusListener.ConnectionStatus.CONNECTED) {
-            isNeedRefresh = false;
-            if (presenter != null) {
-                presenter.init(mRoomId, false);
-            }
-        } else {
-            //如果IM未连接,等待connectStatusListener回调
-            isNeedRefresh = true;
-            if (presenter != null) {
-                presenter.connectIM();
-            }
-        }
-    }
-
-
-    public void onClick(View view) {
-        int id = view.getId();
-        if (id == R.id.view_live_status) {
-            return;
-        }
-        if (id == R.id.iv_close) {
-            if (currentSeatStatus != LiveRoomMsgConstants.MIC_STATUS_NORMAL) {
-                showPageCloseOnMicTipDialog();
-            } else {
-                close();
-            }
-        }
-        if (id == R.id.iv_switch_video_orientation) {
-            //切换横竖屏
-            if (mShopCarDialog != null && mShopCarDialog.isShowing()) {
-                return;
-            }
-            changeOrientation();
-            return;
-        }
-
-        if (id == R.id.iv_switch_video_orientation_full) {
-            //横屏切换竖屏
-            changeOrientation();
-            return;
-        }
-        if (id == R.id.tv_input) {
-            //底部输入框
-            showInputDialog();
-            return;
-        }
-        if (id == R.id.iv_mic) {
-            //连麦
-            if (!isOnMic()) {
-                //非连麦中才判断模式
-                if (checkMicMode()) {
-                    return;
-                }
-                if (connectStatusIsPaused) {
-                    //连接状态异常,暂停连麦
-                    return;
-                }
-            }
-            showMicManagerDialog();
-            return;
-        }
-
-        if (id == R.id.icon_add_like) {
-            if (checkAddLikeMode()) {
-                return;
-            }
-            //点赞
-            LiveRoomAddLikeHelper.getInstance().handleClick(new LiveRoomAddLikeHelper.OnAddLikeResultCallBack() {
-                @Override
-                public void onResult(int count) {
-                    if (presenter != null) {
-                        presenter.setAddLikeCount(count);
-                        presenter.handleAction(LiveRoomMsgConstants.ACTION_SEND_ADD_LIKE_COUNT);
-                    }
-                }
-            });
-            LiveRoomAnimatorHelper.getInstance().startAddLikeAnimation(LiveRoomActivity.this, content_view);
-            return;
-        }
-
-        if (id == R.id.view_shop_car_anim) {
-            if (liveIsFinish) {
-                //直播已结束,不可点击购物车
-                ToastUtil.getInstance().show(LiveRoomActivity.this, "直播已结束");
-                return;
-            }
-            if (viewBinding.llShopCarMenu.getVisibility() != View.VISIBLE) {
-                viewBinding.llShopCarMenu.setVisibility(View.VISIBLE);
-            } else {
-                viewBinding.llShopCarMenu.setVisibility(View.GONE);
-            }
-            return;
-        }
-
-        if (id == R.id.fl_live_view) {
-            //点击隐藏头部信息
-            if (isFullScreen()) {
-                //全屏模式下
-                handleHeaderAnim();
-            }
-            return;
-        }
-
-        if (id == R.id.iv_avatar) {
-            //跳转老师主页
-            if (mRoomInfoBean != null) {
-                ARouter.getInstance()
-                        .build(RouterPath.WebCenter.ACTIVITY_HTML)
-                        .withString(WebConstants.WEB_URL, WebConstants.STUDENT_TEACHER_HOME + mRoomInfoBean.speakerId)
-                        .navigation();
-            }
-            return;
-        }
-
-        if (id == R.id.tv_appointment_course || id == R.id.tv_live_course
-                || id == R.id.tv_video_course || id == R.id.tv_music_sheet) {
-            //约课 直播课 视频课 曲谱
-            startTeacherHomePage(id);
-            sendShowFloatWindowAction(SEND_JUMP_OTHER_PAGE_MSG);
-            return;
-        }
-
-        if (id == R.id.iv_share) {
-            //分享直播间
-            showShareDialog();
-            return;
-        }
-    }
-
-    private void showShareDialog() {
-        if (mRoomInfoBean == null) {
-            return;
-        }
-        if (mLiveRoomShareDialog == null) {
-            mLiveRoomShareDialog = new LiveRoomShareDialog(this);
-            mLiveRoomShareDialog.setOnEventListener(new LiveRoomShareDialog.OnEventListener() {
-                @Override
-                public void onShare(File file) {
-                    shareLive(file);
-                }
-            });
-        }
-        if (!mLiveRoomShareDialog.isShowing()) {
-            mLiveRoomShareDialog.show();
-        }
-        mLiveRoomShareDialog.setData(mRoomInfoBean.speakerPic, mRoomInfoBean.speakerName, mRoomInfoBean.roomUid);
-    }
-
-    private void showMicManagerDialog() {
-        if (mMicManagerDialog == null) {
-            mMicManagerDialog = new LiveRoomMicManagerDialog(this);
-            mMicManagerDialog.setOnEventListener(new LiveRoomMicManagerDialog.OnEventListener() {
-                @Override
-                public void onApplyMic() {
-                    //申请连麦
-                    handleMicEvent();
-                    mMicManagerDialog.setMicStatus(LiveRoomMsgConstants.MIC_STATUS_CONNECTING);
-                    mMicManagerDialog.dismiss();
-                }
-
-                @Override
-                public void onApplyCancel() {
-                    //取消申请连麦
-                    handleMicEvent();
-                }
-
-                @Override
-                public void onCloseMic() {
-                    //关闭连麦
-                    handleMicEvent();
-                }
-            });
-        }
-        if (!mMicManagerDialog.isShowing()) {
-            mMicManagerDialog.show();
-        }
-        if (mRoomInfoBean != null) {
-            mMicManagerDialog.setLiveTeacherInfo(mRoomInfoBean.speakerPic);
-        }
-        mMicManagerDialog.setMicStatus(currentSeatStatus);
-    }
-
-    private void handleMicEvent() {
-        if (currentSeatStatus == LiveRoomMsgConstants.MIC_STATUS_NORMAL) {
-            //未连麦状态 申请连麦
-            if (presenter != null) {
-                presenter.handleAction(LiveRoomMsgConstants.ACTION_SEND_SEAT_APPLY);
-            }
-            updateMicIcon(LiveRoomMsgConstants.MIC_STATUS_CONNECTING);
-            ToastUtil.getInstance().show(LiveRoomActivity.this, getString(R.string.seat_apply_str));
-        } else {
-            //取消连麦
-            showCloseMicTipDialog();
-        }
-    }
-
-    private void startTeacherHomePage(int viewId) {
-        String params = "";
-        if (viewId == R.id.tv_appointment_course) {
-            params = "practice";
-        }
-        if (viewId == R.id.tv_live_course) {
-            params = "live";
-        }
-        if (viewId == R.id.tv_video_course) {
-            params = "video";
-        }
-        if (viewId == R.id.tv_music_sheet) {
-            params = "music";
-        }
-        if (mRoomInfoBean != null) {
-            ARouter.getInstance()
-                    .build(RouterPath.WebCenter.ACTIVITY_HTML)
-                    .withString(WebConstants.WEB_URL, WebConstants.STUDENT_TEACHER_HOME + mRoomInfoBean.speakerId + "&tabs=" + params)
-                    .navigation();
-        }
-    }
-
-
-    private void handleHeaderAnim() {
-        float animOffset = cs_header_info.getTranslationY();
-        if (animOffset == 0) {
-            //隐藏头部信息
-            int bottom = cs_header_info.getBottom();
-            if (hideHeaderInfoAnim == null) {
-                hideHeaderInfoAnim = ObjectAnimator.ofFloat(cs_header_info, "translationY", 0, -bottom);
-                hideHeaderInfoAnim.setDuration(500);
-            }
-            hideHeaderInfoAnim.start();
-        } else {
-            //显示头部信息
-            if (showHeaderInfoAnim == null) {
-                showHeaderInfoAnim = ObjectAnimator.ofFloat(cs_header_info, "translationY", animOffset, 0);
-                showHeaderInfoAnim.setDuration(500);
-            }
-            showHeaderInfoAnim.start();
-        }
-    }
-
-    private void showShopCarDialog() {
-        if (mShopCarDialog == null) {
-            mShopCarDialog = new LiveRoomShopCarDialog(this);
-            mShopCarDialog.setOnEventListener(new LiveRoomShopCarDialog.OnEventListener() {
-                @Override
-                public void onOpenDetail(String url) {
-                    mShopCarDialog.dismiss();
-                    //发送XXX正在抢购消息
-//                    presenter.handleAction(LiveRoomMsgConstants.ACTION_SEND_ON_SNAP_UP);
-//                    sendShowFloatWindowAction(SEND_JUMP_OTHER_PAGE_MSG);
-//                    ARouter.getInstance()
-//                            .build(ARouterConstace.ACTIVITY_HTML)
-//                            .withString(ARouterConstace.URL, url)
-//                            .withString(ARouterConstace.TITLE, "商品详情")
-//                            .navigation();
-                }
-            });
-        }
-        if (!mShopCarDialog.isShowing()) {
-            mShopCarDialog.show();
-        }
-        mShopCarDialog.setRoomId(mRoomId);
-    }
-
-
-    @Override
-    protected void onResume() {
-        super.onResume();
-        Log.i("pq", "onResume");
-        checkImConnectStatus();
-        this.isOnResume = true;
-        unbindService();
-        //取消全部静音
-        muteAll(false);
-    }
-
-
-    /**
-     * 检查IM连接状态
-     */
-    private void checkImConnectStatus() {
-        RongIMClient.ConnectionStatusListener.ConnectionStatus currentConnectionStatus = RongIMClient.getInstance().getCurrentConnectionStatus();
-        if (currentConnectionStatus == RongIMClient.ConnectionStatusListener.ConnectionStatus.CONNECTED) {
-            isNeedRefresh = false;
-        } else {
-            isNeedRefresh = true;
-            if (presenter != null) {
-                presenter.connectIM();
-            }
-        }
-    }
-
-
-    private void showPageCloseOnMicTipDialog() {
-        if (mLiveRoomClosePageOnMicTipDialog == null) {
-            mLiveRoomClosePageOnMicTipDialog = new LiveRoomClosePageOnMicTipDialog(this);
-            mLiveRoomClosePageOnMicTipDialog.setConfirmClickListener(new View.OnClickListener() {
-                @Override
-                public void onClick(View v) {
-                    finish();
-                }
-            });
-        }
-        if (!mLiveRoomClosePageOnMicTipDialog.isShowing()) {
-            mLiveRoomClosePageOnMicTipDialog.show();
-        }
-        mLiveRoomClosePageOnMicTipDialog.setTitle("提示");
-        mLiveRoomClosePageOnMicTipDialog.setContent("连麦中,是否退出房间?");
-    }
-
-    private void showCloseMicTipDialog() {
-        if (mRoomCloseMicTipDialog == null) {
-            mRoomCloseMicTipDialog = new LiveRoomCloseMicTipDialog(this);
-            mRoomCloseMicTipDialog.setConfirmClickListener(new View.OnClickListener() {
-                @Override
-                public void onClick(View v) {
-                    handleCloseMicEvent();
-                    mRoomCloseMicTipDialog.dismiss();
-                    if (mMicManagerDialog != null) {
-                        mMicManagerDialog.dismiss();
-                    }
-                }
-            });
-        }
-        if (!mRoomCloseMicTipDialog.isShowing()) {
-            mRoomCloseMicTipDialog.show();
-        }
-        mRoomCloseMicTipDialog.setContent(getString(currentSeatStatus == LiveRoomMsgConstants.MIC_STATUS_CONNECTING ? R.string.cancel_seat_on_connecting : R.string.cancel_seat_on_connected));
-    }
-
-    /**
-     * 取消连麦
-     */
-    private void handleCloseMicEvent() {
-        if (currentSeatStatus == LiveRoomMsgConstants.MIC_STATUS_CONNECTING) {
-            //连接中取消连接
-            if (presenter != null) {
-                presenter.handleAction(LiveRoomMsgConstants.ACTION_SEND_CANCEL_SEAT_APPLY);
-                updateMicIcon(LiveRoomMsgConstants.MIC_STATUS_NORMAL);
-            }
-        }
-        if (currentSeatStatus == LiveRoomMsgConstants.MIC_STATUS_CONNECT_SUCCESS) {
-            if (presenter != null) {
-                presenter.exitMic();
-            }
-        }
-    }
-
-    private boolean isOnApplyMic() {
-        return currentSeatStatus == LiveRoomMsgConstants.MIC_STATUS_CONNECTING;
-    }
-
-    private boolean isOnMic() {
-        return currentSeatStatus == LiveRoomMsgConstants.MIC_STATUS_CONNECT_SUCCESS;
-    }
-
-    private void updateMicIcon(int micStatus) {
-        //主线程更新
-        iv_mic.post(new Runnable() {
-            @Override
-            public void run() {
-                currentSeatStatus = micStatus;
-                if (micStatus == LiveRoomMsgConstants.MIC_STATUS_NORMAL) {
-                    iv_mic.setImageResource(R.drawable.icon_mic_unconnect);
-                }
-                if (micStatus == LiveRoomMsgConstants.MIC_STATUS_CONNECTING) {
-                    iv_mic.setImageResource(R.drawable.icon_mic_connecting);
-                }
-                if (micStatus == LiveRoomMsgConstants.MIC_STATUS_CONNECT_SUCCESS) {
-                    iv_mic.setImageResource(R.drawable.icon_mic_conected);
-                }
-            }
-        });
-    }
-
-    /**
-     * 检查点赞按钮是否可用
-     *
-     * @return
-     */
-    private boolean checkAddLikeMode() {
-        if (liveIsFinish) {
-            ToastUtil.getInstance().show(LiveRoomActivity.this, "直播已结束");
-            return true;
-        }
-        if (connectStatusIsPaused) {
-            //连接状态异常,暂停点赞
-            ToastUtil.getInstance().show(LiveRoomActivity.this, "网络连接状态异常");
-            return true;
-        }
-        return false;
-    }
-
-
-    private void showInputDialog() {
-        if (checkChatMode()) return;
-        if (mInputBarDialog == null) {
-            mInputBarDialog = new InputBarDialog(LiveRoomActivity.this, new InputBar.InputBarListener() {
-                @Override
-                public boolean onClickSend(String message) {
-                    //发送消息
-                    if (TextUtils.isEmpty(message)) {
-                        ToastUtil.getInstance().show(LiveRoomActivity.this, "消息不能为空");
-                        return false;
-                    }
-                    if (message.length() > LiveConfig.LIVE_MAX_INPUT_TEXT_LENGTH) {
-                        ToastUtil.getInstance().show(LiveRoomActivity.this, "聊天消息需在40个字以内哦");
-                        return false;
-                    }
-                    if (LiveMessageHelper.isQuickAction()) {
-                        ToastUtil.getInstance().show(LiveRoomActivity.this, "您说话太快啦");
-                        return false;
-                    }
-                    sendTextMessage(message);
-                    return true;
-                }
-
-
-                @Override
-                public boolean onClickEmoji() {
-                    return false;
-                }
-            });
-
-            mInputBarDialog.setOnShowListener(new DialogInterface.OnShowListener() {
-                @Override
-                public void onShow(DialogInterface dialog) {
-                    if (mInputBarDialog != null) {
-                        mInputBarDialog.showInput();
-                    }
-                }
-            });
-        }
-        if (!mInputBarDialog.isShowing()) {
-            mInputBarDialog.show();
-        }
-    }
-
-    private void sendTextMessage(String message) {
-        if (checkChatMode()) {
-            //禁止聊天模式
-            if (mInputBarDialog != null) {
-                mInputBarDialog.dismiss();
-            }
-            return;
-        }
-        if (presenter != null) {
-            TextMessage textMessage = TextMessage.obtain(message);
-            UserInfo userInfo = new UserInfo(mImUserId, UserHelper.getUserName(), null);
-            textMessage.setUserInfo(userInfo);
-            presenter.sendMessage(textMessage);
-        }
-    }
-
-    private void changeOrientation() {
-        int currentOrientation = getCurrentOrientation();
-        boolean isNeedFullScreen = currentOrientation != Configuration.ORIENTATION_LANDSCAPE;
-        if (isNeedFullScreen) {
-            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
-        } else {
-            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
-        }
-    }
-
-    @Override
-    public void onConfigurationChanged(@NonNull Configuration newConfig) {
-        super.onConfigurationChanged(newConfig);
-        //改变videoView容器布局尺寸
-        resetVideoContainer(newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE);
-    }
-
-    private void close() {
-        //断开连接,结束页面
-        onBackPressed();
-    }
-
-    @Override
-    protected LiveRoomPresenter createPresenter() {
-        return new LiveRoomPresenter();
-    }
-
-
-    /**
-     * 获取房间信息成功
-     *
-     * @param roomInfoBean
-     */
-    @Override
-    public void getRoomInfoSuccess(LiveRoomInfoBean roomInfoBean) {
-        if (roomInfoBean == null || isFinishing() || isDestroyed()) {
-            return;
-        }
-        mRoomInfoBean = roomInfoBean;
-        isPcClientLive = TextUtils.equals(mRoomInfoBean.os, "pc");
-        resetVideoContainer(!isPcClientLive);
-        if (isShowShare()) {
-            viewBinding.ivShare.setVisibility(View.VISIBLE);
-        } else {
-            viewBinding.ivShare.setVisibility(View.GONE);
-        }
-        currentAddLikeCount = roomInfoBean.likeNum;
-        //连麦模式
-        isEnableMic = roomInfoBean.whether_mic == 1;
-        //聊天模式
-        isEnableChat = roomInfoBean.whether_chat == 1;
-        if (!TextUtils.isEmpty(roomInfoBean.roomConfig)) {
-            try {
-                JSONObject jsonObject = new JSONObject(roomInfoBean.roomConfig);
-                int chatCtrlMode = jsonObject.optInt("whether_chat", 0);
-                int micCtrlMode = jsonObject.optInt("whether_mic", 0);
-                isEnableChat = chatCtrlMode == 1;
-                isEnableMic = micCtrlMode == 1;
-                //购物车是否显示
-                int shopCarMode = jsonObject.optInt("whether_view_shop_cart", 0);
-                if (shopCarMode == 1) {
-                    //隐藏购物车
-                    mViewShopCarAnim.setVisibility(View.GONE);
-                    mIvShopCar.setVisibility(View.GONE);
-                } else {
-                    //显示购物车
-                    mViewShopCarAnim.setVisibility(View.VISIBLE);
-                    mIvShopCar.setVisibility(View.INVISIBLE);
-                }
-            } catch (JSONException e) {
-                e.printStackTrace();
-            }
-        }
-        //黑名单模式
-        isEnableAll = roomInfoBean.blacklistFlag == 1;//1是黑名单 0否
-        updateInputTip();
-        updateAddLikeCountView();
-        //更新未上麦状态
-        updateMicIcon(LiveRoomMsgConstants.MIC_STATUS_NORMAL);
-        if (mTvNumPeople != null) {
-            int peopleCount = roomInfoBean.lookNum + 1;//加上自己
-            mTvNumPeople.setText(String.format("%s人", LiveMemberHelper.getMemberCountText(peopleCount)));
-        }
-
-        if (mIvAvatar != null) {
-            //创建人头像
-            Glide.with(LiveRoomActivity.this).load(roomInfoBean.speakerPic).placeholder(R.drawable.icon_teacher_default_head).error(R.drawable.icon_teacher_default_head).into(mIvAvatar);
-        }
-        if (mTvRoomCreateName != null) {
-            //创建人昵称
-            mTvRoomCreateName.setText(roomInfoBean.speakerName);
-        }
-
-        if (mMessageAdapter != null) {
-            mMessageAdapter.setRoomAuthorId(roomInfoBean.speakerId);
-        }
-        if (presenter != null) {
-            //加入聊天室
-            //加入直播间
-            showLoading();
-            LiveEventHelper.getInstance().register(mRoomInfoBean.roomUid);
-            presenter.leaveRoom(mRoomInfoBean.roomUid, false, true);
-            presenter.joinChartRoom(mRoomInfoBean.roomUid, new IRongCoreCallback.OperationCallback() {
-                @Override
-                public void onSuccess() {
-                    Log.i("pq", "加入聊天房间成功");
-                    if (presenter != null) {
-                        presenter.handleAction(LiveRoomMsgConstants.ACTION_SEND_JOIN_ROOM);
-                    }
-                }
-
-                @Override
-                public void onError(IRongCoreEnum.CoreErrorCode coreErrorCode) {
-                    Log.i("pq", "加入聊天房间fail:" + coreErrorCode);
-                    Toast.makeText(LiveRoomActivity.this, "加入聊天房间fail:" + coreErrorCode, Toast.LENGTH_SHORT).show();
-                }
-            });
-        }
-    }
-
-    private void updateInputTip() {
-        if (tv_input == null) {
-            return;
-        }
-        if (isEnableAll) {
-            tv_input.setText(getString(R.string.unable_input_tip_str));
-        } else {
-            tv_input.setText(getString(R.string.live_input_tips_str));
-        }
-    }
-
-    @Override
-    public void getRoomInfoError(Throwable t) {
-        if (isDestroyed() || isFinishing()) {
-            return;
-        }
-        if (t instanceof ApiException) {
-            ApiException apiException = (ApiException) t;
-            ToastUtil.getInstance().show(LiveRoomActivity.this, apiException.getErrmsg());
-        }
-        finish();
-    }
-
-    private void resetVideoContainer(boolean isFullScreen) {
-        if (mVideoViewManager != null) {
-            mVideoViewManager.setIsNeedFillScreen(isFullScreen);
-        }
-        if (isFullScreen) {
-            if (isPcClientLive) {
-                //隐藏消息列表
-                mGroupViews.setVisibility(View.GONE);
-                mIvClose.setVisibility(View.GONE);
-                //隐藏弹幕消息
-                mFlJoinBarrage.clearAnimation();
-                mFlJoinBarrage.setVisibility(View.GONE);
-                mFlSnapUpBarrage.clearAnimation();
-                mFlSnapUpBarrage.setVisibility(View.GONE);
-                //隐藏竖屏全屏按钮
-                mIvSwitchVideoOrientation.setVisibility(View.GONE);
-                mIvSwitchVideoOrientationFull.setVisibility(View.VISIBLE);
-            } else {
-                //不是PC端直播
-                mIvSwitchVideoOrientation.setVisibility(View.GONE);
-                mIvSwitchVideoOrientationFull.setVisibility(View.GONE);
-            }
-            ConstraintSet set = new ConstraintSet();
-            set.clone(content_view);
-            set.clear(mFlLiveView.getId());
-            if (!isPcClientLive) {
-                //如果是非PC端直播,还需要设置下消息列表控件位置
-                set.clear(R.id.fl_recycler_container);
-                set.connect(R.id.fl_recycler_container, ConstraintSet.TOP, R.id.view_center, ConstraintSet.BOTTOM, SizeUtils.dp2px(50));
-                set.connect(R.id.fl_recycler_container, ConstraintSet.LEFT, content_view.getId(), ConstraintSet.LEFT, 0);
-                set.connect(R.id.fl_recycler_container, ConstraintSet.RIGHT, content_view.getId(), ConstraintSet.RIGHT, 0);
-                set.connect(R.id.fl_recycler_container, ConstraintSet.BOTTOM, tv_input.getId(), ConstraintSet.TOP, SizeUtils.dp2px(10));
-            }
-            set.connect(mFlLiveView.getId(), ConstraintSet.TOP, content_view.getId(), ConstraintSet.TOP, 0);
-            set.connect(mFlLiveView.getId(), ConstraintSet.LEFT, content_view.getId(), ConstraintSet.LEFT, 0);
-            set.connect(mFlLiveView.getId(), ConstraintSet.RIGHT, content_view.getId(), ConstraintSet.RIGHT, 0);
-            set.connect(mFlLiveView.getId(), ConstraintSet.BOTTOM, content_view.getId(), ConstraintSet.BOTTOM, 0);
-            set.applyTo(content_view);
-        } else {
-            //pc端直播,控制居中显示,以及videoview容器的宽高
-            if (cs_header_info.getTranslationY() != 0) {
-                //还原显示头部信息
-                handleHeaderAnim();
-            }
-            if (isPcClientLive) {
-                mGroupViews.setVisibility(View.VISIBLE);
-                mIvClose.setVisibility(View.VISIBLE);
-                mIvSwitchVideoOrientation.setVisibility(View.VISIBLE);
-                mIvSwitchVideoOrientationFull.setVisibility(View.GONE);
-            }
-
-            ConstraintSet set = new ConstraintSet();
-            set.clone(content_view);
-            set.clear(mFlLiveView.getId());
-            set.connect(mFlLiveView.getId(), ConstraintSet.TOP, cs_header_info.getId(), ConstraintSet.BOTTOM, SizeUtils.dp2px(121));
-            set.connect(mFlLiveView.getId(), ConstraintSet.LEFT, content_view.getId(), ConstraintSet.LEFT, 0);
-            set.connect(mFlLiveView.getId(), ConstraintSet.RIGHT, content_view.getId(), ConstraintSet.RIGHT, 0);
-            int maxHeightAtRatio16_9 = UiUtils.getMaxHeightAtRatio16_9(LiveRoomActivity.this);
-            set.constrainHeight(mFlLiveView.getId(), maxHeightAtRatio16_9);
-            set.applyTo(content_view);
-        }
-    }
-
-    public void changVideoViewSize() {
-        int childCount = mFlLiveView.getChildCount();
-        if (childCount == 0) {
-            return;
-        }
-        View childAt = mFlLiveView.getChildAt(0);
-        if (childAt instanceof RCRTCVideoView) {
-            RCRTCVideoView videoView = (RCRTCVideoView) childAt;
-//            mFlLiveView.removeView(videoView);
-//            mFlLiveView.addView(videoView);
-        }
-    }
-
-    @Override
-    public void showFinishView() {
-        //显示结束view
-        if (isFinishing() || isDestroyed()) {
-            return;
-        }
-        ToastUtil.getInstance().showShort("直播间加入异常,请退出重试");
-        Log.i("pq", "加入直播间异常");
-    }
-
-
-    /**
-     * 主讲人的音频状态
-     *
-     * @param isCloseAudioStream
-     */
-    @Override
-    public void syncAudioStatus(boolean isCloseAudioStream) {
-        this.creatorIsCloseAudioStream = isCloseAudioStream;
-        if (creatorIsCloseAudioStream && creatorIsCloseVideoStream) {
-            //如果是关闭音频,同时判断下视频的状态
-            showRestView();
-        }
-    }
-
-    @Override
-    public void showRestView() {
-        showLiveStatusView(LIVE_STATUS_IS_REST);
-    }
-
-    @Override
-    public void showCloseVideoView() {
-        //关闭了视频
-        creatorIsCloseVideoStream = true;
-        if (creatorIsCloseAudioStream) {
-            //同时音频也关闭了
-            showRestView();
-            return;
-        }
-        showLiveStatusView(LIVE_STATUS_IS_CLOSE_VIDEO);
-    }
-
-    private void showLiveStatusView(int status) {
-        if (isFinishing() || isDestroyed()) {
-            return;
-        }
-        if (mViewLiveStatus == null) {
-            return;
-        }
-        //显示视频画面已经关闭页面
-        mViewLiveStatus.post(new Runnable() {
-            @Override
-            public void run() {
-                hideLoading();
-                mViewLiveStatus.setVisibility(View.VISIBLE);
-                if (status == LIVE_STATUS_IS_REST) {
-                    mIvLiveStatusCenterIcon.setImageResource(R.drawable.icon_live_room_rest_bg);
-                    mTvLiveStatusTipText.setText("休息一下,马上回来!!");
-                    mTvLiveStatusTipText.setTextSize(12);
-                    mTvLiveStatusTipText.setBackgroundResource(com.cooleshow.base.R.drawable.shape_gray_14dp);
-                } else if (status == LIVE_STATUS_IS_CLOSE_VIDEO) {
-                    mIvLiveStatusCenterIcon.setImageResource(R.drawable.icon_live_room_close_video);
-                    mTvLiveStatusTipText.setText("主持人已关闭画面!");
-                    mTvLiveStatusTipText.setTextSize(12);
-                    mTvLiveStatusTipText.setBackgroundResource(com.cooleshow.base.R.drawable.shape_gray_14dp);
-                } else if (status == LIVE_STATUS_IS_OFFLINE) {
-                    mIvLiveStatusCenterIcon.setImageResource(R.drawable.icon_live_end_tip);
-                    mTvLiveStatusTipText.setText("直播已结束!");
-                    mTvLiveStatusTipText.setTextSize(14);
-                    mTvLiveStatusTipText.setBackgroundColor(Color.TRANSPARENT);
-                }
-            }
-        });
-    }
-
-    @Override
-    public void showEmptyStatusView() {
-        //显示老师不在线view
-        showRestView();
-        refreshAudio(null, null);
-    }
-
-    @Override
-    public View getContentView() {
-        return content_view;
-    }
-
-    @Override
-    public void addMessageList(List<MessageContent> messageContents, boolean isReset) {
-        //添加多条消息至页面
-    }
-
-    @Override
-    public void addMessageContent(Message message, boolean isReset) {
-        //添加单条消息至页面
-        Log.i("pq", "收到需要显示msg:" + message);
-        //只处理直播间消息,以及本直播间消息
-        if (mMessageAdapter != null) {
-            mMessageAdapter.addMessage(message);
-            if (mRecyclerMsg != null && mLinearLayoutManager != null) {
-                mRecyclerMsg.post(new Runnable() {
-                    @Override
-                    public void run() {
-                        if (isAutoScrollToLast) {
-                            if (mRecyclerMsg != null) {
-                                mRecyclerMsg.scrollToPosition(mMessageAdapter.getItemCount() - 1);
-                            }
-                        } else {
-                            Log.i("pq", "收到消息,不自动滚动");
-                        }
-                    }
-                });
-            }
-        }
-    }
-
-    private void updateAddLikeCountView() {
-        if (mTvAddLikeCount != null) {
-            mTvAddLikeCount.setText(getString(R.string.live_room_add_like_count_str, LiveMemberHelper.getStarsCountText(currentAddLikeCount)));
-        }
-    }
-
-    /**
-     * 控制聊天模式
-     *
-     * @param isEnableChat
-     */
-    @Override
-    public void switchChatMode(boolean isEnableChat) {
-        //控制聊天模式
-        Log.i("pq", "聊天禁止:" + isEnableChat);
-        this.isEnableChat = isEnableChat;
-    }
-
-    @Override
-    public void liveRoomOffline() {
-        //关闭直播间
-        ToastUtil.getInstance().show(this, "直播已结束");
-        this.liveIsFinish = true;
-        //取消连麦
-        if (mMicManagerDialog != null) {
-            mMicManagerDialog.dismiss();
-        }
-        handleCloseMicEvent();
-        notifyMicDelAll();
-        showLiveStatusView(LIVE_STATUS_IS_OFFLINE);
-        hideDialog();
-        //离开房间
-        LiveEventHelper.getInstance().leaveRoom(null);
-    }
-
-    @Override
-    public void liveGoodsChange(String jsonStr) {
-        //直播间商品发生变化
-        if (isDestroyed() || isFinishing()) {
-            return;
-        }
-        if (mShopCarDialog != null) {
-            mShopCarDialog.changeGoods(jsonStr);
-        }
-    }
-
-    /**
-     * 关闭一些交互弹窗
-     */
-    private void hideDialog() {
-        //关闭邀请弹窗
-        if (mInviteSeatMicTipDialog != null && mInviteSeatMicTipDialog.isShowing()) {
-            mInviteSeatMicTipDialog.dismiss();
-        }
-        //关闭商品弹窗
-        if (mShopCarDialog != null && mShopCarDialog.isShowing()) {
-            mShopCarDialog.dismiss();
-        }
-    }
-
-    /**
-     * @param rcUserSeatResponseMessage
-     */
-    @Override
-    public void seatResponse(RCUserSeatResponseMessage rcUserSeatResponseMessage) {
-        if (isFinishing() || isDestroyed()) {
-            return;
-        }
-        if (rcUserSeatResponseMessage == null || !isOwn(rcUserSeatResponseMessage.getAudienceId())) {
-            return;
-        }
-        if (rcUserSeatResponseMessage != null) {
-            int type = rcUserSeatResponseMessage.getType();
-            if (type == LiveRoomMsgConstants.MIC_RESPONSE_AGREE) {
-                //主播同意
-                if (presenter != null) {
-                    if (isOnApplyMic()) {
-                        presenter.joinMic();
-                    }
-                }
-                return;
-            }
-            if (type == LiveRoomMsgConstants.MIC_RESPONSE_DISAGREE) {
-                //主播拒绝
-                updateMicIcon(LiveRoomMsgConstants.MIC_STATUS_NORMAL);
-                ToastUtil.getInstance().show(LiveRoomActivity.this, getString(R.string.create_refuse_seat_tip));
-                return;
-            }
-        }
-    }
-
-    @Override
-    public void onSwitchRole(String userId, RCRTCLiveRole role) {
-        Log.i("pq", "onSwitchRole:" + userId);
-        if (role.getType() == RCRTCLiveRole.AUDIENCE.getType()) {
-            //主播身份切换观众身份 下麦
-            notifyMicContainerDel(userId);
-            return;
-        }
-    }
-
-    @Override
-    public void onUserJoinRoom(RCRTCRemoteUser rcrtcRemoteUser) {
-        if (isFinishing() || isDestroyed()) {
-            return;
-        }
-        Log.i("pq", "onUserJoinRoom:" + rcrtcRemoteUser.getUserId());
-        if (TextUtils.equals(rcrtcRemoteUser.getUserId(), createRoomId)) {
-            createRoomId = "";//重置一下createRoomId,防止创建者退出又进入,全局控制变量未刷新
-        }
-    }
-
-    @Override
-    public void onUserLeftRoomMic(RCRTCRemoteUser rcrtcRemoteUser) {
-        Log.i("pq", "onUserLeftRoomMic:" + rcrtcRemoteUser.getUserId());
-        if (rcrtcRemoteUser != null) {
-            notifyMicContainerDel(rcrtcRemoteUser.getUserId());
-        }
-    }
-
-    @Override
-    public void onUserOfflineRoomMic(RCRTCRemoteUser rcrtcRemoteUser) {
-        Log.i("pq", "onUserOfflineRoomMic:" + rcrtcRemoteUser.getUserId());
-        if (rcrtcRemoteUser != null) {
-            notifyMicContainerDel(rcrtcRemoteUser.getUserId());
-        }
-    }
-
-    @Override
-    public void onRemoteUserPublishResource(String remoteUserId) {
-        if (!TextUtils.isEmpty(remoteUserId)) {
-            Log.i("pq", "收到onRemoteUserPublishResource:" + remoteUserId);
-            refreshAudio(null, null);
-        }
-    }
-
-    @Override
-    public void onRefuseAllMicApply() {
-        if (isFinishing() || isDestroyed()) {
-            return;
-        }
-        if (mMicManagerDialog != null) {
-            mMicManagerDialog.dismiss();
-        }
-        if (isOnApplyMic()) {
-            updateMicIcon(LiveRoomMsgConstants.MIC_STATUS_NORMAL);
-            ToastUtil.getInstance().show(LiveRoomActivity.this, getString(R.string.create_refuse_seat_tip));
-            buildResponseMessage();
-        }
-    }
-
-    /**
-     * 因全部拒绝连麦消息没有携带id相关参数,所以本地造一个拒绝连麦的消息插入到消息列表
-     */
-    private void buildResponseMessage() {
-        if (mRoomInfoBean != null) {
-            String userId = UserHelper.getImUserId();
-            RCUserSeatResponseMessage responseMessage = new RCUserSeatResponseMessage();
-            responseMessage.setType(LiveRoomMsgConstants.MIC_RESPONSE_DISAGREE);
-            responseMessage.setTeacherId(mRoomInfoBean.speakerId);
-            responseMessage.setTeacherName(mRoomInfoBean.speakerName);
-            responseMessage.setAudienceId(UserHelper.getImUserId());
-            responseMessage.setAudienceName(UserHelper.getUserName());
-            Message message = Message.obtain(userId, Conversation.ConversationType.CHATROOM, responseMessage);
-            message.setObjectName(LiveRoomMsgConstants.TAG_CHAT_ROOM_SEAT_RESPONSE);
-            addMessageContent(message, false);
-        }
-    }
-
-    @Override
-    public void onUnderAllMic() {
-        if (isFinishing() || isDestroyed()) {
-            return;
-        }
-        if (isOnMic()) {
-            if (presenter != null) {
-                presenter.exitMic();
-            }
-            ToastUtil.getInstance().show(LiveRoomActivity.this, getString(R.string.down_mic_by_create_tip));
-        }
-    }
-
-    @Override
-    public void syncMemberCount(String count) {
-        //同步成员数量
-        Log.i("pq", "syncMemberCount" + count);
-        if (isFinishing() || isDestroyed()) {
-            return;
-        }
-        if (mTvNumPeople != null) {
-            mTvNumPeople.setText(String.format("%s人", LiveMemberHelper.getMemberCountText(count)));
-        }
-    }
-
-    @Override
-    public void onUserKickOutMsg(RCUserKickOutMessage userKickOutMessage) {
-        //用户被踢出消息
-        if (isFinishing() || isDestroyed()) {
-            return;
-        }
-        if (userKickOutMessage == null || !isOwn(userKickOutMessage.getTargetId())) {
-            return;
-        }
-        String targetId = userKickOutMessage.getTargetId();
-        Log.i("pq", "receive kickOut msg targetId:" + targetId);
-        finish();
-    }
-
-    /**
-     * 控制连麦模式
-     *
-     * @param isEnableMic
-     */
-    @Override
-    public void changeMicControlMode(boolean isEnableMic) {
-        //禁止连麦模式
-        if (isFinishing() || isDestroyed()) {
-            return;
-        }
-        Log.i("pq", "receive mic mode control msg 禁麦模式:" + isEnableMic);
-        this.isEnableMic = isEnableMic;
-        if (isEnableMic && isOnApplyMic()) {
-            handleCloseMicEvent();
-        }
-    }
-
-    private void refresh() {
-        //video流信息
-        List<RCRTCVideoOutputStream> outputStreams = new ArrayList<>();
-        List<RCRTCVideoInputStream> videoInputStreams = new ArrayList<>();
-        //音频流信息
-        List<RCRTCAudioInputStream> audioinputstream = new ArrayList<>();
-        List<RCRTCAudioOutputStream> audioOutputStreams = new ArrayList<>();
-        presenter.getAllStreams(outputStreams, videoInputStreams, audioinputstream, audioOutputStreams);
-        updateVideoView(outputStreams, videoInputStreams, audioinputstream, audioOutputStreams);
-        refreshAudio(audioinputstream, audioOutputStreams);
-    }
-
-    @Override
-    public void subscribeAVStreamSuccess(List<RCRTCInputStream> inputStreams) {
-        if (isDestroyed() || isFinishing()) {
-            return;
-        }
-        if (liveIsFinish) {
-            //直播已结束
-            return;
-        }
-        this.liveIsPause = false;
-        if (inputStreams != null) {
-            refresh();
-        } else {
-            showEmptyStatusView();
-        }
-    }
-
-    @Override
-    public void onSubscribeFailed() {
-        //订阅流失败
-    }
-
-    @Override
-    public void setRoomData(LiveRoomInfoBean roomInfoBean) {
-        //保存房间信息
-        if (presenter != null) {
-            //通知加入房间成功
-            presenter.notifyJoinRoomAction(mRoomId, mUserId);
-        }
-    }
-
-    /**
-     * 清除所有连麦用户的UI
-     */
-    private void notifyMicDelAll() {
-        if (mLlMicContainer != null) {
-            mLlMicContainer.post(new Runnable() {
-                @Override
-                public void run() {
-                    mLlMicContainer.delAll();
-                }
-            });
-        }
-    }
-
-    private void notifyMicContainerDel(String userId) {
-        mLlMicContainer.post(new Runnable() {
-            @Override
-            public void run() {
-                mLlMicContainer.deleteMicUser(new UserInfo(userId, "", null));
-            }
-        });
-    }
-
-    /**
-     * 连麦成功-身份切换主播成功
-     */
-    @Override
-    public void onSeatMicSuccess() {
-        updateMicIcon(LiveRoomMsgConstants.MIC_STATUS_CONNECT_SUCCESS);
-        if (mMicManagerDialog != null) {
-            mMicManagerDialog.dismiss();
-        }
-    }
-
-    /**
-     * 连麦失败
-     */
-    @Override
-    public void onSeatMicFail() {
-        updateMicIcon(LiveRoomMsgConstants.MIC_STATUS_NORMAL);
-    }
-
-    /**
-     * \
-     * 退出连麦成功
-     */
-    @Override
-    public void onExitSeatMicSuccess() {
-        updateMicIcon(LiveRoomMsgConstants.MIC_STATUS_NORMAL);
-        if (!TextUtils.isEmpty(mImUserId)) {
-            notifyMicContainerDel(mImUserId);
-        }
-        if (presenter != null) {
-            presenter.handleAction(LiveRoomMsgConstants.ACTION_SEND_DOWN_SEAT_MIC);
-        }
-    }
-
-    /**
-     * 主播邀请上麦
-     *
-     * @param seatApplyMessage
-     */
-    @Override
-    public void onInviteSeatMic(RCUserSeatApplyMessage seatApplyMessage) {
-        if (isFinishing() || isDestroyed()) {
-            return;
-        }
-        if (seatApplyMessage == null || !isOwn(seatApplyMessage.getAudienceId())) {
-            return;
-        }
-        if (seatApplyMessage.getType() == LiveRoomMsgConstants.MIC_ACTION_INVITE_SEAT_BY_CREATE) {
-            //主讲人邀请观众上麦
-            showInviteSeatDialog();
-            return;
-
-        }
-        if (seatApplyMessage.getType() == LiveRoomMsgConstants.MIC_ACTION_CANCEL_INVITE_SEAT_BY_CREATE) {
-            //主讲人取消邀请观众上麦
-            if (mInviteSeatMicTipDialog != null) {
-                mInviteSeatMicTipDialog.dismiss();
-            }
-            ToastUtil.getInstance().show(LiveRoomActivity.this, getString(R.string.create_recall_seat_invite_tip));
-            return;
-        }
-
-        if (seatApplyMessage.getType() == LiveRoomMsgConstants.MIC_ACTION_CANCEL_SEAT_BY_CREATE) {
-            //主讲人讲观众抱下麦
-            ToastUtil.getInstance().show(LiveRoomActivity.this, getString(R.string.down_mic_by_create_tip));
-            if (presenter != null) {
-                presenter.exitMic();
-            }
-        }
-    }
-
-    @Override
-    public void onUserUnusualLogout(RCUserLogOutUnusualMessage loginOutUnusualMessage) {
-        if (isFinishing() || isDestroyed()) {
-            return;
-        }
-        if (loginOutUnusualMessage == null || !isOwn(loginOutUnusualMessage.getUserId())) {
-            return;
-        }
-        Log.i("pq", "unusual logout");
-        finish();
-    }
-
-    /**
-     * 暂停直播,进行下麦处理
-     */
-    @Override
-    public void onLivePause() {
-        if (isFinishing() || isDestroyed()) {
-            return;
-        }
-        this.liveIsPause = true;
-        ToastUtil.getInstance().show(this, getString(R.string.live_is_pause_str));
-        handleCloseMicEvent();
-        if (mMicManagerDialog != null) {
-            mMicManagerDialog.dismiss();
-        }
-    }
-
-    /**
-     * 点赞数量同步
-     *
-     * @param addLikeMessage
-     */
-    @Override
-    public void onAddLikeMessage(Message message, RCUserSyncAddLikeCountMessage addLikeMessage) {
-        if (isFinishing() || isDestroyed()) {
-            return;
-        }
-        if (TextUtils.equals(message.getSenderUserId(), mImUserId)) {
-            return;
-        }
-        if (addLikeMessage != null) {
-            if (mTvAddLikeCount != null && addLikeMessage != null) {
-//                int counts = addLikeMessage.getCounts();
-//                currentAddLikeCount += counts;
-                currentAddLikeCount = addLikeMessage.getCount();
-                updateAddLikeCountView();
-            }
-        }
-    }
-
-    /**
-     * 获取上麦用户信息成功
-     *
-     * @param friendInfoBean
-     */
-    @Override
-    public void getFriendInfoSuccess(FriendInfoBean friendInfoBean) {
-        if (isFinishing() || isDestroyed()) {
-            return;
-        }
-        if (mLlMicContainer != null && friendInfoBean != null) {
-            mLlMicContainer.updateTargetUserInfo(new UserInfo(friendInfoBean.imFriendId, friendInfoBean.friendNickname, Uri.parse(friendInfoBean.friendAvatar)));
-        }
-    }
-
-    @Override
-    public void onPublishSuccess() {
-        refresh();
-    }
-
-
-    /**
-     * 黑名单状态切换
-     *
-     * @param userId
-     * @param isAddBlack
-     */
-    @Override
-    public void changeBlackUserStatus(String userId, boolean isAddBlack) {
-        if (isFinishing() || isDestroyed()) {
-            return;
-        }
-        if (isOwn(userId)) {
-            isEnableAll = isAddBlack;
-            if (isEnableAll) {
-                //取消连麦
-                if (currentSeatStatus != LiveRoomMsgConstants.MIC_STATUS_NORMAL) {
-                    handleCloseMicEvent();
-                }
-            }
-            updateInputTip();
-        }
-    }
-
-    private boolean isOwn(String targetUserId) {
-        return TextUtils.equals(mImUserId, targetUserId);
-    }
-
-    private void showInviteSeatDialog() {
-        if (mInviteSeatMicTipDialog == null) {
-            mInviteSeatMicTipDialog = new LiveRoomInviteSeatMicTipDialog(this);
-            mInviteSeatMicTipDialog.setViewClickListener(new View.OnClickListener() {
-                @Override
-                public void onClick(View v) {
-                    if (v.getId() == R.id.tv_sure) {
-                        //被邀请连麦->同意连麦
-                        if (presenter != null) {
-                            presenter.handleAction(LiveRoomMsgConstants.ACTION_SEND_CANCEL_SEAT_AGREE_RESPONSE);
-                            presenter.joinMic();
-                        }
-                    }
-                    if (v.getId() == R.id.tv_cancel) {
-                        //被邀请连麦->拒绝连麦
-                        if (presenter != null) {
-                            presenter.handleAction(LiveRoomMsgConstants.ACTION_SEND_CANCEL_SEAT_DISAGREE_RESPONSE);
-                        }
-                        //重置一下连麦状态
-                        handleCloseMicEvent();
-                    }
-                    mInviteSeatMicTipDialog.dismiss();
-                }
-            });
-        }
-        if (!mInviteSeatMicTipDialog.isShowing()) {
-            mInviteSeatMicTipDialog.show();
-        }
-        String defaultNick = "主讲人";
-        if (mRoomInfoBean != null && !TextUtils.isEmpty(mRoomInfoBean.speakerName)) {
-            defaultNick = mRoomInfoBean.speakerName;
-        }
-        mInviteSeatMicTipDialog.setContent(defaultNick);
-    }
-
-    private void refreshAudio(List<RCRTCAudioInputStream> audioInputStreams, List<RCRTCAudioOutputStream> audioOutputStreams) {
-        if (audioInputStreams == null || audioOutputStreams == null) {
-            //参数为空,先获取房间里的全部音频流信息
-            audioInputStreams = new ArrayList<>();
-            audioOutputStreams = new ArrayList<>();
-            presenter.getAudioStreams(audioInputStreams, audioOutputStreams);
-        }
-        ArrayList<String> onMicUserIds = new ArrayList<>();
-        //先处理本地用户
-        for (int i = 0; i < audioOutputStreams.size(); i++) {
-            RCRTCAudioOutputStream audioInputStream = audioOutputStreams.get(i);
-            if (audioInputStream.getMediaType() == RCRTCMediaType.AUDIO) {
-                //音频流判断显示上麦用户
-                String userId = audioInputStream.getUserId();
-                if (mRoomInfoBean != null) {
-                    if (!TextUtils.equals(mRoomInfoBean.speakerId, userId)) {
-                        onMicUserIds.add(userId);
-                    }
-                }
-            }
-        }
-
-        //远端用户的音频流信息
-        for (int i = 0; i < audioInputStreams.size(); i++) {
-            RCRTCAudioInputStream rcrtcAudioInputStream = audioInputStreams.get(i);
-            if (rcrtcAudioInputStream.getMediaType() == RCRTCMediaType.AUDIO) {
-                //音频流判断显示上麦用户
-                String userId = rcrtcAudioInputStream.getUserId();
-                if (mRoomInfoBean != null) {
-                    if (!TextUtils.equals(mRoomInfoBean.speakerId, userId)) {
-                        onMicUserIds.add(userId);
-                    }
-                }
-            }
-        }
-        mLlMicContainer.refreshUI(onMicUserIds);
-    }
-
-    public void updateVideoView(List<RCRTCVideoOutputStream> outputStreams, List<RCRTCVideoInputStream> inputStreams, List<RCRTCAudioInputStream> audioInputStreams, List<RCRTCAudioOutputStream> audioOutputStreams) {
-        mFlLiveView.post(new Runnable() {
-            @Override
-            public void run() {
-                ArrayList<RCRTCVideoStream> videoStreams = new ArrayList<RCRTCVideoStream>();
-                videoStreams.addAll(outputStreams);
-                videoStreams.addAll(inputStreams);
-                ArrayList<RCRTCVideoView> list = new ArrayList<>();
-                boolean isNormalCreateAudioStatus = true;
-                //视频流
-                for (int i = 0; i < videoStreams.size(); i++) {
-                    RCRTCVideoStream rcrtcVideoStream = videoStreams.get(i);
-                    RCRTCVideoView rongRTCVideoView = new RCRTCVideoView(LiveRoomActivity.this);
-                    rcrtcVideoStream.setVideoView(rongRTCVideoView);
-                    list.add(rongRTCVideoView);
-                }
-
-                //音频流
-                for (int i = 0; i < audioInputStreams.size(); i++) {
-                    RCRTCAudioInputStream audioInputStream = audioInputStreams.get(i);
-                    if (audioInputStream.getMediaType() == RCRTCMediaType.AUDIO) {
-                        //音频流判断显示上麦用户
-                        String userId = audioInputStream.getUserId();
-                        if (mRoomInfoBean != null) {
-                            if (TextUtils.equals(mRoomInfoBean.speakerId, userId)) {
-                                //找出主播的音频流
-                                RCRTCResourceState resourceState = audioInputStream.getResourceState();
-                                isNormalCreateAudioStatus = resourceState == RCRTCResourceState.NORMAL;
-                            }
-                        }
-                    }
-                }
-                if (list.size() != 0) {
-                    creatorIsCloseVideoStream = false;
-                    mViewLiveStatus.setVisibility(View.GONE);
-                    checkVideoViewManager();
-                    mVideoViewManager.update(list, isPcClientLive, true);
-                } else {
-                    creatorIsCloseVideoStream = true;
-                    if (isNormalCreateAudioStatus) {
-                        showCloseVideoView();
-                    } else {
-                        //主播关闭了视频流,同时音频流的状态也不是normal状态时
-                        showRestView();
-                    }
-                }
-            }
-        });
-    }
-
-    /**
-     * 检查VideoViewManager是否未null;
-     */
-    private void checkVideoViewManager() {
-        if (mVideoViewManager == null) {
-            mVideoViewManager = new VideoViewManager(mFlLiveView, mFlLiveView.getWidth(), mFlLiveView.getHeight());
-            mVideoViewManager.setRetryClickListener(new View.OnClickListener() {
-                @Override
-                public void onClick(View v) {
-                    if (presenter != null) {
-                        //重新订阅房间的流信息
-                        presenter.subscribeAVStream();
-                    }
-                }
-            });
-        }
-    }
-
-    private boolean findMainScreenStreams(String streamUserId, String streamTag) {
-        if (TextUtils.equals("screenshare", streamTag)) {
-            //屏幕共享流
-            return true;
-        }
-        if (TextUtils.equals(mRoomInfoBean.speakerId, streamUserId)) {
-            return true;
-        }
-        return false;
-    }
-
-    @Override
-    protected void onSaveInstanceState(Bundle outState) {
-        super.onSaveInstanceState(outState);
-        Log.i("LiveRoomActivity", "onSaveInstanceState");
-    }
-
-    @Override
-    public void onBackPressed() {
-        if (liveIsFinish) {
-            super.onBackPressed();
-            return;
-        }
-        boolean permissionOverlay = FloatWindowHelper.requestOverlayPermission(this);
-        if (!permissionOverlay) {
-            showOpenOverlayPermissionTipDialog();
-        } else {
-            if (isFullScreen()) {
-                changeOrientation();
-            } else {
-                showExitLiveTipDialog();
-            }
-        }
-    }
-
-    /**
-     * 退出直播间提示弹窗
-     */
-    private void showExitLiveTipDialog() {
-        LiveRoomCloseTipDialog closeTipDialog = new LiveRoomCloseTipDialog(this);
-        closeTipDialog.setConfirmClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View v) {
-                finish();
-            }
-        });
-        closeTipDialog.show();
-    }
-
-    private void showOpenOverlayPermissionTipDialog() {
-        OpenOverlayPermissionTipDialog overlayPermissionTipDialog = new OpenOverlayPermissionTipDialog(this);
-        overlayPermissionTipDialog.setConfirmClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View v) {
-                overlayPermissionTipDialog.dismiss();
-                Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + getPackageName()));
-                startActivityForResult(intent, FloatWindowHelper.REQUEST_OVERLAY_CODE);
-            }
-        });
-        overlayPermissionTipDialog.show();
-        overlayPermissionTipDialog.setCancelClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View v) {
-                overlayPermissionTipDialog.dismiss();
-                finish();
-            }
-        });
-    }
-
-    @Override
-    protected void onRestoreInstanceState(Bundle savedInstanceState) {
-        super.onRestoreInstanceState(savedInstanceState);
-//        String str =   savedInstanceState.getString("key");
-        Log.i("LiveRoomActivity", "onRestoreInstanceState");
-    }
-
-
-    private int getCurrentOrientation() {
-        return getResources().getConfiguration().orientation;
-    }
-
-    private boolean isFullScreen() {
-        return getCurrentOrientation() == Configuration.ORIENTATION_LANDSCAPE;
-    }
-
-
-    private void startFloatWindowService() {
-        boolean hasPermission = FloatWindowHelper.requestOverlayPermission(this);
-        if (hasPermission) {
-            if (mVideoViewManager != null && mVideoViewManager.getAllVideoViews() != null && mVideoViewManager.getAllVideoViews().size() > 0) {
-                Intent intent = new Intent(this, FloatingWindowService.class);
-                initServiceConnection();
-                intent.putExtra("isPc", isPcClientLive);
-                bindService(intent, serviceConnection, Context.BIND_AUTO_CREATE);
-            }
-        }
-    }
-
-    private void initServiceConnection() {
-        if (serviceConnection == null) {
-            serviceConnection = new ServiceConnection() {
-                @Override
-                public void onServiceConnected(ComponentName name, IBinder service) {
-                    if (service instanceof FloatingWindowService.MyBinder) {
-                        FloatingWindowService.MyBinder mBinder = (FloatingWindowService.MyBinder) service;
-                        if (mVideoViewManager != null) {
-                            ArrayList<RCRTCVideoView> allVideoViews = mVideoViewManager.getAllVideoViews();
-                            mBinder.addVideoView(allVideoViews);
-                        }
-                        mBinder.setOnEventListener(new FloatingWindowService.OnEventListener() {
-                            @Override
-                            public void onServiceDestroy() {
-                                if (mVideoViewManager != null) {
-                                    mVideoViewManager.update(mVideoViewManager.getAllVideoViews(), isPcClientLive, false);
-                                }
-                            }
-
-                            @Override
-                            public void onUnbindService() {
-                                muteAll(true);
-                                unbindService();
-                            }
-                        });
-                    }
-                }
-
-                @Override
-                public void onServiceDisconnected(ComponentName name) {
-                    if (mVideoViewManager != null) {
-                        mVideoViewManager.update(mVideoViewManager.getAllVideoViews(), isPcClientLive, false);
-                    }
-                }
-            };
-        }
-    }
-
-    /**
-     * 是否静音全部
-     *
-     * @param isMute
-     */
-    private void muteAll(boolean isMute) {
-        if (LiveEventHelper.getInstance().getRtcRoom() != null) {
-            RCRTCRoom rtcRoom = LiveEventHelper.getInstance().getRtcRoom();
-            if (rtcRoom.getLocalUser() != null) {
-                LiveEventHelper.getInstance().getRtcRoom().muteAllRemoteAudio(isMute);
-            }
-        }
-    }
-
-
-    @Override
-    protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
-        super.onActivityResult(requestCode, resultCode, data);
-        if (resultCode == RESULT_OK) {
-            if (requestCode == SHARE_CHAT_REQUEST_CODE) {
-                //选择群聊
-                if (targetShareImgFile == null) {
-                    ToastUtil.getInstance().showShort("分享失败");
-                    return;
-                }
-                ShareHelper.parseShareContactData(targetShareImgFile, data);
-                return;
-            }
-        }
-    }
-
-
-    /**
-     * 销毁悬浮窗service
-     */
-    private void unbindService() {
-        if (serviceConnection != null) {
-            try {
-                boolean isExist = AppUtils.isServiceWork(this, FloatingWindowService.CLASS_PATH);
-                if (isExist) {
-                    unbindService(serviceConnection);
-                }
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-        }
-    }
-
-    @Override
-    protected void onPause() {
-        super.onPause();
-        isOnResume = false;
-        sendShowFloatWindowAction(SEND_APP_BACKGROUND_MSG);
-    }
-
-    private void sendShowFloatWindowAction(int what) {
-        android.os.Message message = android.os.Message.obtain();
-        message.what = what;
-        mHandler.sendMessageDelayed(message, SEND_SHOW_FLOAT_WINDOW_TIME);
-    }
-
-    /**
-     * 检查聊天模式
-     */
-    public boolean checkChatMode() {
-        if (liveIsFinish) {
-            ToastUtil.getInstance().show(LiveRoomActivity.this, "直播已结束");
-            return true;
-        }
-        if (isEnableAll) {
-            ToastUtil.getInstance().show(LiveRoomActivity.this, "您已被管理员禁言");
-            return true;
-        }
-        if (isEnableChat) {
-            ToastUtil.getInstance().show(LiveRoomActivity.this, "禁止聊天模式");
-            return true;
-        }
-        return false;
-    }
-
-    /**
-     * 检查mic模式
-     */
-    public boolean checkMicMode() {
-        if (liveIsPause) {
-            ToastUtil.getInstance().show(LiveRoomActivity.this, "老师暂停中,暂时无法接受邀请");
-            return true;
-        }
-        if (liveIsFinish) {
-            ToastUtil.getInstance().show(LiveRoomActivity.this, "直播已结束");
-            return true;
-        }
-        if (isEnableAll) {
-            ToastUtil.getInstance().show(LiveRoomActivity.this, "您已被管理员禁言");
-            return true;
-        }
-        if (isEnableMic) {
-            ToastUtil.getInstance().show(LiveRoomActivity.this, getString(R.string.enable_mic_mode_tip));
-            return true;
-        }
-        return false;
-    }
-
-    @Override
-    public void receiveJoinMessage(RCChatJoinRoomMessage joinRoomMessage) {
-        //收到加入房间消息
-        if (isFinishing() || isDestroyed()) {
-            return;
-        }
-        if (joinRoomMessage == null) {
-            return;
-        }
-        if (isCanShowBarrage()) {
-            mTvJoinBarrage.setText(getString(R.string.enter_live_tip_str, LiveMemberHelper.getMessageName(joinRoomMessage)));
-            showBarrageViewAnim(mFlJoinBarrage);
-        }
-    }
-
-    //老师重新加入房间重置一下连麦状态,假如是连麦中的状态
-    private void resetMicStatus(RCChatJoinRoomMessage joinRoomMessage) {
-        if (!isOnApplyMic()) {
-            return;
-        }
-        String joinUserId = joinRoomMessage.getUserId();
-        if (TextUtils.isEmpty(joinUserId)) {
-            if (joinRoomMessage.getUserInfo() != null) {
-                joinUserId = joinRoomMessage.getUserInfo().getUserId();
-            }
-        }
-        if (!TextUtils.isEmpty(joinUserId) && mRoomInfoBean != null) {
-            if (TextUtils.equals(joinUserId, mRoomInfoBean.speakerId)) {
-                //老师加入直播,重置连麦申请中状态
-                if (isOnApplyMic()) {
-                    updateMicIcon(LiveRoomMsgConstants.MIC_STATUS_NORMAL);
-                }
-            }
-        }
-    }
-
-    /**
-     * 显示弹幕消息
-     */
-    private void showBarrageViewAnim(View targetView) {
-        if (mFlJoinBarrage.getVisibility() == View.VISIBLE || mFlSnapUpBarrage.getVisibility() == View.VISIBLE) {
-            return;
-        }
-        LiveRoomAnimatorHelper.getInstance().startBarrageViewAnimation(this, targetView);
-        hideBarrageView();
-    }
-
-    /**
-     * 隐藏弹幕消息
-     */
-    private void hideBarrageView() {
-        mHandler.postDelayed(new Runnable() {
-            @Override
-            public void run() {
-                if (mFlJoinBarrage != null) {
-                    mFlJoinBarrage.setVisibility(View.GONE);
-                }
-                if (mFlSnapUpBarrage != null) {
-                    mFlSnapUpBarrage.setVisibility(View.GONE);
-                }
-            }
-        }, LiveConfig.LIVE_HIDE_BARRAGE_VIEW_TIME);
-    }
-
-    @Override
-    public void receiveSnapUpMessage(RCOnSnappingUpMessage onSnappingUpMessage) {
-        //收到抢购消息
-        if (isFinishing() || isDestroyed()) {
-            return;
-        }
-        if (onSnappingUpMessage == null) {
-            return;
-        }
-        if (isCanShowBarrage()) {
-            mTvSnapUpBarrage.setText(getString(R.string.live_snap_up_tip_str, LiveMemberHelper.getMessageName(onSnappingUpMessage)));
-            showBarrageViewAnim(mFlSnapUpBarrage);
-        }
-    }
-
-    /**
-     * 判断是否显示弹幕消息
-     *
-     * @return
-     */
-    private boolean isCanShowBarrage() {
-        if (isFullScreen()) {
-            return false;
-        }
-        return mFlJoinBarrage.getVisibility() != View.VISIBLE && mFlSnapUpBarrage.getVisibility() != View.VISIBLE;
-    }
-
-    private void shareLive(File imgfile) {
-        if (mLiveRoomShareDialog != null && mLiveRoomShareDialog.isShowing()) {
-            mLiveRoomShareDialog.dismiss();
-        }
-        this.targetShareImgFile = imgfile;
-        ShareAction ShareAction = new ShareAction(this).setDisplayList(
-                SHARE_MEDIA.WEIXIN, SHARE_MEDIA.WEIXIN_CIRCLE, SHARE_MEDIA.SINA)
-                .setShareboardclickCallback(new ShareBoardlistener() {
-                    @Override
-                    public void onclick(SnsPlatform snsPlatform, SHARE_MEDIA share_media) {
-
-                        if (share_media == null) {
-                            if (TextUtils.equals(snsPlatform.mKeyword, "chat")) {
-                                //分享群聊
-                                ARouter.getInstance().build(TCChatRouterPath.CHAT_SELECT_CONTACT)
-                                        .navigation(LiveRoomActivity.this, SHARE_CHAT_REQUEST_CODE);
-                            }
-                        } else {
-                            if (!UMShareAPI.get(getApplicationContext()).isInstall(LiveRoomActivity.this, share_media)) {
-                                ToastUtil.getInstance().show(getApplicationContext(), "应用未安装,分享失败");
-                                return;
-                            }
-                            UMImage image = new UMImage(LiveRoomActivity.this, imgfile);//bitmap文件
-                            image.setThumb(image);
-                            image.compressStyle = UMImage.CompressStyle.SCALE;
-                            new ShareAction(LiveRoomActivity.this).withMedia(image)
-                                    .setPlatform(share_media)
-                                    .setCallback(LiveRoomActivity.this)
-                                    .share();
-                        }
-                    }
-                });
-        ShareAction.addButton("群聊", "chat", "icon_share_chat_group", "icon_share_chat_group");
-        ShareAction.open();
-    }
-
-    @Override
-    public void onDestroy() {
-        if (presenter != null) {
-            //通知离开房间
-            presenter.notifyLeaveRoomAction();
-        }
-        super.onDestroy();
-        if (connectStatusListener != null) {
-            IMCenter.getInstance().removeConnectionStatusListener(connectStatusListener);
-        }
-        //取消动画
-        if (hideHeaderInfoAnim != null) {
-            hideHeaderInfoAnim.cancel();
-            hideHeaderInfoAnim = null;
-        }
-
-        if (showHeaderInfoAnim != null) {
-            showHeaderInfoAnim.cancel();
-            showHeaderInfoAnim = null;
-        }
-        SoftKeyboardUtil.unregisterSoftInputChangedListener(getWindow());
-        LiveRoomAnimatorHelper.getInstance().releaseAnimator();
-        LiveRoomAddLikeHelper.getInstance().release();
-        LiveEventHelper.getInstance().unRegister();
-        RCRTCAudioRouteManager.getInstance().unInit();
-        if (mHandler != null) {
-            mHandler.removeCallbacksAndMessages(null);
-        }
-        if (mVideoViewManager != null) {
-            mVideoViewManager.onRelease();
-        }
-    }
-
-    @Override
-    public void onSoftInputChanged(int height) {
-        Log.i("pq", "height" + height);
-        if (height == 0) {
-            //软键盘隐藏
-            Log.i("pq", "SoftInput hide");
-            if (mInputBarDialog != null && mInputBarDialog.isShowing()) {
-                mInputBarDialog.dismiss();
-            }
-        } else {
-            //软键盘弹出
-            Log.i("pq", "SoftInput show");
-        }
-    }
-
-
-    //分享回调
-    @Override
-    public void onStart(SHARE_MEDIA share_media) {
-
-    }
-
-    @Override
-    public void onResult(SHARE_MEDIA platform) {
-        //分享成功
-        if (platform.name().equals("WEIXIN_FAVORITE")) {
-            ToastUtil.getInstance().showShort("收藏成功啦");
-        } else {
-            if (platform != SHARE_MEDIA.MORE && platform != SHARE_MEDIA.SMS
-                    && platform != SHARE_MEDIA.EMAIL
-                    && platform != SHARE_MEDIA.FLICKR
-                    && platform != SHARE_MEDIA.FOURSQUARE
-                    && platform != SHARE_MEDIA.TUMBLR
-                    && platform != SHARE_MEDIA.POCKET
-                    && platform != SHARE_MEDIA.PINTEREST
-
-                    && platform != SHARE_MEDIA.INSTAGRAM
-                    && platform != SHARE_MEDIA.GOOGLEPLUS
-                    && platform != SHARE_MEDIA.YNOTE
-                    && platform != SHARE_MEDIA.EVERNOTE) {
-                ToastUtil.getInstance().showShort("分享成功啦");
-            }
-
-        }
-    }
-
-    @Override
-    public void onError(SHARE_MEDIA platform, Throwable throwable) {
-        if (platform != SHARE_MEDIA.MORE && platform != SHARE_MEDIA.SMS
-                && platform != SHARE_MEDIA.EMAIL
-                && platform != SHARE_MEDIA.FLICKR
-                && platform != SHARE_MEDIA.FOURSQUARE
-                && platform != SHARE_MEDIA.TUMBLR
-                && platform != SHARE_MEDIA.POCKET
-                && platform != SHARE_MEDIA.PINTEREST
-
-                && platform != SHARE_MEDIA.INSTAGRAM
-                && platform != SHARE_MEDIA.GOOGLEPLUS
-                && platform != SHARE_MEDIA.YNOTE
-                && platform != SHARE_MEDIA.EVERNOTE) {
-            ToastUtil.getInstance().showShort("分享失败啦");
-
-        }
-    }
-
-    @Override
-    public void onCancel(SHARE_MEDIA share_media) {
-        ToastUtil.getInstance().showShort("分享取消了");
-    }
-
-    private boolean isShowShare() {
-        if (TextUtils.equals(mRoomInfoBean.roomType, "TEMP")) {
-            return true;
-        }
-        return false;
-    }
-}
+//package com.cooleshow.student.ui.live;
+//
+//import android.Manifest;
+//import android.animation.ObjectAnimator;
+//import android.content.ComponentName;
+//import android.content.Context;
+//import android.content.DialogInterface;
+//import android.content.Intent;
+//import android.content.ServiceConnection;
+//import android.content.pm.ActivityInfo;
+//import android.content.res.Configuration;
+//import android.graphics.Color;
+//import android.net.Uri;
+//import android.os.Bundle;
+//import android.os.Handler;
+//import android.os.IBinder;
+//import android.os.Looper;
+//import android.provider.Settings;
+//import android.text.TextUtils;
+//import android.util.Log;
+//import android.view.View;
+//import android.view.WindowManager;
+//import android.widget.FrameLayout;
+//import android.widget.ImageView;
+//import android.widget.LinearLayout;
+//import android.widget.RelativeLayout;
+//import android.widget.TextView;
+//import android.widget.Toast;
+//
+//import com.airbnb.lottie.LottieAnimationView;
+//import com.alibaba.android.arouter.facade.annotation.Route;
+//import com.alibaba.android.arouter.launcher.ARouter;
+//import com.bumptech.glide.Glide;
+//import com.cooleshow.base.common.WebConstants;
+//import com.cooleshow.base.constanst.EventConstants;
+//import com.cooleshow.base.data.net.ApiException;
+//import com.cooleshow.base.router.RouterPath;
+//import com.cooleshow.base.ui.activity.BaseMVPActivity;
+//import com.cooleshow.base.utils.AppUtils;
+//import com.cooleshow.base.utils.PermissionUtils;
+//import com.cooleshow.base.utils.SizeUtils;
+//import com.cooleshow.base.utils.SoftKeyboardUtil;
+//import com.cooleshow.base.utils.ToastUtil;
+//import com.cooleshow.base.utils.UiUtils;
+//import com.cooleshow.base.utils.Utils;
+//import com.cooleshow.base.widgets.InputBar;
+//import com.cooleshow.base.widgets.dialog.CommonConfirmDialog;
+//import com.cooleshow.chatmodule.constants.TCChatRouterPath;
+//import com.cooleshow.student.bean.FriendInfoBean;
+//import com.cooleshow.student.helper.EventHelper;
+//import com.cooleshow.student.helper.ShareHelper;
+//import com.cooleshow.student.ui.live.floatPop.FloatWindowHelper;
+//import com.cooleshow.student.ui.live.floatPop.FloatingWindowService;
+//import com.cooleshow.student.widgets.dialog.LiveRoomCloseTipDialog;
+//import com.cooleshow.student.widgets.dialog.LiveRoomMicManagerDialog;
+//import com.cooleshow.student.widgets.dialog.LiveRoomShareDialog;
+//import com.cooleshow.student.widgets.dialog.OpenOverlayPermissionTipDialog;
+//import com.cooleshow.student.widgets.helper.LiveRoomAddLikeHelper;
+//import com.cooleshow.base.widgets.dialog.InputBarDialog;
+//import com.cooleshow.student.R;
+//import com.cooleshow.student.adapter.MessageAdapter;
+//import com.cooleshow.student.bean.LiveRoomInfoBean;
+//import com.cooleshow.student.contract.LiveRoomContract;
+//import com.cooleshow.student.databinding.ActivityLiveroomLayoutBinding;
+//import com.cooleshow.student.presenter.live.LiveRoomPresenter;
+//import com.rong.io.live.helper.LiveMemberHelper;
+//import com.rong.io.live.helper.LiveMessageHelper;
+//import com.rong.io.live.helper.LiveRTCEngineInitHelper;
+//import com.cooleshow.student.widgets.dialog.LiveRoomCloseMicTipDialog;
+//import com.cooleshow.student.widgets.dialog.LiveRoomClosePageOnMicTipDialog;
+//import com.cooleshow.student.widgets.dialog.LiveRoomInviteSeatMicTipDialog;
+//import com.cooleshow.student.widgets.dialog.LiveRoomShopCarDialog;
+//import com.cooleshow.student.widgets.helper.LiveRoomAnimatorHelper;
+//import com.cooleshow.usercenter.helper.UserHelper;
+//import com.rong.io.live.LiveRoomMsgConstants;
+//import com.rong.io.live.config.LiveConfig;
+//import com.rong.io.live.helper.LiveEventHelper;
+//import com.rong.io.live.message.RCChatJoinRoomMessage;
+//import com.rong.io.live.message.RCOnSnappingUpMessage;
+//import com.rong.io.live.message.RCUserKickOutMessage;
+//import com.rong.io.live.message.RCUserLogOutUnusualMessage;
+//import com.rong.io.live.message.RCUserSeatApplyMessage;
+//import com.rong.io.live.message.RCUserSeatResponseMessage;
+//import com.rong.io.live.message.RCUserSyncAddLikeCountMessage;
+//import com.rong.io.live.widget.LiveRoomMicIconView;
+//
+//import org.json.JSONException;
+//import org.json.JSONObject;
+//
+//import java.io.File;
+//import java.util.ArrayList;
+//import java.util.List;
+//
+//import androidx.annotation.NonNull;
+//import androidx.annotation.Nullable;
+//import androidx.constraintlayout.widget.ConstraintLayout;
+//import androidx.constraintlayout.widget.ConstraintSet;
+//import androidx.constraintlayout.widget.Group;
+//import androidx.recyclerview.widget.LinearLayoutManager;
+//import androidx.recyclerview.widget.RecyclerView;
+//import cn.rongcloud.rtc.api.RCRTCAudioRouteManager;
+//import cn.rongcloud.rtc.api.RCRTCRemoteUser;
+//import cn.rongcloud.rtc.api.RCRTCRoom;
+//import cn.rongcloud.rtc.api.RCRTCVideoStream;
+//import cn.rongcloud.rtc.api.stream.RCRTCAudioInputStream;
+//import cn.rongcloud.rtc.api.stream.RCRTCAudioOutputStream;
+//import cn.rongcloud.rtc.api.stream.RCRTCInputStream;
+//import cn.rongcloud.rtc.api.stream.RCRTCVideoInputStream;
+//import cn.rongcloud.rtc.api.stream.RCRTCVideoOutputStream;
+//import cn.rongcloud.rtc.api.stream.RCRTCVideoView;
+//import cn.rongcloud.rtc.base.RCRTCLiveRole;
+//import cn.rongcloud.rtc.base.RCRTCMediaType;
+//import cn.rongcloud.rtc.base.RCRTCResourceState;
+//import de.hdodenhof.circleimageview.CircleImageView;
+//import io.reactivex.rxjava3.disposables.Disposable;
+//import io.rong.imkit.IMCenter;
+//import io.rong.imlib.IRongCoreCallback;
+//import io.rong.imlib.IRongCoreEnum;
+//import io.rong.imlib.RongIMClient;
+//import io.rong.imlib.model.Conversation;
+//import io.rong.imlib.model.Message;
+//import io.rong.imlib.model.MessageContent;
+//import io.rong.imlib.model.UserInfo;
+//import io.rong.message.TextMessage;
+//
+//import com.cooleshow.student.widgets.helper.VideoViewManager;
+//import com.tbruyelle.rxpermissions3.RxPermissions;
+//import com.umeng.socialize.ShareAction;
+//import com.umeng.socialize.UMShareAPI;
+//import com.umeng.socialize.UMShareListener;
+//import com.umeng.socialize.bean.SHARE_MEDIA;
+//import com.umeng.socialize.media.UMImage;
+//import com.umeng.socialize.shareboard.SnsPlatform;
+//import com.umeng.socialize.utils.ShareBoardlistener;
+//
+///**
+// * Author by pq, Date on 2022/3/29.
+// */
+//
+//@Route(path = RouterPath.LiveCenter.ACTIVITY_LIVE_ROOM)
+//public class LiveRoomActivity extends BaseMVPActivity<ActivityLiveroomLayoutBinding, LiveRoomPresenter> implements View.OnClickListener, LiveRoomContract.view, SoftKeyboardUtil.OnSoftInputChangedListener, UMShareListener {
+//    public static final int SEND_SHOW_FLOAT_WINDOW_TIME = 1000;//退到后台以后检查是否显示悬浮窗等待时长
+//    public static final int SEND_APP_BACKGROUND_MSG = 1001;//退到后台消息
+//    public static final int SEND_JUMP_OTHER_PAGE_MSG = 1002;//页面切换消息(购物车详情页等等)
+//    public static final int OPEN_SHOP_CAR_DIALOG = 1003;//打开购物车
+//    public static final int LIVE_STATUS_IS_REST = 1;//休息一下,马上回来
+//    public static final int LIVE_STATUS_IS_CLOSE_VIDEO = 2;//主持人关闭画面
+//    public static final int LIVE_STATUS_IS_OFFLINE = 3;//直播已结束
+//    public static final int SHARE_CHAT_REQUEST_CODE = 500;//分享群聊requestcode
+//    private File targetShareImgFile = null;
+//    ConstraintLayout content_view;
+//    RelativeLayout mFlLiveView;
+//    LinearLayout ll_like;
+//    RecyclerView mRecyclerMsg;
+//    TextView mTvNumPeople;
+//    ImageView iv_mic;
+//    LiveRoomMicIconView mLlMicContainer;
+//    TextView mTvAddLikeCount;
+//    CircleImageView mIvAvatar;
+//    TextView mTvRoomCreateName;
+//    Group mGroupViews;
+//    ConstraintLayout mViewLiveStatus;
+//    ImageView mIvLiveStatusCenterIcon;
+//    TextView mTvLiveStatusTipText;
+//    ImageView mIvSwitchVideoOrientation;
+//    ImageView mIvSwitchVideoOrientationFull;
+//    ConstraintLayout cs_header_info;
+//    LottieAnimationView mViewShopCarAnim;
+//    ImageView mIvShopCar;
+//    ImageView mIvClose;
+//    TextView tv_input;
+//    FrameLayout mFlJoinBarrage;
+//    TextView mTvJoinBarrage;
+//    FrameLayout mFlSnapUpBarrage;
+//    TextView mTvSnapUpBarrage;
+//
+//    private LiveRoomInfoBean mRoomInfoBean;
+//    private String mRoomId;
+//    private MessageAdapter mMessageAdapter;
+//    private LinearLayoutManager mLinearLayoutManager;
+//    private boolean isEnableChat = false;//默认不禁止
+//    private boolean isEnableMic = false;//默认不禁止
+//    private boolean isEnableAll = false;//默认不禁止 黑名单状态
+//    private InputBarDialog mInputBarDialog;
+//    private boolean isPcClientLive = true;//默认为PC端直播
+//    private int currentSeatStatus = LiveRoomMsgConstants.MIC_STATUS_NORMAL;//1未连麦,2连麦中,3连麦成功
+//    private LiveRoomCloseMicTipDialog mRoomCloseMicTipDialog;
+//    private LiveRoomInviteSeatMicTipDialog mInviteSeatMicTipDialog;
+//    private int currentAddLikeCount = 0;//当前点赞数量
+//    private boolean creatorIsCloseAudioStream = false;
+//    private boolean creatorIsCloseVideoStream = false;
+//    private String createRoomId = "";
+//    private static final String ROOMID_KEY = "roomid_key";
+//    private String mUserId;
+//    private String mImUserId;
+//    private boolean connectStatusIsPaused = false;
+//    private boolean isNeedRefresh = false;//是否需要重新刷新房间信息
+//    private boolean liveIsFinish = false;//直播间是否已结束
+//    private boolean liveIsPause = false;//直播间是否已暂停
+//    private ServiceConnection serviceConnection;
+//    private ObjectAnimator hideHeaderInfoAnim;
+//    private ObjectAnimator showHeaderInfoAnim;
+//    private boolean isOnResume = true;
+//    private boolean isAutoScrollToLast = true;
+//    private Handler mHandler = new Handler(Looper.myLooper()) {
+//        @Override
+//        public void handleMessage(@NonNull android.os.Message msg) {
+//            if (msg.what == SEND_APP_BACKGROUND_MSG) {
+//                //APP切换后台
+//                //开启悬浮窗
+//                if (!isOnResume && AppUtils.isApplicationInBackground(LiveRoomActivity.this)) {
+//                    startFloatWindowService();
+//                }
+//                return;
+//            }
+//            if (msg.what == SEND_JUMP_OTHER_PAGE_MSG) {
+//                //跳转其他页面时候
+//                //开启悬浮窗
+//                if (isOnResume) {
+//                    //如果页面onResume了,就不开启service
+//                    return;
+//                }
+//                startFloatWindowService();
+//                return;
+//            }
+//
+//            if (msg.what == OPEN_SHOP_CAR_DIALOG) {
+//                showShopCarDialog();
+//                return;
+//            }
+//        }
+//    };
+//    private RongIMClient.ConnectionStatusListener connectStatusListener = new RongIMClient.ConnectionStatusListener() {
+//        @Override
+//        public void onChanged(ConnectionStatus status) {
+//            Log.i("pq", "LiveRoomActivity receive ConnectionStatus:" + status);
+//            if (status == ConnectionStatus.KICKED_OFFLINE_BY_OTHER_CLIENT
+//                    || status == ConnectionStatus.SIGN_OUT || status == ConnectionStatus.TIMEOUT) {
+//                finish();
+//            }
+//            if (status == ConnectionStatus.CONNECTED) {
+//                //IM连接成功
+//                if (presenter != null && isNeedRefresh) {
+//                    connectStatusIsPaused = false;
+//                    presenter.init(mRoomId, false);
+//                }
+//            } else {
+//                //其他状态的时候需要重新刷新房间信息
+//                isNeedRefresh = true;
+//            }
+//            if (status == ConnectionStatus.NETWORK_UNAVAILABLE) {
+//                //网络不可用
+//                ToastUtil.getInstance().showShort("您的网络已断开,请检查网络~");
+//            }
+//            if (status == ConnectionStatus.SUSPEND) {
+//                connectStatusIsPaused = true;
+//            }
+//        }
+//    };
+//    private LiveRoomClosePageOnMicTipDialog mLiveRoomClosePageOnMicTipDialog;
+//    private VideoViewManager mVideoViewManager;
+//    private LiveRoomShopCarDialog mShopCarDialog;
+//    private LiveRoomMicManagerDialog mMicManagerDialog;
+//    private LiveRoomShareDialog mLiveRoomShareDialog;
+//
+//    public static void startLiveRoomActivity(Context context, String roomid) {
+//        Intent intent = new Intent(context, LiveRoomActivity.class);
+//        intent.putExtra(ROOMID_KEY, roomid);
+//        context.startActivity(intent);
+//    }
+//
+//    @Override
+//    protected void onCreate(Bundle savedInstanceState) {
+//        getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
+//        super.onCreate(savedInstanceState);
+//        //事件埋点->进入直播间
+//        EventHelper.addEvent(EventConstants.EVENT_ID_LIVE);
+//    }
+//
+//    @Override
+//    protected void initView() {
+//        content_view = viewBinding.contentView;
+//        mFlLiveView = viewBinding.flLiveView;
+//        ll_like = viewBinding.llLike;
+//        mRecyclerMsg = viewBinding.recyclerMsg;
+//        mTvNumPeople = viewBinding.tvNumPeople;
+//        iv_mic = viewBinding.ivMic;
+//        mLlMicContainer = viewBinding.llMicContainer;
+//        mTvAddLikeCount = viewBinding.tvAddLikeCount;
+//        mIvAvatar = viewBinding.ivAvatar;
+//        mTvRoomCreateName = viewBinding.tvRoomAuthorName;
+//        mGroupViews = viewBinding.groupViews;
+//        mViewLiveStatus = viewBinding.viewLiveStatus.csRootLiveStatus;
+//        mIvLiveStatusCenterIcon = viewBinding.viewLiveStatus.ivCenterIcon;
+//        mTvLiveStatusTipText = viewBinding.viewLiveStatus.tvLiveStatusTipText;
+//        mIvSwitchVideoOrientation = viewBinding.ivSwitchVideoOrientation;
+//        mIvSwitchVideoOrientationFull = viewBinding.ivSwitchVideoOrientationFull;
+//        cs_header_info = viewBinding.csHeaderInfo;
+//        mViewShopCarAnim = viewBinding.viewShopCarAnim;
+//        mIvShopCar = viewBinding.ivShopCar;
+//        mIvClose = viewBinding.ivClose;
+//        tv_input = viewBinding.tvInput;
+//        mFlJoinBarrage = viewBinding.flJoinBarrage;
+//        mTvJoinBarrage = viewBinding.tvJoinBarrage;
+//        mFlSnapUpBarrage = viewBinding.flSnapUpBarrage;
+//        mTvSnapUpBarrage = viewBinding.tvSnapUpBarrage;
+//        initListener();
+//    }
+//
+//    private void initListener() {
+//        mIvClose.setOnClickListener(this);
+//        mIvSwitchVideoOrientation.setOnClickListener(this);
+//        mIvSwitchVideoOrientationFull.setOnClickListener(this);
+//        tv_input.setOnClickListener(this);
+//        iv_mic.setOnClickListener(this);
+//        viewBinding.iconAddLike.setOnClickListener(this);
+//        mViewLiveStatus.setOnClickListener(this);
+//        mViewShopCarAnim.setOnClickListener(this);
+//        mFlLiveView.setOnClickListener(this);
+//        viewBinding.tvAppointmentCourse.setOnClickListener(this);
+//        viewBinding.tvLiveCourse.setOnClickListener(this);
+//        viewBinding.tvVideoCourse.setOnClickListener(this);
+//        viewBinding.tvMusicSheet.setOnClickListener(this);
+//        viewBinding.ivAvatar.setOnClickListener(this);
+//        viewBinding.ivShare.setOnClickListener(this);
+//
+//        mRecyclerMsg.addOnScrollListener(new RecyclerView.OnScrollListener() {
+//            @Override
+//            public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
+//                super.onScrollStateChanged(recyclerView, newState);
+//                if (mLinearLayoutManager == null || mMessageAdapter == null) {
+//                    return;
+//                }
+//                int lastCompletelyVisibleItemPosition = mLinearLayoutManager.findLastCompletelyVisibleItemPosition();
+//                if (lastCompletelyVisibleItemPosition == mMessageAdapter.getMessageSize() - 1) {
+//                    isAutoScrollToLast = true;
+//                } else {
+//                    isAutoScrollToLast = false;
+//                }
+//            }
+//        });
+//    }
+//
+//    @Override
+//    protected ActivityLiveroomLayoutBinding getLayoutView() {
+//        return ActivityLiveroomLayoutBinding.inflate(getLayoutInflater());
+//    }
+//
+//
+//    @Override
+//    public void initData() {
+//        super.initData();
+//        mRoomId = getIntent().getStringExtra(ROOMID_KEY);
+//        if (TextUtils.isEmpty(mRoomId)) {
+//            ToastUtil.getInstance().show(this, "房间id不可为空");
+//            finish();
+//            return;
+//        }
+//        String userToken = UserHelper.getUserToken();
+//        if (TextUtils.isEmpty(userToken)) {
+//            finish();
+//            return;
+//        }
+//        if (LiveConfig.isNeedReInitRTC) {
+//            //检查是否需要重新初始化RTC
+//            LiveRTCEngineInitHelper.initRTC();
+//        }
+//        // 初始化音频路由管理类
+//        RCRTCAudioRouteManager.getInstance().init(Utils.getApp());
+//        mFlLiveView.post(new Runnable() {
+//            @Override
+//            public void run() {
+//                checkVideoViewManager();
+//            }
+//        });
+//        mUserId = UserHelper.getUserId();
+//        mImUserId = UserHelper.getImUserId();
+//        mMessageAdapter = new MessageAdapter(this);
+//        mLinearLayoutManager = new LinearLayoutManager(this, RecyclerView.VERTICAL, false);
+//        mRecyclerMsg.setLayoutManager(mLinearLayoutManager);
+//        mRecyclerMsg.setAdapter(mMessageAdapter);
+//        IMCenter.getInstance().addConnectionStatusListener(connectStatusListener);
+//        SoftKeyboardUtil.registerSoftInputChangedListener(getWindow(), this);
+//        mLlMicContainer.setOnEventListener(new LiveRoomMicIconView.OnEventListener() {
+//            @Override
+//            public void getUserInfoByUserId(String userId) {
+//                if (presenter != null) {
+//                    presenter.getUserInfoByUserId(userId);
+//                }
+//            }
+//        });
+//        checkNeedPermission();
+//    }
+//
+//    private void checkNeedPermission() {
+//        Disposable disposable = new RxPermissions(LiveRoomActivity.this)
+//                .request(Manifest.permission.RECORD_AUDIO, Manifest.permission.WRITE_EXTERNAL_STORAGE
+//                        , Manifest.permission.CAMERA)
+//                .subscribe(permission -> {
+//                    if (permission) {
+//                        prepareInitRoom();
+//                    } else {
+//                        CommonConfirmDialog confirmDialog = new CommonConfirmDialog(LiveRoomActivity.this);
+//                        confirmDialog.show();
+//                        confirmDialog.setContent("直播需要麦克风、摄像头、储存权限,去设置?");
+//                        confirmDialog.setConfirmText("去设置");
+//                        confirmDialog.setOnConfirmClickListener(new View.OnClickListener() {
+//                            @Override
+//                            public void onClick(View v) {
+//                                PermissionUtils.toSelfSetting(LiveRoomActivity.this);
+//                            }
+//                        });
+//                    }
+//                });
+//    }
+//
+//    private void prepareInitRoom() {
+//        //根据融云的IM连接状态判断是否需要获取房间信息
+//        RongIMClient.ConnectionStatusListener.ConnectionStatus currentConnectionStatus = RongIMClient.getInstance().getCurrentConnectionStatus();
+//        if (currentConnectionStatus == RongIMClient.ConnectionStatusListener.ConnectionStatus.CONNECTED) {
+//            isNeedRefresh = false;
+//            if (presenter != null) {
+//                presenter.init(mRoomId, false);
+//            }
+//        } else {
+//            //如果IM未连接,等待connectStatusListener回调
+//            isNeedRefresh = true;
+//            if (presenter != null) {
+//                presenter.connectIM();
+//            }
+//        }
+//    }
+//
+//
+//    public void onClick(View view) {
+//        int id = view.getId();
+//        if (id == R.id.view_live_status) {
+//            return;
+//        }
+//        if (id == R.id.iv_close) {
+//            if (currentSeatStatus != LiveRoomMsgConstants.MIC_STATUS_NORMAL) {
+//                showPageCloseOnMicTipDialog();
+//            } else {
+//                close();
+//            }
+//        }
+//        if (id == R.id.iv_switch_video_orientation) {
+//            //切换横竖屏
+//            if (mShopCarDialog != null && mShopCarDialog.isShowing()) {
+//                return;
+//            }
+//            changeOrientation();
+//            return;
+//        }
+//
+//        if (id == R.id.iv_switch_video_orientation_full) {
+//            //横屏切换竖屏
+//            changeOrientation();
+//            return;
+//        }
+//        if (id == R.id.tv_input) {
+//            //底部输入框
+//            showInputDialog();
+//            return;
+//        }
+//        if (id == R.id.iv_mic) {
+//            //连麦
+//            if (!isOnMic()) {
+//                //非连麦中才判断模式
+//                if (checkMicMode()) {
+//                    return;
+//                }
+//                if (connectStatusIsPaused) {
+//                    //连接状态异常,暂停连麦
+//                    return;
+//                }
+//            }
+//            showMicManagerDialog();
+//            return;
+//        }
+//
+//        if (id == R.id.icon_add_like) {
+//            if (checkAddLikeMode()) {
+//                return;
+//            }
+//            //点赞
+//            LiveRoomAddLikeHelper.getInstance().handleClick(new LiveRoomAddLikeHelper.OnAddLikeResultCallBack() {
+//                @Override
+//                public void onResult(int count) {
+//                    if (presenter != null) {
+//                        presenter.setAddLikeCount(count);
+//                        presenter.handleAction(LiveRoomMsgConstants.ACTION_SEND_ADD_LIKE_COUNT);
+//                    }
+//                }
+//            });
+//            LiveRoomAnimatorHelper.getInstance().startAddLikeAnimation(LiveRoomActivity.this, content_view);
+//            return;
+//        }
+//
+//        if (id == R.id.view_shop_car_anim) {
+//            if (liveIsFinish) {
+//                //直播已结束,不可点击购物车
+//                ToastUtil.getInstance().show(LiveRoomActivity.this, "直播已结束");
+//                return;
+//            }
+//            if (viewBinding.llShopCarMenu.getVisibility() != View.VISIBLE) {
+//                viewBinding.llShopCarMenu.setVisibility(View.VISIBLE);
+//            } else {
+//                viewBinding.llShopCarMenu.setVisibility(View.GONE);
+//            }
+//            return;
+//        }
+//
+//        if (id == R.id.fl_live_view) {
+//            //点击隐藏头部信息
+//            if (isFullScreen()) {
+//                //全屏模式下
+//                handleHeaderAnim();
+//            }
+//            return;
+//        }
+//
+//        if (id == R.id.iv_avatar) {
+//            //跳转老师主页
+//            if (mRoomInfoBean != null) {
+//                ARouter.getInstance()
+//                        .build(RouterPath.WebCenter.ACTIVITY_HTML)
+//                        .withString(WebConstants.WEB_URL, WebConstants.STUDENT_TEACHER_HOME + mRoomInfoBean.speakerId)
+//                        .navigation();
+//            }
+//            return;
+//        }
+//
+//        if (id == R.id.tv_appointment_course || id == R.id.tv_live_course
+//                || id == R.id.tv_video_course || id == R.id.tv_music_sheet) {
+//            //约课 直播课 视频课 曲谱
+//            startTeacherHomePage(id);
+//            sendShowFloatWindowAction(SEND_JUMP_OTHER_PAGE_MSG);
+//            return;
+//        }
+//
+//        if (id == R.id.iv_share) {
+//            //分享直播间
+//            showShareDialog();
+//            return;
+//        }
+//    }
+//
+//    private void showShareDialog() {
+//        if (mRoomInfoBean == null) {
+//            return;
+//        }
+//        if (mLiveRoomShareDialog == null) {
+//            mLiveRoomShareDialog = new LiveRoomShareDialog(this);
+//            mLiveRoomShareDialog.setOnEventListener(new LiveRoomShareDialog.OnEventListener() {
+//                @Override
+//                public void onShare(File file) {
+//                    shareLive(file);
+//                }
+//            });
+//        }
+//        if (!mLiveRoomShareDialog.isShowing()) {
+//            mLiveRoomShareDialog.show();
+//        }
+//        mLiveRoomShareDialog.setData(mRoomInfoBean.speakerPic, mRoomInfoBean.speakerName, mRoomInfoBean.roomUid);
+//    }
+//
+//    private void showMicManagerDialog() {
+//        if (mMicManagerDialog == null) {
+//            mMicManagerDialog = new LiveRoomMicManagerDialog(this);
+//            mMicManagerDialog.setOnEventListener(new LiveRoomMicManagerDialog.OnEventListener() {
+//                @Override
+//                public void onApplyMic() {
+//                    //申请连麦
+//                    handleMicEvent();
+//                    mMicManagerDialog.setMicStatus(LiveRoomMsgConstants.MIC_STATUS_CONNECTING);
+//                    mMicManagerDialog.dismiss();
+//                }
+//
+//                @Override
+//                public void onApplyCancel() {
+//                    //取消申请连麦
+//                    handleMicEvent();
+//                }
+//
+//                @Override
+//                public void onCloseMic() {
+//                    //关闭连麦
+//                    handleMicEvent();
+//                }
+//            });
+//        }
+//        if (!mMicManagerDialog.isShowing()) {
+//            mMicManagerDialog.show();
+//        }
+//        if (mRoomInfoBean != null) {
+//            mMicManagerDialog.setLiveTeacherInfo(mRoomInfoBean.speakerPic);
+//        }
+//        mMicManagerDialog.setMicStatus(currentSeatStatus);
+//    }
+//
+//    private void handleMicEvent() {
+//        if (currentSeatStatus == LiveRoomMsgConstants.MIC_STATUS_NORMAL) {
+//            //未连麦状态 申请连麦
+//            if (presenter != null) {
+//                presenter.handleAction(LiveRoomMsgConstants.ACTION_SEND_SEAT_APPLY);
+//            }
+//            updateMicIcon(LiveRoomMsgConstants.MIC_STATUS_CONNECTING);
+//            ToastUtil.getInstance().show(LiveRoomActivity.this, getString(R.string.seat_apply_str));
+//        } else {
+//            //取消连麦
+//            showCloseMicTipDialog();
+//        }
+//    }
+//
+//    private void startTeacherHomePage(int viewId) {
+//        String params = "";
+//        if (viewId == R.id.tv_appointment_course) {
+//            params = "practice";
+//        }
+//        if (viewId == R.id.tv_live_course) {
+//            params = "live";
+//        }
+//        if (viewId == R.id.tv_video_course) {
+//            params = "video";
+//        }
+//        if (viewId == R.id.tv_music_sheet) {
+//            params = "music";
+//        }
+//        if (mRoomInfoBean != null) {
+//            ARouter.getInstance()
+//                    .build(RouterPath.WebCenter.ACTIVITY_HTML)
+//                    .withString(WebConstants.WEB_URL, WebConstants.STUDENT_TEACHER_HOME + mRoomInfoBean.speakerId + "&tabs=" + params)
+//                    .navigation();
+//        }
+//    }
+//
+//
+//    private void handleHeaderAnim() {
+//        float animOffset = cs_header_info.getTranslationY();
+//        if (animOffset == 0) {
+//            //隐藏头部信息
+//            int bottom = cs_header_info.getBottom();
+//            if (hideHeaderInfoAnim == null) {
+//                hideHeaderInfoAnim = ObjectAnimator.ofFloat(cs_header_info, "translationY", 0, -bottom);
+//                hideHeaderInfoAnim.setDuration(500);
+//            }
+//            hideHeaderInfoAnim.start();
+//        } else {
+//            //显示头部信息
+//            if (showHeaderInfoAnim == null) {
+//                showHeaderInfoAnim = ObjectAnimator.ofFloat(cs_header_info, "translationY", animOffset, 0);
+//                showHeaderInfoAnim.setDuration(500);
+//            }
+//            showHeaderInfoAnim.start();
+//        }
+//    }
+//
+//    private void showShopCarDialog() {
+//        if (mShopCarDialog == null) {
+//            mShopCarDialog = new LiveRoomShopCarDialog(this);
+//            mShopCarDialog.setOnEventListener(new LiveRoomShopCarDialog.OnEventListener() {
+//                @Override
+//                public void onOpenDetail(String url) {
+//                    mShopCarDialog.dismiss();
+//                    //发送XXX正在抢购消息
+////                    presenter.handleAction(LiveRoomMsgConstants.ACTION_SEND_ON_SNAP_UP);
+////                    sendShowFloatWindowAction(SEND_JUMP_OTHER_PAGE_MSG);
+////                    ARouter.getInstance()
+////                            .build(ARouterConstace.ACTIVITY_HTML)
+////                            .withString(ARouterConstace.URL, url)
+////                            .withString(ARouterConstace.TITLE, "商品详情")
+////                            .navigation();
+//                }
+//            });
+//        }
+//        if (!mShopCarDialog.isShowing()) {
+//            mShopCarDialog.show();
+//        }
+//        mShopCarDialog.setRoomId(mRoomId);
+//    }
+//
+//
+//    @Override
+//    protected void onResume() {
+//        super.onResume();
+//        Log.i("pq", "onResume");
+//        checkImConnectStatus();
+//        this.isOnResume = true;
+//        unbindService();
+//        //取消全部静音
+//        muteAll(false);
+//    }
+//
+//
+//    /**
+//     * 检查IM连接状态
+//     */
+//    private void checkImConnectStatus() {
+//        RongIMClient.ConnectionStatusListener.ConnectionStatus currentConnectionStatus = RongIMClient.getInstance().getCurrentConnectionStatus();
+//        if (currentConnectionStatus == RongIMClient.ConnectionStatusListener.ConnectionStatus.CONNECTED) {
+//            isNeedRefresh = false;
+//        } else {
+//            isNeedRefresh = true;
+//            if (presenter != null) {
+//                presenter.connectIM();
+//            }
+//        }
+//    }
+//
+//
+//    private void showPageCloseOnMicTipDialog() {
+//        if (mLiveRoomClosePageOnMicTipDialog == null) {
+//            mLiveRoomClosePageOnMicTipDialog = new LiveRoomClosePageOnMicTipDialog(this);
+//            mLiveRoomClosePageOnMicTipDialog.setConfirmClickListener(new View.OnClickListener() {
+//                @Override
+//                public void onClick(View v) {
+//                    finish();
+//                }
+//            });
+//        }
+//        if (!mLiveRoomClosePageOnMicTipDialog.isShowing()) {
+//            mLiveRoomClosePageOnMicTipDialog.show();
+//        }
+//        mLiveRoomClosePageOnMicTipDialog.setTitle("提示");
+//        mLiveRoomClosePageOnMicTipDialog.setContent("连麦中,是否退出房间?");
+//    }
+//
+//    private void showCloseMicTipDialog() {
+//        if (mRoomCloseMicTipDialog == null) {
+//            mRoomCloseMicTipDialog = new LiveRoomCloseMicTipDialog(this);
+//            mRoomCloseMicTipDialog.setConfirmClickListener(new View.OnClickListener() {
+//                @Override
+//                public void onClick(View v) {
+//                    handleCloseMicEvent();
+//                    mRoomCloseMicTipDialog.dismiss();
+//                    if (mMicManagerDialog != null) {
+//                        mMicManagerDialog.dismiss();
+//                    }
+//                }
+//            });
+//        }
+//        if (!mRoomCloseMicTipDialog.isShowing()) {
+//            mRoomCloseMicTipDialog.show();
+//        }
+//        mRoomCloseMicTipDialog.setContent(getString(currentSeatStatus == LiveRoomMsgConstants.MIC_STATUS_CONNECTING ? R.string.cancel_seat_on_connecting : R.string.cancel_seat_on_connected));
+//    }
+//
+//    /**
+//     * 取消连麦
+//     */
+//    private void handleCloseMicEvent() {
+//        if (currentSeatStatus == LiveRoomMsgConstants.MIC_STATUS_CONNECTING) {
+//            //连接中取消连接
+//            if (presenter != null) {
+//                presenter.handleAction(LiveRoomMsgConstants.ACTION_SEND_CANCEL_SEAT_APPLY);
+//                updateMicIcon(LiveRoomMsgConstants.MIC_STATUS_NORMAL);
+//            }
+//        }
+//        if (currentSeatStatus == LiveRoomMsgConstants.MIC_STATUS_CONNECT_SUCCESS) {
+//            if (presenter != null) {
+//                presenter.exitMic();
+//            }
+//        }
+//    }
+//
+//    private boolean isOnApplyMic() {
+//        return currentSeatStatus == LiveRoomMsgConstants.MIC_STATUS_CONNECTING;
+//    }
+//
+//    private boolean isOnMic() {
+//        return currentSeatStatus == LiveRoomMsgConstants.MIC_STATUS_CONNECT_SUCCESS;
+//    }
+//
+//    private void updateMicIcon(int micStatus) {
+//        //主线程更新
+//        iv_mic.post(new Runnable() {
+//            @Override
+//            public void run() {
+//                currentSeatStatus = micStatus;
+//                if (micStatus == LiveRoomMsgConstants.MIC_STATUS_NORMAL) {
+//                    iv_mic.setImageResource(R.drawable.icon_mic_unconnect);
+//                }
+//                if (micStatus == LiveRoomMsgConstants.MIC_STATUS_CONNECTING) {
+//                    iv_mic.setImageResource(R.drawable.icon_mic_connecting);
+//                }
+//                if (micStatus == LiveRoomMsgConstants.MIC_STATUS_CONNECT_SUCCESS) {
+//                    iv_mic.setImageResource(R.drawable.icon_mic_conected);
+//                }
+//            }
+//        });
+//    }
+//
+//    /**
+//     * 检查点赞按钮是否可用
+//     *
+//     * @return
+//     */
+//    private boolean checkAddLikeMode() {
+//        if (liveIsFinish) {
+//            ToastUtil.getInstance().show(LiveRoomActivity.this, "直播已结束");
+//            return true;
+//        }
+//        if (connectStatusIsPaused) {
+//            //连接状态异常,暂停点赞
+//            ToastUtil.getInstance().show(LiveRoomActivity.this, "网络连接状态异常");
+//            return true;
+//        }
+//        return false;
+//    }
+//
+//
+//    private void showInputDialog() {
+//        if (checkChatMode()) return;
+//        if (mInputBarDialog == null) {
+//            mInputBarDialog = new InputBarDialog(LiveRoomActivity.this, new InputBar.InputBarListener() {
+//                @Override
+//                public boolean onClickSend(String message) {
+//                    //发送消息
+//                    if (TextUtils.isEmpty(message)) {
+//                        ToastUtil.getInstance().show(LiveRoomActivity.this, "消息不能为空");
+//                        return false;
+//                    }
+//                    if (message.length() > LiveConfig.LIVE_MAX_INPUT_TEXT_LENGTH) {
+//                        ToastUtil.getInstance().show(LiveRoomActivity.this, "聊天消息需在40个字以内哦");
+//                        return false;
+//                    }
+//                    if (LiveMessageHelper.isQuickAction()) {
+//                        ToastUtil.getInstance().show(LiveRoomActivity.this, "您说话太快啦");
+//                        return false;
+//                    }
+//                    sendTextMessage(message);
+//                    return true;
+//                }
+//
+//
+//                @Override
+//                public boolean onClickEmoji() {
+//                    return false;
+//                }
+//            });
+//
+//            mInputBarDialog.setOnShowListener(new DialogInterface.OnShowListener() {
+//                @Override
+//                public void onShow(DialogInterface dialog) {
+//                    if (mInputBarDialog != null) {
+//                        mInputBarDialog.showInput();
+//                    }
+//                }
+//            });
+//        }
+//        if (!mInputBarDialog.isShowing()) {
+//            mInputBarDialog.show();
+//        }
+//    }
+//
+//    private void sendTextMessage(String message) {
+//        if (checkChatMode()) {
+//            //禁止聊天模式
+//            if (mInputBarDialog != null) {
+//                mInputBarDialog.dismiss();
+//            }
+//            return;
+//        }
+//        if (presenter != null) {
+//            TextMessage textMessage = TextMessage.obtain(message);
+//            UserInfo userInfo = new UserInfo(mImUserId, UserHelper.getUserName(), null);
+//            textMessage.setUserInfo(userInfo);
+//            presenter.sendMessage(textMessage);
+//        }
+//    }
+//
+//    private void changeOrientation() {
+//        int currentOrientation = getCurrentOrientation();
+//        boolean isNeedFullScreen = currentOrientation != Configuration.ORIENTATION_LANDSCAPE;
+//        if (isNeedFullScreen) {
+//            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
+//        } else {
+//            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
+//        }
+//    }
+//
+//    @Override
+//    public void onConfigurationChanged(@NonNull Configuration newConfig) {
+//        super.onConfigurationChanged(newConfig);
+//        //改变videoView容器布局尺寸
+//        resetVideoContainer(newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE);
+//    }
+//
+//    private void close() {
+//        //断开连接,结束页面
+//        onBackPressed();
+//    }
+//
+//    @Override
+//    protected LiveRoomPresenter createPresenter() {
+//        return new LiveRoomPresenter();
+//    }
+//
+//
+//    /**
+//     * 获取房间信息成功
+//     *
+//     * @param roomInfoBean
+//     */
+//    @Override
+//    public void getRoomInfoSuccess(LiveRoomInfoBean roomInfoBean) {
+//        if (roomInfoBean == null || isFinishing() || isDestroyed()) {
+//            return;
+//        }
+//        mRoomInfoBean = roomInfoBean;
+//        isPcClientLive = TextUtils.equals(mRoomInfoBean.os, "pc");
+//        resetVideoContainer(!isPcClientLive);
+//        if (isShowShare()) {
+//            viewBinding.ivShare.setVisibility(View.VISIBLE);
+//        } else {
+//            viewBinding.ivShare.setVisibility(View.GONE);
+//        }
+//        currentAddLikeCount = roomInfoBean.likeNum;
+//        //连麦模式
+//        isEnableMic = roomInfoBean.whether_mic == 1;
+//        //聊天模式
+//        isEnableChat = roomInfoBean.whether_chat == 1;
+//        if (!TextUtils.isEmpty(roomInfoBean.roomConfig)) {
+//            try {
+//                JSONObject jsonObject = new JSONObject(roomInfoBean.roomConfig);
+//                int chatCtrlMode = jsonObject.optInt("whether_chat", 0);
+//                int micCtrlMode = jsonObject.optInt("whether_mic", 0);
+//                isEnableChat = chatCtrlMode == 1;
+//                isEnableMic = micCtrlMode == 1;
+//                //购物车是否显示
+//                int shopCarMode = jsonObject.optInt("whether_view_shop_cart", 0);
+//                if (shopCarMode == 1) {
+//                    //隐藏购物车
+//                    mViewShopCarAnim.setVisibility(View.GONE);
+//                    mIvShopCar.setVisibility(View.GONE);
+//                } else {
+//                    //显示购物车
+//                    mViewShopCarAnim.setVisibility(View.VISIBLE);
+//                    mIvShopCar.setVisibility(View.INVISIBLE);
+//                }
+//            } catch (JSONException e) {
+//                e.printStackTrace();
+//            }
+//        }
+//        //黑名单模式
+//        isEnableAll = roomInfoBean.blacklistFlag == 1;//1是黑名单 0否
+//        updateInputTip();
+//        updateAddLikeCountView();
+//        //更新未上麦状态
+//        updateMicIcon(LiveRoomMsgConstants.MIC_STATUS_NORMAL);
+//        if (mTvNumPeople != null) {
+//            int peopleCount = roomInfoBean.lookNum + 1;//加上自己
+//            mTvNumPeople.setText(String.format("%s人", LiveMemberHelper.getMemberCountText(peopleCount)));
+//        }
+//
+//        if (mIvAvatar != null) {
+//            //创建人头像
+//            Glide.with(LiveRoomActivity.this).load(roomInfoBean.speakerPic).placeholder(R.drawable.icon_teacher_default_head).error(R.drawable.icon_teacher_default_head).into(mIvAvatar);
+//        }
+//        if (mTvRoomCreateName != null) {
+//            //创建人昵称
+//            mTvRoomCreateName.setText(roomInfoBean.speakerName);
+//        }
+//
+//        if (mMessageAdapter != null) {
+//            mMessageAdapter.setRoomAuthorId(roomInfoBean.speakerId);
+//        }
+//        if (presenter != null) {
+//            //加入聊天室
+//            //加入直播间
+//            showLoading();
+//            LiveEventHelper.getInstance().register(mRoomInfoBean.roomUid);
+//            presenter.leaveRoom(mRoomInfoBean.roomUid, false, true);
+//            presenter.joinChartRoom(mRoomInfoBean.roomUid, new IRongCoreCallback.OperationCallback() {
+//                @Override
+//                public void onSuccess() {
+//                    Log.i("pq", "加入聊天房间成功");
+//                    if (presenter != null) {
+//                        presenter.handleAction(LiveRoomMsgConstants.ACTION_SEND_JOIN_ROOM);
+//                    }
+//                }
+//
+//                @Override
+//                public void onError(IRongCoreEnum.CoreErrorCode coreErrorCode) {
+//                    Log.i("pq", "加入聊天房间fail:" + coreErrorCode);
+//                    Toast.makeText(LiveRoomActivity.this, "加入聊天房间fail:" + coreErrorCode, Toast.LENGTH_SHORT).show();
+//                }
+//            });
+//        }
+//    }
+//
+//    private void updateInputTip() {
+//        if (tv_input == null) {
+//            return;
+//        }
+//        if (isEnableAll) {
+//            tv_input.setText(getString(R.string.unable_input_tip_str));
+//        } else {
+//            tv_input.setText(getString(R.string.live_input_tips_str));
+//        }
+//    }
+//
+//    @Override
+//    public void getRoomInfoError(Throwable t) {
+//        if (isDestroyed() || isFinishing()) {
+//            return;
+//        }
+//        if (t instanceof ApiException) {
+//            ApiException apiException = (ApiException) t;
+//            ToastUtil.getInstance().show(LiveRoomActivity.this, apiException.getErrmsg());
+//        }
+//        finish();
+//    }
+//
+//    private void resetVideoContainer(boolean isFullScreen) {
+//        if (mVideoViewManager != null) {
+//            mVideoViewManager.setIsNeedFillScreen(isFullScreen);
+//        }
+//        if (isFullScreen) {
+//            if (isPcClientLive) {
+//                //隐藏消息列表
+//                mGroupViews.setVisibility(View.GONE);
+//                mIvClose.setVisibility(View.GONE);
+//                //隐藏弹幕消息
+//                mFlJoinBarrage.clearAnimation();
+//                mFlJoinBarrage.setVisibility(View.GONE);
+//                mFlSnapUpBarrage.clearAnimation();
+//                mFlSnapUpBarrage.setVisibility(View.GONE);
+//                //隐藏竖屏全屏按钮
+//                mIvSwitchVideoOrientation.setVisibility(View.GONE);
+//                mIvSwitchVideoOrientationFull.setVisibility(View.VISIBLE);
+//            } else {
+//                //不是PC端直播
+//                mIvSwitchVideoOrientation.setVisibility(View.GONE);
+//                mIvSwitchVideoOrientationFull.setVisibility(View.GONE);
+//            }
+//            ConstraintSet set = new ConstraintSet();
+//            set.clone(content_view);
+//            set.clear(mFlLiveView.getId());
+//            if (!isPcClientLive) {
+//                //如果是非PC端直播,还需要设置下消息列表控件位置
+//                set.clear(R.id.fl_recycler_container);
+//                set.connect(R.id.fl_recycler_container, ConstraintSet.TOP, R.id.view_center, ConstraintSet.BOTTOM, SizeUtils.dp2px(50));
+//                set.connect(R.id.fl_recycler_container, ConstraintSet.LEFT, content_view.getId(), ConstraintSet.LEFT, 0);
+//                set.connect(R.id.fl_recycler_container, ConstraintSet.RIGHT, content_view.getId(), ConstraintSet.RIGHT, 0);
+//                set.connect(R.id.fl_recycler_container, ConstraintSet.BOTTOM, tv_input.getId(), ConstraintSet.TOP, SizeUtils.dp2px(10));
+//            }
+//            set.connect(mFlLiveView.getId(), ConstraintSet.TOP, content_view.getId(), ConstraintSet.TOP, 0);
+//            set.connect(mFlLiveView.getId(), ConstraintSet.LEFT, content_view.getId(), ConstraintSet.LEFT, 0);
+//            set.connect(mFlLiveView.getId(), ConstraintSet.RIGHT, content_view.getId(), ConstraintSet.RIGHT, 0);
+//            set.connect(mFlLiveView.getId(), ConstraintSet.BOTTOM, content_view.getId(), ConstraintSet.BOTTOM, 0);
+//            set.applyTo(content_view);
+//        } else {
+//            //pc端直播,控制居中显示,以及videoview容器的宽高
+//            if (cs_header_info.getTranslationY() != 0) {
+//                //还原显示头部信息
+//                handleHeaderAnim();
+//            }
+//            if (isPcClientLive) {
+//                mGroupViews.setVisibility(View.VISIBLE);
+//                mIvClose.setVisibility(View.VISIBLE);
+//                mIvSwitchVideoOrientation.setVisibility(View.VISIBLE);
+//                mIvSwitchVideoOrientationFull.setVisibility(View.GONE);
+//            }
+//
+//            ConstraintSet set = new ConstraintSet();
+//            set.clone(content_view);
+//            set.clear(mFlLiveView.getId());
+//            set.connect(mFlLiveView.getId(), ConstraintSet.TOP, cs_header_info.getId(), ConstraintSet.BOTTOM, SizeUtils.dp2px(121));
+//            set.connect(mFlLiveView.getId(), ConstraintSet.LEFT, content_view.getId(), ConstraintSet.LEFT, 0);
+//            set.connect(mFlLiveView.getId(), ConstraintSet.RIGHT, content_view.getId(), ConstraintSet.RIGHT, 0);
+//            int maxHeightAtRatio16_9 = UiUtils.getMaxHeightAtRatio16_9(LiveRoomActivity.this);
+//            set.constrainHeight(mFlLiveView.getId(), maxHeightAtRatio16_9);
+//            set.applyTo(content_view);
+//        }
+//    }
+//
+//    public void changVideoViewSize() {
+//        int childCount = mFlLiveView.getChildCount();
+//        if (childCount == 0) {
+//            return;
+//        }
+//        View childAt = mFlLiveView.getChildAt(0);
+//        if (childAt instanceof RCRTCVideoView) {
+//            RCRTCVideoView videoView = (RCRTCVideoView) childAt;
+////            mFlLiveView.removeView(videoView);
+////            mFlLiveView.addView(videoView);
+//        }
+//    }
+//
+//    @Override
+//    public void showFinishView() {
+//        //显示结束view
+//        if (isFinishing() || isDestroyed()) {
+//            return;
+//        }
+//        ToastUtil.getInstance().showShort("直播间加入异常,请退出重试");
+//        Log.i("pq", "加入直播间异常");
+//    }
+//
+//
+//    /**
+//     * 主讲人的音频状态
+//     *
+//     * @param isCloseAudioStream
+//     */
+//    @Override
+//    public void syncAudioStatus(boolean isCloseAudioStream) {
+//        this.creatorIsCloseAudioStream = isCloseAudioStream;
+//        if (creatorIsCloseAudioStream && creatorIsCloseVideoStream) {
+//            //如果是关闭音频,同时判断下视频的状态
+//            showRestView();
+//        }
+//    }
+//
+//    @Override
+//    public void showRestView() {
+//        showLiveStatusView(LIVE_STATUS_IS_REST);
+//    }
+//
+//    @Override
+//    public void showCloseVideoView() {
+//        //关闭了视频
+//        creatorIsCloseVideoStream = true;
+//        if (creatorIsCloseAudioStream) {
+//            //同时音频也关闭了
+//            showRestView();
+//            return;
+//        }
+//        showLiveStatusView(LIVE_STATUS_IS_CLOSE_VIDEO);
+//    }
+//
+//    private void showLiveStatusView(int status) {
+//        if (isFinishing() || isDestroyed()) {
+//            return;
+//        }
+//        if (mViewLiveStatus == null) {
+//            return;
+//        }
+//        //显示视频画面已经关闭页面
+//        mViewLiveStatus.post(new Runnable() {
+//            @Override
+//            public void run() {
+//                hideLoading();
+//                mViewLiveStatus.setVisibility(View.VISIBLE);
+//                if (status == LIVE_STATUS_IS_REST) {
+//                    mIvLiveStatusCenterIcon.setImageResource(R.drawable.icon_live_room_rest_bg);
+//                    mTvLiveStatusTipText.setText("休息一下,马上回来!!");
+//                    mTvLiveStatusTipText.setTextSize(12);
+//                    mTvLiveStatusTipText.setBackgroundResource(com.cooleshow.base.R.drawable.shape_gray_14dp);
+//                } else if (status == LIVE_STATUS_IS_CLOSE_VIDEO) {
+//                    mIvLiveStatusCenterIcon.setImageResource(R.drawable.icon_live_room_close_video);
+//                    mTvLiveStatusTipText.setText("主持人已关闭画面!");
+//                    mTvLiveStatusTipText.setTextSize(12);
+//                    mTvLiveStatusTipText.setBackgroundResource(com.cooleshow.base.R.drawable.shape_gray_14dp);
+//                } else if (status == LIVE_STATUS_IS_OFFLINE) {
+//                    mIvLiveStatusCenterIcon.setImageResource(R.drawable.icon_live_end_tip);
+//                    mTvLiveStatusTipText.setText("直播已结束!");
+//                    mTvLiveStatusTipText.setTextSize(14);
+//                    mTvLiveStatusTipText.setBackgroundColor(Color.TRANSPARENT);
+//                }
+//            }
+//        });
+//    }
+//
+//    @Override
+//    public void showEmptyStatusView() {
+//        //显示老师不在线view
+//        showRestView();
+//        refreshAudio(null, null);
+//    }
+//
+//    @Override
+//    public View getContentView() {
+//        return content_view;
+//    }
+//
+//    @Override
+//    public void addMessageList(List<MessageContent> messageContents, boolean isReset) {
+//        //添加多条消息至页面
+//    }
+//
+//    @Override
+//    public void addMessageContent(Message message, boolean isReset) {
+//        //添加单条消息至页面
+//        Log.i("pq", "收到需要显示msg:" + message);
+//        //只处理直播间消息,以及本直播间消息
+//        if (mMessageAdapter != null) {
+//            mMessageAdapter.addMessage(message);
+//            if (mRecyclerMsg != null && mLinearLayoutManager != null) {
+//                mRecyclerMsg.post(new Runnable() {
+//                    @Override
+//                    public void run() {
+//                        if (isAutoScrollToLast) {
+//                            if (mRecyclerMsg != null) {
+//                                mRecyclerMsg.scrollToPosition(mMessageAdapter.getItemCount() - 1);
+//                            }
+//                        } else {
+//                            Log.i("pq", "收到消息,不自动滚动");
+//                        }
+//                    }
+//                });
+//            }
+//        }
+//    }
+//
+//    private void updateAddLikeCountView() {
+//        if (mTvAddLikeCount != null) {
+//            mTvAddLikeCount.setText(getString(R.string.live_room_add_like_count_str, LiveMemberHelper.getStarsCountText(currentAddLikeCount)));
+//        }
+//    }
+//
+//    /**
+//     * 控制聊天模式
+//     *
+//     * @param isEnableChat
+//     */
+//    @Override
+//    public void switchChatMode(boolean isEnableChat) {
+//        //控制聊天模式
+//        Log.i("pq", "聊天禁止:" + isEnableChat);
+//        this.isEnableChat = isEnableChat;
+//    }
+//
+//    @Override
+//    public void liveRoomOffline() {
+//        //关闭直播间
+//        ToastUtil.getInstance().show(this, "直播已结束");
+//        this.liveIsFinish = true;
+//        //取消连麦
+//        if (mMicManagerDialog != null) {
+//            mMicManagerDialog.dismiss();
+//        }
+//        handleCloseMicEvent();
+//        notifyMicDelAll();
+//        showLiveStatusView(LIVE_STATUS_IS_OFFLINE);
+//        hideDialog();
+//        //离开房间
+//        LiveEventHelper.getInstance().leaveRoom(null);
+//    }
+//
+//    @Override
+//    public void liveGoodsChange(String jsonStr) {
+//        //直播间商品发生变化
+//        if (isDestroyed() || isFinishing()) {
+//            return;
+//        }
+//        if (mShopCarDialog != null) {
+//            mShopCarDialog.changeGoods(jsonStr);
+//        }
+//    }
+//
+//    /**
+//     * 关闭一些交互弹窗
+//     */
+//    private void hideDialog() {
+//        //关闭邀请弹窗
+//        if (mInviteSeatMicTipDialog != null && mInviteSeatMicTipDialog.isShowing()) {
+//            mInviteSeatMicTipDialog.dismiss();
+//        }
+//        //关闭商品弹窗
+//        if (mShopCarDialog != null && mShopCarDialog.isShowing()) {
+//            mShopCarDialog.dismiss();
+//        }
+//    }
+//
+//    /**
+//     * @param rcUserSeatResponseMessage
+//     */
+//    @Override
+//    public void seatResponse(RCUserSeatResponseMessage rcUserSeatResponseMessage) {
+//        if (isFinishing() || isDestroyed()) {
+//            return;
+//        }
+//        if (rcUserSeatResponseMessage == null || !isOwn(rcUserSeatResponseMessage.getAudienceId())) {
+//            return;
+//        }
+//        if (rcUserSeatResponseMessage != null) {
+//            int type = rcUserSeatResponseMessage.getType();
+//            if (type == LiveRoomMsgConstants.MIC_RESPONSE_AGREE) {
+//                //主播同意
+//                if (presenter != null) {
+//                    if (isOnApplyMic()) {
+//                        presenter.joinMic();
+//                    }
+//                }
+//                return;
+//            }
+//            if (type == LiveRoomMsgConstants.MIC_RESPONSE_DISAGREE) {
+//                //主播拒绝
+//                updateMicIcon(LiveRoomMsgConstants.MIC_STATUS_NORMAL);
+//                ToastUtil.getInstance().show(LiveRoomActivity.this, getString(R.string.create_refuse_seat_tip));
+//                return;
+//            }
+//        }
+//    }
+//
+//    @Override
+//    public void onSwitchRole(String userId, RCRTCLiveRole role) {
+//        Log.i("pq", "onSwitchRole:" + userId);
+//        if (role.getType() == RCRTCLiveRole.AUDIENCE.getType()) {
+//            //主播身份切换观众身份 下麦
+//            notifyMicContainerDel(userId);
+//            return;
+//        }
+//    }
+//
+//    @Override
+//    public void onUserJoinRoom(RCRTCRemoteUser rcrtcRemoteUser) {
+//        if (isFinishing() || isDestroyed()) {
+//            return;
+//        }
+//        Log.i("pq", "onUserJoinRoom:" + rcrtcRemoteUser.getUserId());
+//        if (TextUtils.equals(rcrtcRemoteUser.getUserId(), createRoomId)) {
+//            createRoomId = "";//重置一下createRoomId,防止创建者退出又进入,全局控制变量未刷新
+//        }
+//    }
+//
+//    @Override
+//    public void onUserLeftRoomMic(RCRTCRemoteUser rcrtcRemoteUser) {
+//        Log.i("pq", "onUserLeftRoomMic:" + rcrtcRemoteUser.getUserId());
+//        if (rcrtcRemoteUser != null) {
+//            notifyMicContainerDel(rcrtcRemoteUser.getUserId());
+//        }
+//    }
+//
+//    @Override
+//    public void onUserOfflineRoomMic(RCRTCRemoteUser rcrtcRemoteUser) {
+//        Log.i("pq", "onUserOfflineRoomMic:" + rcrtcRemoteUser.getUserId());
+//        if (rcrtcRemoteUser != null) {
+//            notifyMicContainerDel(rcrtcRemoteUser.getUserId());
+//        }
+//    }
+//
+//    @Override
+//    public void onRemoteUserPublishResource(String remoteUserId) {
+//        if (!TextUtils.isEmpty(remoteUserId)) {
+//            Log.i("pq", "收到onRemoteUserPublishResource:" + remoteUserId);
+//            refreshAudio(null, null);
+//        }
+//    }
+//
+//    @Override
+//    public void onRefuseAllMicApply() {
+//        if (isFinishing() || isDestroyed()) {
+//            return;
+//        }
+//        if (mMicManagerDialog != null) {
+//            mMicManagerDialog.dismiss();
+//        }
+//        if (isOnApplyMic()) {
+//            updateMicIcon(LiveRoomMsgConstants.MIC_STATUS_NORMAL);
+//            ToastUtil.getInstance().show(LiveRoomActivity.this, getString(R.string.create_refuse_seat_tip));
+//            buildResponseMessage();
+//        }
+//    }
+//
+//    /**
+//     * 因全部拒绝连麦消息没有携带id相关参数,所以本地造一个拒绝连麦的消息插入到消息列表
+//     */
+//    private void buildResponseMessage() {
+//        if (mRoomInfoBean != null) {
+//            String userId = UserHelper.getImUserId();
+//            RCUserSeatResponseMessage responseMessage = new RCUserSeatResponseMessage();
+//            responseMessage.setType(LiveRoomMsgConstants.MIC_RESPONSE_DISAGREE);
+//            responseMessage.setTeacherId(mRoomInfoBean.speakerId);
+//            responseMessage.setTeacherName(mRoomInfoBean.speakerName);
+//            responseMessage.setAudienceId(UserHelper.getImUserId());
+//            responseMessage.setAudienceName(UserHelper.getUserName());
+//            Message message = Message.obtain(userId, Conversation.ConversationType.CHATROOM, responseMessage);
+//            message.setObjectName(LiveRoomMsgConstants.TAG_CHAT_ROOM_SEAT_RESPONSE);
+//            addMessageContent(message, false);
+//        }
+//    }
+//
+//    @Override
+//    public void onUnderAllMic() {
+//        if (isFinishing() || isDestroyed()) {
+//            return;
+//        }
+//        if (isOnMic()) {
+//            if (presenter != null) {
+//                presenter.exitMic();
+//            }
+//            ToastUtil.getInstance().show(LiveRoomActivity.this, getString(R.string.down_mic_by_create_tip));
+//        }
+//    }
+//
+//    @Override
+//    public void syncMemberCount(String count) {
+//        //同步成员数量
+//        Log.i("pq", "syncMemberCount" + count);
+//        if (isFinishing() || isDestroyed()) {
+//            return;
+//        }
+//        if (mTvNumPeople != null) {
+//            mTvNumPeople.setText(String.format("%s人", LiveMemberHelper.getMemberCountText(count)));
+//        }
+//    }
+//
+//    @Override
+//    public void onUserKickOutMsg(RCUserKickOutMessage userKickOutMessage) {
+//        //用户被踢出消息
+//        if (isFinishing() || isDestroyed()) {
+//            return;
+//        }
+//        if (userKickOutMessage == null || !isOwn(userKickOutMessage.getTargetId())) {
+//            return;
+//        }
+//        String targetId = userKickOutMessage.getTargetId();
+//        Log.i("pq", "receive kickOut msg targetId:" + targetId);
+//        finish();
+//    }
+//
+//    /**
+//     * 控制连麦模式
+//     *
+//     * @param isEnableMic
+//     */
+//    @Override
+//    public void changeMicControlMode(boolean isEnableMic) {
+//        //禁止连麦模式
+//        if (isFinishing() || isDestroyed()) {
+//            return;
+//        }
+//        Log.i("pq", "receive mic mode control msg 禁麦模式:" + isEnableMic);
+//        this.isEnableMic = isEnableMic;
+//        if (isEnableMic && isOnApplyMic()) {
+//            handleCloseMicEvent();
+//        }
+//    }
+//
+//    private void refresh() {
+//        //video流信息
+//        List<RCRTCVideoOutputStream> outputStreams = new ArrayList<>();
+//        List<RCRTCVideoInputStream> videoInputStreams = new ArrayList<>();
+//        //音频流信息
+//        List<RCRTCAudioInputStream> audioinputstream = new ArrayList<>();
+//        List<RCRTCAudioOutputStream> audioOutputStreams = new ArrayList<>();
+//        presenter.getAllStreams(outputStreams, videoInputStreams, audioinputstream, audioOutputStreams);
+//        updateVideoView(outputStreams, videoInputStreams, audioinputstream, audioOutputStreams);
+//        refreshAudio(audioinputstream, audioOutputStreams);
+//    }
+//
+//    @Override
+//    public void subscribeAVStreamSuccess(List<RCRTCInputStream> inputStreams) {
+//        if (isDestroyed() || isFinishing()) {
+//            return;
+//        }
+//        if (liveIsFinish) {
+//            //直播已结束
+//            return;
+//        }
+//        this.liveIsPause = false;
+//        if (inputStreams != null) {
+//            refresh();
+//        } else {
+//            showEmptyStatusView();
+//        }
+//    }
+//
+//    @Override
+//    public void onSubscribeFailed() {
+//        //订阅流失败
+//    }
+//
+//    @Override
+//    public void setRoomData(LiveRoomInfoBean roomInfoBean) {
+//        //保存房间信息
+//        if (presenter != null) {
+//            //通知加入房间成功
+//            presenter.notifyJoinRoomAction(mRoomId, mUserId);
+//        }
+//    }
+//
+//    /**
+//     * 清除所有连麦用户的UI
+//     */
+//    private void notifyMicDelAll() {
+//        if (mLlMicContainer != null) {
+//            mLlMicContainer.post(new Runnable() {
+//                @Override
+//                public void run() {
+//                    mLlMicContainer.delAll();
+//                }
+//            });
+//        }
+//    }
+//
+//    private void notifyMicContainerDel(String userId) {
+//        mLlMicContainer.post(new Runnable() {
+//            @Override
+//            public void run() {
+//                mLlMicContainer.deleteMicUser(new UserInfo(userId, "", null));
+//            }
+//        });
+//    }
+//
+//    /**
+//     * 连麦成功-身份切换主播成功
+//     */
+//    @Override
+//    public void onSeatMicSuccess() {
+//        updateMicIcon(LiveRoomMsgConstants.MIC_STATUS_CONNECT_SUCCESS);
+//        if (mMicManagerDialog != null) {
+//            mMicManagerDialog.dismiss();
+//        }
+//    }
+//
+//    /**
+//     * 连麦失败
+//     */
+//    @Override
+//    public void onSeatMicFail() {
+//        updateMicIcon(LiveRoomMsgConstants.MIC_STATUS_NORMAL);
+//    }
+//
+//    /**
+//     * \
+//     * 退出连麦成功
+//     */
+//    @Override
+//    public void onExitSeatMicSuccess() {
+//        updateMicIcon(LiveRoomMsgConstants.MIC_STATUS_NORMAL);
+//        if (!TextUtils.isEmpty(mImUserId)) {
+//            notifyMicContainerDel(mImUserId);
+//        }
+//        if (presenter != null) {
+//            presenter.handleAction(LiveRoomMsgConstants.ACTION_SEND_DOWN_SEAT_MIC);
+//        }
+//    }
+//
+//    /**
+//     * 主播邀请上麦
+//     *
+//     * @param seatApplyMessage
+//     */
+//    @Override
+//    public void onInviteSeatMic(RCUserSeatApplyMessage seatApplyMessage) {
+//        if (isFinishing() || isDestroyed()) {
+//            return;
+//        }
+//        if (seatApplyMessage == null || !isOwn(seatApplyMessage.getAudienceId())) {
+//            return;
+//        }
+//        if (seatApplyMessage.getType() == LiveRoomMsgConstants.MIC_ACTION_INVITE_SEAT_BY_CREATE) {
+//            //主讲人邀请观众上麦
+//            showInviteSeatDialog();
+//            return;
+//
+//        }
+//        if (seatApplyMessage.getType() == LiveRoomMsgConstants.MIC_ACTION_CANCEL_INVITE_SEAT_BY_CREATE) {
+//            //主讲人取消邀请观众上麦
+//            if (mInviteSeatMicTipDialog != null) {
+//                mInviteSeatMicTipDialog.dismiss();
+//            }
+//            ToastUtil.getInstance().show(LiveRoomActivity.this, getString(R.string.create_recall_seat_invite_tip));
+//            return;
+//        }
+//
+//        if (seatApplyMessage.getType() == LiveRoomMsgConstants.MIC_ACTION_CANCEL_SEAT_BY_CREATE) {
+//            //主讲人讲观众抱下麦
+//            ToastUtil.getInstance().show(LiveRoomActivity.this, getString(R.string.down_mic_by_create_tip));
+//            if (presenter != null) {
+//                presenter.exitMic();
+//            }
+//        }
+//    }
+//
+//    @Override
+//    public void onUserUnusualLogout(RCUserLogOutUnusualMessage loginOutUnusualMessage) {
+//        if (isFinishing() || isDestroyed()) {
+//            return;
+//        }
+//        if (loginOutUnusualMessage == null || !isOwn(loginOutUnusualMessage.getUserId())) {
+//            return;
+//        }
+//        Log.i("pq", "unusual logout");
+//        finish();
+//    }
+//
+//    /**
+//     * 暂停直播,进行下麦处理
+//     */
+//    @Override
+//    public void onLivePause() {
+//        if (isFinishing() || isDestroyed()) {
+//            return;
+//        }
+//        this.liveIsPause = true;
+//        ToastUtil.getInstance().show(this, getString(R.string.live_is_pause_str));
+//        handleCloseMicEvent();
+//        if (mMicManagerDialog != null) {
+//            mMicManagerDialog.dismiss();
+//        }
+//    }
+//
+//    /**
+//     * 点赞数量同步
+//     *
+//     * @param addLikeMessage
+//     */
+//    @Override
+//    public void onAddLikeMessage(Message message, RCUserSyncAddLikeCountMessage addLikeMessage) {
+//        if (isFinishing() || isDestroyed()) {
+//            return;
+//        }
+//        if (TextUtils.equals(message.getSenderUserId(), mImUserId)) {
+//            return;
+//        }
+//        if (addLikeMessage != null) {
+//            if (mTvAddLikeCount != null && addLikeMessage != null) {
+////                int counts = addLikeMessage.getCounts();
+////                currentAddLikeCount += counts;
+//                currentAddLikeCount = addLikeMessage.getCount();
+//                updateAddLikeCountView();
+//            }
+//        }
+//    }
+//
+//    /**
+//     * 获取上麦用户信息成功
+//     *
+//     * @param friendInfoBean
+//     */
+//    @Override
+//    public void getFriendInfoSuccess(FriendInfoBean friendInfoBean) {
+//        if (isFinishing() || isDestroyed()) {
+//            return;
+//        }
+//        if (mLlMicContainer != null && friendInfoBean != null) {
+//            mLlMicContainer.updateTargetUserInfo(new UserInfo(friendInfoBean.imFriendId, friendInfoBean.friendNickname, Uri.parse(friendInfoBean.friendAvatar)));
+//        }
+//    }
+//
+//    @Override
+//    public void onPublishSuccess() {
+//        refresh();
+//    }
+//
+//
+//    /**
+//     * 黑名单状态切换
+//     *
+//     * @param userId
+//     * @param isAddBlack
+//     */
+//    @Override
+//    public void changeBlackUserStatus(String userId, boolean isAddBlack) {
+//        if (isFinishing() || isDestroyed()) {
+//            return;
+//        }
+//        if (isOwn(userId)) {
+//            isEnableAll = isAddBlack;
+//            if (isEnableAll) {
+//                //取消连麦
+//                if (currentSeatStatus != LiveRoomMsgConstants.MIC_STATUS_NORMAL) {
+//                    handleCloseMicEvent();
+//                }
+//            }
+//            updateInputTip();
+//        }
+//    }
+//
+//    private boolean isOwn(String targetUserId) {
+//        return TextUtils.equals(mImUserId, targetUserId);
+//    }
+//
+//    private void showInviteSeatDialog() {
+//        if (mInviteSeatMicTipDialog == null) {
+//            mInviteSeatMicTipDialog = new LiveRoomInviteSeatMicTipDialog(this);
+//            mInviteSeatMicTipDialog.setViewClickListener(new View.OnClickListener() {
+//                @Override
+//                public void onClick(View v) {
+//                    if (v.getId() == R.id.tv_sure) {
+//                        //被邀请连麦->同意连麦
+//                        if (presenter != null) {
+//                            presenter.handleAction(LiveRoomMsgConstants.ACTION_SEND_CANCEL_SEAT_AGREE_RESPONSE);
+//                            presenter.joinMic();
+//                        }
+//                    }
+//                    if (v.getId() == R.id.tv_cancel) {
+//                        //被邀请连麦->拒绝连麦
+//                        if (presenter != null) {
+//                            presenter.handleAction(LiveRoomMsgConstants.ACTION_SEND_CANCEL_SEAT_DISAGREE_RESPONSE);
+//                        }
+//                        //重置一下连麦状态
+//                        handleCloseMicEvent();
+//                    }
+//                    mInviteSeatMicTipDialog.dismiss();
+//                }
+//            });
+//        }
+//        if (!mInviteSeatMicTipDialog.isShowing()) {
+//            mInviteSeatMicTipDialog.show();
+//        }
+//        String defaultNick = "主讲人";
+//        if (mRoomInfoBean != null && !TextUtils.isEmpty(mRoomInfoBean.speakerName)) {
+//            defaultNick = mRoomInfoBean.speakerName;
+//        }
+//        mInviteSeatMicTipDialog.setContent(defaultNick);
+//    }
+//
+//    private void refreshAudio(List<RCRTCAudioInputStream> audioInputStreams, List<RCRTCAudioOutputStream> audioOutputStreams) {
+//        if (audioInputStreams == null || audioOutputStreams == null) {
+//            //参数为空,先获取房间里的全部音频流信息
+//            audioInputStreams = new ArrayList<>();
+//            audioOutputStreams = new ArrayList<>();
+//            presenter.getAudioStreams(audioInputStreams, audioOutputStreams);
+//        }
+//        ArrayList<String> onMicUserIds = new ArrayList<>();
+//        //先处理本地用户
+//        for (int i = 0; i < audioOutputStreams.size(); i++) {
+//            RCRTCAudioOutputStream audioInputStream = audioOutputStreams.get(i);
+//            if (audioInputStream.getMediaType() == RCRTCMediaType.AUDIO) {
+//                //音频流判断显示上麦用户
+//                String userId = audioInputStream.getUserId();
+//                if (mRoomInfoBean != null) {
+//                    if (!TextUtils.equals(mRoomInfoBean.speakerId, userId)) {
+//                        onMicUserIds.add(userId);
+//                    }
+//                }
+//            }
+//        }
+//
+//        //远端用户的音频流信息
+//        for (int i = 0; i < audioInputStreams.size(); i++) {
+//            RCRTCAudioInputStream rcrtcAudioInputStream = audioInputStreams.get(i);
+//            if (rcrtcAudioInputStream.getMediaType() == RCRTCMediaType.AUDIO) {
+//                //音频流判断显示上麦用户
+//                String userId = rcrtcAudioInputStream.getUserId();
+//                if (mRoomInfoBean != null) {
+//                    if (!TextUtils.equals(mRoomInfoBean.speakerId, userId)) {
+//                        onMicUserIds.add(userId);
+//                    }
+//                }
+//            }
+//        }
+//        mLlMicContainer.refreshUI(onMicUserIds);
+//    }
+//
+//    public void updateVideoView(List<RCRTCVideoOutputStream> outputStreams, List<RCRTCVideoInputStream> inputStreams, List<RCRTCAudioInputStream> audioInputStreams, List<RCRTCAudioOutputStream> audioOutputStreams) {
+//        mFlLiveView.post(new Runnable() {
+//            @Override
+//            public void run() {
+//                ArrayList<RCRTCVideoStream> videoStreams = new ArrayList<RCRTCVideoStream>();
+//                videoStreams.addAll(outputStreams);
+//                videoStreams.addAll(inputStreams);
+//                ArrayList<RCRTCVideoView> list = new ArrayList<>();
+//                boolean isNormalCreateAudioStatus = true;
+//                //视频流
+//                for (int i = 0; i < videoStreams.size(); i++) {
+//                    RCRTCVideoStream rcrtcVideoStream = videoStreams.get(i);
+//                    RCRTCVideoView rongRTCVideoView = new RCRTCVideoView(LiveRoomActivity.this);
+//                    rcrtcVideoStream.setVideoView(rongRTCVideoView);
+//                    list.add(rongRTCVideoView);
+//                }
+//
+//                //音频流
+//                for (int i = 0; i < audioInputStreams.size(); i++) {
+//                    RCRTCAudioInputStream audioInputStream = audioInputStreams.get(i);
+//                    if (audioInputStream.getMediaType() == RCRTCMediaType.AUDIO) {
+//                        //音频流判断显示上麦用户
+//                        String userId = audioInputStream.getUserId();
+//                        if (mRoomInfoBean != null) {
+//                            if (TextUtils.equals(mRoomInfoBean.speakerId, userId)) {
+//                                //找出主播的音频流
+//                                RCRTCResourceState resourceState = audioInputStream.getResourceState();
+//                                isNormalCreateAudioStatus = resourceState == RCRTCResourceState.NORMAL;
+//                            }
+//                        }
+//                    }
+//                }
+//                if (list.size() != 0) {
+//                    creatorIsCloseVideoStream = false;
+//                    mViewLiveStatus.setVisibility(View.GONE);
+//                    checkVideoViewManager();
+//                    mVideoViewManager.update(list, isPcClientLive, true);
+//                } else {
+//                    creatorIsCloseVideoStream = true;
+//                    if (isNormalCreateAudioStatus) {
+//                        showCloseVideoView();
+//                    } else {
+//                        //主播关闭了视频流,同时音频流的状态也不是normal状态时
+//                        showRestView();
+//                    }
+//                }
+//            }
+//        });
+//    }
+//
+//    /**
+//     * 检查VideoViewManager是否未null;
+//     */
+//    private void checkVideoViewManager() {
+//        if (mVideoViewManager == null) {
+//            mVideoViewManager = new VideoViewManager(mFlLiveView, mFlLiveView.getWidth(), mFlLiveView.getHeight());
+//            mVideoViewManager.setRetryClickListener(new View.OnClickListener() {
+//                @Override
+//                public void onClick(View v) {
+//                    if (presenter != null) {
+//                        //重新订阅房间的流信息
+//                        presenter.subscribeAVStream();
+//                    }
+//                }
+//            });
+//        }
+//    }
+//
+//    private boolean findMainScreenStreams(String streamUserId, String streamTag) {
+//        if (TextUtils.equals("screenshare", streamTag)) {
+//            //屏幕共享流
+//            return true;
+//        }
+//        if (TextUtils.equals(mRoomInfoBean.speakerId, streamUserId)) {
+//            return true;
+//        }
+//        return false;
+//    }
+//
+//    @Override
+//    protected void onSaveInstanceState(Bundle outState) {
+//        super.onSaveInstanceState(outState);
+//        Log.i("LiveRoomActivity", "onSaveInstanceState");
+//    }
+//
+//    @Override
+//    public void onBackPressed() {
+//        if (liveIsFinish) {
+//            super.onBackPressed();
+//            return;
+//        }
+//        boolean permissionOverlay = FloatWindowHelper.requestOverlayPermission(this);
+//        if (!permissionOverlay) {
+//            showOpenOverlayPermissionTipDialog();
+//        } else {
+//            if (isFullScreen()) {
+//                changeOrientation();
+//            } else {
+//                showExitLiveTipDialog();
+//            }
+//        }
+//    }
+//
+//    /**
+//     * 退出直播间提示弹窗
+//     */
+//    private void showExitLiveTipDialog() {
+//        LiveRoomCloseTipDialog closeTipDialog = new LiveRoomCloseTipDialog(this);
+//        closeTipDialog.setConfirmClickListener(new View.OnClickListener() {
+//            @Override
+//            public void onClick(View v) {
+//                finish();
+//            }
+//        });
+//        closeTipDialog.show();
+//    }
+//
+//    private void showOpenOverlayPermissionTipDialog() {
+//        OpenOverlayPermissionTipDialog overlayPermissionTipDialog = new OpenOverlayPermissionTipDialog(this);
+//        overlayPermissionTipDialog.setConfirmClickListener(new View.OnClickListener() {
+//            @Override
+//            public void onClick(View v) {
+//                overlayPermissionTipDialog.dismiss();
+//                Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + getPackageName()));
+//                startActivityForResult(intent, FloatWindowHelper.REQUEST_OVERLAY_CODE);
+//            }
+//        });
+//        overlayPermissionTipDialog.show();
+//        overlayPermissionTipDialog.setCancelClickListener(new View.OnClickListener() {
+//            @Override
+//            public void onClick(View v) {
+//                overlayPermissionTipDialog.dismiss();
+//                finish();
+//            }
+//        });
+//    }
+//
+//    @Override
+//    protected void onRestoreInstanceState(Bundle savedInstanceState) {
+//        super.onRestoreInstanceState(savedInstanceState);
+////        String str =   savedInstanceState.getString("key");
+//        Log.i("LiveRoomActivity", "onRestoreInstanceState");
+//    }
+//
+//
+//    private int getCurrentOrientation() {
+//        return getResources().getConfiguration().orientation;
+//    }
+//
+//    private boolean isFullScreen() {
+//        return getCurrentOrientation() == Configuration.ORIENTATION_LANDSCAPE;
+//    }
+//
+//
+//    private void startFloatWindowService() {
+//        boolean hasPermission = FloatWindowHelper.requestOverlayPermission(this);
+//        if (hasPermission) {
+//            if (mVideoViewManager != null && mVideoViewManager.getAllVideoViews() != null && mVideoViewManager.getAllVideoViews().size() > 0) {
+//                Intent intent = new Intent(this, FloatingWindowService.class);
+//                initServiceConnection();
+//                intent.putExtra("isPc", isPcClientLive);
+//                bindService(intent, serviceConnection, Context.BIND_AUTO_CREATE);
+//            }
+//        }
+//    }
+//
+//    private void initServiceConnection() {
+//        if (serviceConnection == null) {
+//            serviceConnection = new ServiceConnection() {
+//                @Override
+//                public void onServiceConnected(ComponentName name, IBinder service) {
+//                    if (service instanceof FloatingWindowService.MyBinder) {
+//                        FloatingWindowService.MyBinder mBinder = (FloatingWindowService.MyBinder) service;
+//                        if (mVideoViewManager != null) {
+//                            ArrayList<RCRTCVideoView> allVideoViews = mVideoViewManager.getAllVideoViews();
+//                            mBinder.addVideoView(allVideoViews);
+//                        }
+//                        mBinder.setOnEventListener(new FloatingWindowService.OnEventListener() {
+//                            @Override
+//                            public void onServiceDestroy() {
+//                                if (mVideoViewManager != null) {
+//                                    mVideoViewManager.update(mVideoViewManager.getAllVideoViews(), isPcClientLive, false);
+//                                }
+//                            }
+//
+//                            @Override
+//                            public void onUnbindService() {
+//                                muteAll(true);
+//                                unbindService();
+//                            }
+//                        });
+//                    }
+//                }
+//
+//                @Override
+//                public void onServiceDisconnected(ComponentName name) {
+//                    if (mVideoViewManager != null) {
+//                        mVideoViewManager.update(mVideoViewManager.getAllVideoViews(), isPcClientLive, false);
+//                    }
+//                }
+//            };
+//        }
+//    }
+//
+//    /**
+//     * 是否静音全部
+//     *
+//     * @param isMute
+//     */
+//    private void muteAll(boolean isMute) {
+//        if (LiveEventHelper.getInstance().getRtcRoom() != null) {
+//            RCRTCRoom rtcRoom = LiveEventHelper.getInstance().getRtcRoom();
+//            if (rtcRoom.getLocalUser() != null) {
+//                LiveEventHelper.getInstance().getRtcRoom().muteAllRemoteAudio(isMute);
+//            }
+//        }
+//    }
+//
+//
+//    @Override
+//    protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
+//        super.onActivityResult(requestCode, resultCode, data);
+//        if (resultCode == RESULT_OK) {
+//            if (requestCode == SHARE_CHAT_REQUEST_CODE) {
+//                //选择群聊
+//                if (targetShareImgFile == null) {
+//                    ToastUtil.getInstance().showShort("分享失败");
+//                    return;
+//                }
+//                ShareHelper.parseShareContactData(targetShareImgFile, data);
+//                return;
+//            }
+//        }
+//    }
+//
+//
+//    /**
+//     * 销毁悬浮窗service
+//     */
+//    private void unbindService() {
+//        if (serviceConnection != null) {
+//            try {
+//                boolean isExist = AppUtils.isServiceWork(this, FloatingWindowService.CLASS_PATH);
+//                if (isExist) {
+//                    unbindService(serviceConnection);
+//                }
+//            } catch (Exception e) {
+//                e.printStackTrace();
+//            }
+//        }
+//    }
+//
+//    @Override
+//    protected void onPause() {
+//        super.onPause();
+//        isOnResume = false;
+//        sendShowFloatWindowAction(SEND_APP_BACKGROUND_MSG);
+//    }
+//
+//    private void sendShowFloatWindowAction(int what) {
+//        android.os.Message message = android.os.Message.obtain();
+//        message.what = what;
+//        mHandler.sendMessageDelayed(message, SEND_SHOW_FLOAT_WINDOW_TIME);
+//    }
+//
+//    /**
+//     * 检查聊天模式
+//     */
+//    public boolean checkChatMode() {
+//        if (liveIsFinish) {
+//            ToastUtil.getInstance().show(LiveRoomActivity.this, "直播已结束");
+//            return true;
+//        }
+//        if (isEnableAll) {
+//            ToastUtil.getInstance().show(LiveRoomActivity.this, "您已被管理员禁言");
+//            return true;
+//        }
+//        if (isEnableChat) {
+//            ToastUtil.getInstance().show(LiveRoomActivity.this, "禁止聊天模式");
+//            return true;
+//        }
+//        return false;
+//    }
+//
+//    /**
+//     * 检查mic模式
+//     */
+//    public boolean checkMicMode() {
+//        if (liveIsPause) {
+//            ToastUtil.getInstance().show(LiveRoomActivity.this, "老师暂停中,暂时无法接受邀请");
+//            return true;
+//        }
+//        if (liveIsFinish) {
+//            ToastUtil.getInstance().show(LiveRoomActivity.this, "直播已结束");
+//            return true;
+//        }
+//        if (isEnableAll) {
+//            ToastUtil.getInstance().show(LiveRoomActivity.this, "您已被管理员禁言");
+//            return true;
+//        }
+//        if (isEnableMic) {
+//            ToastUtil.getInstance().show(LiveRoomActivity.this, getString(R.string.enable_mic_mode_tip));
+//            return true;
+//        }
+//        return false;
+//    }
+//
+//    @Override
+//    public void receiveJoinMessage(RCChatJoinRoomMessage joinRoomMessage) {
+//        //收到加入房间消息
+//        if (isFinishing() || isDestroyed()) {
+//            return;
+//        }
+//        if (joinRoomMessage == null) {
+//            return;
+//        }
+//        if (isCanShowBarrage()) {
+//            mTvJoinBarrage.setText(getString(R.string.enter_live_tip_str, LiveMemberHelper.getMessageName(joinRoomMessage)));
+//            showBarrageViewAnim(mFlJoinBarrage);
+//        }
+//    }
+//
+//    //老师重新加入房间重置一下连麦状态,假如是连麦中的状态
+//    private void resetMicStatus(RCChatJoinRoomMessage joinRoomMessage) {
+//        if (!isOnApplyMic()) {
+//            return;
+//        }
+//        String joinUserId = joinRoomMessage.getUserId();
+//        if (TextUtils.isEmpty(joinUserId)) {
+//            if (joinRoomMessage.getUserInfo() != null) {
+//                joinUserId = joinRoomMessage.getUserInfo().getUserId();
+//            }
+//        }
+//        if (!TextUtils.isEmpty(joinUserId) && mRoomInfoBean != null) {
+//            if (TextUtils.equals(joinUserId, mRoomInfoBean.speakerId)) {
+//                //老师加入直播,重置连麦申请中状态
+//                if (isOnApplyMic()) {
+//                    updateMicIcon(LiveRoomMsgConstants.MIC_STATUS_NORMAL);
+//                }
+//            }
+//        }
+//    }
+//
+//    /**
+//     * 显示弹幕消息
+//     */
+//    private void showBarrageViewAnim(View targetView) {
+//        if (mFlJoinBarrage.getVisibility() == View.VISIBLE || mFlSnapUpBarrage.getVisibility() == View.VISIBLE) {
+//            return;
+//        }
+//        LiveRoomAnimatorHelper.getInstance().startBarrageViewAnimation(this, targetView);
+//        hideBarrageView();
+//    }
+//
+//    /**
+//     * 隐藏弹幕消息
+//     */
+//    private void hideBarrageView() {
+//        mHandler.postDelayed(new Runnable() {
+//            @Override
+//            public void run() {
+//                if (mFlJoinBarrage != null) {
+//                    mFlJoinBarrage.setVisibility(View.GONE);
+//                }
+//                if (mFlSnapUpBarrage != null) {
+//                    mFlSnapUpBarrage.setVisibility(View.GONE);
+//                }
+//            }
+//        }, LiveConfig.LIVE_HIDE_BARRAGE_VIEW_TIME);
+//    }
+//
+//    @Override
+//    public void receiveSnapUpMessage(RCOnSnappingUpMessage onSnappingUpMessage) {
+//        //收到抢购消息
+//        if (isFinishing() || isDestroyed()) {
+//            return;
+//        }
+//        if (onSnappingUpMessage == null) {
+//            return;
+//        }
+//        if (isCanShowBarrage()) {
+//            mTvSnapUpBarrage.setText(getString(R.string.live_snap_up_tip_str, LiveMemberHelper.getMessageName(onSnappingUpMessage)));
+//            showBarrageViewAnim(mFlSnapUpBarrage);
+//        }
+//    }
+//
+//    /**
+//     * 判断是否显示弹幕消息
+//     *
+//     * @return
+//     */
+//    private boolean isCanShowBarrage() {
+//        if (isFullScreen()) {
+//            return false;
+//        }
+//        return mFlJoinBarrage.getVisibility() != View.VISIBLE && mFlSnapUpBarrage.getVisibility() != View.VISIBLE;
+//    }
+//
+//    private void shareLive(File imgfile) {
+//        if (mLiveRoomShareDialog != null && mLiveRoomShareDialog.isShowing()) {
+//            mLiveRoomShareDialog.dismiss();
+//        }
+//        this.targetShareImgFile = imgfile;
+//        ShareAction ShareAction = new ShareAction(this).setDisplayList(
+//                SHARE_MEDIA.WEIXIN, SHARE_MEDIA.WEIXIN_CIRCLE, SHARE_MEDIA.SINA)
+//                .setShareboardclickCallback(new ShareBoardlistener() {
+//                    @Override
+//                    public void onclick(SnsPlatform snsPlatform, SHARE_MEDIA share_media) {
+//
+//                        if (share_media == null) {
+//                            if (TextUtils.equals(snsPlatform.mKeyword, "chat")) {
+//                                //分享群聊
+//                                ARouter.getInstance().build(TCChatRouterPath.CHAT_SELECT_CONTACT)
+//                                        .navigation(LiveRoomActivity.this, SHARE_CHAT_REQUEST_CODE);
+//                            }
+//                        } else {
+//                            if (!UMShareAPI.get(getApplicationContext()).isInstall(LiveRoomActivity.this, share_media)) {
+//                                ToastUtil.getInstance().show(getApplicationContext(), "应用未安装,分享失败");
+//                                return;
+//                            }
+//                            UMImage image = new UMImage(LiveRoomActivity.this, imgfile);//bitmap文件
+//                            image.setThumb(image);
+//                            image.compressStyle = UMImage.CompressStyle.SCALE;
+//                            new ShareAction(LiveRoomActivity.this).withMedia(image)
+//                                    .setPlatform(share_media)
+//                                    .setCallback(LiveRoomActivity.this)
+//                                    .share();
+//                        }
+//                    }
+//                });
+//        ShareAction.addButton("群聊", "chat", "icon_share_chat_group", "icon_share_chat_group");
+//        ShareAction.open();
+//    }
+//
+//    @Override
+//    public void onDestroy() {
+//        if (presenter != null) {
+//            //通知离开房间
+//            presenter.notifyLeaveRoomAction();
+//        }
+//        super.onDestroy();
+//        if (connectStatusListener != null) {
+//            IMCenter.getInstance().removeConnectionStatusListener(connectStatusListener);
+//        }
+//        //取消动画
+//        if (hideHeaderInfoAnim != null) {
+//            hideHeaderInfoAnim.cancel();
+//            hideHeaderInfoAnim = null;
+//        }
+//
+//        if (showHeaderInfoAnim != null) {
+//            showHeaderInfoAnim.cancel();
+//            showHeaderInfoAnim = null;
+//        }
+//        SoftKeyboardUtil.unregisterSoftInputChangedListener(getWindow());
+//        LiveRoomAnimatorHelper.getInstance().releaseAnimator();
+//        LiveRoomAddLikeHelper.getInstance().release();
+//        LiveEventHelper.getInstance().unRegister();
+//        RCRTCAudioRouteManager.getInstance().unInit();
+//        if (mHandler != null) {
+//            mHandler.removeCallbacksAndMessages(null);
+//        }
+//        if (mVideoViewManager != null) {
+//            mVideoViewManager.onRelease();
+//        }
+//    }
+//
+//    @Override
+//    public void onSoftInputChanged(int height) {
+//        Log.i("pq", "height" + height);
+//        if (height == 0) {
+//            //软键盘隐藏
+//            Log.i("pq", "SoftInput hide");
+//            if (mInputBarDialog != null && mInputBarDialog.isShowing()) {
+//                mInputBarDialog.dismiss();
+//            }
+//        } else {
+//            //软键盘弹出
+//            Log.i("pq", "SoftInput show");
+//        }
+//    }
+//
+//
+//    //分享回调
+//    @Override
+//    public void onStart(SHARE_MEDIA share_media) {
+//
+//    }
+//
+//    @Override
+//    public void onResult(SHARE_MEDIA platform) {
+//        //分享成功
+//        if (platform.name().equals("WEIXIN_FAVORITE")) {
+//            ToastUtil.getInstance().showShort("收藏成功啦");
+//        } else {
+//            if (platform != SHARE_MEDIA.MORE && platform != SHARE_MEDIA.SMS
+//                    && platform != SHARE_MEDIA.EMAIL
+//                    && platform != SHARE_MEDIA.FLICKR
+//                    && platform != SHARE_MEDIA.FOURSQUARE
+//                    && platform != SHARE_MEDIA.TUMBLR
+//                    && platform != SHARE_MEDIA.POCKET
+//                    && platform != SHARE_MEDIA.PINTEREST
+//
+//                    && platform != SHARE_MEDIA.INSTAGRAM
+//                    && platform != SHARE_MEDIA.GOOGLEPLUS
+//                    && platform != SHARE_MEDIA.YNOTE
+//                    && platform != SHARE_MEDIA.EVERNOTE) {
+//                ToastUtil.getInstance().showShort("分享成功啦");
+//            }
+//
+//        }
+//    }
+//
+//    @Override
+//    public void onError(SHARE_MEDIA platform, Throwable throwable) {
+//        if (platform != SHARE_MEDIA.MORE && platform != SHARE_MEDIA.SMS
+//                && platform != SHARE_MEDIA.EMAIL
+//                && platform != SHARE_MEDIA.FLICKR
+//                && platform != SHARE_MEDIA.FOURSQUARE
+//                && platform != SHARE_MEDIA.TUMBLR
+//                && platform != SHARE_MEDIA.POCKET
+//                && platform != SHARE_MEDIA.PINTEREST
+//
+//                && platform != SHARE_MEDIA.INSTAGRAM
+//                && platform != SHARE_MEDIA.GOOGLEPLUS
+//                && platform != SHARE_MEDIA.YNOTE
+//                && platform != SHARE_MEDIA.EVERNOTE) {
+//            ToastUtil.getInstance().showShort("分享失败啦");
+//
+//        }
+//    }
+//
+//    @Override
+//    public void onCancel(SHARE_MEDIA share_media) {
+//        ToastUtil.getInstance().showShort("分享取消了");
+//    }
+//
+//    private boolean isShowShare() {
+//        if (TextUtils.equals(mRoomInfoBean.roomType, "TEMP")) {
+//            return true;
+//        }
+//        return false;
+//    }
+//}

+ 321 - 321
student/src/main/java/com/cooleshow/student/ui/live/floatPop/FloatWindowHelper.java

@@ -1,321 +1,321 @@
-package com.cooleshow.student.ui.live.floatPop;
-
-import android.app.Activity;
-import android.app.ActivityManager;
-import android.content.Context;
-import android.content.Intent;
-import android.content.res.Configuration;
-import android.graphics.PixelFormat;
-import android.net.Uri;
-import android.os.Build;
-import android.provider.Settings;
-import android.util.Log;
-import android.view.Gravity;
-import android.view.LayoutInflater;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.WindowManager;
-import android.widget.ImageView;
-import android.widget.RelativeLayout;
-
-
-import com.cooleshow.base.common.AppManager;
-import com.cooleshow.base.utils.AppUtils;
-import com.cooleshow.base.utils.UiUtils;
-import com.cooleshow.base.utils.helper.QMUIDisplayHelper;
-import com.cooleshow.base.utils.helper.QMUIStatusBarHelper;
-import com.cooleshow.student.R;
-
-import java.util.List;
-
-import cn.rongcloud.rtc.api.stream.RCRTCVideoView;
-import cn.rongcloud.rtc.core.RendererCommon;
-
-/**
- * Author by pq, Date on 2022/5/13.
- * 悬浮窗
- */
-public class FloatWindowHelper implements View.OnTouchListener {
-    public static final int REQUEST_OVERLAY_CODE = 5000;
-    private Context mContext;
-    private View mContentView;
-    private WindowManager.LayoutParams mFloatParams;
-    private WindowManager mWindowManager;
-    private RelativeLayout mLiveContainer;
-    private int maxWidth;
-    private int maxHeight;
-    private int maxDragX = 0;//控制最大拖拽的坐标
-    private int maxDragY = 0;//控制最大拖拽的坐标
-    private int initX = 0;//初始位置坐标
-    private int initY = 0;//初始位置坐标
-    private OnEventListener mEventListener;
-    private boolean isLiveFromPc = true;
-
-    public FloatWindowHelper(Context context, OnEventListener eventListener) {
-        mContext = context;
-        this.mEventListener = eventListener;
-        initView();
-    }
-
-    private void setDefaultParams() {
-        int deviceWidth = QMUIDisplayHelper.getScreenWidth(mContext);
-        int deviceHeight = QMUIDisplayHelper.getScreenHeight(mContext);
-        int orientation = mContext.getResources().getConfiguration().orientation;
-        if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
-            maxWidth = deviceHeight / 2;
-            maxDragX = deviceHeight - maxWidth;
-            maxHeight = UiUtils.getHeightAtRatio16_9(mContext, maxWidth);
-            int actionBarHeight = QMUIDisplayHelper.getActionBarHeight(mContext);
-            int statusBarHeight = QMUIStatusBarHelper.getStatusbarHeight(mContext);
-            maxDragY = deviceWidth - actionBarHeight - statusBarHeight - maxHeight;
-        } else {
-            if (isLiveFromPc) {
-                //PC端是16:9的比例尺寸
-                maxWidth = deviceWidth / 2;
-                maxHeight = UiUtils.getHeightAtRatio16_9(mContext, maxWidth);
-            } else {
-                maxWidth = deviceWidth / 4;
-                float ratio = (float) deviceWidth / (float) deviceHeight;
-                maxHeight = (int) (maxWidth / ratio);
-            }
-            maxDragX = deviceWidth - maxWidth;
-            maxDragY = deviceHeight - maxHeight;
-        }
-        initX = deviceWidth - maxWidth - 50;
-        initY = maxDragY - 300;
-    }
-
-    /**
-     * 判断是否有悬浮窗权限
-     *
-     * @param activity
-     * @return
-     */
-    public static boolean requestOverlayPermission(Activity activity, int requestCode) {
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
-            if (!Settings.canDrawOverlays(activity)) {
-                Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + activity.getPackageName()));
-                activity.startActivityForResult(intent, requestCode);
-                return false;
-            } else {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    public boolean isLiveFromPc() {
-        return isLiveFromPc;
-    }
-
-    public void setLiveFromPc(boolean liveFromPc) {
-        isLiveFromPc = liveFromPc;
-        //设置默认参数
-        setDefaultParams();
-    }
-
-    /**
-     * 判断是否有悬浮窗权限
-     *
-     * @param activity
-     * @return
-     */
-    public static boolean requestOverlayPermission(Activity activity) {
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
-            if (!Settings.canDrawOverlays(activity)) {
-                return false;
-            } else {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    private void initView() {
-        mContentView = LayoutInflater.from(mContext).inflate(R.layout.view_live_float_window_layout, null);
-        mLiveContainer = mContentView.findViewById(R.id.fl_live_container);
-        ImageView iv_close = mContentView.findViewById(R.id.iv_close);
-        mContentView.setOnClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View v) {
-                setTopApp(mContext);
-            }
-        });
-        iv_close.setOnClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View v) {
-                if (mEventListener != null) {
-                    mEventListener.onClose();
-                }
-            }
-        });
-    }
-
-    public void showFloatingWindowView(Context context) {
-        // 获取系统窗口管理服务
-        mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
-        // 悬浮窗口参数设置及返回
-        mFloatParams = getParams();
-        // 设置窗口触摸移动事件
-        mContentView.setOnTouchListener(this);
-        // 悬浮窗生成
-        mWindowManager.addView(mContentView, mFloatParams);
-    }
-
-    private WindowManager.LayoutParams getParams() {
-        WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams();
-        //设置悬浮窗口类型
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
-            layoutParams.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
-        } else {
-            layoutParams.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
-        }
-        //设置悬浮窗口属性
-        layoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
-                | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
-                | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
-                | WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR
-                | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH;
-        //设置悬浮窗口透明
-        layoutParams.format = PixelFormat.TRANSLUCENT;
-        //设置悬浮窗口长宽数据
-        layoutParams.width = maxWidth;
-        layoutParams.height = maxHeight;
-        //设置悬浮窗显示位置
-        layoutParams.gravity = Gravity.TOP | Gravity.LEFT;
-        layoutParams.x = initX;
-        layoutParams.y = initY;
-        return layoutParams;
-    }
-
-    //开始触控的坐标,移动时的坐标(相对于屏幕左上角的坐标)
-    int mTouchStartX = 0;
-    int mTouchStartY = 0;
-    //开始时的坐标和结束时的坐标(相对于自身控件的坐标)
-    int mStartX = 0;
-    int mStartY = 0;
-    //判断悬浮窗口是否移动,这里做个标记,防止移动后松手触发了点击事件
-    boolean isMove = false;
-
-    @Override
-    public boolean onTouch(View v, MotionEvent motionEvent) {
-        int action = motionEvent.getAction();
-        int x = (int) motionEvent.getX();
-        int y = (int) motionEvent.getY();
-        switch (action) {
-            case MotionEvent.ACTION_DOWN:
-                isMove = false;
-                mTouchStartX = (int) motionEvent.getRawX();
-                mTouchStartY = (int) motionEvent.getRawY();
-                mStartX = x;
-                mStartY = y;
-                break;
-            case MotionEvent.ACTION_MOVE:
-                int nowX = (int) motionEvent.getRawX();
-                int nowY = (int) motionEvent.getRawY();
-                Log.i("pq", "now:x=" + nowX + "y=" + nowX);
-                int offsetX = nowX - mTouchStartX;
-                int offsetY = nowY - mTouchStartY;
-                Log.i("pq", "start:x=" + mTouchStartX + "y=" + mTouchStartY);
-                mFloatParams.x += offsetX;
-                mFloatParams.y += offsetY;
-                if (mFloatParams.x < 0) {
-                    mFloatParams.x = 0;
-                }
-                if (mFloatParams.x > maxDragX) {
-                    mFloatParams.x = maxDragX;
-                }
-                if (mFloatParams.y < 0) {
-                    mFloatParams.y = 0;
-                }
-                if (mFloatParams.y > maxDragY) {
-                    mFloatParams.y = maxDragY;
-                }
-
-                Log.i("pq", "move:x=" + offsetX + "y=" + offsetY);
-                Log.i("pq", "moveAfter:x=" + mFloatParams.x + "y=" + mFloatParams.y);
-                mWindowManager.updateViewLayout(mContentView, mFloatParams);
-                mTouchStartX = nowX;
-                mTouchStartY = nowY;
-                float deltaX = x - mStartX;
-                float deltaY = y - mStartY;
-                if (Math.abs(deltaX) >= 5 || Math.abs(deltaY) >= 5) {
-                    isMove = true;
-                }
-                break;
-            case MotionEvent.ACTION_UP:
-                break;
-            default:
-                break;
-        }
-        //如果是移动事件不触发OnClick事件,防止移动的时候一放手形成点击事件
-        return isMove;
-    }
-
-    public void dismiss() {
-        if (mContext == null) {
-            return;
-        }
-        WindowManager windowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
-        if (windowManager != null && mContentView != null && mContentView.getParent() != null) {
-            windowManager.removeView(mContentView);
-        }
-        if (mLiveContainer != null) {
-            mLiveContainer.removeAllViews();
-        }
-        this.mContext = null;
-    }
-
-    public void addVideoView(List<RCRTCVideoView> videoViews) {
-        if (videoViews != null && videoViews.size() > 0) {
-            mLiveContainer.removeAllViews();
-            for (int i = 0; i < videoViews.size(); i++) {
-                RCRTCVideoView videoView = videoViews.get(i);
-                ViewGroup parent = (ViewGroup) videoView.getParent();
-                if (parent != null) {
-                    parent.removeView(videoView);
-                }
-                RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
-                layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
-                videoView.setScalingType(isLiveFromPc ? RendererCommon.ScalingType.SCALE_ASPECT_FIT : RendererCommon.ScalingType.SCALE_ASPECT_FILL);
-                mLiveContainer.addView(videoView, layoutParams);
-            }
-        }
-    }
-
-    /**
-     * 返回前台
-     *
-     * @param context
-     */
-    public void setTopApp(Context context) {
-        if (AppUtils.isApplicationInBackground(context)) {
-            //获取ActivityManager
-            ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
-            //获得当前运行的task(任务)
-            List<ActivityManager.RunningTaskInfo> taskInfoList = null;
-            if (activityManager != null) {
-                taskInfoList = activityManager.getRunningTasks(100);
-            }
-            if (taskInfoList != null) {
-                for (ActivityManager.RunningTaskInfo taskInfo : taskInfoList) {
-                    //找到本应用的 task,并将它切换到前台
-                    if (taskInfo.topActivity != null && taskInfo.topActivity.getPackageName().equals(context.getPackageName())) {
-                        activityManager.moveTaskToFront(taskInfo.id, 0);
-                        break;
-                    }
-                }
-            }
-        } else {
-            Activity topActivity = AppManager.Companion.getInstance().currentActivity();
-            if (topActivity != null) {
-                topActivity.finish();
-            }
-        }
-    }
-
-    public interface OnEventListener {
-        void onClose();
-    }
-}
+//package com.cooleshow.student.ui.live.floatPop;
+//
+//import android.app.Activity;
+//import android.app.ActivityManager;
+//import android.content.Context;
+//import android.content.Intent;
+//import android.content.res.Configuration;
+//import android.graphics.PixelFormat;
+//import android.net.Uri;
+//import android.os.Build;
+//import android.provider.Settings;
+//import android.util.Log;
+//import android.view.Gravity;
+//import android.view.LayoutInflater;
+//import android.view.MotionEvent;
+//import android.view.View;
+//import android.view.ViewGroup;
+//import android.view.WindowManager;
+//import android.widget.ImageView;
+//import android.widget.RelativeLayout;
+//
+//
+//import com.cooleshow.base.common.AppManager;
+//import com.cooleshow.base.utils.AppUtils;
+//import com.cooleshow.base.utils.UiUtils;
+//import com.cooleshow.base.utils.helper.QMUIDisplayHelper;
+//import com.cooleshow.base.utils.helper.QMUIStatusBarHelper;
+//import com.cooleshow.student.R;
+//
+//import java.util.List;
+//
+//import cn.rongcloud.rtc.api.stream.RCRTCVideoView;
+//import cn.rongcloud.rtc.core.RendererCommon;
+//
+///**
+// * Author by pq, Date on 2022/5/13.
+// * 悬浮窗
+// */
+//public class FloatWindowHelper implements View.OnTouchListener {
+//    public static final int REQUEST_OVERLAY_CODE = 5000;
+//    private Context mContext;
+//    private View mContentView;
+//    private WindowManager.LayoutParams mFloatParams;
+//    private WindowManager mWindowManager;
+//    private RelativeLayout mLiveContainer;
+//    private int maxWidth;
+//    private int maxHeight;
+//    private int maxDragX = 0;//控制最大拖拽的坐标
+//    private int maxDragY = 0;//控制最大拖拽的坐标
+//    private int initX = 0;//初始位置坐标
+//    private int initY = 0;//初始位置坐标
+//    private OnEventListener mEventListener;
+//    private boolean isLiveFromPc = true;
+//
+//    public FloatWindowHelper(Context context, OnEventListener eventListener) {
+//        mContext = context;
+//        this.mEventListener = eventListener;
+//        initView();
+//    }
+//
+//    private void setDefaultParams() {
+//        int deviceWidth = QMUIDisplayHelper.getScreenWidth(mContext);
+//        int deviceHeight = QMUIDisplayHelper.getScreenHeight(mContext);
+//        int orientation = mContext.getResources().getConfiguration().orientation;
+//        if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
+//            maxWidth = deviceHeight / 2;
+//            maxDragX = deviceHeight - maxWidth;
+//            maxHeight = UiUtils.getHeightAtRatio16_9(mContext, maxWidth);
+//            int actionBarHeight = QMUIDisplayHelper.getActionBarHeight(mContext);
+//            int statusBarHeight = QMUIStatusBarHelper.getStatusbarHeight(mContext);
+//            maxDragY = deviceWidth - actionBarHeight - statusBarHeight - maxHeight;
+//        } else {
+//            if (isLiveFromPc) {
+//                //PC端是16:9的比例尺寸
+//                maxWidth = deviceWidth / 2;
+//                maxHeight = UiUtils.getHeightAtRatio16_9(mContext, maxWidth);
+//            } else {
+//                maxWidth = deviceWidth / 4;
+//                float ratio = (float) deviceWidth / (float) deviceHeight;
+//                maxHeight = (int) (maxWidth / ratio);
+//            }
+//            maxDragX = deviceWidth - maxWidth;
+//            maxDragY = deviceHeight - maxHeight;
+//        }
+//        initX = deviceWidth - maxWidth - 50;
+//        initY = maxDragY - 300;
+//    }
+//
+//    /**
+//     * 判断是否有悬浮窗权限
+//     *
+//     * @param activity
+//     * @return
+//     */
+//    public static boolean requestOverlayPermission(Activity activity, int requestCode) {
+//        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+//            if (!Settings.canDrawOverlays(activity)) {
+//                Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + activity.getPackageName()));
+//                activity.startActivityForResult(intent, requestCode);
+//                return false;
+//            } else {
+//                return true;
+//            }
+//        }
+//        return false;
+//    }
+//
+//    public boolean isLiveFromPc() {
+//        return isLiveFromPc;
+//    }
+//
+//    public void setLiveFromPc(boolean liveFromPc) {
+//        isLiveFromPc = liveFromPc;
+//        //设置默认参数
+//        setDefaultParams();
+//    }
+//
+//    /**
+//     * 判断是否有悬浮窗权限
+//     *
+//     * @param activity
+//     * @return
+//     */
+//    public static boolean requestOverlayPermission(Activity activity) {
+//        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+//            if (!Settings.canDrawOverlays(activity)) {
+//                return false;
+//            } else {
+//                return true;
+//            }
+//        }
+//        return false;
+//    }
+//
+//    private void initView() {
+//        mContentView = LayoutInflater.from(mContext).inflate(R.layout.view_live_float_window_layout, null);
+//        mLiveContainer = mContentView.findViewById(R.id.fl_live_container);
+//        ImageView iv_close = mContentView.findViewById(R.id.iv_close);
+//        mContentView.setOnClickListener(new View.OnClickListener() {
+//            @Override
+//            public void onClick(View v) {
+//                setTopApp(mContext);
+//            }
+//        });
+//        iv_close.setOnClickListener(new View.OnClickListener() {
+//            @Override
+//            public void onClick(View v) {
+//                if (mEventListener != null) {
+//                    mEventListener.onClose();
+//                }
+//            }
+//        });
+//    }
+//
+//    public void showFloatingWindowView(Context context) {
+//        // 获取系统窗口管理服务
+//        mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
+//        // 悬浮窗口参数设置及返回
+//        mFloatParams = getParams();
+//        // 设置窗口触摸移动事件
+//        mContentView.setOnTouchListener(this);
+//        // 悬浮窗生成
+//        mWindowManager.addView(mContentView, mFloatParams);
+//    }
+//
+//    private WindowManager.LayoutParams getParams() {
+//        WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams();
+//        //设置悬浮窗口类型
+//        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+//            layoutParams.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
+//        } else {
+//            layoutParams.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
+//        }
+//        //设置悬浮窗口属性
+//        layoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
+//                | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
+//                | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
+//                | WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR
+//                | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH;
+//        //设置悬浮窗口透明
+//        layoutParams.format = PixelFormat.TRANSLUCENT;
+//        //设置悬浮窗口长宽数据
+//        layoutParams.width = maxWidth;
+//        layoutParams.height = maxHeight;
+//        //设置悬浮窗显示位置
+//        layoutParams.gravity = Gravity.TOP | Gravity.LEFT;
+//        layoutParams.x = initX;
+//        layoutParams.y = initY;
+//        return layoutParams;
+//    }
+//
+//    //开始触控的坐标,移动时的坐标(相对于屏幕左上角的坐标)
+//    int mTouchStartX = 0;
+//    int mTouchStartY = 0;
+//    //开始时的坐标和结束时的坐标(相对于自身控件的坐标)
+//    int mStartX = 0;
+//    int mStartY = 0;
+//    //判断悬浮窗口是否移动,这里做个标记,防止移动后松手触发了点击事件
+//    boolean isMove = false;
+//
+//    @Override
+//    public boolean onTouch(View v, MotionEvent motionEvent) {
+//        int action = motionEvent.getAction();
+//        int x = (int) motionEvent.getX();
+//        int y = (int) motionEvent.getY();
+//        switch (action) {
+//            case MotionEvent.ACTION_DOWN:
+//                isMove = false;
+//                mTouchStartX = (int) motionEvent.getRawX();
+//                mTouchStartY = (int) motionEvent.getRawY();
+//                mStartX = x;
+//                mStartY = y;
+//                break;
+//            case MotionEvent.ACTION_MOVE:
+//                int nowX = (int) motionEvent.getRawX();
+//                int nowY = (int) motionEvent.getRawY();
+//                Log.i("pq", "now:x=" + nowX + "y=" + nowX);
+//                int offsetX = nowX - mTouchStartX;
+//                int offsetY = nowY - mTouchStartY;
+//                Log.i("pq", "start:x=" + mTouchStartX + "y=" + mTouchStartY);
+//                mFloatParams.x += offsetX;
+//                mFloatParams.y += offsetY;
+//                if (mFloatParams.x < 0) {
+//                    mFloatParams.x = 0;
+//                }
+//                if (mFloatParams.x > maxDragX) {
+//                    mFloatParams.x = maxDragX;
+//                }
+//                if (mFloatParams.y < 0) {
+//                    mFloatParams.y = 0;
+//                }
+//                if (mFloatParams.y > maxDragY) {
+//                    mFloatParams.y = maxDragY;
+//                }
+//
+//                Log.i("pq", "move:x=" + offsetX + "y=" + offsetY);
+//                Log.i("pq", "moveAfter:x=" + mFloatParams.x + "y=" + mFloatParams.y);
+//                mWindowManager.updateViewLayout(mContentView, mFloatParams);
+//                mTouchStartX = nowX;
+//                mTouchStartY = nowY;
+//                float deltaX = x - mStartX;
+//                float deltaY = y - mStartY;
+//                if (Math.abs(deltaX) >= 5 || Math.abs(deltaY) >= 5) {
+//                    isMove = true;
+//                }
+//                break;
+//            case MotionEvent.ACTION_UP:
+//                break;
+//            default:
+//                break;
+//        }
+//        //如果是移动事件不触发OnClick事件,防止移动的时候一放手形成点击事件
+//        return isMove;
+//    }
+//
+//    public void dismiss() {
+//        if (mContext == null) {
+//            return;
+//        }
+//        WindowManager windowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
+//        if (windowManager != null && mContentView != null && mContentView.getParent() != null) {
+//            windowManager.removeView(mContentView);
+//        }
+//        if (mLiveContainer != null) {
+//            mLiveContainer.removeAllViews();
+//        }
+//        this.mContext = null;
+//    }
+//
+//    public void addVideoView(List<RCRTCVideoView> videoViews) {
+//        if (videoViews != null && videoViews.size() > 0) {
+//            mLiveContainer.removeAllViews();
+//            for (int i = 0; i < videoViews.size(); i++) {
+//                RCRTCVideoView videoView = videoViews.get(i);
+//                ViewGroup parent = (ViewGroup) videoView.getParent();
+//                if (parent != null) {
+//                    parent.removeView(videoView);
+//                }
+//                RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
+//                layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
+//                videoView.setScalingType(isLiveFromPc ? RendererCommon.ScalingType.SCALE_ASPECT_FIT : RendererCommon.ScalingType.SCALE_ASPECT_FILL);
+//                mLiveContainer.addView(videoView, layoutParams);
+//            }
+//        }
+//    }
+//
+//    /**
+//     * 返回前台
+//     *
+//     * @param context
+//     */
+//    public void setTopApp(Context context) {
+//        if (AppUtils.isApplicationInBackground(context)) {
+//            //获取ActivityManager
+//            ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
+//            //获得当前运行的task(任务)
+//            List<ActivityManager.RunningTaskInfo> taskInfoList = null;
+//            if (activityManager != null) {
+//                taskInfoList = activityManager.getRunningTasks(100);
+//            }
+//            if (taskInfoList != null) {
+//                for (ActivityManager.RunningTaskInfo taskInfo : taskInfoList) {
+//                    //找到本应用的 task,并将它切换到前台
+//                    if (taskInfo.topActivity != null && taskInfo.topActivity.getPackageName().equals(context.getPackageName())) {
+//                        activityManager.moveTaskToFront(taskInfo.id, 0);
+//                        break;
+//                    }
+//                }
+//            }
+//        } else {
+//            Activity topActivity = AppManager.Companion.getInstance().currentActivity();
+//            if (topActivity != null) {
+//                topActivity.finish();
+//            }
+//        }
+//    }
+//
+//    public interface OnEventListener {
+//        void onClose();
+//    }
+//}

+ 94 - 94
student/src/main/java/com/cooleshow/student/ui/live/floatPop/FloatingWindowService.java

@@ -1,94 +1,94 @@
-package com.cooleshow.student.ui.live.floatPop;
-
-import android.app.Service;
-import android.content.Intent;
-import android.os.Binder;
-import android.os.IBinder;
-import android.util.Log;
-
-import java.util.List;
-
-import androidx.annotation.Nullable;
-import cn.rongcloud.rtc.api.stream.RCRTCVideoView;
-
-/**
- * Author by pq, Date on 2022/5/13.
- */
-public class FloatingWindowService extends Service implements FloatWindowHelper.OnEventListener {
-    public static final String CLASS_PATH = "com.cooleshow.student.ui.live.floatPop.FloatingWindowService";
-    private FloatWindowHelper mHelper;
-    private boolean isShowing = false;
-    private MyBinder mBinder;
-
-    @Override
-    public void onCreate() {
-        super.onCreate();
-        mHelper = new FloatWindowHelper(this, this);
-    }
-
-    @Override
-    public int onStartCommand(Intent intent, int flags, int startId) {
-        return super.onStartCommand(intent, flags, startId);
-    }
-
-    @Nullable
-    @Override
-    public IBinder onBind(Intent intent) {
-        if (mBinder == null) {
-            mBinder = new MyBinder();
-        }
-        boolean isPc = intent.getBooleanExtra("isPc", true);
-        if (mHelper != null && !isShowing) {
-            mHelper.setLiveFromPc(isPc);
-            mHelper.showFloatingWindowView(this);
-            isShowing = true;
-        }
-        return mBinder;
-    }
-
-    @Override
-    public void onDestroy() {
-        // 移除浮动框
-        if (mHelper != null) {
-            mHelper.dismiss();
-        }
-        if (mBinder != null) {
-            if (mBinder.eventListener != null) {
-                mBinder.eventListener.onServiceDestroy();
-            }
-        }
-        super.onDestroy();
-        Log.i("pq", "FloatingWindowService onDestroy");
-    }
-
-    @Override
-    public void onClose() {
-        if (mBinder != null && mBinder.eventListener != null) {
-            mBinder.eventListener.onUnbindService();
-        }
-    }
-
-    public class MyBinder extends Binder {
-        private OnEventListener eventListener;
-
-        public FloatingWindowService getService() {
-            return FloatingWindowService.this;
-        }
-
-        public void addVideoView(List<RCRTCVideoView> videoViews) {
-            if (mHelper != null) {
-                mHelper.addVideoView(videoViews);
-            }
-        }
-
-        public void setOnEventListener(OnEventListener eventListener) {
-            this.eventListener = eventListener;
-        }
-    }
-
-    public interface OnEventListener {
-        void onServiceDestroy();
-
-        void onUnbindService();
-    }
-}
+//package com.cooleshow.student.ui.live.floatPop;
+//
+//import android.app.Service;
+//import android.content.Intent;
+//import android.os.Binder;
+//import android.os.IBinder;
+//import android.util.Log;
+//
+//import java.util.List;
+//
+//import androidx.annotation.Nullable;
+//import cn.rongcloud.rtc.api.stream.RCRTCVideoView;
+//
+///**
+// * Author by pq, Date on 2022/5/13.
+// */
+//public class FloatingWindowService extends Service implements FloatWindowHelper.OnEventListener {
+//    public static final String CLASS_PATH = "com.cooleshow.student.ui.live.floatPop.FloatingWindowService";
+//    private FloatWindowHelper mHelper;
+//    private boolean isShowing = false;
+//    private MyBinder mBinder;
+//
+//    @Override
+//    public void onCreate() {
+//        super.onCreate();
+//        mHelper = new FloatWindowHelper(this, this);
+//    }
+//
+//    @Override
+//    public int onStartCommand(Intent intent, int flags, int startId) {
+//        return super.onStartCommand(intent, flags, startId);
+//    }
+//
+//    @Nullable
+//    @Override
+//    public IBinder onBind(Intent intent) {
+//        if (mBinder == null) {
+//            mBinder = new MyBinder();
+//        }
+//        boolean isPc = intent.getBooleanExtra("isPc", true);
+//        if (mHelper != null && !isShowing) {
+//            mHelper.setLiveFromPc(isPc);
+//            mHelper.showFloatingWindowView(this);
+//            isShowing = true;
+//        }
+//        return mBinder;
+//    }
+//
+//    @Override
+//    public void onDestroy() {
+//        // 移除浮动框
+//        if (mHelper != null) {
+//            mHelper.dismiss();
+//        }
+//        if (mBinder != null) {
+//            if (mBinder.eventListener != null) {
+//                mBinder.eventListener.onServiceDestroy();
+//            }
+//        }
+//        super.onDestroy();
+//        Log.i("pq", "FloatingWindowService onDestroy");
+//    }
+//
+//    @Override
+//    public void onClose() {
+//        if (mBinder != null && mBinder.eventListener != null) {
+//            mBinder.eventListener.onUnbindService();
+//        }
+//    }
+//
+//    public class MyBinder extends Binder {
+//        private OnEventListener eventListener;
+//
+//        public FloatingWindowService getService() {
+//            return FloatingWindowService.this;
+//        }
+//
+//        public void addVideoView(List<RCRTCVideoView> videoViews) {
+//            if (mHelper != null) {
+//                mHelper.addVideoView(videoViews);
+//            }
+//        }
+//
+//        public void setOnEventListener(OnEventListener eventListener) {
+//            this.eventListener = eventListener;
+//        }
+//    }
+//
+//    public interface OnEventListener {
+//        void onServiceDestroy();
+//
+//        void onUnbindService();
+//    }
+//}

+ 0 - 1
student/src/main/java/com/cooleshow/student/ui/main/CourseTableFragment.kt

@@ -35,7 +35,6 @@ import com.cooleshow.student.widgets.CalendarShrinkDecoration
 import com.cooleshow.student.widgets.helper.CourseHelper
 import com.haibin.calendarview.CalendarView
 import com.scwang.smart.refresh.layout.listener.OnRefreshListener
-import io.rong.imkit.utils.helper.OpenChatHelper
 import kotlinx.android.synthetic.main.fragment_course_table_layout.*
 import java.util.*
 

+ 1 - 2
student/src/main/java/com/cooleshow/student/ui/main/HomeFragment.java

@@ -60,7 +60,6 @@ import com.cooleshow.student.widgets.DialogUtils;
 import com.cooleshow.student.widgets.HomeHotAlbumDecoration;
 import com.cooleshow.usercenter.bean.StudentUserInfo;
 import com.cooleshow.usercenter.helper.UserHelper;
-import com.daya.live_teaching.utils.DisplayUtils;
 import com.scwang.smart.refresh.layout.api.RefreshLayout;
 import com.scwang.smart.refresh.layout.listener.OnRefreshListener;
 import com.youth.banner.Banner;
@@ -586,7 +585,7 @@ public class HomeFragment extends BaseMVPFragment<FragmentHomeLayoutBinding, Hom
 
         int[] location = new int[2];
 
-        location[1] = location[1] + DisplayUtils.dip2px(BaseApplication.context, offsetY);
+        location[1] = location[1] + SizeUtils.dp2px(offsetY);
 
         view.getLocationInWindow(location);
 

+ 6 - 15
student/src/main/java/com/cooleshow/student/ui/main/MainActivity.java

@@ -18,7 +18,6 @@ import androidx.fragment.app.Fragment;
 
 import com.alibaba.android.arouter.facade.annotation.Route;
 import com.alibaba.android.arouter.launcher.ARouter;
-import com.common.im.ui.MessageFragment;
 import com.cooleshow.base.bean.RouteBean;
 import com.cooleshow.base.common.BaseApplication;
 import com.cooleshow.base.constanst.EventConstants;
@@ -55,13 +54,10 @@ import com.cooleshow.student.presenter.main.MainPresenter;
 import com.cooleshow.usercenter.bean.StudentUserInfo;
 import com.cooleshow.usercenter.bean.UserInfo;
 import com.cooleshow.usercenter.helper.UserHelper;
-import com.daya.live_teaching.common.ResultCallback;
-import com.daya.live_teaching.im.IMManager;
 import com.google.android.material.bottomnavigation.BottomNavigationItemView;
 import com.google.android.material.bottomnavigation.BottomNavigationMenuView;
 import com.google.android.material.bottomnavigation.BottomNavigationView;
 import com.google.gson.Gson;
-import com.rong.io.live.config.LiveConfig;
 import com.tbruyelle.rxpermissions3.RxPermissions;
 import com.tencent.bugly.crashreport.CrashReport;
 
@@ -77,8 +73,6 @@ import io.reactivex.rxjava3.core.ObservableEmitter;
 import io.reactivex.rxjava3.core.ObservableOnSubscribe;
 import io.reactivex.rxjava3.functions.Consumer;
 import io.reactivex.rxjava3.schedulers.Schedulers;
-import io.rong.imkit.manager.UnReadMessageManager;
-import io.rong.imlib.RongIMClient;
 
 import static com.cooleshow.base.constanst.Constants.MAIN_PAGE_SELECT_POTION_KEY;
 
@@ -100,13 +94,13 @@ public class MainActivity extends BaseMVPActivity<ActivityMainBinding, MainPrese
     private long lastTime = 0;
     private boolean isNeedSetPushId = true;
     private String floatViewEventUrl = "";
-    private MessageFragment mMessageFragment;
     private IUnReadMessageObserver mUnReadMessageObserver = new IUnReadMessageObserver() {
         @Override
         public void onTotalUnreadMessageCountChanged(long totalUnreadCount) {
             onCountChanged(totalUnreadCount);
         }
     };
+    private ChatFragment mChatFragment;
 
 
     /**
@@ -177,13 +171,12 @@ public class MainActivity extends BaseMVPActivity<ActivityMainBinding, MainPrese
 //        mHomeFragment = new HomeFragment();
         NewHomeFragment newHomeFragment = new NewHomeFragment();
         CourseTableFragment courseTableFragment = new CourseTableFragment();
-        mMessageFragment = new MessageFragment();
-        ChatFragment chatFragment = new ChatFragment();
+        mChatFragment = new ChatFragment();
         shopMallFragment = new MallFragment();
         mMineFragment = new MineFragment();
         mFragments.add(newHomeFragment);
         mFragments.add(courseTableFragment);
-        mFragments.add(chatFragment);
+        mFragments.add(mChatFragment);
         mFragments.add(shopMallFragment);
         mFragments.add(mMineFragment);
         homePageAdapter.setFragments(mFragments);
@@ -328,9 +321,9 @@ public class MainActivity extends BaseMVPActivity<ActivityMainBinding, MainPrese
         if (id == R.id.view_chat) {
             if (UiUtils.isFastClick(200)) {
                 //双击操作
-                if (mMessageFragment != null) {
-                    mMessageFragment.onFindConversationUnRead();
-                }
+//                if (mChatFragment != null) {
+//                    mChatFragment.onFindConversationUnRead();
+//                }
                 return;
             }
             getViewBinding().viewPager.setCurrentItem(2, false);
@@ -405,8 +398,6 @@ public class MainActivity extends BaseMVPActivity<ActivityMainBinding, MainPrese
     public void loadEventBus(LoginStatusEvent event) {
         if (event != null && event.eventCode == LoginStatusConstants.LOGIN_OUT) {
             IMCenter.getInstance().logoutIM();
-            IMManager.getInstance().logout();
-            LiveConfig.isNeedReInitRTC = true;
             CommonConfig.isShowHomeFlashPage = true;
             isNeedSetPushId = true;
             LogUtils.i("pq", "LoginStatusEvent:logout");

+ 1 - 1
student/src/main/java/com/cooleshow/student/ui/main/MallFragment.java

@@ -50,6 +50,7 @@ import com.cooleshow.base.utils.MyFileUtils;
 import com.cooleshow.base.utils.PermissionUtils;
 import com.cooleshow.base.utils.ToastUtil;
 import com.cooleshow.base.utils.Utils;
+import com.cooleshow.base.utils.helper.GlideEngine;
 import com.cooleshow.base.widgets.DialogUtil;
 import com.cooleshow.student.R;
 import com.cooleshow.student.api.APIService;
@@ -61,7 +62,6 @@ import com.cooleshow.student.presenter.main.ShopMallPresenter;
 import com.cooleshow.student.widgets.LollipopFixedWebView;
 import com.cooleshow.student.widgets.helper.JsInterfaceUtils;
 import com.cooleshow.usercenter.helper.UserHelper;
-import com.daya.live_teaching.utils.GlideEngine;
 import com.google.gson.Gson;
 import com.luck.picture.lib.PictureSelector;
 import com.luck.picture.lib.config.PictureConfig;

+ 0 - 1
student/src/main/java/com/cooleshow/student/ui/main/TalentStyleFragment.java

@@ -16,7 +16,6 @@ import com.cooleshow.student.R;
 import com.cooleshow.student.adapter.HomeTalentStyleAdapter;
 import com.cooleshow.student.bean.HomeStyleBean;
 import com.cooleshow.student.databinding.FragmentHomeTalentLayoutBinding;
-import com.cooleshow.student.ui.live.LiveRoomActivity;
 
 import java.util.ArrayList;
 import java.util.List;

+ 2 - 2
student/src/main/java/com/cooleshow/student/ui/message/MessageBoxActivity.java

@@ -25,6 +25,7 @@ import com.cooleshow.base.ui.activity.BaseMVPActivity;
 import com.cooleshow.base.utils.GsonUtils;
 import com.cooleshow.base.utils.JumpUtils;
 import com.cooleshow.base.utils.SizeUtils;
+import com.cooleshow.base.utils.helper.QMUIStatusBarHelper;
 import com.cooleshow.student.R;
 import com.cooleshow.student.adapter.MessageBoxAdapter;
 import com.cooleshow.student.bean.CountOfUnreadBean;
@@ -38,7 +39,6 @@ import com.scwang.smart.refresh.layout.listener.OnRefreshListener;
 import java.util.ArrayList;
 import java.util.List;
 
-import io.rong.imkit.utils.StatusBarUtil;
 
 /**
  * 创建日期:2022/5/24 11:14
@@ -95,7 +95,7 @@ public class MessageBoxActivity extends BaseMVPActivity<ActivityMessageBoxBindin
     @Override
     protected void onCreate(@Nullable Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
-        StatusBarUtil.setStatusBarDarkTheme(this, true);
+        QMUIStatusBarHelper.setStatusBarLightMode(this);
     }
 
     private MessageBoxAdapter messageBoxAdapter;

+ 2 - 2
student/src/main/java/com/cooleshow/student/ui/mine/CheckModifyPhoneNumActivity.java

@@ -14,6 +14,7 @@ import com.cooleshow.base.router.RouterPath;
 import com.cooleshow.base.ui.activity.BaseMVPActivity;
 import com.cooleshow.base.utils.ToastUtil;
 import com.cooleshow.base.utils.ToastUtils;
+import com.cooleshow.base.utils.helper.QMUIStatusBarHelper;
 import com.cooleshow.chatmodule.utils.helper.IMThemManager;
 import com.cooleshow.student.R;
 import com.cooleshow.student.contract.CheckModifyPhoneNumContract;
@@ -21,7 +22,6 @@ import com.cooleshow.student.databinding.ActivityCheckModifyPhonenumBinding;
 import com.cooleshow.student.presenter.mine.CheckModifyPhoneNumPresenter;
 
 
-import io.rong.imkit.utils.StatusBarUtil;
 
 /**
  * 创建日期:2022/5/17 10:02
@@ -55,7 +55,7 @@ public class CheckModifyPhoneNumActivity extends BaseMVPActivity<ActivityCheckMo
     protected void onCreate(@Nullable Bundle savedInstanceState) {
         StyleConfig.setTheme(this);
         super.onCreate(savedInstanceState);
-        StatusBarUtil.setStatusBarDarkTheme(this, true);
+        QMUIStatusBarHelper.setStatusBarLightMode(this);
     }
     @Override
     protected void initView() {

+ 2 - 2
student/src/main/java/com/cooleshow/student/ui/mine/EquipmentTestActivity.java

@@ -28,6 +28,7 @@ import com.cooleshow.base.router.RouterPath;
 import com.cooleshow.base.ui.activity.BaseMVPActivity;
 import com.cooleshow.base.utils.FileUtils;
 import com.cooleshow.base.utils.NetworkUtil;
+import com.cooleshow.base.utils.helper.QMUIStatusBarHelper;
 import com.cooleshow.base.widgets.DialogUtil;
 import com.cooleshow.student.R;
 import com.cooleshow.student.adapter.TestingListAdapter;
@@ -41,7 +42,6 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.Timer;
 
-import io.rong.imkit.utils.StatusBarUtil;
 
 /**
  * 创建日期:2022/6/1 16:21
@@ -93,7 +93,7 @@ public class EquipmentTestActivity extends BaseMVPActivity<ActivityEquipmentTest
     @Override
     protected void onCreate(@Nullable Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
-        StatusBarUtil.setStatusBarDarkTheme(this, true);
+        QMUIStatusBarHelper.setStatusBarLightMode(this);
     }
     @Override
     public void initData() {

+ 2 - 2
student/src/main/java/com/cooleshow/student/ui/mine/FeedBackActivity.java

@@ -13,6 +13,7 @@ import com.cooleshow.base.router.RouterPath;
 import com.cooleshow.base.ui.activity.BaseMVPActivity;
 import com.cooleshow.base.utils.ToastUtil;
 import com.cooleshow.base.utils.ToastUtils;
+import com.cooleshow.base.utils.helper.QMUIStatusBarHelper;
 import com.cooleshow.chatmodule.utils.helper.IMThemManager;
 import com.cooleshow.student.R;
 import com.cooleshow.student.contract.FeedBackContract;
@@ -25,7 +26,6 @@ import org.json.JSONObject;
 import java.util.HashMap;
 import java.util.Map;
 
-import io.rong.imkit.utils.StatusBarUtil;
 
 /**
  * 创建日期:2022/5/18 16:25
@@ -61,7 +61,7 @@ public class FeedBackActivity extends BaseMVPActivity<ActivityFeedbackBinding, F
     protected void onCreate(@Nullable Bundle savedInstanceState) {
         StyleConfig.setTheme(this);
         super.onCreate(savedInstanceState);
-        StatusBarUtil.setStatusBarDarkTheme(this, true);
+        QMUIStatusBarHelper.setStatusBarLightMode(this);
     }
 
     @Override

+ 2 - 2
student/src/main/java/com/cooleshow/student/ui/mine/ModifyNickNameActivity.java

@@ -15,6 +15,7 @@ import com.cooleshow.base.router.RouterPath;
 import com.cooleshow.base.ui.activity.BaseMVPActivity;
 import com.cooleshow.base.utils.ToastUtil;
 import com.cooleshow.base.utils.ToastUtils;
+import com.cooleshow.base.utils.helper.QMUIStatusBarHelper;
 import com.cooleshow.chatmodule.utils.helper.IMThemManager;
 import com.cooleshow.student.R;
 import com.cooleshow.student.contract.ModifyNickNameContract;
@@ -25,7 +26,6 @@ import com.cooleshow.usercenter.bean.SetDetailBean;
 import org.json.JSONException;
 import org.json.JSONObject;
 
-import io.rong.imkit.utils.StatusBarUtil;
 
 /**
  * 创建日期:2022/5/16 17:22
@@ -61,7 +61,7 @@ public class ModifyNickNameActivity extends BaseMVPActivity<ActivityModifyNickna
     protected void onCreate(@Nullable Bundle savedInstanceState) {
         StyleConfig.setTheme(this);
         super.onCreate(savedInstanceState);
-        StatusBarUtil.setStatusBarDarkTheme(this, true);
+        QMUIStatusBarHelper.setStatusBarLightMode(this);
     }
     @Override
     protected void initView() {

+ 2 - 2
student/src/main/java/com/cooleshow/student/ui/mine/ModifyPasswordActivity.java

@@ -18,6 +18,7 @@ import com.cooleshow.base.router.RouterPath;
 import com.cooleshow.base.ui.activity.BaseMVPActivity;
 import com.cooleshow.base.utils.ToastUtil;
 import com.cooleshow.base.utils.ToastUtils;
+import com.cooleshow.base.utils.helper.QMUIStatusBarHelper;
 import com.cooleshow.base.widgets.dialog.ImgVerifyCodeDialog;
 import com.cooleshow.chatmodule.utils.helper.IMThemManager;
 import com.cooleshow.student.R;
@@ -36,7 +37,6 @@ import java.util.Map;
 import java.util.Timer;
 import java.util.TimerTask;
 
-import io.rong.imkit.utils.StatusBarUtil;
 
 /**
  * 创建日期:2022/5/17 13:33
@@ -79,7 +79,7 @@ public class ModifyPasswordActivity extends BaseMVPActivity<ActivityModifyPasswo
     protected void onCreate(@Nullable Bundle savedInstanceState) {
         StyleConfig.setTheme(this);
         super.onCreate(savedInstanceState);
-        StatusBarUtil.setStatusBarDarkTheme(this, true);
+        QMUIStatusBarHelper.setStatusBarLightMode(this);
     }
 
     @Autowired(name = "phoneNum")

+ 2 - 2
student/src/main/java/com/cooleshow/student/ui/mine/ModifyPhoneNumActivity.java

@@ -18,6 +18,7 @@ import com.cooleshow.base.router.RouterPath;
 import com.cooleshow.base.ui.activity.BaseMVPActivity;
 import com.cooleshow.base.utils.ToastUtil;
 import com.cooleshow.base.utils.ToastUtils;
+import com.cooleshow.base.utils.helper.QMUIStatusBarHelper;
 import com.cooleshow.base.widgets.dialog.ImgVerifyCodeDialog;
 import com.cooleshow.chatmodule.utils.helper.IMThemManager;
 import com.cooleshow.student.R;
@@ -37,7 +38,6 @@ import java.util.Map;
 import java.util.Timer;
 import java.util.TimerTask;
 
-import io.rong.imkit.utils.StatusBarUtil;
 
 /**
  * 创建日期:2022/5/17 10:49
@@ -81,7 +81,7 @@ public class ModifyPhoneNumActivity extends BaseMVPActivity<ActivityModifyPhonen
     protected void onCreate(@Nullable Bundle savedInstanceState) {
         StyleConfig.setTheme(this);
         super.onCreate(savedInstanceState);
-        StatusBarUtil.setStatusBarDarkTheme(this, true);
+        QMUIStatusBarHelper.setStatusBarLightMode(this);
     }
 
     @Autowired(name = "oldPhone")

+ 2 - 2
student/src/main/java/com/cooleshow/student/ui/mine/NetworkMonitoringActivity.java

@@ -13,6 +13,7 @@ import com.alibaba.android.arouter.facade.annotation.Route;
 import com.cooleshow.base.router.RouterPath;
 import com.cooleshow.base.ui.activity.BaseMVPActivity;
 import com.cooleshow.base.utils.NetworkUtil;
+import com.cooleshow.base.utils.helper.QMUIStatusBarHelper;
 import com.cooleshow.base.widgets.BaseDialog;
 import com.cooleshow.base.widgets.DialogUtil;
 import com.cooleshow.base.widgets.RoundProgressBar;
@@ -25,7 +26,6 @@ import com.cooleshow.student.presenter.mine.NetworkMonitoringPresenter;
 
 import java.util.Random;
 
-import io.rong.imkit.utils.StatusBarUtil;
 
 /**
  * 创建日期:2022/6/1 14:50
@@ -58,7 +58,7 @@ public class NetworkMonitoringActivity extends BaseMVPActivity<ActivityNetworkMo
     @Override
     protected void onCreate(@Nullable Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
-        StatusBarUtil.setStatusBarDarkTheme(this, true);
+        QMUIStatusBarHelper.setStatusBarLightMode(this);
 
     }
     @Override

+ 2 - 2
student/src/main/java/com/cooleshow/student/ui/mine/PayTestActivity.java

@@ -17,6 +17,7 @@ import com.cooleshow.base.router.RouterPath;
 import com.cooleshow.base.ui.activity.BaseMVPActivity;
 import com.cooleshow.base.utils.ToastUtil;
 import com.cooleshow.base.utils.ToastUtils;
+import com.cooleshow.base.utils.helper.QMUIStatusBarHelper;
 import com.cooleshow.student.R;
 import com.cooleshow.student.bean.PayTestBean;
 import com.cooleshow.student.bean.alipay.AuthResult;
@@ -35,7 +36,6 @@ import org.json.JSONObject;
 
 import java.util.Map;
 
-import io.rong.imkit.utils.StatusBarUtil;
 
 /**
  * 创建日期:2022/5/25 13:46
@@ -75,7 +75,7 @@ public class PayTestActivity extends BaseMVPActivity<ActivityPayTestBinding, Pay
     @Override
     protected void onCreate(@Nullable Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
-        StatusBarUtil.setStatusBarDarkTheme(this, true);
+        QMUIStatusBarHelper.setStatusBarLightMode(this);
         //沙箱环境支付
         EnvUtils.setEnv(EnvUtils.EnvEnum.SANDBOX);
         api = WXAPIFactory.createWXAPI(this, null);

+ 2 - 2
student/src/main/java/com/cooleshow/student/ui/mine/PersonalCertificationActivity.java

@@ -18,6 +18,7 @@ import com.cooleshow.base.ui.activity.BaseMVPActivity;
 import com.cooleshow.base.utils.SpannableStringUtils;
 import com.cooleshow.base.utils.ToastUtil;
 import com.cooleshow.base.utils.ToastUtils;
+import com.cooleshow.base.utils.helper.QMUIStatusBarHelper;
 import com.cooleshow.base.utils.helper.WebStartHelper;
 import com.cooleshow.student.R;
 import com.cooleshow.student.contract.PersonalCertificationContract;
@@ -28,7 +29,6 @@ import com.cooleshow.student.presenter.mine.PersonalCertificationPresenter;
 import org.json.JSONException;
 import org.json.JSONObject;
 
-import io.rong.imkit.utils.StatusBarUtil;
 
 /**
  * 创建日期:2022/5/17 14:17
@@ -74,7 +74,7 @@ public class PersonalCertificationActivity extends BaseMVPActivity<ActivityPerso
     @Override
     protected void onCreate(@Nullable Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
-        StatusBarUtil.setStatusBarDarkTheme(this, true);
+        QMUIStatusBarHelper.setStatusBarLightMode(this);
     }
 
     @Override

+ 3 - 4
student/src/main/java/com/cooleshow/student/ui/mine/PersonalSettingActivity.java

@@ -25,6 +25,8 @@ import com.cooleshow.base.bean.TeachableInstrumentBean;
 import com.cooleshow.base.router.RouterPath;
 import com.cooleshow.base.utils.DateUtil;
 import com.cooleshow.base.utils.MyFileUtils;
+import com.cooleshow.base.utils.helper.GlideEngine;
+import com.cooleshow.base.utils.helper.QMUIStatusBarHelper;
 import com.cooleshow.usercenter.bean.StudentUserInfo;
 import com.cooleshow.usercenter.helper.UserHelper;
 import com.cooleshow.base.ui.activity.BaseMVPActivity;
@@ -39,7 +41,6 @@ import com.cooleshow.student.contract.PersonalSettingContract;
 import com.cooleshow.student.databinding.ActivityPersonalSettingBinding;
 import com.cooleshow.student.presenter.mine.PersonalSettingPresenter;
 import com.cooleshow.usercenter.bean.SetDetailBean;
-import com.daya.live_teaching.utils.GlideEngine;
 import com.luck.picture.lib.PictureSelector;
 import com.luck.picture.lib.compress.CompressionPredicate;
 import com.luck.picture.lib.compress.Luban;
@@ -61,8 +62,6 @@ import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 
-import io.rong.imkit.RongIM;
-import io.rong.imkit.utils.StatusBarUtil;
 
 /**
  * 创建日期:2022/5/16 16:07
@@ -84,7 +83,7 @@ public class PersonalSettingActivity extends BaseMVPActivity<ActivityPersonalSet
     @Override
     protected void onCreate(@Nullable Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
-        StatusBarUtil.setStatusBarDarkTheme(this, true);
+        QMUIStatusBarHelper.setStatusBarLightMode(this);
 
     }
 

+ 2 - 2
student/src/main/java/com/cooleshow/student/ui/mine/SettingActivity.java

@@ -14,6 +14,7 @@ import com.cooleshow.base.constanst.EventConstants;
 import com.cooleshow.base.router.RouterPath;
 import com.cooleshow.base.ui.activity.BaseMVPActivity;
 import com.cooleshow.base.utils.SPUtils;
+import com.cooleshow.base.utils.helper.QMUIStatusBarHelper;
 import com.cooleshow.base.utils.helper.WebStartHelper;
 import com.cooleshow.student.R;
 import com.cooleshow.student.contract.SettingContract;
@@ -23,7 +24,6 @@ import com.cooleshow.student.presenter.mine.SettingPresenter;
 import com.cooleshow.usercenter.constants.UserConstants;
 import com.cooleshow.usercenter.helper.UserHelper;
 
-import io.rong.imkit.utils.StatusBarUtil;
 
 /**
  * 创建日期:2022/5/16 16:55
@@ -86,7 +86,7 @@ public class SettingActivity extends BaseMVPActivity<ActivitySettingBinding, Set
     @Override
     protected void onCreate(@Nullable Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
-        StatusBarUtil.setStatusBarDarkTheme(this, true);
+        QMUIStatusBarHelper.setStatusBarLightMode(this);
     }
 
     private boolean is_detection;

+ 2 - 2
student/src/main/java/com/cooleshow/student/ui/mine/TeachableInstrumentActivity.java

@@ -17,6 +17,7 @@ import com.cooleshow.base.router.RouterPath;
 import com.cooleshow.base.ui.activity.BaseMVPActivity;
 import com.cooleshow.base.utils.ToastUtil;
 import com.cooleshow.base.utils.ToastUtils;
+import com.cooleshow.base.utils.helper.QMUIStatusBarHelper;
 import com.cooleshow.student.R;
 import com.cooleshow.student.adapter.TeachableInstrumentAdapter;
 import com.cooleshow.student.contract.TeachableInstrumentContract;
@@ -27,7 +28,6 @@ import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.List;
 
-import io.rong.imkit.utils.StatusBarUtil;
 
 /**
  * 创建日期:2022/6/1 9:15
@@ -112,7 +112,7 @@ public class TeachableInstrumentActivity extends BaseMVPActivity<ActivityTeachab
     protected void onCreate(@Nullable Bundle savedInstanceState) {
         StyleConfig.setTheme(this);
         super.onCreate(savedInstanceState);
-        StatusBarUtil.setStatusBarDarkTheme(this, true);
+        QMUIStatusBarHelper.setStatusBarLightMode(this);
     }
 
     @Override

+ 2 - 2
student/src/main/java/com/cooleshow/student/ui/splash/GuideActivity.java

@@ -22,6 +22,7 @@ import com.cooleshow.base.constanst.Constants;
 import com.cooleshow.base.router.RouterPath;
 import com.cooleshow.base.ui.activity.BaseMVPActivity;
 import com.cooleshow.base.utils.SPUtils;
+import com.cooleshow.base.utils.helper.QMUIStatusBarHelper;
 import com.cooleshow.base.widgets.MyViewPage;
 import com.cooleshow.student.R;
 import com.cooleshow.student.adapter.ViewPagerAdapter;
@@ -32,7 +33,6 @@ import com.cooleshow.usercenter.helper.UserHelper;
 import java.util.ArrayList;
 import java.util.List;
 
-import io.rong.imkit.utils.StatusBarUtil;
 
 /**
  * 创建日期:2022/5/24 17:53
@@ -74,7 +74,7 @@ public class GuideActivity extends BaseMVPActivity<ActivityGuideBinding, GuidePr
     @Override
     protected void onCreate(@Nullable Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
-        StatusBarUtil.setStatusBarDarkTheme(this, true);
+        QMUIStatusBarHelper.setStatusBarLightMode(this);
     }
 
     private void goAction() {

+ 2 - 2
student/src/main/java/com/cooleshow/student/ui/splash/SplashActivity.kt

@@ -19,13 +19,13 @@ import com.cooleshow.base.constanst.Constants
 import com.cooleshow.base.router.RouterPath
 import com.cooleshow.base.ui.activity.BaseActivity
 import com.cooleshow.base.utils.*
+import com.cooleshow.base.utils.helper.QMUIStatusBarHelper
 import com.cooleshow.base.widgets.dialog.PrivacyTipDialog
 import com.cooleshow.student.databinding.ActivitySplashLayoutBinding
 import com.cooleshow.student.helper.InitHelper
 import com.cooleshow.usercenter.constants.UserConstants
 import com.cooleshow.usercenter.helper.UserHelper
 import com.cooleshow.usercenter.ui.activity.VerifyCodeLoginActivity
-import io.rong.imkit.utils.StatusBarUtil
 import java.net.URLDecoder
 
 
@@ -39,7 +39,7 @@ class SplashActivity : BaseActivity<ActivitySplashLayoutBinding>() {
 
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
-        StatusBarUtil.setStatusBarDarkTheme(this, true)
+        QMUIStatusBarHelper.setStatusBarLightMode(this)
     }
 
     override fun initView() {

+ 2 - 4
student/src/main/java/com/cooleshow/student/ui/web/HtmlActivity.java

@@ -63,6 +63,7 @@ import com.cooleshow.base.utils.ToastUtil;
 import com.cooleshow.base.utils.UriUtils;
 import com.cooleshow.base.utils.WebParamsUtils;
 import com.cooleshow.base.utils.helper.DialogHelper;
+import com.cooleshow.base.utils.helper.GlideEngine;
 import com.cooleshow.base.utils.helper.QMUIStatusBarHelper;
 import com.cooleshow.base.utils.helper.upload.UploadHelper;
 import com.cooleshow.base.widgets.DialogUtil;
@@ -76,11 +77,9 @@ import com.cooleshow.student.bean.alipay.PayResult;
 import com.cooleshow.student.bean.weixinpay.WeixinPayInfo;
 import com.cooleshow.student.databinding.ActivityHtml1Binding;
 import com.cooleshow.student.helper.ShareHelper;
-import com.cooleshow.student.ui.live.LiveRoomActivity;
 import com.cooleshow.student.widgets.LollipopFixedWebView;
 import com.cooleshow.student.widgets.helper.JsInterfaceUtils;
 import com.cooleshow.usercenter.helper.UserHelper;
-import com.daya.live_teaching.utils.GlideEngine;
 import com.daya.tclive.helper.TTLiveHelper;
 import com.google.gson.Gson;
 import com.gyf.immersionbar.ImmersionBar;
@@ -123,7 +122,6 @@ import java.util.Map;
 import io.reactivex.rxjava3.core.Observer;
 import io.reactivex.rxjava3.disposables.Disposable;
 import io.reactivex.rxjava3.schedulers.Schedulers;
-import io.rong.imkit.utils.helper.OpenChatHelper;
 import okhttp3.ResponseBody;
 
 @Route(path = RouterPath.WebCenter.ACTIVITY_HTML)
@@ -606,7 +604,7 @@ public class HtmlActivity extends BaseActivity<ActivityHtml1Binding> implements
         if (isFinishing() || isDestroyed()) {
             return;
         }
-        if (TextUtils.equals(OpenChatHelper.SINGLE_CHAT, type)) {
+        if (TextUtils.equals(ChatHelper.SINGLE_CHAT, type)) {
             ChatHelper.getInstance().goChat(id, "");
         } else {
             ChatHelper.getInstance().goGroupChat(id, "");

+ 1 - 1
student/src/main/java/com/cooleshow/student/ui/web/HtmlHorizontalScreenActivity.java

@@ -59,6 +59,7 @@ import com.cooleshow.base.utils.UriUtils;
 import com.cooleshow.base.utils.Utils;
 import com.cooleshow.base.utils.WebParamsUtils;
 import com.cooleshow.base.utils.helper.DialogHelper;
+import com.cooleshow.base.utils.helper.GlideEngine;
 import com.cooleshow.base.utils.helper.QMUIStatusBarHelper;
 import com.cooleshow.base.utils.helper.upload.UploadHelper;
 import com.cooleshow.base.widgets.DialogUtil;
@@ -74,7 +75,6 @@ import com.cooleshow.student.helper.ShareHelper;
 import com.cooleshow.student.widgets.LollipopFixedWebView;
 import com.cooleshow.student.widgets.helper.JsInterfaceUtils;
 import com.cooleshow.usercenter.helper.UserHelper;
-import com.daya.live_teaching.utils.GlideEngine;
 import com.google.gson.Gson;
 import com.gyf.immersionbar.ImmersionBar;
 import com.luck.picture.lib.PictureSelector;

+ 1 - 1
student/src/main/java/com/cooleshow/student/ui/web/WebActivity.java

@@ -37,6 +37,7 @@ import com.cooleshow.base.utils.PermissionUtils;
 import com.cooleshow.base.utils.ToastUtils;
 import com.cooleshow.base.utils.UriUtils;
 import com.cooleshow.base.utils.Utils;
+import com.cooleshow.base.utils.helper.GlideEngine;
 import com.cooleshow.base.utils.helper.QMUIStatusBarHelper;
 import com.cooleshow.base.utils.helper.upload.UploadHelper;
 import com.cooleshow.base.widgets.LollipopFixedWebView;
@@ -46,7 +47,6 @@ import com.cooleshow.student.R;
 import com.cooleshow.student.databinding.ActivityHtmlBinding;
 import com.cooleshow.student.widgets.helper.JsInterfaceHelper;
 import com.cooleshow.usercenter.helper.UserHelper;
-import com.daya.live_teaching.utils.GlideEngine;
 import com.luck.picture.lib.PictureSelector;
 import com.luck.picture.lib.config.PictureConfig;
 import com.luck.picture.lib.config.PictureMimeType;

+ 2 - 2
student/src/main/java/com/cooleshow/student/ui/work/HomeWorkActivity.java

@@ -11,6 +11,7 @@ import com.alibaba.android.arouter.facade.annotation.Route;
 import com.cooleshow.base.router.RouterPath;
 
 import com.cooleshow.base.ui.activity.BaseMVPActivity;
+import com.cooleshow.base.utils.helper.QMUIStatusBarHelper;
 import com.cooleshow.student.adapter.HomeWorkPagerAdapter;
 import com.cooleshow.student.contract.HomeWorkActContract;
 import com.cooleshow.student.databinding.ActivityHomeworkBinding;
@@ -21,7 +22,6 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
-import io.rong.imkit.utils.StatusBarUtil;
 
 /**
  * 创建日期:2022/5/23 10:47
@@ -34,7 +34,7 @@ public class HomeWorkActivity extends BaseMVPActivity<ActivityHomeworkBinding, H
     @Override
     protected void onCreate(@Nullable Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
-        StatusBarUtil.setStatusBarDarkTheme(this, true);
+        QMUIStatusBarHelper.setStatusBarLightMode(this);
     }
 
     private TabLayout tabLayout;

+ 0 - 1
student/src/main/java/com/cooleshow/student/ui/work/HomeWorkDetailActivity.java

@@ -44,7 +44,6 @@ import androidx.annotation.Nullable;
 import androidx.recyclerview.widget.GridLayoutManager;
 import androidx.recyclerview.widget.LinearLayoutManager;
 import androidx.recyclerview.widget.RecyclerView;
-import io.rong.imkit.utils.helper.OpenChatHelper;
 
 /**
  * Author by pq, Date on 2022/7/6.

+ 0 - 1
student/src/main/java/com/cooleshow/student/ui/work/HomeWorkFragment.java

@@ -9,7 +9,6 @@ import android.widget.TextView;
 import androidx.annotation.NonNull;
 import androidx.recyclerview.widget.LinearLayoutManager;
 import androidx.recyclerview.widget.RecyclerView;
-import io.rong.imkit.utils.helper.OpenChatHelper;
 
 import com.alibaba.android.arouter.launcher.ARouter;
 import com.bigkoo.pickerview.builder.TimePickerBuilder;

+ 0 - 1
student/src/main/java/com/cooleshow/student/widgets/DialogUtils.java

@@ -26,7 +26,6 @@ import com.cooleshow.base.utils.GlideUtils;
 import com.cooleshow.student.R;
 import com.cooleshow.student.bean.AppHomeBean;
 import com.cooleshow.usercenter.utils.SavePicUtil;
-import com.daya.live_teaching.utils.ToastUtils;
 
 /**
  * 创建日期:2022/5/30 10:08

+ 144 - 144
student/src/main/java/com/cooleshow/student/widgets/dialog/LiveRoomMicManagerDialog.java

@@ -1,144 +1,144 @@
-package com.cooleshow.student.widgets.dialog;
-
-import android.app.Dialog;
-import android.content.Context;
-import android.os.Bundle;
-import android.view.Gravity;
-import android.view.View;
-import android.view.Window;
-import android.view.WindowManager;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.TextView;
-
-import com.cooleshow.base.utils.GlideUtils;
-import com.cooleshow.student.R;
-import com.cooleshow.usercenter.helper.UserHelper;
-import com.rong.io.live.LiveRoomMsgConstants;
-
-import androidx.annotation.NonNull;
-import androidx.constraintlayout.widget.ConstraintLayout;
-
-/**
- * Author by pq, Date on 2022/8/11.
- */
-public class LiveRoomMicManagerDialog extends Dialog implements View.OnClickListener {
-
-    private LinearLayout mLlApply;
-    private TextView mTvApplyMic;
-    private TextView mTvCancel;
-    private ConstraintLayout mCsApplying;
-    private TextView mTvCancelApply;
-    private ImageView mIvOwnerAvatar;
-    private ImageView mIvTeacherAvatar;
-    private LinearLayout mLlCloseMic;
-    private TextView mTvCloseMic;
-    private TextView mTvCancel2;
-    private OnEventListener mEventListener;
-
-    public LiveRoomMicManagerDialog(@NonNull Context context) {
-        super(context, R.style.MyBottomDialogStyle);
-    }
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.dialog_live_room_mic_manager_layout);
-        Window window = getWindow();
-        //设置dialog在屏幕底部
-        window.setGravity(Gravity.BOTTOM);
-        //设置dialog弹出时的动画效果,从屏幕底部向上弹出
-        window.setWindowAnimations(com.cooleshow.base.R.style.BottomAnimation);
-        window.getDecorView().setPadding(0, 0, 0, 0);
-        //获得window窗口的属性
-        WindowManager.LayoutParams lp = window.getAttributes();
-        //设置窗口宽度为充满全屏
-        lp.width = WindowManager.LayoutParams.MATCH_PARENT;
-        //设置窗口高度为包裹内容
-        lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
-        lp.horizontalMargin = 0;
-        lp.verticalMargin = 0;
-        //将设置好的属性set回去
-        window.setAttributes(lp);
-
-        mLlApply = findViewById(R.id.ll_apply);
-        mTvApplyMic = findViewById(R.id.tv_apply_mic);
-        mTvCancel = findViewById(R.id.tv_cancel);
-        mCsApplying = findViewById(R.id.cs_applying);
-        mTvCancelApply = findViewById(R.id.tv_cancel_apply);
-        mIvOwnerAvatar = findViewById(R.id.iv_owner_avatar);
-        mIvTeacherAvatar = findViewById(R.id.iv_teacher_avatar);
-        mLlCloseMic = findViewById(R.id.ll_close_mic);
-        mTvCloseMic = findViewById(R.id.tv_close_mic);
-        mTvCancel2 = findViewById(R.id.tv_cancel2);
-
-        String userAvatar = UserHelper.getUserAvatar();
-        GlideUtils.INSTANCE.loadImage(getContext(),userAvatar,mIvOwnerAvatar,R.drawable.icon_teacher_default_head);
-        initListener();
-    }
-
-    private void initListener() {
-        mTvApplyMic.setOnClickListener(this);
-        mTvCancel.setOnClickListener(this);
-        mTvCancelApply.setOnClickListener(this);
-        mTvCloseMic.setOnClickListener(this);
-        mTvCancel2.setOnClickListener(this);
-    }
-
-    public void setMicStatus(int micStatus) {
-        if (mLlApply != null) {
-            mLlApply.setVisibility(micStatus == LiveRoomMsgConstants.MIC_STATUS_NORMAL ? View.VISIBLE : View.GONE);
-        }
-        if (mCsApplying != null) {
-            mCsApplying.setVisibility(micStatus == LiveRoomMsgConstants.MIC_STATUS_CONNECTING ? View.VISIBLE : View.GONE);
-        }
-        if (mLlCloseMic != null) {
-            mLlCloseMic.setVisibility(micStatus == LiveRoomMsgConstants.MIC_STATUS_CONNECT_SUCCESS ? View.VISIBLE : View.GONE);
-        }
-    }
-
-    @Override
-    public void onClick(View v) {
-        int id = v.getId();
-        if (id == R.id.tv_cancel || id == R.id.tv_cancel2) {
-            dismiss();
-            return;
-        }
-        if (id == R.id.tv_cancel_apply) {
-            //取消申请
-            if (mEventListener != null) {
-                mEventListener.onApplyCancel();
-            }
-        }
-        if (id == R.id.tv_apply_mic) {
-            //申请连麦
-            if (mEventListener != null) {
-                mEventListener.onApplyMic();
-            }
-        }
-        if (id == R.id.tv_close_mic) {
-            //关闭连麦
-            if (mEventListener != null) {
-                mEventListener.onCloseMic();
-            }
-        }
-    }
-
-    public void setLiveTeacherInfo(String teacherAvatar){
-        if (mIvTeacherAvatar != null) {
-            GlideUtils.INSTANCE.loadImage(getContext(),teacherAvatar,mIvTeacherAvatar,R.drawable.icon_teacher_default_head);
-        }
-    }
-
-    public void setOnEventListener(OnEventListener listener) {
-        this.mEventListener = listener;
-    }
-
-    public interface OnEventListener {
-        void onApplyMic();
-
-        void onApplyCancel();
-
-        void onCloseMic();
-    }
-}
+//package com.cooleshow.student.widgets.dialog;
+//
+//import android.app.Dialog;
+//import android.content.Context;
+//import android.os.Bundle;
+//import android.view.Gravity;
+//import android.view.View;
+//import android.view.Window;
+//import android.view.WindowManager;
+//import android.widget.ImageView;
+//import android.widget.LinearLayout;
+//import android.widget.TextView;
+//
+//import com.cooleshow.base.utils.GlideUtils;
+//import com.cooleshow.student.R;
+//import com.cooleshow.usercenter.helper.UserHelper;
+//import com.rong.io.live.LiveRoomMsgConstants;
+//
+//import androidx.annotation.NonNull;
+//import androidx.constraintlayout.widget.ConstraintLayout;
+//
+///**
+// * Author by pq, Date on 2022/8/11.
+// */
+//public class LiveRoomMicManagerDialog extends Dialog implements View.OnClickListener {
+//
+//    private LinearLayout mLlApply;
+//    private TextView mTvApplyMic;
+//    private TextView mTvCancel;
+//    private ConstraintLayout mCsApplying;
+//    private TextView mTvCancelApply;
+//    private ImageView mIvOwnerAvatar;
+//    private ImageView mIvTeacherAvatar;
+//    private LinearLayout mLlCloseMic;
+//    private TextView mTvCloseMic;
+//    private TextView mTvCancel2;
+//    private OnEventListener mEventListener;
+//
+//    public LiveRoomMicManagerDialog(@NonNull Context context) {
+//        super(context, R.style.MyBottomDialogStyle);
+//    }
+//
+//    @Override
+//    protected void onCreate(Bundle savedInstanceState) {
+//        super.onCreate(savedInstanceState);
+//        setContentView(R.layout.dialog_live_room_mic_manager_layout);
+//        Window window = getWindow();
+//        //设置dialog在屏幕底部
+//        window.setGravity(Gravity.BOTTOM);
+//        //设置dialog弹出时的动画效果,从屏幕底部向上弹出
+//        window.setWindowAnimations(com.cooleshow.base.R.style.BottomAnimation);
+//        window.getDecorView().setPadding(0, 0, 0, 0);
+//        //获得window窗口的属性
+//        WindowManager.LayoutParams lp = window.getAttributes();
+//        //设置窗口宽度为充满全屏
+//        lp.width = WindowManager.LayoutParams.MATCH_PARENT;
+//        //设置窗口高度为包裹内容
+//        lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
+//        lp.horizontalMargin = 0;
+//        lp.verticalMargin = 0;
+//        //将设置好的属性set回去
+//        window.setAttributes(lp);
+//
+//        mLlApply = findViewById(R.id.ll_apply);
+//        mTvApplyMic = findViewById(R.id.tv_apply_mic);
+//        mTvCancel = findViewById(R.id.tv_cancel);
+//        mCsApplying = findViewById(R.id.cs_applying);
+//        mTvCancelApply = findViewById(R.id.tv_cancel_apply);
+//        mIvOwnerAvatar = findViewById(R.id.iv_owner_avatar);
+//        mIvTeacherAvatar = findViewById(R.id.iv_teacher_avatar);
+//        mLlCloseMic = findViewById(R.id.ll_close_mic);
+//        mTvCloseMic = findViewById(R.id.tv_close_mic);
+//        mTvCancel2 = findViewById(R.id.tv_cancel2);
+//
+//        String userAvatar = UserHelper.getUserAvatar();
+//        GlideUtils.INSTANCE.loadImage(getContext(),userAvatar,mIvOwnerAvatar,R.drawable.icon_teacher_default_head);
+//        initListener();
+//    }
+//
+//    private void initListener() {
+//        mTvApplyMic.setOnClickListener(this);
+//        mTvCancel.setOnClickListener(this);
+//        mTvCancelApply.setOnClickListener(this);
+//        mTvCloseMic.setOnClickListener(this);
+//        mTvCancel2.setOnClickListener(this);
+//    }
+//
+//    public void setMicStatus(int micStatus) {
+//        if (mLlApply != null) {
+//            mLlApply.setVisibility(micStatus == LiveRoomMsgConstants.MIC_STATUS_NORMAL ? View.VISIBLE : View.GONE);
+//        }
+//        if (mCsApplying != null) {
+//            mCsApplying.setVisibility(micStatus == LiveRoomMsgConstants.MIC_STATUS_CONNECTING ? View.VISIBLE : View.GONE);
+//        }
+//        if (mLlCloseMic != null) {
+//            mLlCloseMic.setVisibility(micStatus == LiveRoomMsgConstants.MIC_STATUS_CONNECT_SUCCESS ? View.VISIBLE : View.GONE);
+//        }
+//    }
+//
+//    @Override
+//    public void onClick(View v) {
+//        int id = v.getId();
+//        if (id == R.id.tv_cancel || id == R.id.tv_cancel2) {
+//            dismiss();
+//            return;
+//        }
+//        if (id == R.id.tv_cancel_apply) {
+//            //取消申请
+//            if (mEventListener != null) {
+//                mEventListener.onApplyCancel();
+//            }
+//        }
+//        if (id == R.id.tv_apply_mic) {
+//            //申请连麦
+//            if (mEventListener != null) {
+//                mEventListener.onApplyMic();
+//            }
+//        }
+//        if (id == R.id.tv_close_mic) {
+//            //关闭连麦
+//            if (mEventListener != null) {
+//                mEventListener.onCloseMic();
+//            }
+//        }
+//    }
+//
+//    public void setLiveTeacherInfo(String teacherAvatar){
+//        if (mIvTeacherAvatar != null) {
+//            GlideUtils.INSTANCE.loadImage(getContext(),teacherAvatar,mIvTeacherAvatar,R.drawable.icon_teacher_default_head);
+//        }
+//    }
+//
+//    public void setOnEventListener(OnEventListener listener) {
+//        this.mEventListener = listener;
+//    }
+//
+//    public interface OnEventListener {
+//        void onApplyMic();
+//
+//        void onApplyCancel();
+//
+//        void onCloseMic();
+//    }
+//}

+ 0 - 2
student/src/main/java/com/cooleshow/student/widgets/helper/JsInterfaceAccomPanyUtils.java

@@ -23,8 +23,6 @@ import com.gyf.immersionbar.ImmersionBar;
 
 import org.json.JSONObject;
 
-import io.rong.imkit.RongIM;
-import io.rong.imlib.model.UserInfo;
 
 /**
  * Description:

+ 0 - 2
student/src/main/java/com/cooleshow/student/widgets/helper/JsInterfaceUtils.java

@@ -24,8 +24,6 @@ import com.gyf.immersionbar.ImmersionBar;
 
 import org.json.JSONObject;
 
-import io.rong.imkit.RongIM;
-import io.rong.imlib.model.UserInfo;
 
 /**
  * Description:

+ 17 - 22
student/src/main/java/com/cooleshow/student/widgets/helper/VideoViewManager.java

@@ -15,20 +15,15 @@ import java.util.ArrayList;
 import java.util.LinkedHashMap;
 import java.util.Map;
 
-import cn.rongcloud.rtc.api.stream.RCRTCVideoView;
-import cn.rongcloud.rtc.api.stream.view.RCRTCRendererEventsListener;
-import cn.rongcloud.rtc.core.RendererCommon;
-
-import static cn.rongcloud.rtc.core.RendererCommon.ScalingType.SCALE_ASPECT_FILL;
 
 public class VideoViewManager {
 
     private static final String TAG = "VideoViewManager";
     private static final int MAX_WAIT_RENDER_TIME = 8000;
-    ArrayList<RCRTCVideoView> arrayListVideoView;
+    ArrayList<View> arrayListVideoView;
     int mWidth, mHeight;
     private RelativeLayout flSurfaceContainer;
-    private Map<String, RCRTCVideoView> linkedHashMap = new LinkedHashMap<>();
+    private Map<String, View> linkedHashMap = new LinkedHashMap<>();
     private boolean isFullScreen = false;
     private int mainScreenPosition = 0;
     private int otherVideoViewMaxWidth = 0;
@@ -68,7 +63,7 @@ public class VideoViewManager {
      *
      * @param list
      */
-    public void update(ArrayList<RCRTCVideoView> list, boolean isPc, boolean isShowLoading) {
+    public void update(ArrayList<View> list, boolean isPc, boolean isShowLoading) {
         Log.i("pq", "update" + list.size());
         Log.i("pq", "mainScreenPosition" + mainScreenPosition);
         arrayListVideoView = list;
@@ -105,17 +100,17 @@ public class VideoViewManager {
             if (index >= arrayListVideoView.size()) {
                 break;
             }
-            arrayListVideoView.get(i).setRendererEventsListener(new RCRTCRendererEventsListener() {
-                @Override
-                public void onFirstFrame() {
-                    Log.i("pq", "视频第一帧渲染");
-                    hideStatusView();
-
-                }
-            });
-            arrayListVideoView.get(i).setScalingType(isPc ? RendererCommon.ScalingType.SCALE_ASPECT_FIT : SCALE_ASPECT_FILL);
-            flSurfaceContainer.addView(arrayListVideoView.get(i), layoutParams);
-            index++;
+//            arrayListVideoView.get(i).setRendererEventsListener(new RCRTCRendererEventsListener() {
+//                @Override
+//                public void onFirstFrame() {
+//                    Log.i("pq", "视频第一帧渲染");
+//                    hideStatusView();
+//
+//                }
+//            });
+//            arrayListVideoView.get(i).setScalingType(isPc ? RendererCommon.ScalingType.SCALE_ASPECT_FIT : SCALE_ASPECT_FILL);
+//            flSurfaceContainer.addView(arrayListVideoView.get(i), layoutParams);
+//            index++;
         }
         if (isShowLoading) {
             showLoadStatus();
@@ -169,13 +164,13 @@ public class VideoViewManager {
 
     public void release() {
         if (null != arrayListVideoView && 0 != arrayListVideoView.size()) {
-            for (RCRTCVideoView v : arrayListVideoView) {
-                v.release();
+            for (View v : arrayListVideoView) {
+//                v.release();
             }
         }
     }
 
-    public ArrayList<RCRTCVideoView> getAllVideoViews() {
+    public ArrayList<View> getAllVideoViews() {
         return arrayListVideoView;
     }
 

+ 12 - 12
student/src/main/res/layout/activity_liveroom_layout.xml

@@ -189,18 +189,18 @@
         app:layout_constraintLeft_toLeftOf="parent"
         app:layout_constraintTop_toBottomOf="@+id/cs_header_info" />
 
-    <com.rong.io.live.widget.LiveRoomMicIconView
-        android:id="@+id/ll_mic_container"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="9dp"
-        android:layout_marginBottom="9dp"
-        android:paddingStart="5dp"
-        android:paddingEnd="5dp"
-        app:layout_constraintBottom_toTopOf="@+id/mic_container_guide_view"
-        app:layout_constraintLeft_toLeftOf="parent"
-        app:layout_constraintRight_toRightOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/cs_header_info" />
+<!--    <com.rong.io.live.widget.LiveRoomMicIconView-->
+<!--        android:id="@+id/ll_mic_container"-->
+<!--        android:layout_width="match_parent"-->
+<!--        android:layout_height="wrap_content"-->
+<!--        android:layout_marginTop="9dp"-->
+<!--        android:layout_marginBottom="9dp"-->
+<!--        android:paddingStart="5dp"-->
+<!--        android:paddingEnd="5dp"-->
+<!--        app:layout_constraintBottom_toTopOf="@+id/mic_container_guide_view"-->
+<!--        app:layout_constraintLeft_toLeftOf="parent"-->
+<!--        app:layout_constraintRight_toRightOf="parent"-->
+<!--        app:layout_constraintTop_toBottomOf="@+id/cs_header_info" />-->
 
     <androidx.appcompat.widget.AppCompatTextView
         android:id="@+id/tv_input"

+ 1631 - 1631
teacher/src/main/java/com/cooleshow/teacher/ui/live/TeacherLiveRoomActivity.java

@@ -1,1632 +1,1632 @@
-package com.cooleshow.teacher.ui.live;
-
-import android.Manifest;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Looper;
-import android.text.TextUtils;
-import android.util.Log;
-import android.view.KeyEvent;
-import android.view.View;
-import android.view.WindowManager;
-import android.widget.FrameLayout;
-import android.widget.ImageView;
-import android.widget.RelativeLayout;
-import android.widget.TextView;
-
-import com.alibaba.android.arouter.facade.annotation.Route;
-import com.alibaba.android.arouter.launcher.ARouter;
-import com.bumptech.glide.Glide;
-import com.cooleshow.base.data.net.ApiException;
-import com.cooleshow.base.router.RouterPath;
-import com.cooleshow.base.ui.activity.BaseMVPActivity;
-import com.cooleshow.base.utils.AppUtils;
-import com.cooleshow.base.utils.ClickUtils;
-import com.cooleshow.base.utils.DateUtil;
-import com.cooleshow.base.utils.DateUtils;
-import com.cooleshow.base.utils.LogUtils;
-import com.cooleshow.base.utils.PermissionUtils;
-import com.cooleshow.base.utils.SoftKeyboardUtil;
-import com.cooleshow.base.utils.TimeUtils;
-import com.cooleshow.base.utils.ToastUtil;
-import com.cooleshow.base.utils.Utils;
-import com.cooleshow.base.widgets.InputBar;
-import com.cooleshow.base.widgets.dialog.CommonConfirmDialog;
-import com.cooleshow.base.widgets.dialog.InputBarDialog;
-import com.cooleshow.chatmodule.bean.ContactListBean;
-import com.cooleshow.chatmodule.constants.TCChatRouterPath;
-import com.cooleshow.chatmodule.utils.helper.ChatHelper;
-import com.cooleshow.teacher.R;
-import com.cooleshow.teacher.adapter.LiveRoomMessageAdapter;
-import com.cooleshow.teacher.bean.LiveRoomInfoBean;
-import com.cooleshow.teacher.contract.LiveRoomContract;
-import com.cooleshow.teacher.databinding.ActivityTeacherLiveRoomLayoutBinding;
-import com.cooleshow.teacher.helper.EventHelper;
-import com.cooleshow.teacher.helper.LiveRoomAnimatorHelper;
-import com.cooleshow.teacher.presenter.live.LiveRoomPresenter;
-import com.cooleshow.teacher.widgets.dialog.LiveBeautyOptionsDialog;
-import com.cooleshow.teacher.widgets.dialog.LiveMicManagerDialog;
-import com.cooleshow.teacher.widgets.dialog.LiveRoomManagerDialog;
-import com.cooleshow.teacher.widgets.helper.VideoViewManager;
-import com.cooleshow.usercenter.helper.UserHelper;
-import com.daya.live_teaching.utils.ToastUtils;
-import com.daya.tclive.bean.FriendInfoBean;
-import com.gyf.immersionbar.ImmersionBar;
-import com.rong.io.live.LiveRoomMsgConstants;
-import com.rong.io.live.bean.User;
-import com.rong.io.live.config.LiveConfig;
-import com.rong.io.live.helper.LiveEventHelper;
-import com.rong.io.live.helper.LiveMemberHelper;
-import com.rong.io.live.helper.LiveMessageHelper;
-import com.rong.io.live.helper.LiveRTCEngineInitHelper;
-import com.rong.io.live.helper.LiveRoomMicMemberHelper;
-import com.rong.io.live.message.RCChatJoinRoomMessage;
-import com.rong.io.live.message.RCOnSnappingUpMessage;
-import com.rong.io.live.message.RCUserAddLikeMessage;
-import com.rong.io.live.message.RCUserSeatApplyMessage;
-import com.rong.io.live.widget.LiveRoomMicIconView;
-import com.tbruyelle.rxpermissions3.RxPermissions;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import androidx.constraintlayout.widget.ConstraintLayout;
-import androidx.recyclerview.widget.LinearLayoutManager;
-import androidx.recyclerview.widget.RecyclerView;
-import cn.rongcloud.rtc.api.RCRTCAudioRouteManager;
-import cn.rongcloud.rtc.api.RCRTCEngine;
-import cn.rongcloud.rtc.api.RCRTCRemoteUser;
-import cn.rongcloud.rtc.api.RCRTCVideoStream;
-import cn.rongcloud.rtc.api.callback.IRCRTCStatusReportListener;
-import cn.rongcloud.rtc.api.report.StatusBean;
-import cn.rongcloud.rtc.api.report.StatusReport;
-import cn.rongcloud.rtc.api.stream.RCRTCAudioInputStream;
-import cn.rongcloud.rtc.api.stream.RCRTCAudioOutputStream;
-import cn.rongcloud.rtc.api.stream.RCRTCVideoInputStream;
-import cn.rongcloud.rtc.api.stream.RCRTCVideoOutputStream;
-import cn.rongcloud.rtc.api.stream.RCRTCVideoView;
-import cn.rongcloud.rtc.base.RCRTCLiveRole;
-import cn.rongcloud.rtc.base.RCRTCMediaType;
-import cn.rongcloud.rtc.base.RCRTCResourceState;
-import io.reactivex.rxjava3.disposables.Disposable;
-import io.rong.imkit.IMCenter;
-import io.rong.imkit.picture.tools.DoubleUtils;
-import io.rong.imkit.utils.helper.OpenChatHelper;
-import io.rong.imlib.IRongCoreCallback;
-import io.rong.imlib.IRongCoreEnum;
-import io.rong.imlib.RongIMClient;
-import io.rong.imlib.model.Message;
-import io.rong.imlib.model.MessageContent;
-import io.rong.imlib.model.UserInfo;
-import io.rong.message.TextMessage;
-
-/**
- * Author by pq, Date on 2022/6/5.
- * 老师端直播间页面
- */
-@Route(path = RouterPath.LiveCenter.ACTIVITY_LIVE_ROOM_TEACHER)
-public class TeacherLiveRoomActivity extends BaseMVPActivity<ActivityTeacherLiveRoomLayoutBinding, LiveRoomPresenter> implements LiveRoomContract.LiveRoomView, View.OnClickListener, SoftKeyboardUtil.OnSoftInputChangedListener, LiveRoomMicMemberHelper.OnEventListener {
-    public static final String ROOMID_KEY = "roomid_key";
-    public static final String DEFAULT_TIME_TEXT = "00:00:00";
-    public static final int SYNC_ADD_LIKE_TIME = 10000;//同步点赞数时长(兼心跳功能)
-    public static final int SEND_APP_BACKGROUND_MSG = 1001;//退到后台消息
-    public static final int SHARE_LIVE_REQUEST_CODE = 1002;//分享直播
-    public static final int LIVE_TIME_COUNT = 1003;//直播倒计时
-    public static final int LIVE_TIME_COUNT_END_TIP = 1004;//直播课剩余时间倒计时
-    public static final int LIVE_TIME_COUNT_SPACE = 1000;//直播倒计时间隔
-
-
-    ImageView ivReverseCamera;
-    ImageView ivLiveBeauty;
-    ImageView ivLiveShare;
-    TextView tvStartLive;
-    TextView tvClose;
-    ImageView mIvAvatar;
-    TextView mTvRoomCreateName;
-    TextView mTvNumPeople;
-    RelativeLayout flLiveView;
-    RecyclerView recyclerMsg;
-    FrameLayout mFlCreateOptions;
-    ConstraintLayout mCsMainLayout;
-    TextView mTvOnMicNumTip;
-    TextView mTvAddLikeCount;
-    TextView mTvLiveDelay;
-    ImageView mIvLiveDelay;
-    FrameLayout mFlJoinBarrage;
-    TextView mTvJoinBarrage;
-    FrameLayout mFlSnapUpBarrage;
-    TextView mTvSnapUpBarrage;
-    LiveRoomMicIconView llMicContainer;
-
-    public String mRoomId = "";
-    private VideoViewManager mVideoViewManager;
-    private int currentAddLikeCount = 0;//当前点赞数量
-    private boolean isNeedRefresh = false;//是否需要重新刷新房间信息
-    private LiveRoomInfoBean mRoomInfoBean;
-    private String mUserId;
-    private String mImUserId;
-    private InputBarDialog mInputBarDialog;
-    private int currentLiveMode = LiveConfig.LIVE_MODE_PREVIEW;//默认是预览模式
-    private int currentLiveStatus = LiveConfig.LIVE_STATUS_NORMAL;
-    private boolean isAutoScrollToLast = true;
-    private boolean isDisAbleMic = false;// disable true 关闭麦克风 false 打开麦克风
-    private RongIMClient.ConnectionStatusListener connectStatusListener = new RongIMClient.ConnectionStatusListener() {
-        @Override
-        public void onChanged(ConnectionStatus status) {
-            Log.i("pq", "LiveRoomActivity receive ConnectionStatus:" + status);
-            if (status == ConnectionStatus.KICKED_OFFLINE_BY_OTHER_CLIENT
-                    || status == ConnectionStatus.SIGN_OUT || status == ConnectionStatus.TIMEOUT) {
-                ToastUtil.getInstance().showShort("您的网络状态异常,请重试");
-                finish();
-            }
-            if (status == ConnectionStatus.CONNECTED) {
-                //IM连接成功
-                if (presenter != null && isNeedRefresh) {
-                    isNeedRefresh = false;
-                    presenter.init(mRoomId, true);
-                }
-            } else {
-                //其他状态的时候需要重新刷新房间信息
-                isNeedRefresh = true;
-            }
-
-            if (status == ConnectionStatus.NETWORK_UNAVAILABLE) {
-                //网络不可用
-                ToastUtil.getInstance().showShort("您的网络已断开,请检查网络~");
-            }
-        }
-    };
-
-    private Runnable mRunnable = new Runnable() {
-        @Override
-        public void run() {
-            //10S更新一次当前UI,通知服务端点赞数量
-            Log.i("pq", "sync add like:" + currentAddLikeCount);
-            updateAddLikeCountView();
-            if (presenter != null) {
-                presenter.syncAddLikeNum(String.valueOf(currentAddLikeCount), mRoomId);
-                presenter.handleAction(LiveRoomMsgConstants.ACTION_SEND_ADD_LIKE_COUNT, currentAddLikeCount);
-            }
-            syncAddLikeNum();
-        }
-    };
-    private LiveRoomMessageAdapter mMessageAdapter;
-    private LinearLayoutManager mLinearLayoutManager;
-    private LiveBeautyOptionsDialog mOptionsDialog;
-    private LiveRoomMicMemberHelper mRoomMicMemberHelper;
-    private LiveMicManagerDialog mLiveMicManagerDialog;
-
-    private Handler mHandler = new Handler(Looper.myLooper()) {
-        @Override
-        public void handleMessage(@NonNull android.os.Message msg) {
-            int what = msg.what;
-            if (what == SEND_APP_BACKGROUND_MSG) {
-                if (!isOnResume && AppUtils.isApplicationInBackground(TeacherLiveRoomActivity.this)) {
-                    Log.i("pq", "onPause publish");
-                    pauseLive();
-                }
-                return;
-            }
-            if (what == LIVE_TIME_COUNT) {
-                //倒计时处理
-                countTimeTotal = countTimeTotal - LIVE_TIME_COUNT_SPACE;
-                if (countTimeTotal <= 0) {
-                    if (checkIsNeedRecount()) {
-                        handleEndTipTimeCount();
-                    } else {
-                        updateTimeText(DEFAULT_TIME_TEXT);
-                    }
-                    return;
-                }
-                String s = DateUtil.convertDateTime(countTimeTotal);
-                updateTimeText(s);
-                sendCountTimeMessage();
-                return;
-            }
-            if (what == LIVE_TIME_COUNT_END_TIP) {
-                countTimeTotal = countTimeTotal - LIVE_TIME_COUNT_SPACE;
-                if (countTimeTotal <= 0) {
-                    updateEndTimeTipText(DEFAULT_TIME_TEXT);
-                    return;
-                }
-                String s = DateUtil.convertDateTime(countTimeTotal);
-                updateEndTimeTipText(s);
-                sendEndTipCountTimeMessage();
-                return;
-            }
-        }
-    };
-
-    private LiveRoomManagerDialog mRoomManagerDialog;
-    private CommonConfirmDialog mConfirmDialog;
-    private boolean isOnResume = false;
-    private long countTimeTotal = 0;
-
-    public static void start(Context context, String roomId) {
-        Intent intent = new Intent(context, TeacherLiveRoomActivity.class);
-        intent.putExtra(ROOMID_KEY, roomId);
-        context.startActivity(intent);
-    }
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
-        super.onCreate(savedInstanceState);
-    }
-
-    @Override
-    protected void initView() {
-        ivReverseCamera = viewBinding.viewCreateOptions.ivReverseCamera;
-        ivLiveBeauty = viewBinding.viewCreateOptions.ivLiveBeauty;
-        ivLiveShare = viewBinding.viewCreateOptions.ivLiveShare;
-        tvStartLive = viewBinding.viewCreateOptions.tvStartLive;
-        tvClose = viewBinding.viewCreateOptions.tvClose;
-        mIvAvatar = viewBinding.viewMainLayout.ivAvatar;
-        mTvRoomCreateName = viewBinding.viewMainLayout.tvRoomAuthorName;
-        mTvNumPeople = viewBinding.viewMainLayout.tvNumPeople;
-        flLiveView = viewBinding.flLiveView;
-        recyclerMsg = viewBinding.viewMainLayout.recyclerMsg;
-        mFlCreateOptions = viewBinding.viewCreateOptions.getRoot();
-        mCsMainLayout = viewBinding.viewMainLayout.getRoot();
-        mTvOnMicNumTip = viewBinding.viewMainLayout.tvOnMicNumTip;
-        mTvAddLikeCount = viewBinding.viewMainLayout.tvAddLikeCount;
-        mTvLiveDelay = viewBinding.viewMainLayout.tvLiveDelay;
-        mIvLiveDelay = viewBinding.viewMainLayout.ivLiveDelay;
-        mFlJoinBarrage = viewBinding.viewMainLayout.flJoinBarrage;
-        mTvJoinBarrage = viewBinding.viewMainLayout.tvJoinBarrage;
-        mFlSnapUpBarrage = viewBinding.viewMainLayout.flSnapUpBarrage;
-        mTvSnapUpBarrage = viewBinding.viewMainLayout.tvSnapUpBarrage;
-        llMicContainer = viewBinding.viewMainLayout.llMicContainer;
-        viewBinding.viewMainLayout.mainIvReverseCamera.setOnClickListener(this);
-        ivReverseCamera.setOnClickListener(this);
-        ivLiveBeauty.setOnClickListener(this);
-        ivLiveShare.setOnClickListener(this);
-        tvStartLive.setOnClickListener(this);
-        tvClose.setOnClickListener(this);
-        viewBinding.viewMainLayout.tvInput.setOnClickListener(this);
-        viewBinding.viewMainLayout.ivMic.setOnClickListener(this);
-        viewBinding.viewMainLayout.iconFinishLive.setOnClickListener(this);
-        viewBinding.viewMainLayout.ivMicMode.setOnClickListener(this);
-    }
-
-    @Override
-    protected ActivityTeacherLiveRoomLayoutBinding getLayoutView() {
-        return ActivityTeacherLiveRoomLayoutBinding.inflate(getLayoutInflater());
-    }
-
-    public void setStatusBarColor() {
-        ImmersionBar.with(this)
-                .keyboardEnable(false)//为了防止软键盘顶起底部布局
-                .transparentStatusBar()
-                .statusBarDarkFont(false, 0.2f) //原理:如果当前设备支持状态栏字体变色,会设置状态栏字体为黑色,如果当前设备不支持状态栏字体变色,会使当前状态栏加上透明度,否则不执行透明度
-                .autoDarkModeEnable(false)
-                .flymeOSStatusBarFontColor(R.color.white)  //修改flyme OS状态栏字体颜色
-                .init();  //必须调用方可沉浸
-    }
-
-    @Override
-    public void initData() {
-        super.initData();
-        mRoomId = getIntent().getStringExtra(ROOMID_KEY);
-        if (TextUtils.isEmpty(mRoomId)) {
-            ToastUtil.getInstance().show(this, "房间id不可为空");
-            finish();
-            return;
-        }
-        String userToken = UserHelper.getUserToken();
-        if (TextUtils.isEmpty(userToken)) {
-            finish();
-            return;
-        }
-        mUserId = UserHelper.getUserId();
-        mImUserId = UserHelper.getImUserId();
-        mHandler.post(new Runnable() {
-            @Override
-            public void run() {
-                checkVideoViewManager();
-            }
-        });
-        mRoomMicMemberHelper = new LiveRoomMicMemberHelper();
-        mRoomMicMemberHelper.setOnEventListener(this);
-        mMessageAdapter = new LiveRoomMessageAdapter(this);
-        mLinearLayoutManager = new LinearLayoutManager(this, RecyclerView.VERTICAL, false);
-        recyclerMsg.setLayoutManager(mLinearLayoutManager);
-        recyclerMsg.setAdapter(mMessageAdapter);
-        checkNeedPermission();
-    }
-
-    private void initLiveConfig() {
-        initListener();
-        if (LiveConfig.isNeedReInitRTC) {
-            //检查是否需要重新初始化RTC
-            LiveRTCEngineInitHelper.initRTC();
-        }
-        //开启美颜
-        LiveRTCEngineInitHelper.openBeauty();
-        // 初始化音频路由管理类
-        RCRTCAudioRouteManager.getInstance().init(Utils.getApp());
-        prepareInitRoom();
-    }
-
-    private void checkNeedPermission() {
-        Disposable disposable = new RxPermissions(TeacherLiveRoomActivity.this)
-                .request(Manifest.permission.RECORD_AUDIO, Manifest.permission.WRITE_EXTERNAL_STORAGE
-                        , Manifest.permission.CAMERA)
-                .subscribe(permission -> {
-                    if (permission) {
-                        initLiveConfig();
-                    } else {
-                        CommonConfirmDialog confirmDialog = new CommonConfirmDialog(TeacherLiveRoomActivity.this);
-                        confirmDialog.show();
-                        confirmDialog.setContent("直播需要麦克风、摄像头、储存权限,去设置?");
-                        confirmDialog.setConfirmText("去设置");
-                        confirmDialog.setOnConfirmClickListener(new View.OnClickListener() {
-                            @Override
-                            public void onClick(View v) {
-                                PermissionUtils.toSelfSetting(TeacherLiveRoomActivity.this);
-                            }
-                        });
-                    }
-                });
-    }
-
-
-    private void updateTimeText(String text) {
-        if (viewBinding.viewMainLayout.tvTimeCount != null) {
-            viewBinding.viewMainLayout.tvTimeCount.setVisibility(View.VISIBLE);
-            viewBinding.viewMainLayout.tvTimeCountEndTip.setVisibility(View.GONE);
-            viewBinding.viewMainLayout.tvTimeCount.setText(text);
-        }
-    }
-
-    private void updateEndTimeTipText(String text) {
-        if (viewBinding.viewMainLayout.tvTimeCountEndTip != null) {
-            viewBinding.viewMainLayout.tvTimeCount.setVisibility(View.GONE);
-            viewBinding.viewMainLayout.tvTimeCountEndTip.setVisibility(View.VISIBLE);
-            viewBinding.viewMainLayout.tvTimeCountEndTip.setText("直播关闭: " + text);
-        }
-    }
-
-    private void initListener() {
-        IMCenter.getInstance().addConnectionStatusListener(connectStatusListener);
-        SoftKeyboardUtil.registerSoftInputChangedListener(getWindow(), this);
-        recyclerMsg.addOnScrollListener(new RecyclerView.OnScrollListener() {
-            @Override
-            public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
-                super.onScrollStateChanged(recyclerView, newState);
-                if (mLinearLayoutManager == null || mMessageAdapter == null) {
-                    return;
-                }
-                int lastCompletelyVisibleItemPosition = mLinearLayoutManager.findLastCompletelyVisibleItemPosition();
-                if (lastCompletelyVisibleItemPosition == mMessageAdapter.getMessageSize() - 1) {
-                    isAutoScrollToLast = true;
-                } else {
-                    isAutoScrollToLast = false;
-                }
-            }
-        });
-    }
-
-    private void bindLiveStatusReport() {
-        //注册通话状态数据监听器 全局监听需要在重新加入房间之后重新设置(重新加入房间,角色属性变更,融云的全局监听都会失效)
-        RCRTCEngine.getInstance().registerStatusReportListener(new IRCRTCStatusReportListener() {
-            @Override
-            public void onConnectionStats(StatusReport statusReport) {
-                super.onConnectionStats(statusReport);
-                long lossRate = 0;
-                for (Map.Entry<String, StatusBean> entry : statusReport.statusVideoSends.entrySet()) {
-                    StatusBean statusBean = entry.getValue();
-                    //获取userID
-                    String userId = statusBean.uid;
-                    //获取视频 宽x高@帧率
-                    String resolution = statusBean.frameWidth + "x" + statusBean.frameHeight + "@" + statusBean.frameRate;
-                    //获取码率
-                    long bitRate = statusBean.bitRate;
-                    //丢包率:超过30,视频卡顿现象会很明显
-                    lossRate = statusBean.packetLostRate;
-                }
-                if (statusReport != null) {
-                    int rtt = statusReport.rtt;
-                    if (rtt > 999) {
-                        rtt = 999;
-                    }
-                    updateLiveDelayUI(rtt, lossRate);
-                }
-            }
-        });
-    }
-
-
-    private void prepareInitRoom() {
-        //根据融云的IM连接状态判断是否需要获取房间信息
-        RongIMClient.ConnectionStatusListener.ConnectionStatus currentConnectionStatus = RongIMClient.getInstance().getCurrentConnectionStatus();
-        if (currentConnectionStatus == RongIMClient.ConnectionStatusListener.ConnectionStatus.CONNECTED) {
-            isNeedRefresh = false;
-            if (presenter != null) {
-                presenter.init(mRoomId, true);
-            }
-        } else {
-            //如果IM未连接,等待connectStatusListener回调
-            isNeedRefresh = true;
-            presenter.connectIM();
-        }
-    }
-
-
-    /**
-     * 暂停直播
-     */
-    private void pauseLive() {
-        if (presenter != null) {
-            presenter.handleAction(LiveRoomMsgConstants.ACTION_SEND_PAUSE_LIVE);
-            currentLiveStatus = LiveConfig.LIVE_STATUS_PAUSE;
-            mHandler.removeMessages(LIVE_TIME_COUNT);
-            mHandler.removeMessages(LIVE_TIME_COUNT_END_TIP);
-            presenter.cancelPublish(null);
-        }
-    }
-
-    /**
-     * 检查VideoViewManager是否未null;
-     */
-    private void checkVideoViewManager() {
-        if (mVideoViewManager == null) {
-            mVideoViewManager = new VideoViewManager(flLiveView, flLiveView.getWidth(), flLiveView.getHeight());
-            mVideoViewManager.setRetryClickListener(new View.OnClickListener() {
-                @Override
-                public void onClick(View v) {
-                    if (presenter != null) {
-                        //重新订阅房间的流信息
-//                        presenter.subscribeAVStream();
-                    }
-                }
-            });
-        }
-    }
-
-
-    @Override
-    protected LiveRoomPresenter createPresenter() {
-        return new LiveRoomPresenter();
-    }
-
-    @Override
-    protected void onResume() {
-        super.onResume();
-        this.isOnResume = true;
-        if (isLiveMode() && isLivePause()) {
-            Log.i("pq", "onResume publish");
-            currentLiveMode = LiveConfig.LIVE_MODE_LIVE_START;
-            presenter.startPublish();
-        }
-    }
-
-    @Override
-    protected void onPause() {
-        super.onPause();
-        this.isOnResume = false;
-        if (isLiveMode()) {
-            //退到后台,延迟2S发送检测消息,
-            android.os.Message obtain = android.os.Message.obtain();
-            obtain.what = SEND_APP_BACKGROUND_MSG;
-            mHandler.sendMessageDelayed(obtain, 2000);
-        }
-    }
-
-    /**
-     * 获取房间信息成功
-     *
-     * @param roomInfoBean
-     */
-    @Override
-    public void getRoomInfoSuccess(LiveRoomInfoBean roomInfoBean) {
-        if (isFinishing() || isDestroyed()) {
-            return;
-        }
-        if (roomInfoBean == null) {
-            ToastUtils.showToast("获取房间信息失败,请退出重试");
-            finish();
-            return;
-        }
-
-        mRoomInfoBean = roomInfoBean;
-        if (mMessageAdapter != null) {
-            mMessageAdapter.setRoomAuthorId(roomInfoBean.speakerId);
-        }
-        int peopleCount = roomInfoBean.lookNum;
-        mTvNumPeople.setText(String.format("%s人", LiveMemberHelper.getMemberCountText(peopleCount)));
-        //同步点赞数
-        currentAddLikeCount = roomInfoBean.likeNum;
-        updateAddLikeCountView();
-        //创建人头像
-        Glide.with(TeacherLiveRoomActivity.this).load(roomInfoBean.speakerPic).placeholder(R.drawable.icon_teacher_default_head).error(R.drawable.icon_teacher_default_head).into(mIvAvatar);
-        //创建人昵称
-        mTvRoomCreateName.setText(roomInfoBean.speakerName);
-        if (presenter != null) {
-            //配置直播的config配置
-            presenter.initPublishConfig();
-            LiveEventHelper.getInstance().register(roomInfoBean.roomUid);
-            Log.i("pq", "initPublishConfig");
-            Log.i("pq", "isPreviewMode:" + isPreviewMode());
-            if (isPreviewMode()) {
-                openPreViewMode();
-            } else {
-                //加入房间
-                presenter.prepareJoinRoom(roomInfoBean.roomUid, true);
-            }
-        }
-    }
-
-    private void handleEndTipTimeCount() {
-        if (mRoomInfoBean == null) {
-            return;
-        }
-        Date date = DateUtil.str2Date(mRoomInfoBean.liveEndTime);
-        long currentTime = System.currentTimeMillis();
-        if (date != null) {
-            long timeResult = date.getTime() + mRoomInfoBean.getExpiredCloseMinute() - currentTime;
-            countTimeTotal = timeResult > 0 ? timeResult : 0;
-            sendEndTipCountTimeMessage();
-        }
-    }
-
-    private void handleTimerCount() {
-        if (mRoomInfoBean == null) {
-            return;
-        }
-        Date date = DateUtil.str2Date(mRoomInfoBean.liveEndTime);
-        long currentTime = System.currentTimeMillis();
-        if (date != null) {
-            long timeResult = date.getTime() - currentTime;
-            countTimeTotal = timeResult > 0 ? timeResult : 0;
-            sendCountTimeMessage();
-        }
-    }
-
-    private void sendCountTimeMessage() {
-        mHandler.removeMessages(LIVE_TIME_COUNT);
-        android.os.Message message = android.os.Message.obtain();
-        message.what = LIVE_TIME_COUNT;
-        mHandler.sendMessageDelayed(message, LIVE_TIME_COUNT_SPACE);
-    }
-
-    private void sendEndTipCountTimeMessage() {
-        mHandler.removeMessages(LIVE_TIME_COUNT_END_TIP);
-        android.os.Message message = android.os.Message.obtain();
-        message.what = LIVE_TIME_COUNT_END_TIP;
-        mHandler.sendMessageDelayed(message, LIVE_TIME_COUNT_SPACE);
-    }
-
-    /**
-     * 是否是预览模式
-     *
-     * @return
-     */
-    private boolean isPreviewMode() {
-        return currentLiveMode == LiveConfig.LIVE_MODE_PREVIEW;
-    }
-
-    /**
-     * \
-     * 是否是直播中
-     *
-     * @return
-     */
-    private boolean isLiveMode() {
-        return currentLiveMode == LiveConfig.LIVE_MODE_LIVE_START;
-    }
-
-    /**
-     * 直播暂停状态
-     *
-     * @return
-     */
-    private boolean isLivePause() {
-        return currentLiveStatus == LiveConfig.LIVE_STATUS_PAUSE;
-    }
-
-    /**
-     * 切换直播模式
-     *
-     * @param mode
-     */
-    private void switchLiveMode(int mode) {
-        //切换直播模式
-        currentLiveMode = mode;
-        if (mode == LiveConfig.LIVE_MODE_PREVIEW) {
-            //直播暂停模式,切换成预览模式
-            //通知关闭直播录像
-            switchOpsLiveVideoMode(LiveConfig.CLOSE_OPS_LIVE_VIDEO_TYPE);
-            openPreViewMode();
-        } else {
-            //直播模式
-            presenter.startPublish();
-        }
-    }
-
-    /**
-     * 开启预览模式
-     */
-    private void openPreViewMode() {
-        if (presenter != null) {
-            showLoading();
-            switchMainUI();
-            presenter.openVideoPreview();
-        }
-    }
-
-    /**
-     * 切换主场景
-     */
-    private void switchMainUI() {
-        if (currentLiveMode == LiveConfig.LIVE_MODE_PREVIEW) {
-            mFlCreateOptions.setVisibility(View.VISIBLE);
-            mCsMainLayout.setVisibility(View.GONE);
-        } else {
-            mFlCreateOptions.setVisibility(View.GONE);
-            mCsMainLayout.setVisibility(View.VISIBLE);
-        }
-    }
-
-    @Override
-    public void onClick(View v) {
-        int id = v.getId();
-        if (id == R.id.tv_close) {
-            finish();
-            return;
-        }
-
-        if (id == R.id.iv_live_share) {
-            //分享
-            ARouter.getInstance().build(TCChatRouterPath.CHAT_SELECT_CONTACT)
-                    .navigation(this, SHARE_LIVE_REQUEST_CODE);
-            return;
-        }
-        if (id == R.id.main_iv_reverse_camera || id == R.id.iv_reverse_camera) {
-            //翻转摄像头
-            presenter.reverseCamera();
-            return;
-        }
-        if (id == R.id.iv_live_beauty) {
-            //美颜
-            showBeautyOptionsDialog();
-            return;
-        }
-
-        if (id == R.id.tv_start_live) {
-            //开始直播
-            if (DoubleUtils.isFastDoubleClick()) {
-                return;
-            }
-            if (mRoomInfoBean != null) {
-                if (isLivePause()) {
-                    //直播暂停模式,恢复直播
-                    presenter.startPublish();
-                } else {
-                    //预览模式,开启直播
-                    //点开启直播之前再次验证一下房间信息
-                    currentLiveMode = LiveConfig.LIVE_MODE_LIVE_START;
-                    presenter.getRoomInfo(mRoomId);
-                }
-            }
-        }
-
-        if (id == R.id.iv_mic) {
-            //连麦管理
-            showMicManagerDialog();
-            return;
-        }
-
-        if (id == R.id.tv_input) {
-            //底部输入框
-            showInputDialog();
-            return;
-        }
-
-        if (id == R.id.icon_finish_live) {
-            //显示直播间管理弹窗
-            showLiveRoomManagerDialog();
-            return;
-        }
-
-        if (id == R.id.iv_mic_mode) {
-            //禁音切换
-            updateMicMode();
-            return;
-        }
-    }
-
-    private void updateMicMode() {
-        if (isDisAbleMic) {
-            presenter.setMicrophoneDisable(false);
-            isDisAbleMic = false;
-            ToastUtil.getInstance().showShort("您已开启麦克风");
-            viewBinding.viewMainLayout.ivMicMode.setImageResource(R.drawable.icon_mic_mode_on);
-        } else {
-            presenter.setMicrophoneDisable(true);
-            isDisAbleMic = true;
-            ToastUtil.getInstance().showShort("您已关闭麦克风");
-            viewBinding.viewMainLayout.ivMicMode.setImageResource(R.drawable.icon_mic_mode_off);
-        }
-    }
-
-    /**
-     * 同步点赞数并且
-     */
-    private void syncAddLikeNum() {
-        if (mHandler != null) {
-            mHandler.removeCallbacks(mRunnable);
-            //10S发送一次同步点赞兼心跳
-            mHandler.postDelayed(mRunnable, SYNC_ADD_LIKE_TIME);
-        }
-    }
-
-    private void updateAddLikeCountView() {
-        if (mTvAddLikeCount != null) {
-            mTvAddLikeCount.setText(getString(R.string.live_room_add_like_count_str, LiveMemberHelper.getStarsCountText(currentAddLikeCount)));
-        }
-    }
-
-    @Override
-    public void syncMemberCount(String count) {
-        //同步成员数量
-        Log.i("pq", "syncMemberCount" + count);
-        if (isFinishing() || isDestroyed()) {
-            return;
-        }
-        if (mTvNumPeople != null) {
-            mTvNumPeople.setText(String.format("%s人", LiveMemberHelper.getMemberCountText(count)));
-        }
-    }
-
-    @Override
-    public void receiveJoinMessage(RCChatJoinRoomMessage joinRoomMessage) {
-        //收到加入房间消息
-        if (checkActivityIsFinish()) {
-            return;
-        }
-        if (joinRoomMessage == null) {
-            return;
-        }
-        //加入房间之前把申请列表删除
-        String userId = joinRoomMessage.getUserId();
-        if (TextUtils.isEmpty(userId) && joinRoomMessage.getUserInfo() != null) {
-            userId = joinRoomMessage.getUserInfo().getUserId();
-        }
-        if (!TextUtils.isEmpty(userId)) {
-            delApplyUser(userId);
-        }
-        if (isCanShowBarrage()) {
-            mTvJoinBarrage.setText(getString(R.string.enter_live_tip_str, LiveMemberHelper.getMessageName(joinRoomMessage)));
-            showBarrageViewAnim(mFlJoinBarrage);
-        }
-    }
-
-    /**
-     * 判断是否显示弹幕消息
-     *
-     * @return
-     */
-    private boolean isCanShowBarrage() {
-        return mFlJoinBarrage.getVisibility() != View.VISIBLE && mFlSnapUpBarrage.getVisibility() != View.VISIBLE;
-    }
-
-    /**
-     * 显示弹幕消息
-     */
-    private void showBarrageViewAnim(View targetView) {
-        if (mFlJoinBarrage.getVisibility() == View.VISIBLE || mFlSnapUpBarrage.getVisibility() == View.VISIBLE) {
-            return;
-        }
-        LiveRoomAnimatorHelper.getInstance().startBarrageViewAnimation(this, targetView);
-        hideBarrageView();
-    }
-
-    /**
-     * 隐藏弹幕消息
-     */
-    private void hideBarrageView() {
-        mHandler.postDelayed(new Runnable() {
-            @Override
-            public void run() {
-                if (mFlJoinBarrage != null) {
-                    mFlJoinBarrage.setVisibility(View.GONE);
-                }
-                if (mFlSnapUpBarrage != null) {
-                    mFlSnapUpBarrage.setVisibility(View.GONE);
-                }
-            }
-        }, LiveConfig.LIVE_HIDE_BARRAGE_VIEW_TIME);
-    }
-
-    @Override
-    public void receiveSnapUpMessage(RCOnSnappingUpMessage onSnappingUpMessage) {
-        //收到抢购消息
-        if (checkActivityIsFinish()) {
-            return;
-        }
-        if (onSnappingUpMessage == null) {
-            return;
-        }
-        if (isCanShowBarrage()) {
-            mTvSnapUpBarrage.setText(getString(R.string.live_snap_up_tip_str, LiveMemberHelper.getMessageName(onSnappingUpMessage)));
-            showBarrageViewAnim(mFlSnapUpBarrage);
-        }
-    }
-
-    @Override
-    public void liveRoomOffline() {
-        if (isFinishing() || isDestroyed()) {
-            return;
-        }
-        ToastUtil.getInstance().show(this, "直播已结束");
-        finish();
-    }
-
-    /**
-     * 获取房间信息失败
-     *
-     * @param throwable
-     */
-    @Override
-    public void getRoomInfoError(Throwable throwable) {
-        if (isFinishing() || isDestroyed()) {
-            return;
-        }
-        if (throwable instanceof ApiException) {
-            ApiException apiException = (ApiException) throwable;
-            ToastUtil.getInstance().show(TeacherLiveRoomActivity.this, apiException.getErrmsg());
-        }
-        finish();
-    }
-
-    @Override
-    public void showFinishView() {
-
-    }
-
-    /**
-     * 观众端发送的点赞消息
-     *
-     * @param addLikeMessage
-     */
-    @Override
-    public void onAddLikeMessage(RCUserAddLikeMessage addLikeMessage) {
-        if (isFinishing() || isDestroyed() || addLikeMessage == null) {
-            return;
-        }
-        Log.i("pq", "receive addlikeNum:" + addLikeMessage.getCounts());
-        currentAddLikeCount += addLikeMessage.getCounts();
-    }
-
-    @Override
-    public void addMessageList(List<MessageContent> messageContents, boolean isReset) {
-
-    }
-
-    @Override
-    public void addMessageContent(Message message, boolean isReset) {
-        //添加单条消息至页面
-        Log.i("pq", "收到需要显示msg:" + message);
-        //只处理直播间消息,以及本直播间消息
-        if (mMessageAdapter != null) {
-            mMessageAdapter.addMessage(message);
-            if (mLinearLayoutManager != null) {
-                recyclerMsg.post(new Runnable() {
-                    @Override
-                    public void run() {
-                        if (isAutoScrollToLast) {
-                            if (recyclerMsg != null) {
-                                recyclerMsg.scrollToPosition(mMessageAdapter.getItemCount() - 1);
-                            }
-                        } else {
-                            Log.i("pq", "收到消息,不触发滚动");
-                        }
-                    }
-                });
-            }
-        }
-    }
-
-    @Override
-    public void setRoomData(LiveRoomInfoBean roomInfoBean) {
-        if (presenter != null) {
-            bindLiveStatusReport();
-            startPublish();
-            syncAddLikeNum();
-            //通知加入房间成功
-            presenter.notifyJoinRoomAction(mRoomId, mUserId);
-            //加入聊天房间
-            presenter.joinChartRoom(roomInfoBean.roomUid, new IRongCoreCallback.OperationCallback() {
-                @Override
-                public void onSuccess() {
-                    Log.i("pq", "加入聊天房间成功");
-                    if (presenter != null) {
-                        presenter.handleAction(LiveRoomMsgConstants.ACTION_SEND_JOIN_ROOM);
-                        presenter.sendDefaultMessage();
-                    }
-                }
-
-                @Override
-                public void onError(IRongCoreEnum.CoreErrorCode coreErrorCode) {
-                    Log.i("pq", "加入聊天房间fail:" + coreErrorCode);
-                }
-            });
-        }
-    }
-
-    /**
-     * 开始推流
-     */
-    private void startPublish() {
-        //切换直播模式
-        currentLiveMode = LiveConfig.LIVE_MODE_LIVE_START;
-        if (isLivePause()) {
-            //直播暂停模式
-            return;
-        }
-        if (presenter != null) {
-            presenter.startPublish();
-        }
-    }
-
-    @Override
-    public void onPublishSuccess() {
-        Log.i("pq", "onPublishSuccess");
-        //通知开启直播间回放
-        switchOpsLiveVideoMode(LiveConfig.OPEN_OPS_LIVE_VIDEO_TYPE);
-        handleTimerCount();
-        refresh();
-    }
-
-    @Override
-    public View getContentView() {
-        return flLiveView;
-    }
-
-    /**
-     * 预览模式
-     *
-     * @param videoView
-     */
-    @Override
-    public void addVideoPreview(RCRTCVideoView videoView) {
-        checkVideoViewManager();
-        if (mVideoViewManager != null) {
-            ArrayList<RCRTCVideoView> videoViews = new ArrayList<>();
-            videoViews.add(videoView);
-            mVideoViewManager.update(videoViews, false);
-        } else {
-            Log.i("pq", "mVideoViewManager == null");
-        }
-    }
-
-    @Override
-    public void openCameraSuccess(Boolean data) {
-        hideLoading();
-        Log.i("pq", "openCameraSuccess:" + data);
-    }
-
-    @Override
-    public void openCameraError(String errorMsg) {
-        Log.i("pq", "openCameraError:" + errorMsg);
-        mHandler.post(new Runnable() {
-            @Override
-            public void run() {
-                ToastUtil.getInstance().show(TeacherLiveRoomActivity.this, errorMsg);
-            }
-        });
-    }
-
-    @Override
-    public void onUserJoinRoom(RCRTCRemoteUser rcrtcRemoteUser) {
-
-    }
-
-    @Override
-    public void onUserLeftRoomMic(RCRTCRemoteUser rcrtcRemoteUser) {
-        if (presenter != null && rcrtcRemoteUser != null) {
-            delOnMicUser(rcrtcRemoteUser.getUserId());
-        }
-    }
-
-    @Override
-    public void onUserOfflineRoomMic(RCRTCRemoteUser rcrtcRemoteUser) {
-        if (presenter != null && rcrtcRemoteUser != null) {
-            delOnMicUser(rcrtcRemoteUser.getUserId());
-        }
-    }
-
-    /**
-     * 删除麦上用户
-     *
-     * @param userId
-     */
-    private void delOnMicUser(String userId) {
-        runOnUiThread(new Runnable() {
-            @Override
-            public void run() {
-                if (mRoomMicMemberHelper != null) {
-                    presenter.unSubscribeStream(userId, null);
-                    mRoomMicMemberHelper.delOnMicUser(userId);
-                    updateMicManagerData();
-                }
-            }
-        });
-    }
-
-    private void delApplyUser(String targetUserId) {
-        runOnUiThread(new Runnable() {
-            @Override
-            public void run() {
-                mRoomMicMemberHelper.delApplyUser(targetUserId);
-                updateMicManagerData();
-            }
-        });
-    }
-
-    @Override
-    public void onSwitchRole(String userId, RCRTCLiveRole role) {
-        Log.i("pq", "receive onSwitchRole:" + role.getType());
-        if (role.getType() == RCRTCLiveRole.AUDIENCE.getType()) {
-            //role转换为观众,主播取消订阅该用户的流
-            if (presenter != null) {
-                //取消订阅该成员消息
-                delOnMicUser(userId);
-            }
-        }
-    }
-
-    @Override
-    public void onSeatApplyMessage(RCUserSeatApplyMessage seatApplyMessage) {
-        //连麦申请消息
-        if (isFinishing() || isDestroyed() || seatApplyMessage == null) {
-            return;
-        }
-        if (!isOwn(seatApplyMessage.getTeacherId())) {
-            return;
-        }
-        if (seatApplyMessage.getType() == LiveRoomMsgConstants.MIC_ACTION_SEAT_BY_USER) {
-            //观众申请
-            User user = new User();
-            user.setUserName(seatApplyMessage.getAudienceName());
-            user.setUserId(seatApplyMessage.getAudienceId());
-            user.setPortrait(seatApplyMessage.getAudienceAvatar());
-            mRoomMicMemberHelper.addApplyUser(user);
-            updateMicManagerData();
-        }
-        if (seatApplyMessage.getType() == LiveRoomMsgConstants.MIC_ACTION_CANCEL_SEAT_BY_USER) {
-            //观众取消
-            User user = new User();
-            user.setUserName(seatApplyMessage.getAudienceName());
-            user.setUserId(seatApplyMessage.getAudienceId());
-            user.setPortrait(seatApplyMessage.getAudienceAvatar());
-            mRoomMicMemberHelper.delApplyUser(user, false);
-            updateMicManagerData();
-        }
-    }
-
-    @Override
-    public void onRemoteUserPublishResource(String remoteUserId) {
-        refreshAudio(null, null);
-    }
-
-    @Override
-    public void getFriendInfoSuccess(FriendInfoBean data) {
-        if (isFinishing() || isDestroyed()) {
-            return;
-        }
-        User user = new User();
-        user.setUserId(data.getImFriendId());
-        user.setUserName(data.getFriendNickname());
-        user.setPortrait(data.getFriendAvatar());
-        mRoomMicMemberHelper.refreshUserInfo(user);
-        if (mLiveMicManagerDialog != null) {
-            mLiveMicManagerDialog.setOnMicListData(mRoomMicMemberHelper.getOnMicUsers());
-        }
-        if (llMicContainer != null) {
-            llMicContainer.refreshUIByUser(mRoomMicMemberHelper.getOnMicUsers());
-        }
-    }
-
-    @Override
-    public void onUserLeaveRoom(String targetUserId) {
-        //用户离开直播间消息
-        if (presenter != null && mRoomMicMemberHelper != null) {
-            //删除连麦申请
-            if (!TextUtils.isEmpty(targetUserId)) {
-                delApplyUser(targetUserId);
-            }
-        }
-    }
-
-    private void updateMicManagerData() {
-        if (mLiveMicManagerDialog != null) {
-            mLiveMicManagerDialog.setApplyListData(mRoomMicMemberHelper.getOnApplyMicUsers());
-            mLiveMicManagerDialog.setOnMicListData(mRoomMicMemberHelper.getOnMicUsers());
-        }
-        if (llMicContainer != null) {
-            llMicContainer.refreshUIByUser(mRoomMicMemberHelper.getOnMicUsers());
-        }
-        if (mTvOnMicNumTip != null) {
-            ArrayList<User> onApplyMicUsers = mRoomMicMemberHelper.getOnApplyMicUsers();
-            if (onApplyMicUsers != null && onApplyMicUsers.size() > 0) {
-                mTvOnMicNumTip.setVisibility(View.VISIBLE);
-                mTvOnMicNumTip.setText(String.valueOf(onApplyMicUsers.size()));
-            } else {
-                mTvOnMicNumTip.setVisibility(View.GONE);
-            }
-        }
-    }
-
-    /**
-     * 用户判断消息目标是否是自己
-     *
-     * @param targetId
-     * @return
-     */
-    private boolean isOwn(String targetId) {
-        return TextUtils.equals(targetId, mImUserId);
-    }
-
-    private void refresh() {
-        //video流信息
-        List<RCRTCVideoOutputStream> outputStreams = new ArrayList<>();
-        List<RCRTCVideoInputStream> videoInputStreams = new ArrayList<>();
-        //音频流信息
-        List<RCRTCAudioInputStream> audioinputstream = new ArrayList<>();
-        List<RCRTCAudioOutputStream> audioOutputStreams = new ArrayList<>();
-        presenter.getAllStreams(outputStreams, videoInputStreams, audioinputstream, audioOutputStreams);
-        updateVideoView(outputStreams, videoInputStreams, audioinputstream);
-        refreshAudio(audioinputstream, audioOutputStreams);
-    }
-
-
-    private void refreshAudio(List<RCRTCAudioInputStream> audioInputStreams, List<RCRTCAudioOutputStream> audioOutputStreams) {
-        if (audioInputStreams == null || audioOutputStreams == null) {
-            //参数为空,先获取房间里的全部音频流信息
-            audioInputStreams = new ArrayList<>();
-            audioOutputStreams = new ArrayList<>();
-            presenter.getAudioStreams(audioInputStreams, audioOutputStreams);
-        }
-        mRoomMicMemberHelper.delAllOnMicUser();
-        //远端用户的音频流信息
-        for (int i = 0; i < audioInputStreams.size(); i++) {
-            RCRTCAudioInputStream rcrtcAudioInputStream = audioInputStreams.get(i);
-            if (rcrtcAudioInputStream.getMediaType() == RCRTCMediaType.AUDIO) {
-                //音频流判断显示上麦用户
-                String userId = rcrtcAudioInputStream.getUserId();
-                if (mRoomInfoBean != null) {
-                    if (!TextUtils.equals(mRoomInfoBean.speakerId, userId)) {
-                        User user = mRoomMicMemberHelper.createUser(userId);
-                        mRoomMicMemberHelper.addOnMicUser(user);
-                    }
-                }
-            }
-        }
-        runOnUiThread(new Runnable() {
-            @Override
-            public void run() {
-                updateMicManagerData();
-            }
-        });
-    }
-
-    public void updateVideoView(List<RCRTCVideoOutputStream> outputStreams, List<RCRTCVideoInputStream> inputStreams, List<RCRTCAudioInputStream> audioInputStreams) {
-        mHandler.post(new Runnable() {
-            @Override
-            public void run() {
-                currentLiveStatus = LiveConfig.LIVE_STATUS_NORMAL;
-                currentLiveMode = LiveConfig.LIVE_MODE_LIVE_START;
-                switchMainUI();
-                ArrayList<RCRTCVideoStream> videoStreams = new ArrayList<RCRTCVideoStream>();
-                videoStreams.addAll(outputStreams);
-                videoStreams.addAll(inputStreams);
-                ArrayList<RCRTCVideoView> list = new ArrayList<>();
-                ArrayList<String> otherAudioUserIds = new ArrayList<>();
-                boolean isNormalCreateAudioStatus = true;
-
-                //视频流
-                for (int i = 0; i < videoStreams.size(); i++) {
-                    RCRTCVideoStream rcrtcVideoStream = videoStreams.get(i);
-                    RCRTCVideoView rongRTCVideoView = new RCRTCVideoView(TeacherLiveRoomActivity.this);
-                    rcrtcVideoStream.setVideoView(rongRTCVideoView);
-                    list.add(rongRTCVideoView);
-                }
-
-                //音频流
-                for (int i = 0; i < audioInputStreams.size(); i++) {
-                    RCRTCAudioInputStream audioInputStream = audioInputStreams.get(i);
-                    if (audioInputStream.getMediaType() == RCRTCMediaType.AUDIO) {
-                        //音频流判断显示上麦用户
-                        String userId = audioInputStream.getUserId();
-                        if (TextUtils.equals(mImUserId, userId)) {
-                            continue;
-                        }
-                        if (mRoomInfoBean != null) {
-                            if (!TextUtils.equals(mRoomInfoBean.speakerId, userId)) {
-                                otherAudioUserIds.add(userId);
-                            } else {
-                                //主播的音频流
-                                RCRTCResourceState resourceState = audioInputStream.getResourceState();
-                                isNormalCreateAudioStatus = resourceState == RCRTCResourceState.NORMAL;
-                            }
-                        }
-                    }
-                }
-                mVideoViewManager.update(list, true);
-            }
-        });
-    }
-
-    /**
-     * 显示通用提示弹窗
-     *
-     * @param content
-     * @param confirmText
-     */
-    private void showCommonTipDialog(String content, String confirmText, View.OnClickListener listener) {
-        if (mConfirmDialog == null) {
-            mConfirmDialog = new CommonConfirmDialog(this);
-        }
-        if (!mConfirmDialog.isShowing()) {
-            mConfirmDialog.show();
-        }
-        mConfirmDialog.setContent(content);
-        mConfirmDialog.setConfirmText(confirmText);
-        mConfirmDialog.setOnConfirmClickListener(listener);
-    }
-
-
-    /**
-     * 显示直播间管理弹窗
-     */
-    private void showLiveRoomManagerDialog() {
-        if (mRoomManagerDialog == null) {
-            mRoomManagerDialog = new LiveRoomManagerDialog(this);
-            mRoomManagerDialog.setOnEventListener(new LiveRoomManagerDialog.OnEventListener() {
-                @Override
-                public void onPauseLive() {
-                    //暂停直播
-                    showCommonTipDialog(getString(R.string.live_pause_tip_str), getString(R.string.pause_live), new View.OnClickListener() {
-                        @Override
-                        public void onClick(View v) {
-                            if (mConfirmDialog != null) {
-                                mConfirmDialog.dismiss();
-                            }
-                            if (mRoomManagerDialog != null) {
-                                mRoomManagerDialog.dismiss();
-                            }
-                            pauseLive();
-                            switchLiveMode(LiveConfig.LIVE_MODE_PREVIEW);
-                        }
-                    });
-                }
-
-                @Override
-                public void onFinishLive() {
-                    //结束直播
-                    showCommonTipDialog(getString(R.string.finish_live_tip_str), getString(R.string.live_finish_str), new View.OnClickListener() {
-                        @Override
-                        public void onClick(View v) {
-                            if (mRoomManagerDialog != null) {
-                                mRoomManagerDialog.dismiss();
-                            }
-                            if (mConfirmDialog != null) {
-                                mConfirmDialog.dismiss();
-                            }
-                            if (presenter != null) {
-                                presenter.notifyCloseLiveRoomAction(mRoomId);
-                            }
-                            finish();
-                        }
-                    });
-                }
-            });
-        }
-        if (!mRoomManagerDialog.isShowing()) {
-            mRoomManagerDialog.show();
-        }
-    }
-
-    /**
-     * 显示连麦控制弹窗
-     */
-    private void showMicManagerDialog() {
-        if (mLiveMicManagerDialog == null) {
-            mLiveMicManagerDialog = new LiveMicManagerDialog(this);
-            mLiveMicManagerDialog.setOnEventListener(new LiveMicManagerDialog.OnEventListener() {
-                @Override
-                public void onAgreeApply(User user) {
-                    ArrayList<User> onMicUsers = mRoomMicMemberHelper.getOnMicUsers();
-                    if (onMicUsers != null && onMicUsers.size() >= 4) {
-                        ToastUtil.getInstance().showShort("最多支持4人上麦哦~");
-                        return;
-                    }
-                    //同意连麦申请
-                    presenter.handleAction(LiveRoomMsgConstants.ACTION_AGREE_MIC_APPLY, user);
-                    if (mRoomMicMemberHelper != null) {
-                        mRoomMicMemberHelper.delApplyUser(user, true);
-                    }
-                    updateMicManagerData();
-                }
-
-                @Override
-                public void onUnderMic(User user) {
-                    //下麦
-                    presenter.handleAction(LiveRoomMsgConstants.ACTION_CANCEL_ON_MIC_BY_TEACHER, user);
-                    if (mRoomMicMemberHelper != null) {
-                        mRoomMicMemberHelper.delOnMicUser(user);
-                    }
-                    updateMicManagerData();
-                }
-
-                @Override
-                public void onRefuseAllMicApply() {
-                    if (mRoomMicMemberHelper != null) {
-                        mRoomMicMemberHelper.delAllApplyUser();
-                    }
-                    updateMicManagerData();
-                    if (presenter != null) {
-                        presenter.handleAction(LiveRoomMsgConstants.ACTION_SEND_REFUSE_ALL_MIC_APPLY_MSG);
-                    }
-                }
-
-                @Override
-                public void onSwitchMicMode(boolean isEnable) {
-                    if (isEnable) {
-                        if (mRoomMicMemberHelper != null) {
-                            mRoomMicMemberHelper.delAllApplyUser();
-                        }
-                        updateMicManagerData();
-                    }
-                    if (presenter != null) {
-                        //1禁止连麦 0否
-                        presenter.syncMicMode(mRoomId, isEnable ? 1 : 0);
-                        presenter.handleAction(LiveRoomMsgConstants.ACTION_SWITCH_MIC_MODE, isEnable);
-                    }
-                }
-
-                @Override
-                public void onUnderAllMic() {
-                    if (mRoomMicMemberHelper != null) {
-                        mRoomMicMemberHelper.delAllOnMicUser();
-                        mRoomMicMemberHelper.delAllUserCache();
-                    }
-                    updateMicManagerData();
-                    if (presenter != null) {
-                        presenter.handleAction(LiveRoomMsgConstants.ACTION_SEND_UNDER_ALL_MIC_MSG);
-                    }
-                }
-            });
-        }
-        if (!mLiveMicManagerDialog.isShowing()) {
-            mLiveMicManagerDialog.show();
-        }
-        mLiveMicManagerDialog.setApplyListData(mRoomMicMemberHelper.getOnApplyMicUsers());
-        mLiveMicManagerDialog.setOnMicListData(mRoomMicMemberHelper.getOnMicUsers());
-    }
-
-    private void showBeautyOptionsDialog() {
-        if (mOptionsDialog == null) {
-            mOptionsDialog = new LiveBeautyOptionsDialog(this);
-            mOptionsDialog.setFragmentActivity(this);
-            mOptionsDialog.setOnShowListener(new DialogInterface.OnShowListener() {
-                @Override
-                public void onShow(DialogInterface dialog) {
-                    mFlCreateOptions.setVisibility(View.GONE);
-                }
-            });
-
-            mOptionsDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
-                @Override
-                public void onDismiss(DialogInterface dialog) {
-                    mFlCreateOptions.setVisibility(View.VISIBLE);
-                }
-            });
-        }
-        if (!mOptionsDialog.isShowing()) {
-            mOptionsDialog.show();
-        }
-    }
-
-    private void showInputDialog() {
-        if (mRoomInfoBean == null) {
-            return;
-        }
-        if (mInputBarDialog == null) {
-            mInputBarDialog = new InputBarDialog(TeacherLiveRoomActivity.this, new InputBar.InputBarListener() {
-                @Override
-                public boolean onClickSend(String message) {
-                    //发送消息
-                    if (TextUtils.isEmpty(message)) {
-                        ToastUtil.getInstance().show(TeacherLiveRoomActivity.this, "消息不能为空");
-                        return false;
-                    }
-                    if (message.length() > LiveConfig.LIVE_MAX_INPUT_TEXT_LENGTH) {
-                        ToastUtil.getInstance().show(TeacherLiveRoomActivity.this, "聊天消息需在40个字以内哦");
-                        return false;
-                    }
-                    if (LiveMessageHelper.isQuickAction()) {
-                        ToastUtil.getInstance().show(TeacherLiveRoomActivity.this, "您说话太快啦");
-                        return false;
-                    }
-                    sendTextMessage(message);
-                    return true;
-                }
-
-
-                @Override
-                public boolean onClickEmoji() {
-                    return false;
-                }
-            });
-
-            mInputBarDialog.setOnShowListener(new DialogInterface.OnShowListener() {
-                @Override
-                public void onShow(DialogInterface dialog) {
-                    if (mInputBarDialog != null) {
-                        mInputBarDialog.showInput();
-                    }
-                }
-            });
-        }
-        if (!mInputBarDialog.isShowing()) {
-            mInputBarDialog.show();
-        }
-    }
-
-    private void sendTextMessage(String message) {
-        if (presenter != null) {
-            TextMessage textMessage = TextMessage.obtain(message);
-            UserInfo userInfo = new UserInfo(mImUserId, UserHelper.getUserName(), null);
-            textMessage.setUserInfo(userInfo);
-            presenter.sendMessage(textMessage);
-        }
-    }
-
-    private void updateLiveDelayUI(int delay, long lossRate) {
-        if (mHandler != null) {
-            mHandler.post(new Runnable() {
-                @Override
-                public void run() {
-                    if (mTvLiveDelay == null || mIvLiveDelay == null) {
-                        return;
-                    }
-                    if (lossRate == 100) {
-                        mTvLiveDelay.setText(getString(R.string.net_error_tip));
-                        mIvLiveDelay.setImageResource(R.drawable.icon_live_delay_high);
-                        return;
-                    }
-                    mTvLiveDelay.setText(getString(R.string.live_delay_text, delay));
-                    if (delay <= LiveConfig.LIVE_DELAY_NORMAL) {
-                        //正常延迟模式
-                        mIvLiveDelay.setImageResource(R.drawable.icon_live_delay_normal);
-                        return;
-                    }
-                    if (delay <= LiveConfig.LIVE_DELAY_MIDDLE) {
-                        //一般延迟模式
-                        mIvLiveDelay.setImageResource(R.drawable.icon_live_delay_middle);
-                    } else {
-                        //一般延迟模式
-                        mIvLiveDelay.setImageResource(R.drawable.icon_live_delay_high);
-                    }
-                }
-            });
-        }
-    }
-
-
-    @Override
-    public void onDestroy() {
-        if (presenter != null) {
-            presenter.notifyLeaveRoomAction();
-        }
-        switchOpsLiveVideoMode(LiveConfig.CLOSE_OPS_LIVE_VIDEO_TYPE);
-        super.onDestroy();
-        if (mVideoViewManager != null) {
-            mVideoViewManager.onRelease();
-        }
-        if (mHandler != null) {
-            mHandler.removeCallbacksAndMessages(null);
-        }
-        if (connectStatusListener != null) {
-            IMCenter.getInstance().removeConnectionStatusListener(connectStatusListener);
-        }
-        SoftKeyboardUtil.unregisterSoftInputChangedListener(getWindow());
-        LiveEventHelper.getInstance().unRegister();
-        RCRTCAudioRouteManager.getInstance().unInit();
-        //取消注册通话状态数据监听器
-        RCRTCEngine.getInstance().unregisterStatusReportListener();
-        LiveRoomAnimatorHelper.getInstance().releaseAnimator();
-    }
-
-    /**
-     * 通知(开启/关闭)直播录像
-     *
-     * @param type
-     */
-    private void switchOpsLiveVideoMode(String type) {
-        //酷乐秀暂时先不需要这个流程,暂时先注释掉,后续考虑优化去掉
+//package com.cooleshow.teacher.ui.live;
+//
+//import android.Manifest;
+//import android.content.Context;
+//import android.content.DialogInterface;
+//import android.content.Intent;
+//import android.os.Bundle;
+//import android.os.Handler;
+//import android.os.Looper;
+//import android.text.TextUtils;
+//import android.util.Log;
+//import android.view.KeyEvent;
+//import android.view.View;
+//import android.view.WindowManager;
+//import android.widget.FrameLayout;
+//import android.widget.ImageView;
+//import android.widget.RelativeLayout;
+//import android.widget.TextView;
+//
+//import com.alibaba.android.arouter.facade.annotation.Route;
+//import com.alibaba.android.arouter.launcher.ARouter;
+//import com.bumptech.glide.Glide;
+//import com.cooleshow.base.data.net.ApiException;
+//import com.cooleshow.base.router.RouterPath;
+//import com.cooleshow.base.ui.activity.BaseMVPActivity;
+//import com.cooleshow.base.utils.AppUtils;
+//import com.cooleshow.base.utils.ClickUtils;
+//import com.cooleshow.base.utils.DateUtil;
+//import com.cooleshow.base.utils.DateUtils;
+//import com.cooleshow.base.utils.LogUtils;
+//import com.cooleshow.base.utils.PermissionUtils;
+//import com.cooleshow.base.utils.SoftKeyboardUtil;
+//import com.cooleshow.base.utils.TimeUtils;
+//import com.cooleshow.base.utils.ToastUtil;
+//import com.cooleshow.base.utils.Utils;
+//import com.cooleshow.base.widgets.InputBar;
+//import com.cooleshow.base.widgets.dialog.CommonConfirmDialog;
+//import com.cooleshow.base.widgets.dialog.InputBarDialog;
+//import com.cooleshow.chatmodule.bean.ContactListBean;
+//import com.cooleshow.chatmodule.constants.TCChatRouterPath;
+//import com.cooleshow.chatmodule.utils.helper.ChatHelper;
+//import com.cooleshow.teacher.R;
+//import com.cooleshow.teacher.adapter.LiveRoomMessageAdapter;
+//import com.cooleshow.teacher.bean.LiveRoomInfoBean;
+//import com.cooleshow.teacher.contract.LiveRoomContract;
+//import com.cooleshow.teacher.databinding.ActivityTeacherLiveRoomLayoutBinding;
+//import com.cooleshow.teacher.helper.EventHelper;
+//import com.cooleshow.teacher.helper.LiveRoomAnimatorHelper;
+//import com.cooleshow.teacher.presenter.live.LiveRoomPresenter;
+//import com.cooleshow.teacher.widgets.dialog.LiveBeautyOptionsDialog;
+//import com.cooleshow.teacher.widgets.dialog.LiveMicManagerDialog;
+//import com.cooleshow.teacher.widgets.dialog.LiveRoomManagerDialog;
+//import com.cooleshow.teacher.widgets.helper.VideoViewManager;
+//import com.cooleshow.usercenter.helper.UserHelper;
+//import com.daya.live_teaching.utils.ToastUtils;
+//import com.daya.tclive.bean.FriendInfoBean;
+//import com.gyf.immersionbar.ImmersionBar;
+//import com.rong.io.live.LiveRoomMsgConstants;
+//import com.rong.io.live.bean.User;
+//import com.rong.io.live.config.LiveConfig;
+//import com.rong.io.live.helper.LiveEventHelper;
+//import com.rong.io.live.helper.LiveMemberHelper;
+//import com.rong.io.live.helper.LiveMessageHelper;
+//import com.rong.io.live.helper.LiveRTCEngineInitHelper;
+//import com.rong.io.live.helper.LiveRoomMicMemberHelper;
+//import com.rong.io.live.message.RCChatJoinRoomMessage;
+//import com.rong.io.live.message.RCOnSnappingUpMessage;
+//import com.rong.io.live.message.RCUserAddLikeMessage;
+//import com.rong.io.live.message.RCUserSeatApplyMessage;
+//import com.rong.io.live.widget.LiveRoomMicIconView;
+//import com.tbruyelle.rxpermissions3.RxPermissions;
+//
+//import java.util.ArrayList;
+//import java.util.Date;
+//import java.util.List;
+//import java.util.Map;
+//
+//import androidx.annotation.NonNull;
+//import androidx.annotation.Nullable;
+//import androidx.constraintlayout.widget.ConstraintLayout;
+//import androidx.recyclerview.widget.LinearLayoutManager;
+//import androidx.recyclerview.widget.RecyclerView;
+//import cn.rongcloud.rtc.api.RCRTCAudioRouteManager;
+//import cn.rongcloud.rtc.api.RCRTCEngine;
+//import cn.rongcloud.rtc.api.RCRTCRemoteUser;
+//import cn.rongcloud.rtc.api.RCRTCVideoStream;
+//import cn.rongcloud.rtc.api.callback.IRCRTCStatusReportListener;
+//import cn.rongcloud.rtc.api.report.StatusBean;
+//import cn.rongcloud.rtc.api.report.StatusReport;
+//import cn.rongcloud.rtc.api.stream.RCRTCAudioInputStream;
+//import cn.rongcloud.rtc.api.stream.RCRTCAudioOutputStream;
+//import cn.rongcloud.rtc.api.stream.RCRTCVideoInputStream;
+//import cn.rongcloud.rtc.api.stream.RCRTCVideoOutputStream;
+//import cn.rongcloud.rtc.api.stream.RCRTCVideoView;
+//import cn.rongcloud.rtc.base.RCRTCLiveRole;
+//import cn.rongcloud.rtc.base.RCRTCMediaType;
+//import cn.rongcloud.rtc.base.RCRTCResourceState;
+//import io.reactivex.rxjava3.disposables.Disposable;
+//import io.rong.imkit.IMCenter;
+//import io.rong.imkit.picture.tools.DoubleUtils;
+//import io.rong.imkit.utils.helper.OpenChatHelper;
+//import io.rong.imlib.IRongCoreCallback;
+//import io.rong.imlib.IRongCoreEnum;
+//import io.rong.imlib.RongIMClient;
+//import io.rong.imlib.model.Message;
+//import io.rong.imlib.model.MessageContent;
+//import io.rong.imlib.model.UserInfo;
+//import io.rong.message.TextMessage;
+//
+///**
+// * Author by pq, Date on 2022/6/5.
+// * 老师端直播间页面
+// */
+//@Route(path = RouterPath.LiveCenter.ACTIVITY_LIVE_ROOM_TEACHER)
+//public class TeacherLiveRoomActivity extends BaseMVPActivity<ActivityTeacherLiveRoomLayoutBinding, LiveRoomPresenter> implements LiveRoomContract.LiveRoomView, View.OnClickListener, SoftKeyboardUtil.OnSoftInputChangedListener, LiveRoomMicMemberHelper.OnEventListener {
+//    public static final String ROOMID_KEY = "roomid_key";
+//    public static final String DEFAULT_TIME_TEXT = "00:00:00";
+//    public static final int SYNC_ADD_LIKE_TIME = 10000;//同步点赞数时长(兼心跳功能)
+//    public static final int SEND_APP_BACKGROUND_MSG = 1001;//退到后台消息
+//    public static final int SHARE_LIVE_REQUEST_CODE = 1002;//分享直播
+//    public static final int LIVE_TIME_COUNT = 1003;//直播倒计时
+//    public static final int LIVE_TIME_COUNT_END_TIP = 1004;//直播课剩余时间倒计时
+//    public static final int LIVE_TIME_COUNT_SPACE = 1000;//直播倒计时间隔
+//
+//
+//    ImageView ivReverseCamera;
+//    ImageView ivLiveBeauty;
+//    ImageView ivLiveShare;
+//    TextView tvStartLive;
+//    TextView tvClose;
+//    ImageView mIvAvatar;
+//    TextView mTvRoomCreateName;
+//    TextView mTvNumPeople;
+//    RelativeLayout flLiveView;
+//    RecyclerView recyclerMsg;
+//    FrameLayout mFlCreateOptions;
+//    ConstraintLayout mCsMainLayout;
+//    TextView mTvOnMicNumTip;
+//    TextView mTvAddLikeCount;
+//    TextView mTvLiveDelay;
+//    ImageView mIvLiveDelay;
+//    FrameLayout mFlJoinBarrage;
+//    TextView mTvJoinBarrage;
+//    FrameLayout mFlSnapUpBarrage;
+//    TextView mTvSnapUpBarrage;
+//    LiveRoomMicIconView llMicContainer;
+//
+//    public String mRoomId = "";
+//    private VideoViewManager mVideoViewManager;
+//    private int currentAddLikeCount = 0;//当前点赞数量
+//    private boolean isNeedRefresh = false;//是否需要重新刷新房间信息
+//    private LiveRoomInfoBean mRoomInfoBean;
+//    private String mUserId;
+//    private String mImUserId;
+//    private InputBarDialog mInputBarDialog;
+//    private int currentLiveMode = LiveConfig.LIVE_MODE_PREVIEW;//默认是预览模式
+//    private int currentLiveStatus = LiveConfig.LIVE_STATUS_NORMAL;
+//    private boolean isAutoScrollToLast = true;
+//    private boolean isDisAbleMic = false;// disable true 关闭麦克风 false 打开麦克风
+//    private RongIMClient.ConnectionStatusListener connectStatusListener = new RongIMClient.ConnectionStatusListener() {
+//        @Override
+//        public void onChanged(ConnectionStatus status) {
+//            Log.i("pq", "LiveRoomActivity receive ConnectionStatus:" + status);
+//            if (status == ConnectionStatus.KICKED_OFFLINE_BY_OTHER_CLIENT
+//                    || status == ConnectionStatus.SIGN_OUT || status == ConnectionStatus.TIMEOUT) {
+//                ToastUtil.getInstance().showShort("您的网络状态异常,请重试");
+//                finish();
+//            }
+//            if (status == ConnectionStatus.CONNECTED) {
+//                //IM连接成功
+//                if (presenter != null && isNeedRefresh) {
+//                    isNeedRefresh = false;
+//                    presenter.init(mRoomId, true);
+//                }
+//            } else {
+//                //其他状态的时候需要重新刷新房间信息
+//                isNeedRefresh = true;
+//            }
+//
+//            if (status == ConnectionStatus.NETWORK_UNAVAILABLE) {
+//                //网络不可用
+//                ToastUtil.getInstance().showShort("您的网络已断开,请检查网络~");
+//            }
+//        }
+//    };
+//
+//    private Runnable mRunnable = new Runnable() {
+//        @Override
+//        public void run() {
+//            //10S更新一次当前UI,通知服务端点赞数量
+//            Log.i("pq", "sync add like:" + currentAddLikeCount);
+//            updateAddLikeCountView();
+//            if (presenter != null) {
+//                presenter.syncAddLikeNum(String.valueOf(currentAddLikeCount), mRoomId);
+//                presenter.handleAction(LiveRoomMsgConstants.ACTION_SEND_ADD_LIKE_COUNT, currentAddLikeCount);
+//            }
+//            syncAddLikeNum();
+//        }
+//    };
+//    private LiveRoomMessageAdapter mMessageAdapter;
+//    private LinearLayoutManager mLinearLayoutManager;
+//    private LiveBeautyOptionsDialog mOptionsDialog;
+//    private LiveRoomMicMemberHelper mRoomMicMemberHelper;
+//    private LiveMicManagerDialog mLiveMicManagerDialog;
+//
+//    private Handler mHandler = new Handler(Looper.myLooper()) {
+//        @Override
+//        public void handleMessage(@NonNull android.os.Message msg) {
+//            int what = msg.what;
+//            if (what == SEND_APP_BACKGROUND_MSG) {
+//                if (!isOnResume && AppUtils.isApplicationInBackground(TeacherLiveRoomActivity.this)) {
+//                    Log.i("pq", "onPause publish");
+//                    pauseLive();
+//                }
+//                return;
+//            }
+//            if (what == LIVE_TIME_COUNT) {
+//                //倒计时处理
+//                countTimeTotal = countTimeTotal - LIVE_TIME_COUNT_SPACE;
+//                if (countTimeTotal <= 0) {
+//                    if (checkIsNeedRecount()) {
+//                        handleEndTipTimeCount();
+//                    } else {
+//                        updateTimeText(DEFAULT_TIME_TEXT);
+//                    }
+//                    return;
+//                }
+//                String s = DateUtil.convertDateTime(countTimeTotal);
+//                updateTimeText(s);
+//                sendCountTimeMessage();
+//                return;
+//            }
+//            if (what == LIVE_TIME_COUNT_END_TIP) {
+//                countTimeTotal = countTimeTotal - LIVE_TIME_COUNT_SPACE;
+//                if (countTimeTotal <= 0) {
+//                    updateEndTimeTipText(DEFAULT_TIME_TEXT);
+//                    return;
+//                }
+//                String s = DateUtil.convertDateTime(countTimeTotal);
+//                updateEndTimeTipText(s);
+//                sendEndTipCountTimeMessage();
+//                return;
+//            }
+//        }
+//    };
+//
+//    private LiveRoomManagerDialog mRoomManagerDialog;
+//    private CommonConfirmDialog mConfirmDialog;
+//    private boolean isOnResume = false;
+//    private long countTimeTotal = 0;
+//
+//    public static void start(Context context, String roomId) {
+//        Intent intent = new Intent(context, TeacherLiveRoomActivity.class);
+//        intent.putExtra(ROOMID_KEY, roomId);
+//        context.startActivity(intent);
+//    }
+//
+//    @Override
+//    protected void onCreate(Bundle savedInstanceState) {
+//        getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
+//        super.onCreate(savedInstanceState);
+//    }
+//
+//    @Override
+//    protected void initView() {
+//        ivReverseCamera = viewBinding.viewCreateOptions.ivReverseCamera;
+//        ivLiveBeauty = viewBinding.viewCreateOptions.ivLiveBeauty;
+//        ivLiveShare = viewBinding.viewCreateOptions.ivLiveShare;
+//        tvStartLive = viewBinding.viewCreateOptions.tvStartLive;
+//        tvClose = viewBinding.viewCreateOptions.tvClose;
+//        mIvAvatar = viewBinding.viewMainLayout.ivAvatar;
+//        mTvRoomCreateName = viewBinding.viewMainLayout.tvRoomAuthorName;
+//        mTvNumPeople = viewBinding.viewMainLayout.tvNumPeople;
+//        flLiveView = viewBinding.flLiveView;
+//        recyclerMsg = viewBinding.viewMainLayout.recyclerMsg;
+//        mFlCreateOptions = viewBinding.viewCreateOptions.getRoot();
+//        mCsMainLayout = viewBinding.viewMainLayout.getRoot();
+//        mTvOnMicNumTip = viewBinding.viewMainLayout.tvOnMicNumTip;
+//        mTvAddLikeCount = viewBinding.viewMainLayout.tvAddLikeCount;
+//        mTvLiveDelay = viewBinding.viewMainLayout.tvLiveDelay;
+//        mIvLiveDelay = viewBinding.viewMainLayout.ivLiveDelay;
+//        mFlJoinBarrage = viewBinding.viewMainLayout.flJoinBarrage;
+//        mTvJoinBarrage = viewBinding.viewMainLayout.tvJoinBarrage;
+//        mFlSnapUpBarrage = viewBinding.viewMainLayout.flSnapUpBarrage;
+//        mTvSnapUpBarrage = viewBinding.viewMainLayout.tvSnapUpBarrage;
+//        llMicContainer = viewBinding.viewMainLayout.llMicContainer;
+//        viewBinding.viewMainLayout.mainIvReverseCamera.setOnClickListener(this);
+//        ivReverseCamera.setOnClickListener(this);
+//        ivLiveBeauty.setOnClickListener(this);
+//        ivLiveShare.setOnClickListener(this);
+//        tvStartLive.setOnClickListener(this);
+//        tvClose.setOnClickListener(this);
+//        viewBinding.viewMainLayout.tvInput.setOnClickListener(this);
+//        viewBinding.viewMainLayout.ivMic.setOnClickListener(this);
+//        viewBinding.viewMainLayout.iconFinishLive.setOnClickListener(this);
+//        viewBinding.viewMainLayout.ivMicMode.setOnClickListener(this);
+//    }
+//
+//    @Override
+//    protected ActivityTeacherLiveRoomLayoutBinding getLayoutView() {
+//        return ActivityTeacherLiveRoomLayoutBinding.inflate(getLayoutInflater());
+//    }
+//
+//    public void setStatusBarColor() {
+//        ImmersionBar.with(this)
+//                .keyboardEnable(false)//为了防止软键盘顶起底部布局
+//                .transparentStatusBar()
+//                .statusBarDarkFont(false, 0.2f) //原理:如果当前设备支持状态栏字体变色,会设置状态栏字体为黑色,如果当前设备不支持状态栏字体变色,会使当前状态栏加上透明度,否则不执行透明度
+//                .autoDarkModeEnable(false)
+//                .flymeOSStatusBarFontColor(R.color.white)  //修改flyme OS状态栏字体颜色
+//                .init();  //必须调用方可沉浸
+//    }
+//
+//    @Override
+//    public void initData() {
+//        super.initData();
+//        mRoomId = getIntent().getStringExtra(ROOMID_KEY);
+//        if (TextUtils.isEmpty(mRoomId)) {
+//            ToastUtil.getInstance().show(this, "房间id不可为空");
+//            finish();
+//            return;
+//        }
+//        String userToken = UserHelper.getUserToken();
+//        if (TextUtils.isEmpty(userToken)) {
+//            finish();
+//            return;
+//        }
+//        mUserId = UserHelper.getUserId();
+//        mImUserId = UserHelper.getImUserId();
+//        mHandler.post(new Runnable() {
+//            @Override
+//            public void run() {
+//                checkVideoViewManager();
+//            }
+//        });
+//        mRoomMicMemberHelper = new LiveRoomMicMemberHelper();
+//        mRoomMicMemberHelper.setOnEventListener(this);
+//        mMessageAdapter = new LiveRoomMessageAdapter(this);
+//        mLinearLayoutManager = new LinearLayoutManager(this, RecyclerView.VERTICAL, false);
+//        recyclerMsg.setLayoutManager(mLinearLayoutManager);
+//        recyclerMsg.setAdapter(mMessageAdapter);
+//        checkNeedPermission();
+//    }
+//
+//    private void initLiveConfig() {
+//        initListener();
+//        if (LiveConfig.isNeedReInitRTC) {
+//            //检查是否需要重新初始化RTC
+//            LiveRTCEngineInitHelper.initRTC();
+//        }
+//        //开启美颜
+//        LiveRTCEngineInitHelper.openBeauty();
+//        // 初始化音频路由管理类
+//        RCRTCAudioRouteManager.getInstance().init(Utils.getApp());
+//        prepareInitRoom();
+//    }
+//
+//    private void checkNeedPermission() {
+//        Disposable disposable = new RxPermissions(TeacherLiveRoomActivity.this)
+//                .request(Manifest.permission.RECORD_AUDIO, Manifest.permission.WRITE_EXTERNAL_STORAGE
+//                        , Manifest.permission.CAMERA)
+//                .subscribe(permission -> {
+//                    if (permission) {
+//                        initLiveConfig();
+//                    } else {
+//                        CommonConfirmDialog confirmDialog = new CommonConfirmDialog(TeacherLiveRoomActivity.this);
+//                        confirmDialog.show();
+//                        confirmDialog.setContent("直播需要麦克风、摄像头、储存权限,去设置?");
+//                        confirmDialog.setConfirmText("去设置");
+//                        confirmDialog.setOnConfirmClickListener(new View.OnClickListener() {
+//                            @Override
+//                            public void onClick(View v) {
+//                                PermissionUtils.toSelfSetting(TeacherLiveRoomActivity.this);
+//                            }
+//                        });
+//                    }
+//                });
+//    }
+//
+//
+//    private void updateTimeText(String text) {
+//        if (viewBinding.viewMainLayout.tvTimeCount != null) {
+//            viewBinding.viewMainLayout.tvTimeCount.setVisibility(View.VISIBLE);
+//            viewBinding.viewMainLayout.tvTimeCountEndTip.setVisibility(View.GONE);
+//            viewBinding.viewMainLayout.tvTimeCount.setText(text);
+//        }
+//    }
+//
+//    private void updateEndTimeTipText(String text) {
+//        if (viewBinding.viewMainLayout.tvTimeCountEndTip != null) {
+//            viewBinding.viewMainLayout.tvTimeCount.setVisibility(View.GONE);
+//            viewBinding.viewMainLayout.tvTimeCountEndTip.setVisibility(View.VISIBLE);
+//            viewBinding.viewMainLayout.tvTimeCountEndTip.setText("直播关闭: " + text);
+//        }
+//    }
+//
+//    private void initListener() {
+//        IMCenter.getInstance().addConnectionStatusListener(connectStatusListener);
+//        SoftKeyboardUtil.registerSoftInputChangedListener(getWindow(), this);
+//        recyclerMsg.addOnScrollListener(new RecyclerView.OnScrollListener() {
+//            @Override
+//            public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
+//                super.onScrollStateChanged(recyclerView, newState);
+//                if (mLinearLayoutManager == null || mMessageAdapter == null) {
+//                    return;
+//                }
+//                int lastCompletelyVisibleItemPosition = mLinearLayoutManager.findLastCompletelyVisibleItemPosition();
+//                if (lastCompletelyVisibleItemPosition == mMessageAdapter.getMessageSize() - 1) {
+//                    isAutoScrollToLast = true;
+//                } else {
+//                    isAutoScrollToLast = false;
+//                }
+//            }
+//        });
+//    }
+//
+//    private void bindLiveStatusReport() {
+//        //注册通话状态数据监听器 全局监听需要在重新加入房间之后重新设置(重新加入房间,角色属性变更,融云的全局监听都会失效)
+//        RCRTCEngine.getInstance().registerStatusReportListener(new IRCRTCStatusReportListener() {
+//            @Override
+//            public void onConnectionStats(StatusReport statusReport) {
+//                super.onConnectionStats(statusReport);
+//                long lossRate = 0;
+//                for (Map.Entry<String, StatusBean> entry : statusReport.statusVideoSends.entrySet()) {
+//                    StatusBean statusBean = entry.getValue();
+//                    //获取userID
+//                    String userId = statusBean.uid;
+//                    //获取视频 宽x高@帧率
+//                    String resolution = statusBean.frameWidth + "x" + statusBean.frameHeight + "@" + statusBean.frameRate;
+//                    //获取码率
+//                    long bitRate = statusBean.bitRate;
+//                    //丢包率:超过30,视频卡顿现象会很明显
+//                    lossRate = statusBean.packetLostRate;
+//                }
+//                if (statusReport != null) {
+//                    int rtt = statusReport.rtt;
+//                    if (rtt > 999) {
+//                        rtt = 999;
+//                    }
+//                    updateLiveDelayUI(rtt, lossRate);
+//                }
+//            }
+//        });
+//    }
+//
+//
+//    private void prepareInitRoom() {
+//        //根据融云的IM连接状态判断是否需要获取房间信息
+//        RongIMClient.ConnectionStatusListener.ConnectionStatus currentConnectionStatus = RongIMClient.getInstance().getCurrentConnectionStatus();
+//        if (currentConnectionStatus == RongIMClient.ConnectionStatusListener.ConnectionStatus.CONNECTED) {
+//            isNeedRefresh = false;
+//            if (presenter != null) {
+//                presenter.init(mRoomId, true);
+//            }
+//        } else {
+//            //如果IM未连接,等待connectStatusListener回调
+//            isNeedRefresh = true;
+//            presenter.connectIM();
+//        }
+//    }
+//
+//
+//    /**
+//     * 暂停直播
+//     */
+//    private void pauseLive() {
+//        if (presenter != null) {
+//            presenter.handleAction(LiveRoomMsgConstants.ACTION_SEND_PAUSE_LIVE);
+//            currentLiveStatus = LiveConfig.LIVE_STATUS_PAUSE;
+//            mHandler.removeMessages(LIVE_TIME_COUNT);
+//            mHandler.removeMessages(LIVE_TIME_COUNT_END_TIP);
+//            presenter.cancelPublish(null);
+//        }
+//    }
+//
+//    /**
+//     * 检查VideoViewManager是否未null;
+//     */
+//    private void checkVideoViewManager() {
+//        if (mVideoViewManager == null) {
+//            mVideoViewManager = new VideoViewManager(flLiveView, flLiveView.getWidth(), flLiveView.getHeight());
+//            mVideoViewManager.setRetryClickListener(new View.OnClickListener() {
+//                @Override
+//                public void onClick(View v) {
+//                    if (presenter != null) {
+//                        //重新订阅房间的流信息
+////                        presenter.subscribeAVStream();
+//                    }
+//                }
+//            });
+//        }
+//    }
+//
+//
+//    @Override
+//    protected LiveRoomPresenter createPresenter() {
+//        return new LiveRoomPresenter();
+//    }
+//
+//    @Override
+//    protected void onResume() {
+//        super.onResume();
+//        this.isOnResume = true;
+//        if (isLiveMode() && isLivePause()) {
+//            Log.i("pq", "onResume publish");
+//            currentLiveMode = LiveConfig.LIVE_MODE_LIVE_START;
+//            presenter.startPublish();
+//        }
+//    }
+//
+//    @Override
+//    protected void onPause() {
+//        super.onPause();
+//        this.isOnResume = false;
+//        if (isLiveMode()) {
+//            //退到后台,延迟2S发送检测消息,
+//            android.os.Message obtain = android.os.Message.obtain();
+//            obtain.what = SEND_APP_BACKGROUND_MSG;
+//            mHandler.sendMessageDelayed(obtain, 2000);
+//        }
+//    }
+//
+//    /**
+//     * 获取房间信息成功
+//     *
+//     * @param roomInfoBean
+//     */
+//    @Override
+//    public void getRoomInfoSuccess(LiveRoomInfoBean roomInfoBean) {
+//        if (isFinishing() || isDestroyed()) {
+//            return;
+//        }
+//        if (roomInfoBean == null) {
+//            ToastUtils.showToast("获取房间信息失败,请退出重试");
+//            finish();
+//            return;
+//        }
+//
+//        mRoomInfoBean = roomInfoBean;
+//        if (mMessageAdapter != null) {
+//            mMessageAdapter.setRoomAuthorId(roomInfoBean.speakerId);
+//        }
+//        int peopleCount = roomInfoBean.lookNum;
+//        mTvNumPeople.setText(String.format("%s人", LiveMemberHelper.getMemberCountText(peopleCount)));
+//        //同步点赞数
+//        currentAddLikeCount = roomInfoBean.likeNum;
+//        updateAddLikeCountView();
+//        //创建人头像
+//        Glide.with(TeacherLiveRoomActivity.this).load(roomInfoBean.speakerPic).placeholder(R.drawable.icon_teacher_default_head).error(R.drawable.icon_teacher_default_head).into(mIvAvatar);
+//        //创建人昵称
+//        mTvRoomCreateName.setText(roomInfoBean.speakerName);
+//        if (presenter != null) {
+//            //配置直播的config配置
+//            presenter.initPublishConfig();
+//            LiveEventHelper.getInstance().register(roomInfoBean.roomUid);
+//            Log.i("pq", "initPublishConfig");
+//            Log.i("pq", "isPreviewMode:" + isPreviewMode());
+//            if (isPreviewMode()) {
+//                openPreViewMode();
+//            } else {
+//                //加入房间
+//                presenter.prepareJoinRoom(roomInfoBean.roomUid, true);
+//            }
+//        }
+//    }
+//
+//    private void handleEndTipTimeCount() {
+//        if (mRoomInfoBean == null) {
+//            return;
+//        }
+//        Date date = DateUtil.str2Date(mRoomInfoBean.liveEndTime);
+//        long currentTime = System.currentTimeMillis();
+//        if (date != null) {
+//            long timeResult = date.getTime() + mRoomInfoBean.getExpiredCloseMinute() - currentTime;
+//            countTimeTotal = timeResult > 0 ? timeResult : 0;
+//            sendEndTipCountTimeMessage();
+//        }
+//    }
+//
+//    private void handleTimerCount() {
+//        if (mRoomInfoBean == null) {
+//            return;
+//        }
+//        Date date = DateUtil.str2Date(mRoomInfoBean.liveEndTime);
+//        long currentTime = System.currentTimeMillis();
+//        if (date != null) {
+//            long timeResult = date.getTime() - currentTime;
+//            countTimeTotal = timeResult > 0 ? timeResult : 0;
+//            sendCountTimeMessage();
+//        }
+//    }
+//
+//    private void sendCountTimeMessage() {
+//        mHandler.removeMessages(LIVE_TIME_COUNT);
+//        android.os.Message message = android.os.Message.obtain();
+//        message.what = LIVE_TIME_COUNT;
+//        mHandler.sendMessageDelayed(message, LIVE_TIME_COUNT_SPACE);
+//    }
+//
+//    private void sendEndTipCountTimeMessage() {
+//        mHandler.removeMessages(LIVE_TIME_COUNT_END_TIP);
+//        android.os.Message message = android.os.Message.obtain();
+//        message.what = LIVE_TIME_COUNT_END_TIP;
+//        mHandler.sendMessageDelayed(message, LIVE_TIME_COUNT_SPACE);
+//    }
+//
+//    /**
+//     * 是否是预览模式
+//     *
+//     * @return
+//     */
+//    private boolean isPreviewMode() {
+//        return currentLiveMode == LiveConfig.LIVE_MODE_PREVIEW;
+//    }
+//
+//    /**
+//     * \
+//     * 是否是直播中
+//     *
+//     * @return
+//     */
+//    private boolean isLiveMode() {
+//        return currentLiveMode == LiveConfig.LIVE_MODE_LIVE_START;
+//    }
+//
+//    /**
+//     * 直播暂停状态
+//     *
+//     * @return
+//     */
+//    private boolean isLivePause() {
+//        return currentLiveStatus == LiveConfig.LIVE_STATUS_PAUSE;
+//    }
+//
+//    /**
+//     * 切换直播模式
+//     *
+//     * @param mode
+//     */
+//    private void switchLiveMode(int mode) {
+//        //切换直播模式
+//        currentLiveMode = mode;
+//        if (mode == LiveConfig.LIVE_MODE_PREVIEW) {
+//            //直播暂停模式,切换成预览模式
+//            //通知关闭直播录像
+//            switchOpsLiveVideoMode(LiveConfig.CLOSE_OPS_LIVE_VIDEO_TYPE);
+//            openPreViewMode();
+//        } else {
+//            //直播模式
+//            presenter.startPublish();
+//        }
+//    }
+//
+//    /**
+//     * 开启预览模式
+//     */
+//    private void openPreViewMode() {
+//        if (presenter != null) {
+//            showLoading();
+//            switchMainUI();
+//            presenter.openVideoPreview();
+//        }
+//    }
+//
+//    /**
+//     * 切换主场景
+//     */
+//    private void switchMainUI() {
+//        if (currentLiveMode == LiveConfig.LIVE_MODE_PREVIEW) {
+//            mFlCreateOptions.setVisibility(View.VISIBLE);
+//            mCsMainLayout.setVisibility(View.GONE);
+//        } else {
+//            mFlCreateOptions.setVisibility(View.GONE);
+//            mCsMainLayout.setVisibility(View.VISIBLE);
+//        }
+//    }
+//
+//    @Override
+//    public void onClick(View v) {
+//        int id = v.getId();
+//        if (id == R.id.tv_close) {
+//            finish();
+//            return;
+//        }
+//
+//        if (id == R.id.iv_live_share) {
+//            //分享
+//            ARouter.getInstance().build(TCChatRouterPath.CHAT_SELECT_CONTACT)
+//                    .navigation(this, SHARE_LIVE_REQUEST_CODE);
+//            return;
+//        }
+//        if (id == R.id.main_iv_reverse_camera || id == R.id.iv_reverse_camera) {
+//            //翻转摄像头
+//            presenter.reverseCamera();
+//            return;
+//        }
+//        if (id == R.id.iv_live_beauty) {
+//            //美颜
+//            showBeautyOptionsDialog();
+//            return;
+//        }
+//
+//        if (id == R.id.tv_start_live) {
+//            //开始直播
+//            if (DoubleUtils.isFastDoubleClick()) {
+//                return;
+//            }
+//            if (mRoomInfoBean != null) {
+//                if (isLivePause()) {
+//                    //直播暂停模式,恢复直播
+//                    presenter.startPublish();
+//                } else {
+//                    //预览模式,开启直播
+//                    //点开启直播之前再次验证一下房间信息
+//                    currentLiveMode = LiveConfig.LIVE_MODE_LIVE_START;
+//                    presenter.getRoomInfo(mRoomId);
+//                }
+//            }
+//        }
+//
+//        if (id == R.id.iv_mic) {
+//            //连麦管理
+//            showMicManagerDialog();
+//            return;
+//        }
+//
+//        if (id == R.id.tv_input) {
+//            //底部输入框
+//            showInputDialog();
+//            return;
+//        }
+//
+//        if (id == R.id.icon_finish_live) {
+//            //显示直播间管理弹窗
+//            showLiveRoomManagerDialog();
+//            return;
+//        }
+//
+//        if (id == R.id.iv_mic_mode) {
+//            //禁音切换
+//            updateMicMode();
+//            return;
+//        }
+//    }
+//
+//    private void updateMicMode() {
+//        if (isDisAbleMic) {
+//            presenter.setMicrophoneDisable(false);
+//            isDisAbleMic = false;
+//            ToastUtil.getInstance().showShort("您已开启麦克风");
+//            viewBinding.viewMainLayout.ivMicMode.setImageResource(R.drawable.icon_mic_mode_on);
+//        } else {
+//            presenter.setMicrophoneDisable(true);
+//            isDisAbleMic = true;
+//            ToastUtil.getInstance().showShort("您已关闭麦克风");
+//            viewBinding.viewMainLayout.ivMicMode.setImageResource(R.drawable.icon_mic_mode_off);
+//        }
+//    }
+//
+//    /**
+//     * 同步点赞数并且
+//     */
+//    private void syncAddLikeNum() {
+//        if (mHandler != null) {
+//            mHandler.removeCallbacks(mRunnable);
+//            //10S发送一次同步点赞兼心跳
+//            mHandler.postDelayed(mRunnable, SYNC_ADD_LIKE_TIME);
+//        }
+//    }
+//
+//    private void updateAddLikeCountView() {
+//        if (mTvAddLikeCount != null) {
+//            mTvAddLikeCount.setText(getString(R.string.live_room_add_like_count_str, LiveMemberHelper.getStarsCountText(currentAddLikeCount)));
+//        }
+//    }
+//
+//    @Override
+//    public void syncMemberCount(String count) {
+//        //同步成员数量
+//        Log.i("pq", "syncMemberCount" + count);
+//        if (isFinishing() || isDestroyed()) {
+//            return;
+//        }
+//        if (mTvNumPeople != null) {
+//            mTvNumPeople.setText(String.format("%s人", LiveMemberHelper.getMemberCountText(count)));
+//        }
+//    }
+//
+//    @Override
+//    public void receiveJoinMessage(RCChatJoinRoomMessage joinRoomMessage) {
+//        //收到加入房间消息
+//        if (checkActivityIsFinish()) {
+//            return;
+//        }
+//        if (joinRoomMessage == null) {
+//            return;
+//        }
+//        //加入房间之前把申请列表删除
+//        String userId = joinRoomMessage.getUserId();
+//        if (TextUtils.isEmpty(userId) && joinRoomMessage.getUserInfo() != null) {
+//            userId = joinRoomMessage.getUserInfo().getUserId();
+//        }
+//        if (!TextUtils.isEmpty(userId)) {
+//            delApplyUser(userId);
+//        }
+//        if (isCanShowBarrage()) {
+//            mTvJoinBarrage.setText(getString(R.string.enter_live_tip_str, LiveMemberHelper.getMessageName(joinRoomMessage)));
+//            showBarrageViewAnim(mFlJoinBarrage);
+//        }
+//    }
+//
+//    /**
+//     * 判断是否显示弹幕消息
+//     *
+//     * @return
+//     */
+//    private boolean isCanShowBarrage() {
+//        return mFlJoinBarrage.getVisibility() != View.VISIBLE && mFlSnapUpBarrage.getVisibility() != View.VISIBLE;
+//    }
+//
+//    /**
+//     * 显示弹幕消息
+//     */
+//    private void showBarrageViewAnim(View targetView) {
+//        if (mFlJoinBarrage.getVisibility() == View.VISIBLE || mFlSnapUpBarrage.getVisibility() == View.VISIBLE) {
+//            return;
+//        }
+//        LiveRoomAnimatorHelper.getInstance().startBarrageViewAnimation(this, targetView);
+//        hideBarrageView();
+//    }
+//
+//    /**
+//     * 隐藏弹幕消息
+//     */
+//    private void hideBarrageView() {
+//        mHandler.postDelayed(new Runnable() {
+//            @Override
+//            public void run() {
+//                if (mFlJoinBarrage != null) {
+//                    mFlJoinBarrage.setVisibility(View.GONE);
+//                }
+//                if (mFlSnapUpBarrage != null) {
+//                    mFlSnapUpBarrage.setVisibility(View.GONE);
+//                }
+//            }
+//        }, LiveConfig.LIVE_HIDE_BARRAGE_VIEW_TIME);
+//    }
+//
+//    @Override
+//    public void receiveSnapUpMessage(RCOnSnappingUpMessage onSnappingUpMessage) {
+//        //收到抢购消息
+//        if (checkActivityIsFinish()) {
+//            return;
+//        }
+//        if (onSnappingUpMessage == null) {
+//            return;
+//        }
+//        if (isCanShowBarrage()) {
+//            mTvSnapUpBarrage.setText(getString(R.string.live_snap_up_tip_str, LiveMemberHelper.getMessageName(onSnappingUpMessage)));
+//            showBarrageViewAnim(mFlSnapUpBarrage);
+//        }
+//    }
+//
+//    @Override
+//    public void liveRoomOffline() {
+//        if (isFinishing() || isDestroyed()) {
+//            return;
+//        }
+//        ToastUtil.getInstance().show(this, "直播已结束");
+//        finish();
+//    }
+//
+//    /**
+//     * 获取房间信息失败
+//     *
+//     * @param throwable
+//     */
+//    @Override
+//    public void getRoomInfoError(Throwable throwable) {
+//        if (isFinishing() || isDestroyed()) {
+//            return;
+//        }
+//        if (throwable instanceof ApiException) {
+//            ApiException apiException = (ApiException) throwable;
+//            ToastUtil.getInstance().show(TeacherLiveRoomActivity.this, apiException.getErrmsg());
+//        }
+//        finish();
+//    }
+//
+//    @Override
+//    public void showFinishView() {
+//
+//    }
+//
+//    /**
+//     * 观众端发送的点赞消息
+//     *
+//     * @param addLikeMessage
+//     */
+//    @Override
+//    public void onAddLikeMessage(RCUserAddLikeMessage addLikeMessage) {
+//        if (isFinishing() || isDestroyed() || addLikeMessage == null) {
+//            return;
+//        }
+//        Log.i("pq", "receive addlikeNum:" + addLikeMessage.getCounts());
+//        currentAddLikeCount += addLikeMessage.getCounts();
+//    }
+//
+//    @Override
+//    public void addMessageList(List<MessageContent> messageContents, boolean isReset) {
+//
+//    }
+//
+//    @Override
+//    public void addMessageContent(Message message, boolean isReset) {
+//        //添加单条消息至页面
+//        Log.i("pq", "收到需要显示msg:" + message);
+//        //只处理直播间消息,以及本直播间消息
+//        if (mMessageAdapter != null) {
+//            mMessageAdapter.addMessage(message);
+//            if (mLinearLayoutManager != null) {
+//                recyclerMsg.post(new Runnable() {
+//                    @Override
+//                    public void run() {
+//                        if (isAutoScrollToLast) {
+//                            if (recyclerMsg != null) {
+//                                recyclerMsg.scrollToPosition(mMessageAdapter.getItemCount() - 1);
+//                            }
+//                        } else {
+//                            Log.i("pq", "收到消息,不触发滚动");
+//                        }
+//                    }
+//                });
+//            }
+//        }
+//    }
+//
+//    @Override
+//    public void setRoomData(LiveRoomInfoBean roomInfoBean) {
+//        if (presenter != null) {
+//            bindLiveStatusReport();
+//            startPublish();
+//            syncAddLikeNum();
+//            //通知加入房间成功
+//            presenter.notifyJoinRoomAction(mRoomId, mUserId);
+//            //加入聊天房间
+//            presenter.joinChartRoom(roomInfoBean.roomUid, new IRongCoreCallback.OperationCallback() {
+//                @Override
+//                public void onSuccess() {
+//                    Log.i("pq", "加入聊天房间成功");
+//                    if (presenter != null) {
+//                        presenter.handleAction(LiveRoomMsgConstants.ACTION_SEND_JOIN_ROOM);
+//                        presenter.sendDefaultMessage();
+//                    }
+//                }
+//
+//                @Override
+//                public void onError(IRongCoreEnum.CoreErrorCode coreErrorCode) {
+//                    Log.i("pq", "加入聊天房间fail:" + coreErrorCode);
+//                }
+//            });
+//        }
+//    }
+//
+//    /**
+//     * 开始推流
+//     */
+//    private void startPublish() {
+//        //切换直播模式
+//        currentLiveMode = LiveConfig.LIVE_MODE_LIVE_START;
+//        if (isLivePause()) {
+//            //直播暂停模式
+//            return;
+//        }
 //        if (presenter != null) {
-//            presenter.notifyOpenOpsLiveVideoAction(mRoomId, type, mUserId);
-//        }
-    }
-
-    @Override
-    protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
-        super.onActivityResult(requestCode, resultCode, data);
-        if (resultCode == RESULT_OK) {
-            if (requestCode == SHARE_LIVE_REQUEST_CODE && data != null) {
-                String targetId = data.getStringExtra("targetId");
-                int conversationValue = data.getIntExtra("conversation", -1);
-                if (mRoomInfoBean != null && !TextUtils.isEmpty(targetId) && conversationValue != -1) {
-                    ChatHelper.getInstance().sendShareLiveMessage(targetId, conversationValue, mRoomInfoBean.roomUid
-                            , mRoomInfoBean.speakerPic,
-                            mRoomInfoBean.speakerName, mRoomInfoBean.liveRemark);
-                }
-            }
-        }
-    }
-
-    @Override
-    public boolean onKeyDown(int keyCode, KeyEvent event) {
-        if (keyCode == KeyEvent.KEYCODE_BACK) {
-            return true;
-        }
-        return super.onKeyDown(keyCode, event);
-    }
-
-    @Override
-    public void onSoftInputChanged(int height) {
-        Log.i("pq", "height" + height);
-        if (height == 0) {
-            //软键盘隐藏
-            Log.i("pq", "SoftInput hide");
-            if (mInputBarDialog != null && mInputBarDialog.isShowing()) {
-                mInputBarDialog.dismiss();
-            }
-        } else {
-            //软键盘弹出
-            Log.i("pq", "SoftInput show");
-        }
-    }
-
-    /**
-     * 直播课需要有一个额外时间提示
-     */
-    private boolean checkIsNeedRecount() {
-        if (mRoomInfoBean != null) {
-            if (!TextUtils.equals(mRoomInfoBean.roomType, "TEMP") && mRoomInfoBean.expiredCloseMinute != 0) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    private boolean checkActivityIsFinish() {
-        if (isFinishing() || isDestroyed()) {
-            return true;
-        }
-        return false;
-    }
-
-    @Override
-    public void onPointerCaptureChanged(boolean hasCapture) {
-        super.onPointerCaptureChanged(hasCapture);
-    }
-
-    @Override
-    public void getMicUserInfo(String userId) {
-        if (presenter != null) {
-            presenter.getUserInfoByUserId(userId);
-        }
-    }
-}
+//            presenter.startPublish();
+//        }
+//    }
+//
+//    @Override
+//    public void onPublishSuccess() {
+//        Log.i("pq", "onPublishSuccess");
+//        //通知开启直播间回放
+//        switchOpsLiveVideoMode(LiveConfig.OPEN_OPS_LIVE_VIDEO_TYPE);
+//        handleTimerCount();
+//        refresh();
+//    }
+//
+//    @Override
+//    public View getContentView() {
+//        return flLiveView;
+//    }
+//
+//    /**
+//     * 预览模式
+//     *
+//     * @param videoView
+//     */
+//    @Override
+//    public void addVideoPreview(RCRTCVideoView videoView) {
+//        checkVideoViewManager();
+//        if (mVideoViewManager != null) {
+//            ArrayList<RCRTCVideoView> videoViews = new ArrayList<>();
+//            videoViews.add(videoView);
+//            mVideoViewManager.update(videoViews, false);
+//        } else {
+//            Log.i("pq", "mVideoViewManager == null");
+//        }
+//    }
+//
+//    @Override
+//    public void openCameraSuccess(Boolean data) {
+//        hideLoading();
+//        Log.i("pq", "openCameraSuccess:" + data);
+//    }
+//
+//    @Override
+//    public void openCameraError(String errorMsg) {
+//        Log.i("pq", "openCameraError:" + errorMsg);
+//        mHandler.post(new Runnable() {
+//            @Override
+//            public void run() {
+//                ToastUtil.getInstance().show(TeacherLiveRoomActivity.this, errorMsg);
+//            }
+//        });
+//    }
+//
+//    @Override
+//    public void onUserJoinRoom(RCRTCRemoteUser rcrtcRemoteUser) {
+//
+//    }
+//
+//    @Override
+//    public void onUserLeftRoomMic(RCRTCRemoteUser rcrtcRemoteUser) {
+//        if (presenter != null && rcrtcRemoteUser != null) {
+//            delOnMicUser(rcrtcRemoteUser.getUserId());
+//        }
+//    }
+//
+//    @Override
+//    public void onUserOfflineRoomMic(RCRTCRemoteUser rcrtcRemoteUser) {
+//        if (presenter != null && rcrtcRemoteUser != null) {
+//            delOnMicUser(rcrtcRemoteUser.getUserId());
+//        }
+//    }
+//
+//    /**
+//     * 删除麦上用户
+//     *
+//     * @param userId
+//     */
+//    private void delOnMicUser(String userId) {
+//        runOnUiThread(new Runnable() {
+//            @Override
+//            public void run() {
+//                if (mRoomMicMemberHelper != null) {
+//                    presenter.unSubscribeStream(userId, null);
+//                    mRoomMicMemberHelper.delOnMicUser(userId);
+//                    updateMicManagerData();
+//                }
+//            }
+//        });
+//    }
+//
+//    private void delApplyUser(String targetUserId) {
+//        runOnUiThread(new Runnable() {
+//            @Override
+//            public void run() {
+//                mRoomMicMemberHelper.delApplyUser(targetUserId);
+//                updateMicManagerData();
+//            }
+//        });
+//    }
+//
+//    @Override
+//    public void onSwitchRole(String userId, RCRTCLiveRole role) {
+//        Log.i("pq", "receive onSwitchRole:" + role.getType());
+//        if (role.getType() == RCRTCLiveRole.AUDIENCE.getType()) {
+//            //role转换为观众,主播取消订阅该用户的流
+//            if (presenter != null) {
+//                //取消订阅该成员消息
+//                delOnMicUser(userId);
+//            }
+//        }
+//    }
+//
+//    @Override
+//    public void onSeatApplyMessage(RCUserSeatApplyMessage seatApplyMessage) {
+//        //连麦申请消息
+//        if (isFinishing() || isDestroyed() || seatApplyMessage == null) {
+//            return;
+//        }
+//        if (!isOwn(seatApplyMessage.getTeacherId())) {
+//            return;
+//        }
+//        if (seatApplyMessage.getType() == LiveRoomMsgConstants.MIC_ACTION_SEAT_BY_USER) {
+//            //观众申请
+//            User user = new User();
+//            user.setUserName(seatApplyMessage.getAudienceName());
+//            user.setUserId(seatApplyMessage.getAudienceId());
+//            user.setPortrait(seatApplyMessage.getAudienceAvatar());
+//            mRoomMicMemberHelper.addApplyUser(user);
+//            updateMicManagerData();
+//        }
+//        if (seatApplyMessage.getType() == LiveRoomMsgConstants.MIC_ACTION_CANCEL_SEAT_BY_USER) {
+//            //观众取消
+//            User user = new User();
+//            user.setUserName(seatApplyMessage.getAudienceName());
+//            user.setUserId(seatApplyMessage.getAudienceId());
+//            user.setPortrait(seatApplyMessage.getAudienceAvatar());
+//            mRoomMicMemberHelper.delApplyUser(user, false);
+//            updateMicManagerData();
+//        }
+//    }
+//
+//    @Override
+//    public void onRemoteUserPublishResource(String remoteUserId) {
+//        refreshAudio(null, null);
+//    }
+//
+//    @Override
+//    public void getFriendInfoSuccess(FriendInfoBean data) {
+//        if (isFinishing() || isDestroyed()) {
+//            return;
+//        }
+//        User user = new User();
+//        user.setUserId(data.getImFriendId());
+//        user.setUserName(data.getFriendNickname());
+//        user.setPortrait(data.getFriendAvatar());
+//        mRoomMicMemberHelper.refreshUserInfo(user);
+//        if (mLiveMicManagerDialog != null) {
+//            mLiveMicManagerDialog.setOnMicListData(mRoomMicMemberHelper.getOnMicUsers());
+//        }
+//        if (llMicContainer != null) {
+//            llMicContainer.refreshUIByUser(mRoomMicMemberHelper.getOnMicUsers());
+//        }
+//    }
+//
+//    @Override
+//    public void onUserLeaveRoom(String targetUserId) {
+//        //用户离开直播间消息
+//        if (presenter != null && mRoomMicMemberHelper != null) {
+//            //删除连麦申请
+//            if (!TextUtils.isEmpty(targetUserId)) {
+//                delApplyUser(targetUserId);
+//            }
+//        }
+//    }
+//
+//    private void updateMicManagerData() {
+//        if (mLiveMicManagerDialog != null) {
+//            mLiveMicManagerDialog.setApplyListData(mRoomMicMemberHelper.getOnApplyMicUsers());
+//            mLiveMicManagerDialog.setOnMicListData(mRoomMicMemberHelper.getOnMicUsers());
+//        }
+//        if (llMicContainer != null) {
+//            llMicContainer.refreshUIByUser(mRoomMicMemberHelper.getOnMicUsers());
+//        }
+//        if (mTvOnMicNumTip != null) {
+//            ArrayList<User> onApplyMicUsers = mRoomMicMemberHelper.getOnApplyMicUsers();
+//            if (onApplyMicUsers != null && onApplyMicUsers.size() > 0) {
+//                mTvOnMicNumTip.setVisibility(View.VISIBLE);
+//                mTvOnMicNumTip.setText(String.valueOf(onApplyMicUsers.size()));
+//            } else {
+//                mTvOnMicNumTip.setVisibility(View.GONE);
+//            }
+//        }
+//    }
+//
+//    /**
+//     * 用户判断消息目标是否是自己
+//     *
+//     * @param targetId
+//     * @return
+//     */
+//    private boolean isOwn(String targetId) {
+//        return TextUtils.equals(targetId, mImUserId);
+//    }
+//
+//    private void refresh() {
+//        //video流信息
+//        List<RCRTCVideoOutputStream> outputStreams = new ArrayList<>();
+//        List<RCRTCVideoInputStream> videoInputStreams = new ArrayList<>();
+//        //音频流信息
+//        List<RCRTCAudioInputStream> audioinputstream = new ArrayList<>();
+//        List<RCRTCAudioOutputStream> audioOutputStreams = new ArrayList<>();
+//        presenter.getAllStreams(outputStreams, videoInputStreams, audioinputstream, audioOutputStreams);
+//        updateVideoView(outputStreams, videoInputStreams, audioinputstream);
+//        refreshAudio(audioinputstream, audioOutputStreams);
+//    }
+//
+//
+//    private void refreshAudio(List<RCRTCAudioInputStream> audioInputStreams, List<RCRTCAudioOutputStream> audioOutputStreams) {
+//        if (audioInputStreams == null || audioOutputStreams == null) {
+//            //参数为空,先获取房间里的全部音频流信息
+//            audioInputStreams = new ArrayList<>();
+//            audioOutputStreams = new ArrayList<>();
+//            presenter.getAudioStreams(audioInputStreams, audioOutputStreams);
+//        }
+//        mRoomMicMemberHelper.delAllOnMicUser();
+//        //远端用户的音频流信息
+//        for (int i = 0; i < audioInputStreams.size(); i++) {
+//            RCRTCAudioInputStream rcrtcAudioInputStream = audioInputStreams.get(i);
+//            if (rcrtcAudioInputStream.getMediaType() == RCRTCMediaType.AUDIO) {
+//                //音频流判断显示上麦用户
+//                String userId = rcrtcAudioInputStream.getUserId();
+//                if (mRoomInfoBean != null) {
+//                    if (!TextUtils.equals(mRoomInfoBean.speakerId, userId)) {
+//                        User user = mRoomMicMemberHelper.createUser(userId);
+//                        mRoomMicMemberHelper.addOnMicUser(user);
+//                    }
+//                }
+//            }
+//        }
+//        runOnUiThread(new Runnable() {
+//            @Override
+//            public void run() {
+//                updateMicManagerData();
+//            }
+//        });
+//    }
+//
+//    public void updateVideoView(List<RCRTCVideoOutputStream> outputStreams, List<RCRTCVideoInputStream> inputStreams, List<RCRTCAudioInputStream> audioInputStreams) {
+//        mHandler.post(new Runnable() {
+//            @Override
+//            public void run() {
+//                currentLiveStatus = LiveConfig.LIVE_STATUS_NORMAL;
+//                currentLiveMode = LiveConfig.LIVE_MODE_LIVE_START;
+//                switchMainUI();
+//                ArrayList<RCRTCVideoStream> videoStreams = new ArrayList<RCRTCVideoStream>();
+//                videoStreams.addAll(outputStreams);
+//                videoStreams.addAll(inputStreams);
+//                ArrayList<RCRTCVideoView> list = new ArrayList<>();
+//                ArrayList<String> otherAudioUserIds = new ArrayList<>();
+//                boolean isNormalCreateAudioStatus = true;
+//
+//                //视频流
+//                for (int i = 0; i < videoStreams.size(); i++) {
+//                    RCRTCVideoStream rcrtcVideoStream = videoStreams.get(i);
+//                    RCRTCVideoView rongRTCVideoView = new RCRTCVideoView(TeacherLiveRoomActivity.this);
+//                    rcrtcVideoStream.setVideoView(rongRTCVideoView);
+//                    list.add(rongRTCVideoView);
+//                }
+//
+//                //音频流
+//                for (int i = 0; i < audioInputStreams.size(); i++) {
+//                    RCRTCAudioInputStream audioInputStream = audioInputStreams.get(i);
+//                    if (audioInputStream.getMediaType() == RCRTCMediaType.AUDIO) {
+//                        //音频流判断显示上麦用户
+//                        String userId = audioInputStream.getUserId();
+//                        if (TextUtils.equals(mImUserId, userId)) {
+//                            continue;
+//                        }
+//                        if (mRoomInfoBean != null) {
+//                            if (!TextUtils.equals(mRoomInfoBean.speakerId, userId)) {
+//                                otherAudioUserIds.add(userId);
+//                            } else {
+//                                //主播的音频流
+//                                RCRTCResourceState resourceState = audioInputStream.getResourceState();
+//                                isNormalCreateAudioStatus = resourceState == RCRTCResourceState.NORMAL;
+//                            }
+//                        }
+//                    }
+//                }
+//                mVideoViewManager.update(list, true);
+//            }
+//        });
+//    }
+//
+//    /**
+//     * 显示通用提示弹窗
+//     *
+//     * @param content
+//     * @param confirmText
+//     */
+//    private void showCommonTipDialog(String content, String confirmText, View.OnClickListener listener) {
+//        if (mConfirmDialog == null) {
+//            mConfirmDialog = new CommonConfirmDialog(this);
+//        }
+//        if (!mConfirmDialog.isShowing()) {
+//            mConfirmDialog.show();
+//        }
+//        mConfirmDialog.setContent(content);
+//        mConfirmDialog.setConfirmText(confirmText);
+//        mConfirmDialog.setOnConfirmClickListener(listener);
+//    }
+//
+//
+//    /**
+//     * 显示直播间管理弹窗
+//     */
+//    private void showLiveRoomManagerDialog() {
+//        if (mRoomManagerDialog == null) {
+//            mRoomManagerDialog = new LiveRoomManagerDialog(this);
+//            mRoomManagerDialog.setOnEventListener(new LiveRoomManagerDialog.OnEventListener() {
+//                @Override
+//                public void onPauseLive() {
+//                    //暂停直播
+//                    showCommonTipDialog(getString(R.string.live_pause_tip_str), getString(R.string.pause_live), new View.OnClickListener() {
+//                        @Override
+//                        public void onClick(View v) {
+//                            if (mConfirmDialog != null) {
+//                                mConfirmDialog.dismiss();
+//                            }
+//                            if (mRoomManagerDialog != null) {
+//                                mRoomManagerDialog.dismiss();
+//                            }
+//                            pauseLive();
+//                            switchLiveMode(LiveConfig.LIVE_MODE_PREVIEW);
+//                        }
+//                    });
+//                }
+//
+//                @Override
+//                public void onFinishLive() {
+//                    //结束直播
+//                    showCommonTipDialog(getString(R.string.finish_live_tip_str), getString(R.string.live_finish_str), new View.OnClickListener() {
+//                        @Override
+//                        public void onClick(View v) {
+//                            if (mRoomManagerDialog != null) {
+//                                mRoomManagerDialog.dismiss();
+//                            }
+//                            if (mConfirmDialog != null) {
+//                                mConfirmDialog.dismiss();
+//                            }
+//                            if (presenter != null) {
+//                                presenter.notifyCloseLiveRoomAction(mRoomId);
+//                            }
+//                            finish();
+//                        }
+//                    });
+//                }
+//            });
+//        }
+//        if (!mRoomManagerDialog.isShowing()) {
+//            mRoomManagerDialog.show();
+//        }
+//    }
+//
+//    /**
+//     * 显示连麦控制弹窗
+//     */
+//    private void showMicManagerDialog() {
+//        if (mLiveMicManagerDialog == null) {
+//            mLiveMicManagerDialog = new LiveMicManagerDialog(this);
+//            mLiveMicManagerDialog.setOnEventListener(new LiveMicManagerDialog.OnEventListener() {
+//                @Override
+//                public void onAgreeApply(User user) {
+//                    ArrayList<User> onMicUsers = mRoomMicMemberHelper.getOnMicUsers();
+//                    if (onMicUsers != null && onMicUsers.size() >= 4) {
+//                        ToastUtil.getInstance().showShort("最多支持4人上麦哦~");
+//                        return;
+//                    }
+//                    //同意连麦申请
+//                    presenter.handleAction(LiveRoomMsgConstants.ACTION_AGREE_MIC_APPLY, user);
+//                    if (mRoomMicMemberHelper != null) {
+//                        mRoomMicMemberHelper.delApplyUser(user, true);
+//                    }
+//                    updateMicManagerData();
+//                }
+//
+//                @Override
+//                public void onUnderMic(User user) {
+//                    //下麦
+//                    presenter.handleAction(LiveRoomMsgConstants.ACTION_CANCEL_ON_MIC_BY_TEACHER, user);
+//                    if (mRoomMicMemberHelper != null) {
+//                        mRoomMicMemberHelper.delOnMicUser(user);
+//                    }
+//                    updateMicManagerData();
+//                }
+//
+//                @Override
+//                public void onRefuseAllMicApply() {
+//                    if (mRoomMicMemberHelper != null) {
+//                        mRoomMicMemberHelper.delAllApplyUser();
+//                    }
+//                    updateMicManagerData();
+//                    if (presenter != null) {
+//                        presenter.handleAction(LiveRoomMsgConstants.ACTION_SEND_REFUSE_ALL_MIC_APPLY_MSG);
+//                    }
+//                }
+//
+//                @Override
+//                public void onSwitchMicMode(boolean isEnable) {
+//                    if (isEnable) {
+//                        if (mRoomMicMemberHelper != null) {
+//                            mRoomMicMemberHelper.delAllApplyUser();
+//                        }
+//                        updateMicManagerData();
+//                    }
+//                    if (presenter != null) {
+//                        //1禁止连麦 0否
+//                        presenter.syncMicMode(mRoomId, isEnable ? 1 : 0);
+//                        presenter.handleAction(LiveRoomMsgConstants.ACTION_SWITCH_MIC_MODE, isEnable);
+//                    }
+//                }
+//
+//                @Override
+//                public void onUnderAllMic() {
+//                    if (mRoomMicMemberHelper != null) {
+//                        mRoomMicMemberHelper.delAllOnMicUser();
+//                        mRoomMicMemberHelper.delAllUserCache();
+//                    }
+//                    updateMicManagerData();
+//                    if (presenter != null) {
+//                        presenter.handleAction(LiveRoomMsgConstants.ACTION_SEND_UNDER_ALL_MIC_MSG);
+//                    }
+//                }
+//            });
+//        }
+//        if (!mLiveMicManagerDialog.isShowing()) {
+//            mLiveMicManagerDialog.show();
+//        }
+//        mLiveMicManagerDialog.setApplyListData(mRoomMicMemberHelper.getOnApplyMicUsers());
+//        mLiveMicManagerDialog.setOnMicListData(mRoomMicMemberHelper.getOnMicUsers());
+//    }
+//
+//    private void showBeautyOptionsDialog() {
+//        if (mOptionsDialog == null) {
+//            mOptionsDialog = new LiveBeautyOptionsDialog(this);
+//            mOptionsDialog.setFragmentActivity(this);
+//            mOptionsDialog.setOnShowListener(new DialogInterface.OnShowListener() {
+//                @Override
+//                public void onShow(DialogInterface dialog) {
+//                    mFlCreateOptions.setVisibility(View.GONE);
+//                }
+//            });
+//
+//            mOptionsDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
+//                @Override
+//                public void onDismiss(DialogInterface dialog) {
+//                    mFlCreateOptions.setVisibility(View.VISIBLE);
+//                }
+//            });
+//        }
+//        if (!mOptionsDialog.isShowing()) {
+//            mOptionsDialog.show();
+//        }
+//    }
+//
+//    private void showInputDialog() {
+//        if (mRoomInfoBean == null) {
+//            return;
+//        }
+//        if (mInputBarDialog == null) {
+//            mInputBarDialog = new InputBarDialog(TeacherLiveRoomActivity.this, new InputBar.InputBarListener() {
+//                @Override
+//                public boolean onClickSend(String message) {
+//                    //发送消息
+//                    if (TextUtils.isEmpty(message)) {
+//                        ToastUtil.getInstance().show(TeacherLiveRoomActivity.this, "消息不能为空");
+//                        return false;
+//                    }
+//                    if (message.length() > LiveConfig.LIVE_MAX_INPUT_TEXT_LENGTH) {
+//                        ToastUtil.getInstance().show(TeacherLiveRoomActivity.this, "聊天消息需在40个字以内哦");
+//                        return false;
+//                    }
+//                    if (LiveMessageHelper.isQuickAction()) {
+//                        ToastUtil.getInstance().show(TeacherLiveRoomActivity.this, "您说话太快啦");
+//                        return false;
+//                    }
+//                    sendTextMessage(message);
+//                    return true;
+//                }
+//
+//
+//                @Override
+//                public boolean onClickEmoji() {
+//                    return false;
+//                }
+//            });
+//
+//            mInputBarDialog.setOnShowListener(new DialogInterface.OnShowListener() {
+//                @Override
+//                public void onShow(DialogInterface dialog) {
+//                    if (mInputBarDialog != null) {
+//                        mInputBarDialog.showInput();
+//                    }
+//                }
+//            });
+//        }
+//        if (!mInputBarDialog.isShowing()) {
+//            mInputBarDialog.show();
+//        }
+//    }
+//
+//    private void sendTextMessage(String message) {
+//        if (presenter != null) {
+//            TextMessage textMessage = TextMessage.obtain(message);
+//            UserInfo userInfo = new UserInfo(mImUserId, UserHelper.getUserName(), null);
+//            textMessage.setUserInfo(userInfo);
+//            presenter.sendMessage(textMessage);
+//        }
+//    }
+//
+//    private void updateLiveDelayUI(int delay, long lossRate) {
+//        if (mHandler != null) {
+//            mHandler.post(new Runnable() {
+//                @Override
+//                public void run() {
+//                    if (mTvLiveDelay == null || mIvLiveDelay == null) {
+//                        return;
+//                    }
+//                    if (lossRate == 100) {
+//                        mTvLiveDelay.setText(getString(R.string.net_error_tip));
+//                        mIvLiveDelay.setImageResource(R.drawable.icon_live_delay_high);
+//                        return;
+//                    }
+//                    mTvLiveDelay.setText(getString(R.string.live_delay_text, delay));
+//                    if (delay <= LiveConfig.LIVE_DELAY_NORMAL) {
+//                        //正常延迟模式
+//                        mIvLiveDelay.setImageResource(R.drawable.icon_live_delay_normal);
+//                        return;
+//                    }
+//                    if (delay <= LiveConfig.LIVE_DELAY_MIDDLE) {
+//                        //一般延迟模式
+//                        mIvLiveDelay.setImageResource(R.drawable.icon_live_delay_middle);
+//                    } else {
+//                        //一般延迟模式
+//                        mIvLiveDelay.setImageResource(R.drawable.icon_live_delay_high);
+//                    }
+//                }
+//            });
+//        }
+//    }
+//
+//
+//    @Override
+//    public void onDestroy() {
+//        if (presenter != null) {
+//            presenter.notifyLeaveRoomAction();
+//        }
+//        switchOpsLiveVideoMode(LiveConfig.CLOSE_OPS_LIVE_VIDEO_TYPE);
+//        super.onDestroy();
+//        if (mVideoViewManager != null) {
+//            mVideoViewManager.onRelease();
+//        }
+//        if (mHandler != null) {
+//            mHandler.removeCallbacksAndMessages(null);
+//        }
+//        if (connectStatusListener != null) {
+//            IMCenter.getInstance().removeConnectionStatusListener(connectStatusListener);
+//        }
+//        SoftKeyboardUtil.unregisterSoftInputChangedListener(getWindow());
+//        LiveEventHelper.getInstance().unRegister();
+//        RCRTCAudioRouteManager.getInstance().unInit();
+//        //取消注册通话状态数据监听器
+//        RCRTCEngine.getInstance().unregisterStatusReportListener();
+//        LiveRoomAnimatorHelper.getInstance().releaseAnimator();
+//    }
+//
+//    /**
+//     * 通知(开启/关闭)直播录像
+//     *
+//     * @param type
+//     */
+//    private void switchOpsLiveVideoMode(String type) {
+//        //酷乐秀暂时先不需要这个流程,暂时先注释掉,后续考虑优化去掉
+////        if (presenter != null) {
+////            presenter.notifyOpenOpsLiveVideoAction(mRoomId, type, mUserId);
+////        }
+//    }
+//
+//    @Override
+//    protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
+//        super.onActivityResult(requestCode, resultCode, data);
+//        if (resultCode == RESULT_OK) {
+//            if (requestCode == SHARE_LIVE_REQUEST_CODE && data != null) {
+//                String targetId = data.getStringExtra("targetId");
+//                int conversationValue = data.getIntExtra("conversation", -1);
+//                if (mRoomInfoBean != null && !TextUtils.isEmpty(targetId) && conversationValue != -1) {
+//                    ChatHelper.getInstance().sendShareLiveMessage(targetId, conversationValue, mRoomInfoBean.roomUid
+//                            , mRoomInfoBean.speakerPic,
+//                            mRoomInfoBean.speakerName, mRoomInfoBean.liveRemark);
+//                }
+//            }
+//        }
+//    }
+//
+//    @Override
+//    public boolean onKeyDown(int keyCode, KeyEvent event) {
+//        if (keyCode == KeyEvent.KEYCODE_BACK) {
+//            return true;
+//        }
+//        return super.onKeyDown(keyCode, event);
+//    }
+//
+//    @Override
+//    public void onSoftInputChanged(int height) {
+//        Log.i("pq", "height" + height);
+//        if (height == 0) {
+//            //软键盘隐藏
+//            Log.i("pq", "SoftInput hide");
+//            if (mInputBarDialog != null && mInputBarDialog.isShowing()) {
+//                mInputBarDialog.dismiss();
+//            }
+//        } else {
+//            //软键盘弹出
+//            Log.i("pq", "SoftInput show");
+//        }
+//    }
+//
+//    /**
+//     * 直播课需要有一个额外时间提示
+//     */
+//    private boolean checkIsNeedRecount() {
+//        if (mRoomInfoBean != null) {
+//            if (!TextUtils.equals(mRoomInfoBean.roomType, "TEMP") && mRoomInfoBean.expiredCloseMinute != 0) {
+//                return true;
+//            }
+//        }
+//        return false;
+//    }
+//
+//    private boolean checkActivityIsFinish() {
+//        if (isFinishing() || isDestroyed()) {
+//            return true;
+//        }
+//        return false;
+//    }
+//
+//    @Override
+//    public void onPointerCaptureChanged(boolean hasCapture) {
+//        super.onPointerCaptureChanged(hasCapture);
+//    }
+//
+//    @Override
+//    public void getMicUserInfo(String userId) {
+//        if (presenter != null) {
+//            presenter.getUserInfoByUserId(userId);
+//        }
+//    }
+//}