fix[声望升级-修复BUG]

This commit is contained in:
Martin 2024-05-30 18:25:01 +08:00
parent b0c5d44d1c
commit 278801b77a
13 changed files with 205 additions and 111 deletions

View File

@ -184,6 +184,36 @@ public class SWManager extends BaseCacheManager {
}
}
public void setDrPkNumClarity(int selectClarity) {
if (cfg != null && mRtcEngine != null) {
VideoEncoderConfiguration.VideoDimensions videoDimensions = new VideoEncoderConfiguration.VideoDimensions();
switch (selectClarity) {
case 1:
videoDimensions.width = 720;
videoDimensions.height = 1280;
cfg.dimensions = videoDimensions;
break;
case 2:
case 3:
videoDimensions.width = 360;
videoDimensions.height = 640;
cfg.dimensions = videoDimensions;
break;
case 4:
videoDimensions.width = 360;
videoDimensions.height = 320;
cfg.dimensions = videoDimensions;
break;
}
mRtcEngine.setVideoEncoderConfiguration(cfg);
}
}
/**
* 设置镜像模式
*/

View File

@ -123,6 +123,7 @@ import cn.rongcloud.rtc.api.RCRTCEngine;
import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback;
import cn.rongcloud.rtc.base.RCRTCRect;
import cn.rongcloud.rtc.base.RTCErrorCode;
import io.agora.beautyapi.faceunity.agora.SWManager;
import io.rong.imlib.IRongCallback;
import io.rong.imlib.RongIMClient;
import io.rong.imlib.model.Conversation;
@ -1656,6 +1657,7 @@ public class LiveSwAnchorActivity extends LiveActivity implements LiveFunctionCl
mLiveRoomViewHolder.endDRGif();
}
}
SWManager.get().setDrPkNumClarity(1);
// if (mLiveRoomViewHolder != null) {
// mLiveRoomViewHolder.hotAddVisibility(false);
// }

View File

@ -374,12 +374,7 @@ public class LiveGiftAnimPresenter {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.GIFT_POPUP)
.setmLiveUid(mLiveUid)
.setmStream(mStream)
.setmWishGiftId(blindBox.getEvent().getBlindBoxId() + "")
.setIsContactGift(true));
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.GIFT_POPUP).setmLiveUid(mLiveUid).setmStream(mStream).setmWishGiftId(blindBox.getEvent().getBlindBoxId() + "").setIsContactGift(true));
}
}, 1000);
} else {
@ -436,6 +431,7 @@ public class LiveGiftAnimPresenter {
}
});
}
private void changeLiveRoom(LiveReceiveGiftBean mTempGifGiftBean) {
if (mTempGifGiftBean != null) {
String uid = mTempGifGiftBean.getUid();
@ -657,6 +653,16 @@ public class LiveGiftAnimPresenter {
});
}
/**
* 釋放全局通知
*/
public void releaseServiceNotice() {
L.eSw("releaseServiceNotice 釋放全局通知");
mHandler.sendEmptyMessageDelayed(full_service_notice_new_1, 100);
full_service_notice_new.setVisibility(View.GONE);
}
private void setGitTipAnimatorBuyZuoji() {
mDp500 = DpUtil.dp2px(500);
mGifGiftTipShowAnimatorBuyZuoji = ObjectAnimator.ofFloat(mGifGiftTipGroupBuyZuoji, "translationX", mDp500, 0);
@ -1003,8 +1009,7 @@ public class LiveGiftAnimPresenter {
}
}
} else {
if ((bean.getGifUrl().contains("svga") || bean.getGifUrl().contains("gif")) &&
IMLoginManager.get(mContext).isGiftEffect()) {
if ((bean.getGifUrl().contains("svga") || bean.getGifUrl().contains("gif")) && IMLoginManager.get(mContext).isGiftEffect()) {
//同一直播间玩家自己送礼物也能看到全服通知
//同一直播间其他玩家也能看到全服通知
@ -1159,6 +1164,7 @@ public class LiveGiftAnimPresenter {
mRoomNum = event.getLiveuid();
if (mShowAllServer) {
L.eSw("mGifAll != null");
if (mGifAll != null) {
LiveReceiveGiftBean bean = new LiveReceiveGiftBean();
bean.setSendtype(91);
@ -1167,6 +1173,7 @@ public class LiveGiftAnimPresenter {
mGifAll.offer(bean);
}
} else {
L.eSw("mGifAll != nullnullnullnullnullnull");
notifyFFGGGDJANEvent = event;
mShowAllServer = true;
index4Guard = getFirstIndexOfValue(heightOffsetArr, 0);
@ -1264,23 +1271,17 @@ public class LiveGiftAnimPresenter {
mGifGiftTipGroupBuyGuardNew.setVisibility(View.VISIBLE);
switch (event.getGuardType()) {
case "1":
guardAllServerNotifyBg.setBackgroundResource(WordUtil.isNewZh() ?
R.mipmap.background_all_server_notify_star_zh :
R.mipmap.background_all_server_notify_star_en);
guardAllServerNotifyBg.setBackgroundResource(WordUtil.isNewZh() ? R.mipmap.background_all_server_notify_star_zh : R.mipmap.background_all_server_notify_star_en);
mGifGiftTipBuyGuardNew.setTextColor(Color.parseColor("#072A93"));
mIvLookBuyGuardNew.setBackgroundResource(R.mipmap.btn_star_guard_onlookers);
break;
case "2":
guardAllServerNotifyBg.setBackgroundResource(WordUtil.isNewZh() ?
R.mipmap.background_all_server_notify_king_zh :
R.mipmap.background_all_server_notify_king_en);
guardAllServerNotifyBg.setBackgroundResource(WordUtil.isNewZh() ? R.mipmap.background_all_server_notify_king_zh : R.mipmap.background_all_server_notify_king_en);
mGifGiftTipBuyGuardNew.setTextColor(Color.parseColor("#BF0B0A"));
mIvLookBuyGuardNew.setBackgroundResource(R.mipmap.btn_king_guard_onlookers);
break;
case "3":
guardAllServerNotifyBg.setBackgroundResource(WordUtil.isNewZh() ?
R.mipmap.background_all_server_notify_god_zh :
R.mipmap.background_all_server_notify_sgod_en);
guardAllServerNotifyBg.setBackgroundResource(WordUtil.isNewZh() ? R.mipmap.background_all_server_notify_god_zh : R.mipmap.background_all_server_notify_sgod_en);
mGifGiftTipBuyGuardNew.setTextColor(Color.parseColor("#41057E"));
mIvLookBuyGuardNew.setBackgroundResource(R.mipmap.btn_god_guard_onlookers);
break;
@ -1333,13 +1334,7 @@ public class LiveGiftAnimPresenter {
IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo();
if (!TextUtils.isEmpty(notifyFFGGGDJANEvent.getLink())) {
StringBuffer htmlUrl = new StringBuffer();
htmlUrl.append(notifyFFGGGDJANEvent.getLink())
.append(notifyFFGGGDJANEvent.getLink().contains("?") ? "&uid=" : "?uid=")
.append(userInfo.getId())
.append("&token=")
.append(userInfo.getToken())
.append("&isZh=")
.append(((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
htmlUrl.append(notifyFFGGGDJANEvent.getLink()).append(notifyFFGGGDJANEvent.getLink().contains("?") ? "&uid=" : "?uid=").append(userInfo.getId()).append("&token=").append(userInfo.getToken()).append("&isZh=").append(((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
if (!TextUtils.isEmpty(notifyFFGGGDJANEvent.getH5Type())) {
if (TextUtils.equals(notifyFFGGGDJANEvent.getH5Type(), "1")) {
Bundle bundle = new Bundle();
@ -1412,9 +1407,7 @@ public class LiveGiftAnimPresenter {
mGifGiftTipGroupBuyZuoji.setLayoutParams(params);
}
String text = mTempGifGiftBean.getUserNiceName() + " <myfont size='24px'>"
+ mContext.getString(R.string.live_send_buy_zuoji_1)
+ "</myfont> " + (mTempGifGiftBean.getCarName());
String text = mTempGifGiftBean.getUserNiceName() + " <myfont size='24px'>" + mContext.getString(R.string.live_send_buy_zuoji_1) + "</myfont> " + (mTempGifGiftBean.getCarName());
Spanned spanned = Html.fromHtml(text, null, new HtmlTagHandler("myfont"));
mGifGiftTipBuyZuoji.setText(spanned);
mGifGiftTipBuyZuoji.setSelected(false);
@ -1453,9 +1446,7 @@ public class LiveGiftAnimPresenter {
mGifGiftTipGroupBuyLiangName.setLayoutParams(params);
}
String text = mTempGifGiftBean.getUserNiceName() + " <myfont size='24px'>"
+ mContext.getString(R.string.live_send_buy_liang_name_1)
+ "</myfont> " + mTempGifGiftBean.getLiangName();
String text = mTempGifGiftBean.getUserNiceName() + " <myfont size='24px'>" + mContext.getString(R.string.live_send_buy_liang_name_1) + "</myfont> " + mTempGifGiftBean.getLiangName();
Spanned spanned = Html.fromHtml(text, null, new HtmlTagHandler("myfont"));
mGifGiftTipBuyLiangName.setText(spanned);
mGifGiftTipBuyLiangName.setSelected(false);

View File

@ -474,6 +474,7 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
livePushSwViewHolder.setAnDrPkRtc(String.valueOf(drPkbeans.get(i).getId()), -1);
}
}
SWManager.get().setDrPkNumClarity(drPkbeans.size());
if(drPkbeans.size()==1){
mLiveAnchorViewHolder.closeEndPkBt();
}
@ -518,6 +519,7 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
dRjoinOtherRoom(u);
//展示结束连麦按钮
mLiveAnchorViewHolder.showEndPkBt();
mLiveAnchorViewHolder.setDrpkRoomId(CommonAppConfig.getInstance().getUid());
}
/**
@ -1172,6 +1174,7 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
if (removeIndex != -1) {
drPkbeans.remove(removeIndex);
}
SWManager.get().setDrPkNumClarity(drPkbeans.size());
setDrPkUserInfoView(drPkbeans);
}
}

View File

@ -323,7 +323,6 @@ public class SocketSwClient {
L.eSw("action3 == 2:" + u.getId());
L.eSw("收到对方同意多人PK邀请");
mListener.onLinkDRMicPkApplyOk(u);
SWManager.get().setDimensions(3);//退出直播间将分别率设置为 VD_840x480
} else if (action3 == 6) {//开始Pk
if (LiveRoomViewHolder.mHandler != null) {
LiveRoomViewHolder.mHandler.removeCallbacksAndMessages(null);

View File

@ -298,6 +298,11 @@ public class LivePlayKsyViewHolder extends LiveRoomPlayViewHolder {
}
@Override
public void endLiveMic() {
}
@Override
public ViewGroup getSmallContainer() {

View File

@ -610,6 +610,11 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
}
@Override
public void endLiveMic() {
}
@Override
public ViewGroup getSmallContainer() {
return mSmallContainer;

View File

@ -415,13 +415,15 @@ public class LivePlaySwViewHolder extends LiveRoomPlayViewHolder {
}
});
}
private void endLiveMic() {
@Override
public void endLiveMic() {
L.eSw("endLiveMic");
if(swAuManager!=null){
swAuManager.setMicAn(false);
userJoinLinkMic = false;
MicStatusManager.getInstance().clear();
}
}
@Override
public void hideCover() {
@ -882,17 +884,22 @@ public class LivePlaySwViewHolder extends LiveRoomPlayViewHolder {
boolean isShow = false;
boolean isShowInvitation = false;
@Subscribe(threadMode = ThreadMode.MAIN)
public void onUpdata(String str) {
if ("UsertoRY".equals(str)) {
//todo 新增dis监听
if (isShow) {
if (isShow||MicStatusManager.getInstance().getMicStatus()==MicStatusManager.MIC_TYPE_OPEN) {
return;
}
isShow = true;
DialogUitl.showSimpleDialog(mContext, mContext.getString(R.string.mic_tag), new DialogUitl.SimpleCallback2() {
@Override
public void onCancelClick() {
MicStatusManager.getInstance().setMicData(MicStatusManager.MIC_TYPE_DEFAULT, LiveActivity.mLiveUid);
userJoinLinkMic = false;
isShow = false;
}
@ -904,6 +911,10 @@ public class LivePlaySwViewHolder extends LiveRoomPlayViewHolder {
});
} else if ("inviteMic".equals(str)) {
if (isShowInvitation||MicStatusManager.getInstance().getMicStatus()==MicStatusManager.MIC_TYPE_OPEN) {
return;
}
isShowInvitation = true;
String content = "邀請您進行語音連麥";
String confirm = "接受";
String cancel = "拒絕";
@ -912,9 +923,9 @@ public class LivePlaySwViewHolder extends LiveRoomPlayViewHolder {
confirm = "accept";
cancel = "cancel";
}
DialogUitl.Builder builder = new DialogUitl.Builder(mContext).setContent(content).setTitle(mLiveBean.getUserNiceName()).setConfirmString(confirm).setCancelString(cancel).setView(R.layout.dialog_live_mic_invite).setClickCallback(new DialogUitl.SimpleCallback() {
DialogUitl.Builder builder = new DialogUitl.Builder(mContext).setContent(content).setTitle(mLiveBean.getUserNiceName()).setConfirmString(confirm).setCancelString(cancel).setView(R.layout.dialog_live_mic_invite).setClickCallback3(new DialogUitl.SimpleCallback3() {
@Override
public void onConfirmClick(Dialog dialog, String content) {
public void onConfirmClick(Dialog dialog) {
String[] permissions;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
permissions = new String[]{Manifest.permission.READ_MEDIA_IMAGES, Manifest.permission.RECORD_AUDIO};
@ -924,13 +935,17 @@ public class LivePlaySwViewHolder extends LiveRoomPlayViewHolder {
LiveAudienceActivity.mProcessResultUtil.requestPermissions(permissions, new Runnable() {
@Override
public void run() {
// UsertoRY();
//将自己设置成给主播,和主播连麦
L.eSw("将自己设置成给主播,和主播连麦");
joinLiveMic();
isShowInvitation = false;
}
});
}
@Override
public void onCancel() {
isShowInvitation = false;
}
});
builder.build().show();
@ -948,6 +963,11 @@ public class LivePlaySwViewHolder extends LiveRoomPlayViewHolder {
}
}
public void endLiveMicUser(){
endLiveMic();
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onOpenDrawer(LiveAudienceEvent event) {
if (event.getType() == LiveAudienceEvent.LiveAudienceType.LIVE_VIDEO) {

View File

@ -114,6 +114,11 @@ public class LivePlayTxViewHolder extends LiveRoomPlayViewHolder implements ITXL
}
@Override
public void endLiveMic() {
}
@Override
protected int getLayoutId() {
return R.layout.view_live_play_tx;

View File

@ -130,6 +130,8 @@ public abstract class LiveRoomPlayViewHolder extends AbsViewHolder implements IL
public abstract void claerDrPkInfoView();
public abstract void endLiveMic();
public interface OnMicCallback {
void onMikUpdate();

View File

@ -4058,6 +4058,13 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
mLiveGiftAnimPresenter.showAllServerNotifyFFGGGD(notifyFFGGGDJANEvent,showB);
}
public void cancelAllAnim(){
if(mLiveGiftAnimPresenter!=null){
mLiveGiftAnimPresenter.releaseServiceNotice();
}
}
//全服通知 购买坐骑
public void showBuyZuojiMessage(LiveReceiveGiftBean bean) {
if (mLiveGiftAnimPresenter == null) {

View File

@ -957,6 +957,10 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
if (mLiveAudienceViewHolder != null) {
mLiveAudienceViewHolder.removeCallbacks();
}
if(mLivePlayViewHolder!=null){
mLivePlayViewHolder.stopPlay2();
mLiveRoomViewHolder.cancelAllAnim();
}
//断开socket
if (mSocketRyClient != null) {
mSocketRyClient.disConnect();
@ -988,9 +992,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveSwLinkMicPkPresenter.release();
mLiveSwLinkMicPkPresenter = null;
}
if(mLivePlayViewHolder!=null){
mLivePlayViewHolder.stopPlay2();
}
if (mLiveEndViewHolder != null) {
removeLiveEnd();
}
@ -1168,6 +1170,26 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
DialogUitl.showSimpleDialog(mContext, null, "連麥中,退出將斷開語音連麥!", false, new DialogUitl.SimpleCallback3() {
@Override
public void onConfirmClick(Dialog dialog) {
if(isSw){
if(mLivePlayViewHolder!=null){
mLivePlayViewHolder.endLiveMic();
HttpClient.getInstance().get("live.leaveDrLm", "live.leaveDrLm")
.params("roomid", liveID)
.execute(new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
Log.e("ry", code + "退出多人");
}
});
if (isBackPressed) {
MicStatusManager.getInstance().clear();
((LiveAudienceActivity) mContext).closeRoom();
} else {
EventBus.getDefault().post(new LiveRoomChangeEvent(bean, liveType, liveTypeVal));
}
}
}else{
if (RCRTCEngine.getInstance().getRoom() == null || RCRTCEngine.getInstance().getRoom().getLocalUser() == null) {
return;
}
@ -1231,6 +1253,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
}
});
}
}
@Override
public void onCancel() {

View File

@ -19,7 +19,6 @@
android:gravity="center_vertical"
android:orientation="horizontal">
<RelativeLayout
android:layout_width="65dp"
android:layout_height="65dp"
@ -46,11 +45,11 @@
android:scaleType="centerCrop"
app:autoPlay="true" />
</RelativeLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:orientation="vertical">
@ -65,8 +64,11 @@
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
android:ellipsize="end"
android:text="用户名称"
android:textColor="#F6F7FB"
tools:textColor="@color/gray1"
android:textSize="14sp" />
<ImageView
@ -100,7 +102,7 @@
</LinearLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_width="120dp"
android:layout_height="match_parent">
@ -130,7 +132,7 @@
android:id="@+id/mic_btn"
android:layout_width="wrap_content"
android:layout_height="28dp"
android:layout_marginEnd="36dp"
android:layout_marginEnd="10dp"
android:background="@drawable/bg_anchor_mic_info_btn_ok"
android:text="同意"
android:textColor="#FFFFFF"