From f18e847baf0b7963d9832e0dc77430f00ee15071 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Wed, 7 Sep 2022 19:52:48 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=B4=E6=92=AD=E9=97=B4=E9=80=80=E5=87=BA?= =?UTF-8?q?=E9=97=AA=E9=80=80=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.gradle | 4 +-- .../live/activity/LiveAudienceActivity.java | 14 ++++---- .../yunbao/live/views/LivePlayListener.java | 2 +- .../live/views/PortraitLiveManager.java | 36 +++++++++---------- 4 files changed, 27 insertions(+), 29 deletions(-) diff --git a/config.gradle b/config.gradle index 7d7250467..629b46c1d 100644 --- a/config.gradle +++ b/config.gradle @@ -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 = [ //正式 diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java index b7741ed97..68578c0a2 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -120,7 +120,6 @@ public class LiveAudienceActivity extends LiveActivity { //直播间进入房间队列 private Handler liveHandler = new Handler(); - @Override public 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; diff --git a/live/src/main/java/com/yunbao/live/views/LivePlayListener.java b/live/src/main/java/com/yunbao/live/views/LivePlayListener.java index 9f0668b68..d2b7f21cc 100644 --- a/live/src/main/java/com/yunbao/live/views/LivePlayListener.java +++ b/live/src/main/java/com/yunbao/live/views/LivePlayListener.java @@ -17,7 +17,7 @@ public interface LivePlayListener extends LiveActivityLifeCallback { /** * 用户滑动移除该页面 */ - void onRemove(); + void onRemove(boolean isQuit); /** * @return 页面的根布局 View diff --git a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java index de6a6fde4..0047042d2 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -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() {