|
@@ -10,6 +10,7 @@ import android.content.Intent;
|
|
|
import android.content.ServiceConnection;
|
|
|
import android.content.pm.ActivityInfo;
|
|
|
import android.content.res.Configuration;
|
|
|
+import android.graphics.Canvas;
|
|
|
import android.graphics.Color;
|
|
|
import android.net.Uri;
|
|
|
import android.os.Bundle;
|
|
@@ -29,11 +30,14 @@ 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.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.ToastUtil;
|
|
|
import com.cooleshow.base.utils.UiUtils;
|
|
|
import com.cooleshow.base.widgets.DensityUtil;
|
|
@@ -115,7 +119,7 @@ import static com.tencent.live2.V2TXLiveDef.V2TXLiveRotation.V2TXLiveRotation0;
|
|
|
* Author by pq, Date on 2023/2/22.
|
|
|
*/
|
|
|
@Route(path = ARouterConstace.ACTIVITY_TT_LIVE_ROOM)
|
|
|
-public class TCStudentLiveRoomActivity extends BaseMVPActivity<AcTtLiveroomLayoutBinding,TTLiveRoomPresenter> implements TTLiveRoomContract.View, View.OnClickListener {
|
|
|
+public class TCStudentLiveRoomActivity extends BaseMVPActivity<AcTtLiveroomLayoutBinding, TTLiveRoomPresenter> implements TTLiveRoomContract.View, View.OnClickListener, SoftKeyboardUtil.OnSoftInputChangedListener {
|
|
|
public static final String TAG = "TTLiveRoomActivity";
|
|
|
|
|
|
ConstraintLayout content_view;
|
|
@@ -315,13 +319,12 @@ public class TCStudentLiveRoomActivity extends BaseMVPActivity<AcTtLiveroomLayou
|
|
|
|
|
|
@Override
|
|
|
protected void initView() {
|
|
|
- setStatusBarColor();
|
|
|
content_view = viewBinding.contentView;
|
|
|
- mVideoView= viewBinding.videoView;
|
|
|
- flVideoContainer= viewBinding.flVideoContainer;
|
|
|
- csVideoContainer= viewBinding.csVideoContainer;
|
|
|
- mGroupViews= viewBinding.groupViews;
|
|
|
- mFlJoinBarrage= viewBinding.flJoinBarrage;
|
|
|
+ mVideoView = viewBinding.videoView;
|
|
|
+ flVideoContainer = viewBinding.flVideoContainer;
|
|
|
+ csVideoContainer = viewBinding.csVideoContainer;
|
|
|
+ mGroupViews = viewBinding.groupViews;
|
|
|
+ mFlJoinBarrage = viewBinding.flJoinBarrage;
|
|
|
mIvClose = viewBinding.ivClose;
|
|
|
mFlSnapUpBarrage = viewBinding.flSnapUpBarrage;
|
|
|
mIvSwitchVideoOrientation = viewBinding.ivSwitchVideoOrientation;
|
|
@@ -365,6 +368,12 @@ public class TCStudentLiveRoomActivity extends BaseMVPActivity<AcTtLiveroomLayou
|
|
|
}
|
|
|
mMessageAdapter = new TTMessageAdapter(this);
|
|
|
mLinearLayoutManager = new LinearLayoutManager(this, RecyclerView.VERTICAL, false);
|
|
|
+ mRecyclerMsg.addItemDecoration(new RecyclerView.ItemDecoration() {
|
|
|
+ @Override
|
|
|
+ public void onDraw(@NonNull Canvas c, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
|
|
|
+ super.onDraw(c, parent, state);
|
|
|
+ }
|
|
|
+ });
|
|
|
mRecyclerMsg.setLayoutManager(mLinearLayoutManager);
|
|
|
mRecyclerMsg.setAdapter(mMessageAdapter);
|
|
|
}
|
|
@@ -393,7 +402,7 @@ public class TCStudentLiveRoomActivity extends BaseMVPActivity<AcTtLiveroomLayou
|
|
|
//关键 player 对象与界面 view
|
|
|
mMLivePlayer.setRenderView(mVideoView);
|
|
|
mMLivePlayer.enableReceiveSeiMessage(true, TTLiveConfig.DEFAULT_PAYLOAD_TYPE);
|
|
|
- presenter.init(this,mRoomId);
|
|
|
+ presenter.init(this, mRoomId);
|
|
|
initListener();
|
|
|
}
|
|
|
|
|
@@ -404,7 +413,7 @@ public class TCStudentLiveRoomActivity extends BaseMVPActivity<AcTtLiveroomLayou
|
|
|
private void initListener() {
|
|
|
initViewClickListener();
|
|
|
TCIMSdkManager.getInstance().addEventListener(mTIMSDKListener);
|
|
|
-
|
|
|
+ SoftKeyboardUtil.registerSoftInputChangedListener(getWindow(), this);
|
|
|
mRecyclerMsg.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
|
|
@Override
|
|
|
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
|
|
@@ -560,7 +569,7 @@ public class TCStudentLiveRoomActivity extends BaseMVPActivity<AcTtLiveroomLayou
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void initViewClickListener(){
|
|
|
+ private void initViewClickListener() {
|
|
|
viewBinding.ivClose.setOnClickListener(this);
|
|
|
viewBinding.ivSwitchVideoOrientation.setOnClickListener(this);
|
|
|
viewBinding.flInput.setOnClickListener(this);
|
|
@@ -1300,6 +1309,9 @@ public class TCStudentLiveRoomActivity extends BaseMVPActivity<AcTtLiveroomLayou
|
|
|
}
|
|
|
|
|
|
private void showShopCarDialog() {
|
|
|
+ if (roomInfo == null || TextUtils.isEmpty(roomInfo.getShopCarUrl())) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (mShopCarDialog == null) {
|
|
|
mShopCarDialog = new LiveRoomShopCarDialog(this);
|
|
|
mShopCarDialog.setOnEventListener(new LiveRoomShopCarDialog.OnEventListener() {
|
|
@@ -1308,19 +1320,19 @@ public class TCStudentLiveRoomActivity extends BaseMVPActivity<AcTtLiveroomLayou
|
|
|
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();
|
|
|
+ sendShowFloatWindowAction(SEND_JUMP_OTHER_PAGE_MSG);
|
|
|
+ ARouter.getInstance()
|
|
|
+ .build(RouterPath.WebCenter.ACTIVITY_HTML)
|
|
|
+ .withString(WebConstants.WEB_URL, url)
|
|
|
+ .withString(WebConstants.WEB_TITLE, "商品详情")
|
|
|
+ .navigation();
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
if (!mShopCarDialog.isShowing()) {
|
|
|
mShopCarDialog.show();
|
|
|
}
|
|
|
- mShopCarDialog.setRoomId(mRoomId);
|
|
|
+ mShopCarDialog.setRoomId(mRoomId, roomInfo.getShopCarUrl());
|
|
|
}
|
|
|
|
|
|
private void showInviteSeatDialog() {
|
|
@@ -1456,7 +1468,7 @@ public class TCStudentLiveRoomActivity extends BaseMVPActivity<AcTtLiveroomLayou
|
|
|
updateMicIcon(LiveRoomMsgConstants.MIC_STATUS_NORMAL);
|
|
|
ToastUtil.getInstance().show(TCStudentLiveRoomActivity.this, getString(R.string.create_refuse_seat_tip));
|
|
|
if (roomInfo != null) {
|
|
|
- presenter.buildResponseMessage(mUserId, roomInfo.speakerId, roomInfo.speakerName);
|
|
|
+ presenter.buildResponseMessage(mUserId, roomInfo.speakerImUserId, roomInfo.speakerName);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1600,11 +1612,8 @@ public class TCStudentLiveRoomActivity extends BaseMVPActivity<AcTtLiveroomLayou
|
|
|
return;
|
|
|
}
|
|
|
if (mLlMicContainer != null && friendInfoBean != null) {
|
|
|
- String friendAvatar = "";
|
|
|
- if (friendInfoBean.friend != null) {
|
|
|
- friendAvatar = friendInfoBean.friend.avatar;
|
|
|
- }
|
|
|
- mLlMicContainer.updateTargetUserInfo(new TTUserInfo(friendInfoBean.friendId, friendInfoBean.friendNickname, !TextUtils.isEmpty(friendAvatar) ? Uri.parse(friendAvatar) : null));
|
|
|
+ String friendAvatar = friendInfoBean.getFriendAvatar();
|
|
|
+ mLlMicContainer.updateTargetUserInfo(new TTUserInfo(friendInfoBean.getImFriendId(), friendInfoBean.friendNickname, !TextUtils.isEmpty(friendAvatar) ? Uri.parse(friendAvatar) : null));
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -2000,7 +2009,7 @@ public class TCStudentLiveRoomActivity extends BaseMVPActivity<AcTtLiveroomLayou
|
|
|
}
|
|
|
if (roomInfo != null) {
|
|
|
this.roomInfo = roomInfo;
|
|
|
- LOG.i(TAG,"getRoomInfoSuccess:"+roomInfo.toString());
|
|
|
+ LOG.i(TAG, "getRoomInfoSuccess:" + roomInfo.toString());
|
|
|
String userSig = roomInfo.getUserSig();
|
|
|
if (!TextUtils.isEmpty(userSig)) {
|
|
|
presenter.connectIM(mUserId, userSig);
|
|
@@ -2022,19 +2031,21 @@ public class TCStudentLiveRoomActivity extends BaseMVPActivity<AcTtLiveroomLayou
|
|
|
// isEnableChat = chatCtrlMode == 1;
|
|
|
// isEnableMic = micCtrlMode == 1;
|
|
|
//
|
|
|
-// 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();
|
|
|
// }
|
|
|
// }
|
|
|
+
|
|
|
+ if (TextUtils.isEmpty(roomInfo.getShopCarUrl())) {
|
|
|
+ //隐藏购物车
|
|
|
+ mViewShopCarAnim.setVisibility(View.GONE);
|
|
|
+ mIvShopCar.setVisibility(View.GONE);
|
|
|
+ } else {
|
|
|
+ //显示购物车
|
|
|
+ mViewShopCarAnim.setVisibility(View.VISIBLE);
|
|
|
+ mIvShopCar.setVisibility(View.INVISIBLE);
|
|
|
+ }
|
|
|
//黑名单模式
|
|
|
isEnableAll = roomInfo.blacklistFlag == 1;//1是黑名单 0否
|
|
|
updateInputTip();
|
|
@@ -2212,7 +2223,7 @@ public class TCStudentLiveRoomActivity extends BaseMVPActivity<AcTtLiveroomLayou
|
|
|
|
|
|
public String getSpeakerId() {
|
|
|
if (roomInfo != null) {
|
|
|
- return roomInfo.speakerId;
|
|
|
+ return roomInfo.speakerImUserId;
|
|
|
}
|
|
|
return "";
|
|
|
}
|
|
@@ -2329,6 +2340,21 @@ public class TCStudentLiveRoomActivity extends BaseMVPActivity<AcTtLiveroomLayou
|
|
|
}
|
|
|
|
|
|
@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 onDestroy() {
|
|
|
if (presenter != null) {
|
|
|
presenter.release();
|
|
@@ -2350,11 +2376,11 @@ public class TCStudentLiveRoomActivity extends BaseMVPActivity<AcTtLiveroomLayou
|
|
|
showHeaderInfoAnim.cancel();
|
|
|
showHeaderInfoAnim = null;
|
|
|
}
|
|
|
+ SoftKeyboardUtil.unregisterSoftInputChangedListener(getWindow());
|
|
|
LiveRoomAnimatorHelper.getInstance().releaseAnimator();
|
|
|
LiveRoomAddLikeHelper.getInstance().release();
|
|
|
TRTCSdkManager.getInstance().release();
|
|
|
TCIMSdkManager.getInstance().quitGroup(mRoomId);
|
|
|
TCIMSdkManager.getInstance().release(mTIMSDKListener);
|
|
|
}
|
|
|
-
|
|
|
}
|