From e9fa533e5ae071d8da5f2452455ee03793235420 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Mon, 28 Nov 2022 18:09:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=A4=9A=E6=AC=A1=E8=B0=83?= =?UTF-8?q?=E7=94=A8=E6=A3=80=E6=9F=A5=E7=9B=B4=E6=92=AD=E9=97=B4=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/http/live/LiveNetManager.java | 3 + .../live/activity/LiveAudienceActivity.java | 109 +++++++++++------- .../live/activity/PDLIiveChatActivity.java | 14 ++- .../live/activity/WebViewActivityMedal.java | 12 +- .../yunbao/live/adapter/LiveChatAdapter.java | 9 +- .../live/dialog/LiveGameDialogFragment.java | 12 +- .../live/dialog/LiveHDDialogFragment.java | 6 + .../dialog/LiveOldUserDialogFragment.java | 12 +- .../live/dialog/LiveUserDialogFragment.java | 5 + .../live/presenter/LiveGiftAnimPresenter.java | 12 +- .../presenter/LiveRoomCheckLivePresenter.java | 8 +- .../yunbao/live/views/LiveEndViewHolder.java | 5 + .../yunbao/live/views/LiveRoomViewHolder.java | 5 + .../live/views/PortraitLiveManager.java | 98 ++++++++-------- .../yunbao/live/views/SidebarViewHoler.java | 13 ++- .../yunbao/main/activity/EntryActivity.java | 12 +- .../main/activity/LiveClassActivity.java | 12 +- .../yunbao/main/activity/LoginActivity.java | 13 ++- .../yunbao/main/activity/MainActivity.java | 36 +++++- .../main/activity/MyWebViewActivity.java | 5 + .../main/activity/MyWebViewActivity2.java | 5 + .../main/activity/RegisterActivity.java | 16 ++- .../yunbao/main/activity/SearchActivity.java | 14 ++- .../main/activity/WeekWebViewActivity.java | 12 +- .../yunbao/main/adapter/SearchAdapter.java | 11 +- .../yunbao/main/dialog/OneLoginDialog.java | 24 +++- .../views/AbsMainListChildViewHolder.java | 24 +++- .../views/MainHomeCommunityViewHolder.java | 12 +- .../main/views/MainHomeLiveViewHolder.java | 17 ++- .../main/views/MainMessageViewHolder.java | 12 +- .../main/views/UserHomeViewHolder2.java | 5 + 31 files changed, 428 insertions(+), 125 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java index dc74d3fc9..29a01f9ca 100644 --- a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java +++ b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java @@ -2,6 +2,7 @@ package com.yunbao.common.http.live; import android.content.Context; import android.text.TextUtils; +import android.util.Log; import com.yunbao.common.Constants; import com.yunbao.common.R; @@ -372,6 +373,7 @@ public class LiveNetManager { .subscribe(new Consumer>() { @Override public void accept(ResponseModel enterRoomNewModelResponseModel) throws Exception { + Log.e("进入房间","enterRoomNew--------------------------------------------"); enterRoomDisposable = null; if (callback != null) { callback.onSuccess(enterRoomNewModelResponseModel.getData().getInfo()); @@ -404,6 +406,7 @@ public class LiveNetManager { .subscribe(new Consumer>() { @Override public void accept(ResponseModel stringResponseModel) throws Exception { + Log.e("进入房间","userJoinRoomNew--------------------------------------------"); userJoinDisposable = null; } }, new Consumer() { 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 e7b9b26c1..0c5e7dd3c 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -301,42 +301,59 @@ public class LiveAudienceActivity extends LiveActivity { @Override public void run() { AnchorRecommendItemModel data = itemModelList.get(mCurrentPage); - new LiveRoomCheckLivePresenter(mContext, data.getUid(), data.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { - @Override - public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { - - try { - mLiveSDK = Integer.parseInt(liveSdk); - mLiveTypeVal = Integer.parseInt(liveTypeVal); - } catch (NumberFormatException e) { - mLiveSDK = 0; - mLiveTypeVal = 0; - } - mLiveType = liveType; - String json = GsonUtils.toJson(data); - mLiveBean = GsonUtils.fromJson(json, LiveBean.class); - mLiveBean.setUserNiceName(data.getUserNicename()); - mLiveUid = mLiveBean.getUid(); - mStream = mLiveBean.getStream(); - mAncherName = mLiveBean.getUserNiceName(); - mAncherIcon = mLiveBean.getAvatar(); - Log.e(TAG, "mLiveUid--------------------------->" + mLiveUid); - //加载当前页面数据 - View rootView = manager.getRootView(); - if (rootView.getParent() != null && rootView.getParent() instanceof ViewGroup) { - ((ViewGroup) (rootView.getParent())).removeView(rootView); - manager.onRemove(false); - } - mViewGroup.addView(manager.getRootView()); - - manager.onAdd(mLiveBean, liveType, mLiveTypeVal, mLiveSDK); - //加载完页面后再后台静默下载礼物svga - downloadAllGift(); - over(); + if (mCurrentPage==0){ + View rootView = manager.getRootView(); + if (rootView.getParent() != null && rootView.getParent() instanceof ViewGroup) { + ((ViewGroup) (rootView.getParent())).removeView(rootView); + manager.onRemove(false); } - }); + mViewGroup.addView(manager.getRootView()); + manager.onAdd(mLiveBean, mLiveType, mLiveTypeVal, mLiveSDK); + //加载完页面后再后台静默下载礼物svga + downloadAllGift(); + over(); + }else { + new LiveRoomCheckLivePresenter(mContext, data.getUid(), data.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + try { + mLiveSDK = Integer.parseInt(liveSdk); + mLiveTypeVal = Integer.parseInt(liveTypeVal); + } catch (NumberFormatException e) { + mLiveSDK = 0; + mLiveTypeVal = 0; + } + mLiveType = liveType; + String json = GsonUtils.toJson(data); + mLiveBean = GsonUtils.fromJson(json, LiveBean.class); + mLiveBean.setUserNiceName(data.getUserNicename()); + mLiveUid = mLiveBean.getUid(); + mStream = mLiveBean.getStream(); + mAncherName = mLiveBean.getUserNiceName(); + mAncherIcon = mLiveBean.getAvatar(); + Log.e(TAG, "mLiveUid--------------------------->" + mLiveUid); + //加载当前页面数据 + View rootView = manager.getRootView(); + if (rootView.getParent() != null && rootView.getParent() instanceof ViewGroup) { + ((ViewGroup) (rootView.getParent())).removeView(rootView); + manager.onRemove(false); + } + mViewGroup.addView(manager.getRootView()); + + manager.onAdd(mLiveBean, liveType, mLiveTypeVal, mLiveSDK); + //加载完页面后再后台静默下载礼物svga + downloadAllGift(); + over(); + } + + @Override + public void onCheckError(String contextError) { + finish(); + } + }); + } } }; @@ -731,15 +748,23 @@ public class LiveAudienceActivity extends LiveActivity { @Override public void onSuccess(int code, String msg, String[] info) { LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); - new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), (liveUid, stream, liveType, liveTypeVal, liveSdk) -> { - if (liveBean == null) { - return; + new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + if (liveBean == null) { + return; + } + if(MicStatusManager.getInstance().isMic(liveUid)){ + MicStatusManager.getInstance().showDownMicDialog(mContext); + return; + } + EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)).setLiveEnd(true)); } - if(MicStatusManager.getInstance().isMic(liveUid)){ - MicStatusManager.getInstance().showDownMicDialog(mContext); - return; + + @Override + public void onCheckError(String contextError) { + } - EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)).setLiveEnd(true)); }); } }); @@ -1028,9 +1053,7 @@ public class LiveAudienceActivity extends LiveActivity { break; case LIVE_ROOM_EXCEPTION: //主播未直播时自动下滑至下一个直播间 - itemModelList.remove(mCurrentPage); - mPagerAdapter.notifyDataSetChanged(); - verticalViewPager.setCurrentItem(mCurrentPage + 1); + onBackPressed(); break; case REFRESH_THE_LIVEl_PAGE: getDrawer(); diff --git a/live/src/main/java/com/yunbao/live/activity/PDLIiveChatActivity.java b/live/src/main/java/com/yunbao/live/activity/PDLIiveChatActivity.java index e154e86cb..ca3142eda 100644 --- a/live/src/main/java/com/yunbao/live/activity/PDLIiveChatActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/PDLIiveChatActivity.java @@ -28,6 +28,7 @@ import com.yunbao.live.adapter.SystemChatMessageAdapter; import com.yunbao.live.bean.ImUserBean; import com.yunbao.live.event.RecommendLiveRoomEvent; import com.yunbao.live.http.LiveHttpUtil; +import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; @@ -194,7 +195,18 @@ public class PDLIiveChatActivity extends FragmentActivity { public void onSuccess(int code, String msg, String[] info) { if (code == 0 && info.length > 0) { LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); - RouteUtil.forwardLiveAudienceActivity(liveBean, 0, 0, 0); + new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal)); + } + + @Override + public void onCheckError(String contextError) { + + } + }); + } else { RouteUtil.forwardUserHome(mContext, event.getLiveuid(), 0); } diff --git a/live/src/main/java/com/yunbao/live/activity/WebViewActivityMedal.java b/live/src/main/java/com/yunbao/live/activity/WebViewActivityMedal.java index d9771066d..e9e98e524 100644 --- a/live/src/main/java/com/yunbao/live/activity/WebViewActivityMedal.java +++ b/live/src/main/java/com/yunbao/live/activity/WebViewActivityMedal.java @@ -166,7 +166,17 @@ public class WebViewActivityMedal extends AbsActivity { public void onSuccess(int code, String msg, String[] info) { if (code == 0 && info.length > 0) { LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); - RouteUtil.forwardLiveAudienceActivity(liveBean,0 , 0,0); + new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal)); + } + + @Override + public void onCheckError(String contextError) { + + } + }); } else { RouteUtil.forwardUserHome(mContext, String.valueOf(live_id), 0); } diff --git a/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java b/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java index 9096d03e8..657cdec6d 100644 --- a/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java @@ -319,17 +319,10 @@ public class LiveChatAdapter extends RecyclerView.Adapter { } } else if (bean.getType() == -2) {//自动消息,点击发言 - boolean isContains = false; - for (LiveChatBean model : mList) { - if (bean.getType() == -2) { - isContains = true; - } - } - if (isContains) { + mBg.setBackgroundResource(R.drawable.bg_chat_automatic_item); mTextView.setText(R.string.automatic_chat); bean.setHeart(position); - } } else if (bean.getType() == MSG_HOUR_RANK_CHANGE) { mBg.setBackgroundResource(R.drawable.bg_chat_automatic_item); mTextView.setText(bean.getContent()); diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveGameDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveGameDialogFragment.java index e20f31a52..750f56dc7 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveGameDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveGameDialogFragment.java @@ -294,7 +294,17 @@ public class LiveGameDialogFragment extends AbsDialogFragment { public void onSuccess(int code, String msg, String[] info) { if (code == 0 && info.length > 0) { LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); - RouteUtil.forwardLiveAudienceActivity(liveBean,0 , 0,0); + new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal)); + } + + @Override + public void onCheckError(String contextError) { + + } + }); } else { RouteUtil.forwardUserHome(mContext, live_id, 0); } diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveHDDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveHDDialogFragment.java index 1c89a48de..e654fa9ce 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveHDDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveHDDialogFragment.java @@ -245,6 +245,12 @@ public class LiveHDDialogFragment extends AbsDialogFragment { return; } EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)).setLiveEnd(true)); + dismiss(); + } + + @Override + public void onCheckError(String contextError) { + } }); } else { diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveOldUserDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveOldUserDialogFragment.java index 1e838ec12..2407a5453 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveOldUserDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveOldUserDialogFragment.java @@ -184,7 +184,17 @@ public class LiveOldUserDialogFragment extends AbsDialogFragment implements View public void onSuccess(int code, String msg, String[] info) { if (code == 0 && info.length > 0) { LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); - RouteUtil.forwardLiveAudienceActivity(liveBean,0 , 0,0); + new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal)); + } + + @Override + public void onCheckError(String contextError) { + + } + }); } } }); diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java index 17c38bf56..e3c3f826c 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java @@ -626,6 +626,11 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On } EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)).setLiveEnd(true)); } + + @Override + public void onCheckError(String contextError) { + + } }); } } diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java index b5b6fdf19..ceb97efb0 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java @@ -373,7 +373,17 @@ public class LiveGiftAnimPresenter { public void onSuccess(int code, String msg, String[] info) { if (code == 0 && info.length > 0) { LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); - RouteUtil.forwardLiveAudienceActivity(liveBean,0 , 0,0); + new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal)); + } + + @Override + public void onCheckError(String contextError) { + + } + }); } } }); diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveRoomCheckLivePresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveRoomCheckLivePresenter.java index 333629212..eb3670fe7 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveRoomCheckLivePresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveRoomCheckLivePresenter.java @@ -59,7 +59,7 @@ public class LiveRoomCheckLivePresenter { @Override public void forwardPwdRoom(CheckLiveModel model) { - DialogUitl.showSimpleInputDialog(mContext, WordUtil.getString(R.string.live_input_password), DialogUitl.INPUT_TYPE_NUMBER_PASSWORD, new DialogUitl.SimpleCallback2() { + DialogUitl.showSimpleInputDialog(context, WordUtil.getString(R.string.live_input_password), DialogUitl.INPUT_TYPE_NUMBER_PASSWORD, new DialogUitl.SimpleCallback2() { @Override public void onCancelClick() { if (mContext instanceof Activity) { @@ -74,7 +74,7 @@ public class LiveRoomCheckLivePresenter { return; } String password = MD5Util.getMD5(content); - if (mLiveTypeMsg.equalsIgnoreCase(password)) { + if (model.getTypeMsg().equalsIgnoreCase(password)) { dialog.dismiss(); if (actionListener != null) { actionListener.onLiveRoomChanged(liveUid, stream, model.getType(), model.getTypeVal(), model.getLiveSdk()); @@ -88,7 +88,7 @@ public class LiveRoomCheckLivePresenter { @Override public void forwardPayRoom(CheckLiveModel model) { - DialogUitl.showSimpleDialog(mContext, mLiveTypeMsg, new DialogUitl.SimpleCallback() { + DialogUitl.showSimpleDialog(context, mLiveTypeMsg, new DialogUitl.SimpleCallback() { @Override public void onConfirmClick(Dialog dialog, String content) { LiveHttpUtil.roomCharge(liveUid, stream, new HttpCallback() { @@ -277,5 +277,7 @@ public class LiveRoomCheckLivePresenter { public interface NewActionListener { void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk); + + void onCheckError(String contextError); } } diff --git a/live/src/main/java/com/yunbao/live/views/LiveEndViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveEndViewHolder.java index c4184c514..0ed15d730 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveEndViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveEndViewHolder.java @@ -337,6 +337,11 @@ public class LiveEndViewHolder extends AbsViewHolder implements View.OnClickList } EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)).setLiveEnd(true)); } + + @Override + public void onCheckError(String contextError) { + + } }); Bus.get().post(new CloseEvent()); } else { diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java index fdf6ef775..373162dc9 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -3581,6 +3581,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal))); } } + + @Override + public void onCheckError(String contextError) { + + } }); } else { RouteUtil.forwardUserHome(mContext, liveId, 0); 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 802d56e63..c0b649b35 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -15,7 +15,6 @@ import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; import android.widget.ImageView; -import android.widget.RelativeLayout; import androidx.annotation.NonNull; import androidx.drawerlayout.widget.DrawerLayout; @@ -287,6 +286,14 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe } + private Runnable sendFIm = new Runnable() { + @Override + public void run() { + //加入房间发送Im消息 + LiveNetManager.get(mContext).userJoinRoomNew(mLiveBean.getStream(), mLiveBean.getUid()); + } + }; + /** * 新进入房间接口 */ @@ -298,8 +305,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe public void onSuccess(EnterRoomNewModel data) { mLivePlayViewHolder.setLiveBeanLandscape(data.getLiveInfo().getLandscape()); isEnterRoom = true; - //加入房间发送Im消息 - LiveNetManager.get(mContext).userJoinRoomNew(mLiveBean.getStream(), mLiveBean.getUid()); + //延时1秒发送 + liveHandler.postDelayed(sendFIm, 700); + //新人任務 mLiveRoomViewHolder.configBanner3(data.getNewPeopleTask()); //小时榜 @@ -508,6 +516,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe public void removeLiveEnd() { if (mLiveAudienceViewHolder != null) { + mLiveAudienceViewHolder.removeFromParent(); mLiveAudienceViewHolder.removeCallbacks(); mLiveAudienceViewHolder.release(); @@ -539,6 +548,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe @Override public void onRemove(boolean isQuit) { LiveNetManager.get(mContext).cancelLive(); + liveHandler.removeCallbacks(sendFIm); LiveHttpUtil.cancel(LiveHttpConsts.CHECK_LIVE); LiveHttpUtil.cancel(LiveHttpConsts.ENTER_ROOM); LiveHttpUtil.cancel(LiveHttpConsts.ROOM_CHARGE); @@ -546,8 +556,10 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe CommonHttpUtil.cancel(LiveHttpConsts.GET_WISH_LIST); IMLoginManager.get(mContext).setisNewUserOne(false); //子线程执行退出操作 - exitLiveRoom(false); - + exitLiveRoom(isEnterRoom); + if (mLiveAudienceViewHolder != null) { + mLiveAudienceViewHolder.removeCallbacks(); + } //断开socket @@ -1414,65 +1426,57 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe * 退出直播间 */ public void exitLiveRoom(boolean isQuitF) { - if (mLiveBean == null && !isEnterRoom) { + if (!isEnterRoom) { return; } - RongChatRoomClient.getInstance().quitChatRoom("g" + mLiveBean.getUid(), new IRongCoreCallback.OperationCallback() { - @Override - public void onSuccess() { - Log.i("tx", "退出成功"); - LiveNetManager.get(mContext) - .leaveRoomNew(mLiveBean.getStream(), mLiveBean.getUid(), new com.yunbao.common.http.base.HttpCallback() { + if (mLiveBean != null) { + isEnterRoom = false; + RongChatRoomClient.getInstance().quitChatRoom("g" + mLiveBean.getUid(), new IRongCoreCallback.OperationCallback() { + @Override + public void onSuccess() { + try { + V2TIMManager.getInstance().quitGroup("g" + mLiveBean.getUid(), new V2TIMCallback() { @Override - public void onSuccess(String data) { - if (isQuitF) { - onRemove(true); - } + public void onSuccess() { + + Log.i("tx", "退出成功" + mLiveBean.getUid()); + LiveNetManager.get(mContext) + .leaveRoomNew(mLiveBean.getStream(), mLiveBean.getUid(), new com.yunbao.common.http.base.HttpCallback() { + @Override + public void onSuccess(String data) { + if (isQuitF) { + onRemove(true); + } + } + + @Override + public void onError(String error) { + + } + }); } @Override - public void onError(String error) { - + public void onError(int code, String desc) { + Log.i("tx", "退出失败"); } }); - } + } catch (Exception e) { + e.printStackTrace(); + } - @Override - public void onError(IRongCoreEnum.CoreErrorCode coreErrorCode) { - - } - }); - - try { - V2TIMManager.getInstance().quitGroup("g" + mLiveBean.getUid(), new V2TIMCallback() { - @Override - public void onSuccess() { - - Log.i("tx", "退出成功" + mLiveBean.getUid()); - LiveNetManager.get(mContext) - .leaveRoomNew(mLiveBean.getStream(), mLiveBean.getUid(), new com.yunbao.common.http.base.HttpCallback() { - @Override - public void onSuccess(String data) { - - } - - @Override - public void onError(String error) { - - } - }); } @Override - public void onError(int code, String desc) { - Log.i("tx", "退出失败"); + public void onError(IRongCoreEnum.CoreErrorCode coreErrorCode) { + } }); - } catch (Exception e) { - e.printStackTrace(); + } + } diff --git a/live/src/main/java/com/yunbao/live/views/SidebarViewHoler.java b/live/src/main/java/com/yunbao/live/views/SidebarViewHoler.java index f8581185f..4d4406f92 100644 --- a/live/src/main/java/com/yunbao/live/views/SidebarViewHoler.java +++ b/live/src/main/java/com/yunbao/live/views/SidebarViewHoler.java @@ -20,6 +20,7 @@ import com.yunbao.common.views.SlideInBannerViewHolder; import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.live.R; import com.yunbao.live.http.LiveHttpUtil; +import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; import java.util.List; @@ -99,7 +100,17 @@ public class SidebarViewHoler extends RecyclerView.ViewHolder { mShowLoadingDialog.dismiss(); return; } - RouteUtil.forwardLiveAudienceActivity(liveBean, 0, 0, 0); + new LiveRoomCheckLivePresenter(itemView.getContext(), liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal)); + } + + @Override + public void onCheckError(String contextError) { + + } + }); if (mShowLoadingDialog != null && mShowLoadingDialog.isShowing()) mShowLoadingDialog.dismiss(); ((Activity) itemView.getContext()).finish(); diff --git a/main/src/main/java/com/yunbao/main/activity/EntryActivity.java b/main/src/main/java/com/yunbao/main/activity/EntryActivity.java index daa545048..938d77785 100644 --- a/main/src/main/java/com/yunbao/main/activity/EntryActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/EntryActivity.java @@ -683,7 +683,17 @@ public class EntryActivity extends AppCompatActivity { if (liveBean == null) { return; } - RouteUtil.forwardLiveAudienceActivity(liveBean, 0, 0, 0); + new LiveRoomCheckLivePresenter(activity, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal)); + } + + @Override + public void onCheckError(String contextError) { + + } + }); NoviceInstructorManager.get(activity).setFrist(false); diff --git a/main/src/main/java/com/yunbao/main/activity/LiveClassActivity.java b/main/src/main/java/com/yunbao/main/activity/LiveClassActivity.java index e5f84f590..b5f51de8d 100644 --- a/main/src/main/java/com/yunbao/main/activity/LiveClassActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/LiveClassActivity.java @@ -116,7 +116,17 @@ public class LiveClassActivity extends AbsActivity implements OnItemClickListene * 观看直播 */ public void watchLive(LiveBean liveBean, int position) { - RouteUtil.forwardLiveAudienceActivity(liveBean, 0, 0, 0); + new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal)); + } + + @Override + public void onCheckError(String contextError) { + + } + }); } diff --git a/main/src/main/java/com/yunbao/main/activity/LoginActivity.java b/main/src/main/java/com/yunbao/main/activity/LoginActivity.java index 766ebda98..f2df79525 100644 --- a/main/src/main/java/com/yunbao/main/activity/LoginActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/LoginActivity.java @@ -50,6 +50,7 @@ import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.live.http.LiveHttpUtil; +import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; import com.yunbao.main.R; import com.yunbao.main.event.RegSuccessEvent; import com.yunbao.main.http.MainHttpConsts; @@ -239,7 +240,17 @@ public class LoginActivity extends AbsActivity { if (liveBean == null) { return; } - RouteUtil.forwardLiveAudienceActivity(liveBean, 0, 0, 0); + new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal)); + } + + @Override + public void onCheckError(String contextError) { + + } + }); NoviceInstructorManager.get(activity).setFrist(false); } else { diff --git a/main/src/main/java/com/yunbao/main/activity/MainActivity.java b/main/src/main/java/com/yunbao/main/activity/MainActivity.java index 97b5b6e17..e6c193f73 100644 --- a/main/src/main/java/com/yunbao/main/activity/MainActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MainActivity.java @@ -237,7 +237,17 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene public void onSuccess(int code, String msg, String[] info) { if (code == 0 && info.length > 0) { LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); - RouteUtil.forwardLiveAudienceActivity(liveBean, 0, 0, 0); + new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal)); + } + + @Override + public void onCheckError(String contextError) { + + } + }); } else { ToastUtil.show("直播已结束"); } @@ -408,7 +418,17 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene public void onSuccess(int code, String msg, String[] info) { if (code == 0 && info.length > 0) { LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); - RouteUtil.forwardLiveAudienceActivity(liveBean, 0, 0, 0); + new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal)); + } + + @Override + public void onCheckError(String contextError) { + + } + }); } else { RouteUtil.forwardUserHome(mContext, Uid, 0); } @@ -877,7 +897,17 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene * 观看直播 */ public void watchLive(LiveBean liveBean, String key, int position) { - RouteUtil.forwardLiveAudienceActivity(liveBean, 0, 0, 0); + new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal)); + } + + @Override + public void onCheckError(String contextError) { + + } + }); } diff --git a/main/src/main/java/com/yunbao/main/activity/MyWebViewActivity.java b/main/src/main/java/com/yunbao/main/activity/MyWebViewActivity.java index 7abae3bd7..8c8297b59 100644 --- a/main/src/main/java/com/yunbao/main/activity/MyWebViewActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MyWebViewActivity.java @@ -269,6 +269,11 @@ public class MyWebViewActivity extends AbsActivity { RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk)); } } + + @Override + public void onCheckError(String contextError) { + + } }); } } diff --git a/main/src/main/java/com/yunbao/main/activity/MyWebViewActivity2.java b/main/src/main/java/com/yunbao/main/activity/MyWebViewActivity2.java index 9e24bab30..2b60f1d5c 100644 --- a/main/src/main/java/com/yunbao/main/activity/MyWebViewActivity2.java +++ b/main/src/main/java/com/yunbao/main/activity/MyWebViewActivity2.java @@ -246,6 +246,11 @@ public class MyWebViewActivity2 extends AbsActivity { RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk)); } } + + @Override + public void onCheckError(String contextError) { + + } }); } } diff --git a/main/src/main/java/com/yunbao/main/activity/RegisterActivity.java b/main/src/main/java/com/yunbao/main/activity/RegisterActivity.java index 46e119353..916ace264 100644 --- a/main/src/main/java/com/yunbao/main/activity/RegisterActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/RegisterActivity.java @@ -50,6 +50,7 @@ import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.live.http.LiveHttpUtil; +import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; import com.yunbao.main.R; import com.yunbao.main.event.RegSuccessEvent; import com.yunbao.main.http.MainHttpConsts; @@ -502,8 +503,19 @@ public class RegisterActivity extends AbsActivity { if (liveBean == null) { return; } - RouteUtil.forwardLiveAudienceActivity(liveBean, 0, 0, 0); - NoviceInstructorManager.get(mContext).setFrist(false); + new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal)); + NoviceInstructorManager.get(mContext).setFrist(false); + } + + @Override + public void onCheckError(String contextError) { + + } + }); + } else { MainActivity.forward(RegisterActivity.this, false); diff --git a/main/src/main/java/com/yunbao/main/activity/SearchActivity.java b/main/src/main/java/com/yunbao/main/activity/SearchActivity.java index ee08d2fbf..9e70d0b67 100644 --- a/main/src/main/java/com/yunbao/main/activity/SearchActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/SearchActivity.java @@ -21,11 +21,13 @@ import com.yunbao.common.activity.AbsActivity; import com.yunbao.common.bean.LiveBean; import com.yunbao.common.event.CloseEvent; import com.yunbao.common.http.HttpCallback; +import com.yunbao.common.manager.NoviceInstructorManager; import com.yunbao.common.manager.SearchHistoryRecordManager; import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.WordsTypeUtil; import com.yunbao.live.http.LiveHttpUtil; +import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; import com.yunbao.main.R; import com.yunbao.main.event.JumpUserHomeEvent; import com.yunbao.main.fragment.SearchRecommendFragment; @@ -172,7 +174,17 @@ public class SearchActivity extends AbsActivity { public void onSuccess(int code, String msg, String[] info) { if (code == 0 && info.length > 0) { LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); - RouteUtil.forwardLiveAudienceActivity(liveBean, 0, 0, 0); + new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal)); + } + + @Override + public void onCheckError(String contextError) { + + } + }); } else { //跳转到个人资料 diff --git a/main/src/main/java/com/yunbao/main/activity/WeekWebViewActivity.java b/main/src/main/java/com/yunbao/main/activity/WeekWebViewActivity.java index c2c8618b1..e893de283 100644 --- a/main/src/main/java/com/yunbao/main/activity/WeekWebViewActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/WeekWebViewActivity.java @@ -152,7 +152,17 @@ public class WeekWebViewActivity extends AbsActivity { if (liveBean == null) { return; } - RouteUtil.forwardLiveAudienceActivity(liveBean, 0, 0, 0); + new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal)); + } + + @Override + public void onCheckError(String contextError) { + + } + }); } else { RouteUtil.forwardUserHome(mContext, live_id, 0); } diff --git a/main/src/main/java/com/yunbao/main/adapter/SearchAdapter.java b/main/src/main/java/com/yunbao/main/adapter/SearchAdapter.java index ab419926b..216924177 100644 --- a/main/src/main/java/com/yunbao/main/adapter/SearchAdapter.java +++ b/main/src/main/java/com/yunbao/main/adapter/SearchAdapter.java @@ -198,8 +198,17 @@ public class SearchAdapter extends RefreshAdapter { if (liveBean == null) { return; } + new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal)); + } - RouteUtil.forwardLiveAudienceActivity(liveBean, 0, 0, 0); + @Override + public void onCheckError(String contextError) { + + } + }); } else { RouteUtil.forwardUserHome(mContext, live_id, 0); } diff --git a/main/src/main/java/com/yunbao/main/dialog/OneLoginDialog.java b/main/src/main/java/com/yunbao/main/dialog/OneLoginDialog.java index 9fdd4c692..668dd4e63 100644 --- a/main/src/main/java/com/yunbao/main/dialog/OneLoginDialog.java +++ b/main/src/main/java/com/yunbao/main/dialog/OneLoginDialog.java @@ -148,9 +148,29 @@ public class OneLoginDialog extends AbsDialogFragment { if (liveBean == null) { return; } - RouteUtil.forwardLiveAudienceActivity(liveBean, 0, 0, 0); - NoviceInstructorManager.get(mContext).setFrist(false); + new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal)); + NoviceInstructorManager.get(mContext).setFrist(false); + } + + @Override + public void onCheckError(String contextError) { + + } + }); + } + + @Override + public void onCheckError(String contextError) { + + } + }); } else { MainActivity.forward(mContext, false); } diff --git a/main/src/main/java/com/yunbao/main/views/AbsMainListChildViewHolder.java b/main/src/main/java/com/yunbao/main/views/AbsMainListChildViewHolder.java index 20e1aafe5..fd4ac7921 100644 --- a/main/src/main/java/com/yunbao/main/views/AbsMainListChildViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/AbsMainListChildViewHolder.java @@ -148,7 +148,17 @@ public abstract class AbsMainListChildViewHolder extends AbsMainViewHolder imple public void onSuccess(int code, String msg, String[] info) { if (code == 0 && info.length > 0) { LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); - RouteUtil.forwardLiveAudienceActivity(liveBean, 0, 0, 0); + new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal)); + } + + @Override + public void onCheckError(String contextError) { + + } + }); } else { MainActivity.forward(mContext, false); } @@ -359,7 +369,17 @@ public abstract class AbsMainListChildViewHolder extends AbsMainViewHolder imple if (code == 0 && info.length > 0) { LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); - RouteUtil.forwardLiveAudienceActivity(liveBean, 0, 0, 0); + new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal)); + } + + @Override + public void onCheckError(String contextError) { + + } + }); } else { MainActivity.forward(mContext, false); } diff --git a/main/src/main/java/com/yunbao/main/views/MainHomeCommunityViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainHomeCommunityViewHolder.java index f60c7ac90..8d3703f9e 100644 --- a/main/src/main/java/com/yunbao/main/views/MainHomeCommunityViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainHomeCommunityViewHolder.java @@ -235,7 +235,17 @@ public class MainHomeCommunityViewHolder extends AbsMainHomeChildViewHolder impl if (code == 0 && info.length > 0) { LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); - RouteUtil.forwardLiveAudienceActivity(liveBean, 0, 0, 0); + new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal)); + } + + @Override + public void onCheckError(String contextError) { + + } + }); } else { RouteUtil.forwardUserHome(mContext, String.valueOf(live_id), 0); diff --git a/main/src/main/java/com/yunbao/main/views/MainHomeLiveViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainHomeLiveViewHolder.java index ca0957320..f9ae99960 100644 --- a/main/src/main/java/com/yunbao/main/views/MainHomeLiveViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainHomeLiveViewHolder.java @@ -327,7 +327,17 @@ public class MainHomeLiveViewHolder extends AbsMainHomeChildViewHolder implement gotoRoomKey = null; } liveBean.setParams(gotoRoomKey); - RouteUtil.forwardLiveAudienceActivity(liveBean, 0, 0, 0); + new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal)); + } + + @Override + public void onCheckError(String contextError) { + + } + }); } else { intoIndex = 1; @@ -422,6 +432,11 @@ public class MainHomeLiveViewHolder extends AbsMainHomeChildViewHolder implement RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk)); } } + + @Override + public void onCheckError(String contextError) { + + } }); } else { diff --git a/main/src/main/java/com/yunbao/main/views/MainMessageViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainMessageViewHolder.java index 4fa6f9648..26e38cdb7 100644 --- a/main/src/main/java/com/yunbao/main/views/MainMessageViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainMessageViewHolder.java @@ -416,7 +416,17 @@ public class MainMessageViewHolder extends AbsMainViewHolder { public void onSuccess(int code, String msg, String[] info) { if (code == 0 && info.length > 0) { LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); - RouteUtil.forwardLiveAudienceActivity(liveBean, 0, 0, 0); + new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal)); + } + + @Override + public void onCheckError(String contextError) { + + } + }); } else { RouteUtil.forwardUserHome(mContext, event.getLiveuid(), 0); diff --git a/main/src/main/java/com/yunbao/main/views/UserHomeViewHolder2.java b/main/src/main/java/com/yunbao/main/views/UserHomeViewHolder2.java index 66553bcb2..05dde04f2 100644 --- a/main/src/main/java/com/yunbao/main/views/UserHomeViewHolder2.java +++ b/main/src/main/java/com/yunbao/main/views/UserHomeViewHolder2.java @@ -785,6 +785,11 @@ public class UserHomeViewHolder2 extends AbsLivePageViewHolder implements LiveSh RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk)); } } + + @Override + public void onCheckError(String contextError) { + + } }); } }