直播间退出闪退问题

This commit is contained in:
18401019693 2022-09-07 19:52:48 +08:00
parent 2cbdac4bd0
commit f18e847baf
4 changed files with 27 additions and 29 deletions

View File

@ -4,8 +4,8 @@ ext {
buildToolsVersion: "28.0.3",
minSdkVersion : 21,
targetSdkVersion : 30,
versionCode : 206,
versionName : "6.3.9"
versionCode : 212,
versionName : "6.4.1"
]
manifestPlaceholders = [
//

View File

@ -120,7 +120,6 @@ public class LiveAudienceActivity extends LiveActivity {
//直播间进入房间队列
private Handler liveHandler = new Handler();
@Override
public <T extends View> T findViewById(@IdRes int id) {
@ -241,7 +240,7 @@ public class LiveAudienceActivity extends LiveActivity {
View rootView = viewGroup.findViewById(R.id.drawer_layout);
if (rootView != null && rootView.getParent() != null && rootView.getParent() instanceof ViewGroup) {
((ViewGroup) (rootView.getParent())).removeView(rootView);
manager.onRemove();
manager.onRemove(false);
}
}
// 满足此种条件表明需要加载直播视频以及聊天室了
@ -306,7 +305,7 @@ public class LiveAudienceActivity extends LiveActivity {
View rootView = manager.getRootView();
if (rootView.getParent() != null && rootView.getParent() instanceof ViewGroup) {
((ViewGroup) (rootView.getParent())).removeView(rootView);
manager.onRemove();
manager.onRemove(false);
}
mViewGroup.addView(manager.getRootView());
@ -448,9 +447,7 @@ public class LiveAudienceActivity extends LiveActivity {
} else if (Micing == 2) {
manager.micIngTypeTwo(mLiveBean, mLiveType, mLiveTypeVal);
} else {
manager.onRemove();
super.onBackPressed();
manager.onRemove(true);
}
} catch (Exception e) {
@ -460,7 +457,8 @@ public class LiveAudienceActivity extends LiveActivity {
}
public void end() {
manager.end();
if (manager != null)
manager.end();
}
/**
@ -583,7 +581,7 @@ public class LiveAudienceActivity extends LiveActivity {
LiveHttpUtil.cancel(LiveHttpConsts.CHECK_LIVE);
LiveHttpUtil.cancel(LiveHttpConsts.ENTER_ROOM);
LiveHttpUtil.cancel(LiveHttpConsts.ROOM_CHARGE);
manager.onRemove();
manager.onRemove(false);
mLiveType = e.getLiveType();
mLiveTypeVal = e.getLiveTypeVal();
mLiveBean = liveBean;

View File

@ -17,7 +17,7 @@ public interface LivePlayListener extends LiveActivityLifeCallback {
/**
* 用户滑动移除该页面
*/
void onRemove();
void onRemove(boolean isQuit);
/**
* @return 页面的根布局 View

View File

@ -1,10 +1,5 @@
package com.yunbao.live.views;
import static com.yunbao.common.CommonAppContext.logger;
import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics;
import static com.yunbao.live.views.LivePlayRyViewHolder.Micing;
import static com.yunbao.live.views.LiveRoomViewHolder.isStayRoomfive;
import android.app.Activity;
import android.app.Dialog;
import android.content.Intent;
@ -102,6 +97,11 @@ import io.rong.imlib.chatroom.base.RongChatRoomClient;
import io.rong.imlib.model.Conversation;
import io.rong.message.TextMessage;
import static com.yunbao.common.CommonAppContext.logger;
import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics;
import static com.yunbao.live.views.LivePlayRyViewHolder.Micing;
import static com.yunbao.live.views.LiveRoomViewHolder.isStayRoomfive;
/**
* 竖屏直播间UI逻辑
*/
@ -286,13 +286,15 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
}
@Override
public void onRemove() {
public void onRemove(boolean isQuit) {
LiveHttpUtil.cancel(LiveHttpConsts.CHECK_LIVE);
LiveHttpUtil.cancel(LiveHttpConsts.ENTER_ROOM);
LiveHttpUtil.cancel(LiveHttpConsts.ROOM_CHARGE);
CommonHttpUtil.cancel(CommonHttpConsts.GET_BALANCE);
CommonHttpUtil.cancel(LiveHttpConsts.GET_WISH_LIST);
IMLoginManager.get(mContext).setisNewUserOne(false);
//子线程执行退出操作
exitLiveRoom();
if (mLiveAudienceViewHolder != null) {
mLiveAudienceViewHolder.removeFromParent();
mLiveAudienceViewHolder.removeCallbacks();
@ -312,18 +314,12 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLivePlayViewHolder.release();
}
mLivePlayViewHolder = null;
LiveHttpUtil.cancel(LiveHttpConsts.CHECK_LIVE);
LiveHttpUtil.cancel(LiveHttpConsts.ENTER_ROOM);
LiveHttpUtil.cancel(LiveHttpConsts.ROOM_CHARGE);
CommonHttpUtil.cancel(CommonHttpConsts.GET_BALANCE);
CommonHttpUtil.cancel(LiveHttpConsts.GET_WISH_LIST);
if (mSocketClient != null) {
mSocketClient.disConnect();
mSocketClient = null;
}
if (mLiveRoomViewHolder != null) {
mLiveRoomViewHolder.removeFromParent();
mLiveRoomViewHolder.clearData();
@ -348,7 +344,11 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveRyLinkMicPkPresenter.clearData();
mLiveRyLinkMicPkPresenter.release();
}
if (isQuit) {
if (mContext instanceof LiveAudienceActivity) {
mContext.finish();
}
}
}
@Override
@ -1369,7 +1369,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
* 退出直播间
*/
public void exitLiveRoom() {
if(mLiveBean==null) {
if (mLiveBean == null) {
return;
}
RongChatRoomClient.getInstance().quitChatRoom("g" + mLiveBean.getUid(), new IRongCoreCallback.OperationCallback() {