调整检测连麦对话框位置
修复一处闪退问题
This commit is contained in:
parent
4a9a8c3ec3
commit
4eb9adad78
@ -18,7 +18,8 @@ public class LiveUserGiftBean extends UserBean {
|
||||
private int guardType;
|
||||
private int nub;
|
||||
|
||||
|
||||
public LiveUserGiftBean() {
|
||||
}
|
||||
|
||||
public int getNub() {
|
||||
return nub;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.yunbao.live.utils;
|
||||
package com.yunbao.common.utils;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
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.HttpClient;
|
||||
import com.yunbao.common.http.ResponseModel;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
|
||||
import cn.rongcloud.rtc.api.RCRTCEngine;
|
||||
import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback;
|
||||
@ -31,7 +31,7 @@ public class MicStatusManager {
|
||||
private static MicStatusManager manager;
|
||||
private int micStatus;//连麦状态
|
||||
private String micLiveId;//主播uid
|
||||
private boolean anchorOpenRoom = false;
|
||||
private boolean anchorOpenRoom = false;//主播是否开启连麦房
|
||||
|
||||
public static MicStatusManager getInstance() {
|
||||
if (manager == null) {
|
||||
@ -160,4 +160,16 @@ public class MicStatusManager {
|
||||
public boolean isMic() {
|
||||
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();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -5,6 +5,7 @@ import android.content.Intent;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.HtmlConfig;
|
||||
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) {
|
||||
if(MicStatusManager.getInstance().isMic()){
|
||||
MicStatusManager.getInstance().showDownMicDialog(CommonAppContext.sInstance);
|
||||
return;
|
||||
}
|
||||
ARouter.getInstance().build(PATH_LIVE_AUDIENCE)
|
||||
.withBoolean(Constants.NEW_ENTER_ROOM, false)
|
||||
.withParcelable(Constants.LIVE_BEAN, mLiveBean)
|
||||
|
@ -92,7 +92,7 @@ import com.yunbao.live.http.ImHttpUtil;
|
||||
import com.yunbao.live.http.LiveHttpConsts;
|
||||
import com.yunbao.live.http.LiveHttpUtil;
|
||||
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.PortraitLiveManager;
|
||||
|
||||
@ -1211,13 +1211,7 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
int liveTypeVal, String key, Map<String, String> map, int position, int liveSdk) {
|
||||
if (MicStatusManager.getInstance().getMicStatus() != MicStatusManager.MIC_TYPE_DEFAULT &&
|
||||
!MicStatusManager.getInstance().getMicLiveId().equals(liveBean.getUid())) {
|
||||
Log.i("连麦",MicStatusManager.getInstance().toString()+" | "+liveBean.getUid());
|
||||
DialogUitl.showSimpleDialog(context, "當前正在連麥中,是否退出連麥", new DialogUitl.SimpleCallback() {
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
MicStatusManager.getInstance().downMic();
|
||||
}
|
||||
});
|
||||
MicStatusManager.getInstance().showDownMicDialog(context);
|
||||
return;
|
||||
}
|
||||
Intent intent = new Intent(context, LiveAudienceActivity.class);
|
||||
|
@ -85,7 +85,7 @@ import com.yunbao.live.presenter.LiveRyLinkMicPkPresenter;
|
||||
import com.yunbao.live.socket.SocketRyChatUtil;
|
||||
import com.yunbao.live.socket.SocketRyClient;
|
||||
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.LiveMusicViewHolder;
|
||||
import com.yunbao.live.views.LiveNewReadyRyViewHolder;
|
||||
|
@ -126,7 +126,7 @@ public class AnchorUserMicInfoAdapter extends RefreshAdapter<MicUserBean> {
|
||||
@Override
|
||||
public void onClick(int length) {
|
||||
//只允许最多3人连麦(加主播4人)
|
||||
if (length < 4) {
|
||||
if (length <= 4) {
|
||||
if (tag.getType() == TYPE_MIC_REQUEST) {
|
||||
applyMic(tag, 4, createSocketSendBean());
|
||||
} else if (tag.getType() == TYPE_MIC_INVITE) {
|
||||
|
@ -37,6 +37,7 @@ import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.JavascriptInterfaceUtils;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.MicStatusManager;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.live.R;
|
||||
@ -242,6 +243,10 @@ public class LiveHDDialogFragment extends AbsDialogFragment {
|
||||
return;
|
||||
}
|
||||
dismiss();
|
||||
if(MicStatusManager.getInstance().isMic()){
|
||||
MicStatusManager.getInstance().showDownMicDialog(mContext);
|
||||
return;
|
||||
}
|
||||
EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, liveTypeVal));
|
||||
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ import com.yunbao.common.bean.LiveUserGiftBean;
|
||||
import com.yunbao.live.bean.MicUserBean;
|
||||
import com.yunbao.live.http.LiveHttpUtil;
|
||||
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.Arrays;
|
||||
|
@ -36,7 +36,7 @@ import com.yunbao.live.bean.MicUserBean;
|
||||
import com.yunbao.live.http.LiveHttpUtil;
|
||||
import com.yunbao.live.socket.SocketSendBean;
|
||||
import com.yunbao.live.utils.LiveImDeletUtil;
|
||||
import com.yunbao.live.utils.MicStatusManager;
|
||||
import com.yunbao.common.utils.MicStatusManager;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
|
@ -20,8 +20,7 @@ import com.yunbao.live.event.LiveAudienceEvent;
|
||||
import com.yunbao.live.event.LiveRoomChangeEvent;
|
||||
import com.yunbao.live.http.LiveHttpUtil;
|
||||
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
|
||||
import com.yunbao.live.utils.MicStatusManager;
|
||||
import com.yunbao.live.views.LivePlayRyViewHolder;
|
||||
import com.yunbao.common.utils.MicStatusManager;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
|
@ -17,7 +17,6 @@ import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.lzy.okserver.OkDownload;
|
||||
import com.lzy.okserver.download.DownloadTask;
|
||||
import com.tencent.live2.V2TXLiveDef;
|
||||
@ -26,7 +25,6 @@ import com.tencent.live2.V2TXLivePlayerObserver;
|
||||
import com.tencent.live2.impl.V2TXLivePlayerImpl;
|
||||
import com.tencent.rtmp.ui.TXCloudVideoView;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.CommonHttpConsts;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.HttpClient;
|
||||
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.live.R;
|
||||
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.Subscribe;
|
||||
|
@ -138,7 +138,7 @@ import com.yunbao.live.presenter.LiveEnterRoomAnimPresenter;
|
||||
import com.yunbao.live.presenter.LiveGiftAnimPresenter;
|
||||
import com.yunbao.live.presenter.LiveLightAnimPresenter;
|
||||
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.Subscribe;
|
||||
@ -2094,20 +2094,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
}
|
||||
|
||||
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) {
|
||||
|
@ -88,7 +88,7 @@ import com.yunbao.live.socket.SocketRyChatUtil;
|
||||
import com.yunbao.live.socket.SocketRyClient;
|
||||
import com.yunbao.live.socket.SocketSendBean;
|
||||
import com.yunbao.live.utils.LiveImDeletUtil;
|
||||
import com.yunbao.live.utils.MicStatusManager;
|
||||
import com.yunbao.common.utils.MicStatusManager;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
@ -457,6 +457,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
mLiveRoomViewHolder.setGuardIcon(data.getGuardUserAvatar());
|
||||
//在线列表
|
||||
mLiveRoomViewHolder.setUserList(data.getEnterRoomInfo().getUserlists());
|
||||
//设置直播信息
|
||||
mLiveRoomViewHolder.setLiveInfo(mLiveBean.getUid(), mLiveBean.getStream(), Integer.parseInt(data.getEnterRoomInfo().getUserlistTime()) * 4000);
|
||||
List<BannerBean> bannerBeans = new ArrayList<>();
|
||||
//心愿单
|
||||
if (data.getWishList().getWishList().size() > 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user