调整检测连麦对话框位置

修复一处闪退问题
This commit is contained in:
zlzw 2022-11-25 17:48:47 +08:00
parent 4a9a8c3ec3
commit 4eb9adad78
13 changed files with 39 additions and 37 deletions

View File

@ -18,7 +18,8 @@ public class LiveUserGiftBean extends UserBean {
private int guardType; private int guardType;
private int nub; private int nub;
public LiveUserGiftBean() {
}
public int getNub() { public int getNub() {
return nub; return nub;

View File

@ -1,5 +1,6 @@
package com.yunbao.live.utils; package com.yunbao.common.utils;
import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
@ -11,7 +12,6 @@ import com.yunbao.common.http.API;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.HttpClient; import com.yunbao.common.http.HttpClient;
import com.yunbao.common.http.ResponseModel; import com.yunbao.common.http.ResponseModel;
import com.yunbao.common.utils.ToastUtil;
import cn.rongcloud.rtc.api.RCRTCEngine; import cn.rongcloud.rtc.api.RCRTCEngine;
import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback; import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback;
@ -31,7 +31,7 @@ public class MicStatusManager {
private static MicStatusManager manager; private static MicStatusManager manager;
private int micStatus;//连麦状态 private int micStatus;//连麦状态
private String micLiveId;//主播uid private String micLiveId;//主播uid
private boolean anchorOpenRoom = false; private boolean anchorOpenRoom = false;//主播是否开启连麦房
public static MicStatusManager getInstance() { public static MicStatusManager getInstance() {
if (manager == null) { if (manager == null) {
@ -160,4 +160,16 @@ public class MicStatusManager {
public boolean isMic() { public boolean isMic() {
return micStatus == MIC_TYPE_OPEN; return micStatus == MIC_TYPE_OPEN;
} }
/**
* 显示退出连麦状态对话框
*/
public void showDownMicDialog(Context context) {
DialogUitl.showSimpleDialog(context, "當前正在連麥中,是否退出連麥", new DialogUitl.SimpleCallback() {
@Override
public void onConfirmClick(Dialog dialog, String content) {
downMic();
}
});
}
} }

View File

@ -5,6 +5,7 @@ import android.content.Intent;
import com.alibaba.android.arouter.launcher.ARouter; import com.alibaba.android.arouter.launcher.ARouter;
import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.CommonAppContext;
import com.yunbao.common.Constants; import com.yunbao.common.Constants;
import com.yunbao.common.HtmlConfig; import com.yunbao.common.HtmlConfig;
import com.yunbao.common.bean.LiveBean; import com.yunbao.common.bean.LiveBean;
@ -185,6 +186,10 @@ public class RouteUtil {
* 打开直播页面 * 打开直播页面
*/ */
public static void forwardLiveAudienceActivity(LiveBean mLiveBean, int mLiveType, int mLiveSDK, int mLiveTypeVal) { public static void forwardLiveAudienceActivity(LiveBean mLiveBean, int mLiveType, int mLiveSDK, int mLiveTypeVal) {
if(MicStatusManager.getInstance().isMic()){
MicStatusManager.getInstance().showDownMicDialog(CommonAppContext.sInstance);
return;
}
ARouter.getInstance().build(PATH_LIVE_AUDIENCE) ARouter.getInstance().build(PATH_LIVE_AUDIENCE)
.withBoolean(Constants.NEW_ENTER_ROOM, false) .withBoolean(Constants.NEW_ENTER_ROOM, false)
.withParcelable(Constants.LIVE_BEAN, mLiveBean) .withParcelable(Constants.LIVE_BEAN, mLiveBean)

View File

@ -92,7 +92,7 @@ import com.yunbao.live.http.ImHttpUtil;
import com.yunbao.live.http.LiveHttpConsts; import com.yunbao.live.http.LiveHttpConsts;
import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.http.LiveHttpUtil;
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
import com.yunbao.live.utils.MicStatusManager; import com.yunbao.common.utils.MicStatusManager;
import com.yunbao.live.views.LiveRoomPlayViewHolder; import com.yunbao.live.views.LiveRoomPlayViewHolder;
import com.yunbao.live.views.PortraitLiveManager; import com.yunbao.live.views.PortraitLiveManager;
@ -1211,13 +1211,7 @@ public class LiveAudienceActivity extends LiveActivity {
int liveTypeVal, String key, Map<String, String> map, int position, int liveSdk) { int liveTypeVal, String key, Map<String, String> map, int position, int liveSdk) {
if (MicStatusManager.getInstance().getMicStatus() != MicStatusManager.MIC_TYPE_DEFAULT && if (MicStatusManager.getInstance().getMicStatus() != MicStatusManager.MIC_TYPE_DEFAULT &&
!MicStatusManager.getInstance().getMicLiveId().equals(liveBean.getUid())) { !MicStatusManager.getInstance().getMicLiveId().equals(liveBean.getUid())) {
Log.i("连麦",MicStatusManager.getInstance().toString()+" | "+liveBean.getUid()); MicStatusManager.getInstance().showDownMicDialog(context);
DialogUitl.showSimpleDialog(context, "當前正在連麥中,是否退出連麥", new DialogUitl.SimpleCallback() {
@Override
public void onConfirmClick(Dialog dialog, String content) {
MicStatusManager.getInstance().downMic();
}
});
return; return;
} }
Intent intent = new Intent(context, LiveAudienceActivity.class); Intent intent = new Intent(context, LiveAudienceActivity.class);

View File

@ -85,7 +85,7 @@ import com.yunbao.live.presenter.LiveRyLinkMicPkPresenter;
import com.yunbao.live.socket.SocketRyChatUtil; import com.yunbao.live.socket.SocketRyChatUtil;
import com.yunbao.live.socket.SocketRyClient; import com.yunbao.live.socket.SocketRyClient;
import com.yunbao.live.socket.SocketSendBean; import com.yunbao.live.socket.SocketSendBean;
import com.yunbao.live.utils.MicStatusManager; import com.yunbao.common.utils.MicStatusManager;
import com.yunbao.live.views.LiveEndViewHolder; import com.yunbao.live.views.LiveEndViewHolder;
import com.yunbao.live.views.LiveMusicViewHolder; import com.yunbao.live.views.LiveMusicViewHolder;
import com.yunbao.live.views.LiveNewReadyRyViewHolder; import com.yunbao.live.views.LiveNewReadyRyViewHolder;

View File

@ -126,7 +126,7 @@ public class AnchorUserMicInfoAdapter extends RefreshAdapter<MicUserBean> {
@Override @Override
public void onClick(int length) { public void onClick(int length) {
//只允许最多3人连麦加主播4人 //只允许最多3人连麦加主播4人
if (length < 4) { if (length <= 4) {
if (tag.getType() == TYPE_MIC_REQUEST) { if (tag.getType() == TYPE_MIC_REQUEST) {
applyMic(tag, 4, createSocketSendBean()); applyMic(tag, 4, createSocketSendBean());
} else if (tag.getType() == TYPE_MIC_INVITE) { } else if (tag.getType() == TYPE_MIC_INVITE) {

View File

@ -37,6 +37,7 @@ import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.JavascriptInterfaceUtils; import com.yunbao.common.utils.JavascriptInterfaceUtils;
import com.yunbao.common.utils.L; import com.yunbao.common.utils.L;
import com.yunbao.common.utils.MicStatusManager;
import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.live.R; import com.yunbao.live.R;
@ -242,6 +243,10 @@ public class LiveHDDialogFragment extends AbsDialogFragment {
return; return;
} }
dismiss(); dismiss();
if(MicStatusManager.getInstance().isMic()){
MicStatusManager.getInstance().showDownMicDialog(mContext);
return;
}
EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, liveTypeVal)); EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, liveTypeVal));
} }

View File

@ -35,7 +35,7 @@ import com.yunbao.common.bean.LiveUserGiftBean;
import com.yunbao.live.bean.MicUserBean; import com.yunbao.live.bean.MicUserBean;
import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.http.LiveHttpUtil;
import com.yunbao.live.utils.LiveImDeletUtil; import com.yunbao.live.utils.LiveImDeletUtil;
import com.yunbao.live.utils.MicStatusManager; import com.yunbao.common.utils.MicStatusManager;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;

View File

@ -36,7 +36,7 @@ import com.yunbao.live.bean.MicUserBean;
import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.http.LiveHttpUtil;
import com.yunbao.live.socket.SocketSendBean; import com.yunbao.live.socket.SocketSendBean;
import com.yunbao.live.utils.LiveImDeletUtil; import com.yunbao.live.utils.LiveImDeletUtil;
import com.yunbao.live.utils.MicStatusManager; import com.yunbao.common.utils.MicStatusManager;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;

View File

@ -20,8 +20,7 @@ import com.yunbao.live.event.LiveAudienceEvent;
import com.yunbao.live.event.LiveRoomChangeEvent; import com.yunbao.live.event.LiveRoomChangeEvent;
import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.http.LiveHttpUtil;
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
import com.yunbao.live.utils.MicStatusManager; import com.yunbao.common.utils.MicStatusManager;
import com.yunbao.live.views.LivePlayRyViewHolder;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;

View File

@ -17,7 +17,6 @@ import android.widget.FrameLayout;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import com.alibaba.fastjson.JSON;
import com.lzy.okserver.OkDownload; import com.lzy.okserver.OkDownload;
import com.lzy.okserver.download.DownloadTask; import com.lzy.okserver.download.DownloadTask;
import com.tencent.live2.V2TXLiveDef; import com.tencent.live2.V2TXLiveDef;
@ -26,7 +25,6 @@ import com.tencent.live2.V2TXLivePlayerObserver;
import com.tencent.live2.impl.V2TXLivePlayerImpl; import com.tencent.live2.impl.V2TXLivePlayerImpl;
import com.tencent.rtmp.ui.TXCloudVideoView; import com.tencent.rtmp.ui.TXCloudVideoView;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.CommonHttpConsts;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.HttpClient; import com.yunbao.common.http.HttpClient;
import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.DialogUitl;
@ -37,7 +35,7 @@ import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.utils.MicStatusManager; import com.yunbao.common.utils.MicStatusManager;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.Subscribe;

View File

@ -138,7 +138,7 @@ import com.yunbao.live.presenter.LiveEnterRoomAnimPresenter;
import com.yunbao.live.presenter.LiveGiftAnimPresenter; import com.yunbao.live.presenter.LiveGiftAnimPresenter;
import com.yunbao.live.presenter.LiveLightAnimPresenter; import com.yunbao.live.presenter.LiveLightAnimPresenter;
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
import com.yunbao.live.utils.MicStatusManager; import com.yunbao.common.utils.MicStatusManager;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.Subscribe;
@ -2094,20 +2094,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
} }
getIsHot(); getIsHot();
getGuardInfo();
}
private void getGuardInfo() {
LiveHttpUtil.getUserList(mLiveUid, mStream, "guard", 1, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
JSONObject json = JSONObject.parseObject(info[0]);
JSONArray userlist = json.getJSONArray("userlist");
if (userlist.size() != 0) {
setGuardIcon(JSONArray.parseArray(userlist.toJSONString(), LiveUserGiftBean.class).get(0));
}
}
});
} }
private void setGuardIcon(LiveUserGiftBean guard) { private void setGuardIcon(LiveUserGiftBean guard) {

View File

@ -88,7 +88,7 @@ import com.yunbao.live.socket.SocketRyChatUtil;
import com.yunbao.live.socket.SocketRyClient; import com.yunbao.live.socket.SocketRyClient;
import com.yunbao.live.socket.SocketSendBean; import com.yunbao.live.socket.SocketSendBean;
import com.yunbao.live.utils.LiveImDeletUtil; import com.yunbao.live.utils.LiveImDeletUtil;
import com.yunbao.live.utils.MicStatusManager; import com.yunbao.common.utils.MicStatusManager;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
@ -457,6 +457,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveRoomViewHolder.setGuardIcon(data.getGuardUserAvatar()); mLiveRoomViewHolder.setGuardIcon(data.getGuardUserAvatar());
//在线列表 //在线列表
mLiveRoomViewHolder.setUserList(data.getEnterRoomInfo().getUserlists()); mLiveRoomViewHolder.setUserList(data.getEnterRoomInfo().getUserlists());
//设置直播信息
mLiveRoomViewHolder.setLiveInfo(mLiveBean.getUid(), mLiveBean.getStream(), Integer.parseInt(data.getEnterRoomInfo().getUserlistTime()) * 4000);
List<BannerBean> bannerBeans = new ArrayList<>(); List<BannerBean> bannerBeans = new ArrayList<>();
//心愿单 //心愿单
if (data.getWishList().getWishList().size() > 0) { if (data.getWishList().getWishList().size() > 0) {