|
@@ -2,6 +2,7 @@ package com.daya.tclive.ui;
|
|
|
|
|
|
import android.Manifest;
|
|
|
import android.content.DialogInterface;
|
|
|
+import android.content.Intent;
|
|
|
import android.graphics.Canvas;
|
|
|
import android.os.Bundle;
|
|
|
import android.os.Handler;
|
|
@@ -18,11 +19,13 @@ import android.widget.LinearLayout;
|
|
|
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.router.RouterPath;
|
|
|
import com.cooleshow.base.ui.activity.BaseMVPActivity;
|
|
|
import com.cooleshow.base.utils.AppUtils;
|
|
|
import com.cooleshow.base.utils.GsonUtils;
|
|
|
+import com.cooleshow.base.utils.LOG;
|
|
|
import com.cooleshow.base.utils.PermissionUtils;
|
|
|
import com.cooleshow.base.utils.SoftKeyboardUtil;
|
|
|
import com.cooleshow.base.utils.TimeUtils;
|
|
@@ -32,6 +35,8 @@ import com.cooleshow.base.utils.UiUtils;
|
|
|
import com.cooleshow.base.widgets.InputBar;
|
|
|
import com.cooleshow.base.widgets.dialog.CommonConfirmDialog;
|
|
|
import com.cooleshow.base.widgets.dialog.InputBarDialog;
|
|
|
+import com.cooleshow.chatmodule.constants.TCChatRouterPath;
|
|
|
+import com.cooleshow.chatmodule.utils.helper.ChatHelper;
|
|
|
import com.cooleshow.usercenter.helper.UserHelper;
|
|
|
import com.daya.tclive.R;
|
|
|
import com.daya.tclive.adapter.TTLiveRoomMessageAdapter;
|
|
@@ -82,6 +87,7 @@ 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;
|
|
@@ -125,6 +131,8 @@ public class TCTeacherLiveRoomActivity extends BaseMVPActivity<ActivityTcTeacher
|
|
|
public static final int SEND_COUNT_TIME_MSG = 1003;//计时消息
|
|
|
public static final int SEND_EXIT_COUNT_TIME_MSG = 1004;//退出直播课消息
|
|
|
|
|
|
+ public static final int SHARE_LIVE_REQUEST_CODE = 1002;//分享直播
|
|
|
+
|
|
|
|
|
|
public static final String TAG = "liveRoom";
|
|
|
public static final String ROOMID_KEY = "roomid_key";
|
|
@@ -150,7 +158,7 @@ public class TCTeacherLiveRoomActivity extends BaseMVPActivity<ActivityTcTeacher
|
|
|
|
|
|
private long normalTotalTime = 0;//直播课剩余时间
|
|
|
private long serviceTimeStamp = -1;//服务器时间节点
|
|
|
- private int currentCountType = LiveCourseCountTimeHelper.COUNT_TYPE_COURSE;
|
|
|
+ private int currentCountType = -1;
|
|
|
private long autoCloseNetworkRoomTime = 0;//直播课到时间强制退出时间
|
|
|
private String subjectId;
|
|
|
boolean isNeedCountTime = false;
|
|
@@ -536,6 +544,7 @@ public class TCTeacherLiveRoomActivity extends BaseMVPActivity<ActivityTcTeacher
|
|
|
}
|
|
|
this.mRoomInfoBean = roomInfoBean;
|
|
|
this.isLiveCourse = TextUtils.equals(mRoomInfoBean.type, "live");
|
|
|
+ iconFinishLive.setImageResource(isLiveCourse ? R.drawable.icon_live_course_pause : R.drawable.icon_live_room_close_menu);
|
|
|
syncAddLikeNum();
|
|
|
if (mMessageAdapter != null) {
|
|
|
mMessageAdapter.setRoomAuthorId(roomInfoBean.speakerId);
|
|
@@ -560,6 +569,7 @@ public class TCTeacherLiveRoomActivity extends BaseMVPActivity<ActivityTcTeacher
|
|
|
presenter.connectIM(mRoomId, mUserId, roomInfoBean.getUserSig());
|
|
|
}
|
|
|
}
|
|
|
+ presenter.getRoomCountTimeInfo(mRoomId);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -576,6 +586,7 @@ public class TCTeacherLiveRoomActivity extends BaseMVPActivity<ActivityTcTeacher
|
|
|
viewBinding.viewMainLayout.iconFinishLive.setOnClickListener(this);
|
|
|
viewBinding.viewMainLayout.mainIvReverseCamera.setOnClickListener(this);
|
|
|
viewBinding.viewMainLayout.ivMicMode.setOnClickListener(this);
|
|
|
+ viewBinding.viewCreateOptions.ivLiveShare.setOnClickListener(this);
|
|
|
|
|
|
}
|
|
|
|
|
@@ -601,7 +612,6 @@ public class TCTeacherLiveRoomActivity extends BaseMVPActivity<ActivityTcTeacher
|
|
|
//点开启直播之前再次验证一下房间信息
|
|
|
currentLiveMode = TTLiveConfig.LIVE_MODE_LIVE_START;
|
|
|
presenter.getRoomInfo(mRoomId);
|
|
|
- presenter.getRoomCountTimeInfo(mRoomId);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -632,6 +642,13 @@ public class TCTeacherLiveRoomActivity extends BaseMVPActivity<ActivityTcTeacher
|
|
|
updateMicMode();
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
+ if (id == R.id.iv_live_share) {
|
|
|
+ //分享
|
|
|
+ ARouter.getInstance().build(TCChatRouterPath.CHAT_SELECT_CONTACT)
|
|
|
+ .navigation(this, SHARE_LIVE_REQUEST_CODE);
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -1515,7 +1532,7 @@ public class TCTeacherLiveRoomActivity extends BaseMVPActivity<ActivityTcTeacher
|
|
|
if (data != null && data.getCourseScheduleTimes() != null && data.getCourseScheduleTimes().size() > 0) {
|
|
|
isNeedCountTime = true;
|
|
|
subjectId = data.getSubjectId();
|
|
|
- iconFinishLive.setImageResource(R.drawable.icon_live_course_pause);
|
|
|
+
|
|
|
LiveCourseCountTimeHelper.getInstance().setTimeInfoList(data.getCourseScheduleTimes());
|
|
|
long finishLimitTime = data.getAutoCloseNetworkRoomTime() * 60L * 1000;
|
|
|
LiveCourseCountTimeHelper.getInstance().setAutoCloseNetworkRoomTime(finishLimitTime);
|
|
@@ -1523,7 +1540,6 @@ public class TCTeacherLiveRoomActivity extends BaseMVPActivity<ActivityTcTeacher
|
|
|
startCountTime();
|
|
|
} else {
|
|
|
isNeedCountTime = false;
|
|
|
- iconFinishLive.setImageResource(R.drawable.icon_live_room_close_menu);
|
|
|
llCountTimeTip.setVisibility(View.GONE);
|
|
|
}
|
|
|
}
|
|
@@ -1673,6 +1689,22 @@ public class TCTeacherLiveRoomActivity extends BaseMVPActivity<ActivityTcTeacher
|
|
|
}
|
|
|
|
|
|
@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 void onDestroy() {
|
|
|
if (presenter != null) {
|
|
|
presenter.notifyLeaveRoomAction();
|