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 b55f3cc7d..006034105 100644 --- a/live/src/main/java/com/yunbao/live/activity/PDLIiveChatActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/PDLIiveChatActivity.java @@ -17,6 +17,7 @@ import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.alibaba.fastjson.JSON; +import com.yunbao.common.bean.LiveBean; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.imrongcloud.MessageIMManager; @@ -25,8 +26,6 @@ import com.yunbao.common.utils.RouteUtil; import com.yunbao.live.R; import com.yunbao.live.adapter.SystemChatMessageAdapter; import com.yunbao.live.bean.ImUserBean; -import com.yunbao.common.bean.LiveBean; -import com.yunbao.live.event.LiveRoomChangeEvent; import com.yunbao.live.event.RecommendLiveRoomEvent; import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; @@ -196,14 +195,12 @@ 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); - LiveRoomCheckLivePresenter mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, (liveBean1, liveType, liveTypeVal, liveSdk) -> { - if (liveBean1 == 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(liveTypeVal), Integer.parseInt(liveSdk)); } - EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, liveTypeVal)); - finish(); }); - mCheckLivePresenter.checkLive(liveBean); } else { RouteUtil.forwardUserHome(mContext, event.getLiveuid(), 0); } 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 25a5b4bef..e7ccdeaed 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveGameDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveGameDialogFragment.java @@ -43,11 +43,9 @@ import com.yunbao.live.R; import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveAudienceActivity; import com.yunbao.live.activity.LiveRyAnchorActivity; -import com.yunbao.live.event.LiveRoomChangeEvent; import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; -import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; @@ -289,8 +287,6 @@ public class LiveGameDialogFragment extends AbsDialogFragment { } - private LiveRoomCheckLivePresenter mCheckLivePresenter; - private void gotoLive(final String live_id) { if (!TextUtils.equals(roomId, live_id)) { LiveHttpUtil.getLiveInfo(live_id, new HttpCallback() { @@ -298,20 +294,12 @@ 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); - if (mCheckLivePresenter == null) { - mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() { - @Override - public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) { - if (liveBean == null) { - return; - } - dismiss(); - EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, liveTypeVal)); - - } - }); - } - mCheckLivePresenter.checkLive(liveBean); + 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(liveTypeVal), Integer.parseInt(liveSdk)); + } + }); } else { RouteUtil.forwardUserHome(mContext, live_id, 0); } @@ -364,7 +352,7 @@ public class LiveGameDialogFragment extends AbsDialogFragment { if (event.getData() != null && !event.getData().isEmpty()) { onTrickerySendGiftInto(new JsWishBean(event.getData())); } - } else if (TextUtils.equals(event.getMethod(), "androidMethodClickUser")) { + } else if (TextUtils.equals(event.getMethod(), "androidMethodClickUser")) { if (!(mContext instanceof LiveRyAnchorActivity)) { //点击用户头像 if (!TextUtils.isEmpty(event.getUserId()) && !TextUtils.isEmpty(event.getLiveId())) { 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 6d97e8115..12a444026 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveHDDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveHDDialogFragment.java @@ -226,7 +226,6 @@ public class LiveHDDialogFragment extends AbsDialogFragment { } - private LiveRoomCheckLivePresenter mCheckLivePresenter; private void gotoLive(final String live_id) { if (!TextUtils.equals(roomId, live_id)) { @@ -235,24 +234,12 @@ public class LiveHDDialogFragment 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); - if (mCheckLivePresenter == null) { - mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() { - @Override - public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) { - if (liveBean == null) { - return; - } - dismiss(); - if(MicStatusManager.getInstance().isMic()){ - MicStatusManager.getInstance().showDownMicDialog(mContext); - return; - } - EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, liveTypeVal)); - - } - }); - } - mCheckLivePresenter.checkLive(liveBean); + 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(liveTypeVal), Integer.parseInt(liveSdk)); + } + }); } else { RouteUtil.forwardUserHome(mContext, live_id, 0); } 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 f979a9dd7..2d38f32c7 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveOldUserDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveOldUserDialogFragment.java @@ -137,7 +137,6 @@ public class LiveOldUserDialogFragment extends AbsDialogFragment implements View return true; } - private LiveRoomCheckLivePresenter mCheckLivePresenter; private void gotoLive(String live_id) { DialogUitl.showSimpleDialog(mContext, "是否確認前往對方直播間?", new DialogUitl.SimpleCallback() { @@ -185,26 +184,12 @@ 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); - - if (mCheckLivePresenter == null) { - mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() { - @Override - public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) { - if (liveBean == null) { - return; - } - LiveRoomViewHolder.mHandler.removeCallbacksAndMessages(null); -// if (mFromLiveRoom) { -// ((UserHomeActivity) mContext).onBackPressed(); - dismiss(); - EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, liveTypeVal)); -// } else { -// LiveAudienceActivity.forward(mContext, liveBean, liveType, liveTypeVal, "", 0, liveSdk); -// } - } - }); - } - mCheckLivePresenter.checkLive(liveBean); + 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(liveTypeVal), Integer.parseInt(liveSdk)); + } + }); } } }); 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 d6ae88580..67084361e 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java @@ -153,7 +153,6 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On return true; } - private LiveRoomCheckLivePresenter mCheckLivePresenter; @Override @@ -614,21 +613,12 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On public void onSuccess(int code, String msg, String[] info) { if (code == 0 && info.length > 0) { LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); - - if (mCheckLivePresenter == null) { - mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() { - @Override - public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) { - if (liveBean == null) { - return; - } - LiveRoomViewHolder.mHandler.removeCallbacksAndMessages(null); - dismiss(); - EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, liveTypeVal)); - } - }); - } - mCheckLivePresenter.checkLive(liveBean); + 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(liveTypeVal), Integer.parseInt(liveSdk)); + } + }); } } }); diff --git a/live/src/main/java/com/yunbao/live/dialog/SidebarLiveAudience.java b/live/src/main/java/com/yunbao/live/dialog/SidebarLiveAudience.java index 5ad1c1504..592ab829a 100644 --- a/live/src/main/java/com/yunbao/live/dialog/SidebarLiveAudience.java +++ b/live/src/main/java/com/yunbao/live/dialog/SidebarLiveAudience.java @@ -74,42 +74,7 @@ public class SidebarLiveAudience extends AbsDialogFragment { } - /** - * 前往直播间 - */ - private void gotoLive(final String liveId) { - LiveHttpUtil.getLiveInfo(liveId, new HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - if (code == 0 && info.length > 0) { - LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); - LiveRoomCheckLivePresenter mCheckLivePresenter = new LiveRoomCheckLivePresenter(getActivity(), (liveBean1, liveType, liveTypeVal, liveSdk) -> { - if (liveBean1 == null) { - return; - } - if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_REQUEST) { - Bus.get().post(new LiveAudienceEvent() - .setType(LiveAudienceEvent.LiveAudienceType.LIAN_MAI) - .setMicIng(1) - .setBean(liveBean).setLiveType(liveType).setLiveTypeVal(liveTypeVal)); - } else if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_OPEN) { - Bus.get().post(new LiveAudienceEvent() - .setType(LiveAudienceEvent.LiveAudienceType.LIAN_MAI) - .setMicIng(2) - .setBean(liveBean).setLiveType(liveType).setLiveTypeVal(liveTypeVal)); - } else { - EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, liveTypeVal)); - } - }); - mCheckLivePresenter.checkLive(liveBean); - - } else { - RouteUtil.forwardUserHome(getActivity(), liveId, 0); - } - } - }); - } @Override public void onDismiss(DialogInterface dialog) { 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 d7e3ac087..cee00ed14 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java @@ -47,10 +47,10 @@ import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.GiftCacheUtil; import com.yunbao.common.utils.HtmlTagHandler; import com.yunbao.common.utils.L; +import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.live.R; -import com.yunbao.live.activity.LiveAudienceActivity; import com.yunbao.live.bean.LiveGiftPrizePoolWinBean; import com.yunbao.live.bean.LiveLuckGiftWinBean; import com.yunbao.live.bean.LiveReceiveGiftBean; @@ -374,19 +374,12 @@ public class LiveGiftAnimPresenter { if (code == 0 && info.length > 0) { LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); - if (mCheckLivePresenter == null) { - mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() { - @Override - public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) { - if (liveBean == null) { - return; - } - ((LiveAudienceActivity) mContext).onBackPressed(); - LiveAudienceActivity.forward(mContext, liveBean, liveType, liveTypeVal, "", 0, liveSdk); - } - }); - } - mCheckLivePresenter.checkLive(liveBean); + 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(liveTypeVal), Integer.parseInt(liveSdk)); + } + }); } } }); 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 298edf6ed..0c7788d2b 100644 --- a/live/src/main/java/com/yunbao/live/views/SidebarViewHoler.java +++ b/live/src/main/java/com/yunbao/live/views/SidebarViewHoler.java @@ -19,7 +19,6 @@ import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.views.SlideInBannerViewHolder; import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.live.R; -import com.yunbao.live.activity.LiveAudienceActivity; import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; @@ -98,24 +97,25 @@ public class SidebarViewHoler extends RecyclerView.ViewHolder { public void onSuccess(int code, String msg, String[] info) { if (code == 0 && info.length > 0) { LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); - LiveRoomCheckLivePresenter mCheckLivePresenter = new LiveRoomCheckLivePresenter(itemView.getContext(), (liveBean1, liveType, liveTypeVal, liveSdk) -> { - if (liveBean1 == null) { - if (mShowLoadingDialog != null && mShowLoadingDialog.isShowing()) - mShowLoadingDialog.dismiss(); - return; - } - Map map = null; - if (type == 2) { - map = new HashMap<>(); - map.put("OPEN", "NEWUSER"); - } - LiveAudienceActivity.forward(itemView.getContext(), liveBean1, liveType, liveTypeVal, "", map, 0, liveSdk); + if (liveBean == null) { if (mShowLoadingDialog != null && mShowLoadingDialog.isShowing()) mShowLoadingDialog.dismiss(); - ((Activity) itemView.getContext()).finish(); + return; + } + new LiveRoomCheckLivePresenter(mBanner.getContext(), liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + Map map = null; + if (type == 2) { + map = new HashMap<>(); + map.put("OPEN", "NEWUSER"); + } + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk)); + if (mShowLoadingDialog != null && mShowLoadingDialog.isShowing()) + mShowLoadingDialog.dismiss(); + ((Activity) itemView.getContext()).finish(); + } }); - mCheckLivePresenter.checkLive(liveBean); - } else { if (mShowLoadingDialog != null && mShowLoadingDialog.isShowing()) mShowLoadingDialog.dismiss(); 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 0940dc8b3..ad2222bdf 100644 --- a/main/src/main/java/com/yunbao/main/activity/EntryActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/EntryActivity.java @@ -87,7 +87,6 @@ import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; -import com.yunbao.live.activity.LiveAudienceActivity; import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; import com.yunbao.main.R; @@ -674,7 +673,6 @@ public class EntryActivity extends AppCompatActivity { }); } - private LiveRoomCheckLivePresenter mCheckLivePresenter; private void gotoLive(final String live_id) { LiveHttpUtil.getLiveInfo(live_id, new HttpCallback() { @@ -682,20 +680,17 @@ public class EntryActivity extends AppCompatActivity { public void onSuccess(int code, String msg, String[] info) { if (code == 0 && info.length > 0) { LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); - - if (mCheckLivePresenter == null) { - mCheckLivePresenter = new LiveRoomCheckLivePresenter(EntryActivity.this, new LiveRoomCheckLivePresenter.ActionListener() { - @Override - public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) { - if (liveBean == null) { - return; - } - LiveAudienceActivity.forward(EntryActivity.this, liveBean, liveType, liveTypeVal, "", 0, liveSdk); - NoviceInstructorManager.get(activity).setFrist(false); - } - }); + if (liveBean == null) { + return; } - mCheckLivePresenter.checkLive(liveBean); + 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(liveTypeVal), Integer.parseInt(liveSdk)); + NoviceInstructorManager.get(activity).setFrist(false); + } + }); + } else { MainActivity.forward(EntryActivity.this, false); } 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 fd0a94823..037722d54 100644 --- a/main/src/main/java/com/yunbao/main/activity/LoginActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/LoginActivity.java @@ -46,9 +46,9 @@ import com.yunbao.common.interfaces.CommonCallback; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.NoviceInstructorManager; import com.yunbao.common.manager.imrongcloud.RongcloudIMManager; +import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; -import com.yunbao.live.activity.LiveAudienceActivity; import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; import com.yunbao.main.R; @@ -230,7 +230,6 @@ public class LoginActivity extends AbsActivity { WebViewActivity.forward(mContext, HtmlConfig.LOGIN_PRIVCAY); } - private LiveRoomCheckLivePresenter mCheckLivePresenter; private void gotoLive(final String live_id) { LiveHttpUtil.getLiveInfo(live_id, new HttpCallback() { @@ -238,20 +237,17 @@ public class LoginActivity 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); - - if (mCheckLivePresenter == null) { - mCheckLivePresenter = new LiveRoomCheckLivePresenter(LoginActivity.this, new LiveRoomCheckLivePresenter.ActionListener() { - @Override - public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) { - if (liveBean == null) { - return; - } - LiveAudienceActivity.forward(LoginActivity.this, liveBean, liveType, liveTypeVal, "", 0, liveSdk); - NoviceInstructorManager.get(activity).setFrist(false); - } - }); + if (liveBean == null) { + return; } - mCheckLivePresenter.checkLive(liveBean); + 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(liveTypeVal), Integer.parseInt(liveSdk)); + NoviceInstructorManager.get(activity).setFrist(false); + } + }); + } else { MainActivity.forward(LoginActivity.this, false); } 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 20d5aecd4..7c2d84a3a 100644 --- a/main/src/main/java/com/yunbao/main/activity/MainActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MainActivity.java @@ -237,19 +237,12 @@ 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); - - LiveRoomCheckLivePresenter mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() { + new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { @Override - public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) { - if (liveBean == null) { - return; - } - LiveAudienceActivity.forward(mContext, liveBean, liveType, liveTypeVal, "", 0, liveSdk); - + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk)); } }); - - mCheckLivePresenter.checkLive(liveBean); } else { ToastUtil.show("直播已结束"); } @@ -420,20 +413,12 @@ 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); - - - LiveRoomCheckLivePresenter mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() { + new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { @Override - public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) { - if (liveBean == null) { - return; - } - LiveAudienceActivity.forward(mContext, liveBean, liveType, liveTypeVal, "", 0, liveSdk); - + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk)); } }); - - mCheckLivePresenter.checkLive(liveBean); } else { RouteUtil.forwardUserHome(mContext, Uid, 0); } 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 3a1a048fa..fdb3e21cf 100644 --- a/main/src/main/java/com/yunbao/main/activity/MyWebViewActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MyWebViewActivity.java @@ -23,6 +23,7 @@ import android.widget.LinearLayout; import android.widget.ProgressBar; import androidx.annotation.RequiresApi; + import com.alibaba.android.arouter.facade.annotation.Route; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; @@ -50,7 +51,6 @@ import com.yunbao.common.utils.ProcessImageUtil; import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; -import com.yunbao.live.activity.LiveAudienceActivity; import com.yunbao.live.event.LiveRoomChangeEvent; import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; @@ -247,26 +247,24 @@ public class MyWebViewActivity extends AbsActivity { if (code == 0 && info.length > 0) { LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); - if (mCheckLivePresenter == null) { - mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() { - @Override - public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) { - if (liveBean == null) { - return; - } - if (LiveRoomViewHolder.mHandler != null) { - LiveRoomViewHolder.mHandler.removeCallbacksAndMessages(null); - } - if (!"".equals(Constants.mStream)) { - finish(); - EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, liveTypeVal)); - } else { - LiveAudienceActivity.forward(mContext, liveBean, liveType, liveTypeVal, "", 0, liveSdk); - } - } - }); + if (liveBean == null) { + return; } - mCheckLivePresenter.checkLive(liveBean); + 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 (LiveRoomViewHolder.mHandler != null) { + LiveRoomViewHolder.mHandler.removeCallbacksAndMessages(null); + } + if (!"".endsWith(Constants.mStream)) { + finish(); + EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal))); + } else { + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk)); + } + } + }); } } }); 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 f3d0539df..bc6ff64b0 100644 --- a/main/src/main/java/com/yunbao/main/activity/MyWebViewActivity2.java +++ b/main/src/main/java/com/yunbao/main/activity/MyWebViewActivity2.java @@ -38,7 +38,6 @@ import com.yunbao.common.utils.L; import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; -import com.yunbao.live.activity.LiveAudienceActivity; import com.yunbao.live.activity.SystemMessageActivity; import com.yunbao.live.event.LiveRoomChangeEvent; import com.yunbao.live.http.LiveHttpUtil; @@ -225,27 +224,24 @@ public class MyWebViewActivity2 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); - - if (mCheckLivePresenter == null) { - mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() { - @Override - public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) { - if (liveBean == null) { - return; - } - if (LiveRoomViewHolder.mHandler != null) { - LiveRoomViewHolder.mHandler.removeCallbacksAndMessages(null); - } - if (!"".endsWith(Constants.mStream)) { - finish(); - EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, liveTypeVal)); - } else { - LiveAudienceActivity.forward(mContext, liveBean, liveType, liveTypeVal, "", 0, liveSdk); - } - } - }); + if (liveBean == null) { + return; } - mCheckLivePresenter.checkLive(liveBean); + 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 (LiveRoomViewHolder.mHandler != null) { + LiveRoomViewHolder.mHandler.removeCallbacksAndMessages(null); + } + if (!"".endsWith(Constants.mStream)) { + finish(); + EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal))); + } else { + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk)); + } + } + }); } } }); 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 d338a1b8d..ad08ab34e 100644 --- a/main/src/main/java/com/yunbao/main/activity/RegisterActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/RegisterActivity.java @@ -20,6 +20,7 @@ import android.widget.EditText; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; + import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.blankj.utilcode.util.DeviceUtils; @@ -45,9 +46,9 @@ import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.NoviceInstructorManager; import com.yunbao.common.manager.imrongcloud.RongcloudIMManager; import com.yunbao.common.utils.DialogUitl; +import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; -import com.yunbao.live.activity.LiveAudienceActivity; import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; import com.yunbao.main.R; @@ -492,7 +493,6 @@ public class RegisterActivity extends AbsActivity { startActivity(intent); } - private LiveRoomCheckLivePresenter mCheckLivePresenter; private void gotoLive(final String live_id) { LiveHttpUtil.getLiveInfo(live_id, new HttpCallback() { @@ -500,20 +500,16 @@ public class RegisterActivity 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); - - if (mCheckLivePresenter == null) { - mCheckLivePresenter = new LiveRoomCheckLivePresenter(RegisterActivity.this, new LiveRoomCheckLivePresenter.ActionListener() { - @Override - public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) { - if (liveBean == null) { - return; - } - LiveAudienceActivity.forward(RegisterActivity.this, liveBean, liveType, liveTypeVal, "", 0, liveSdk); - NoviceInstructorManager.get(activity).setFrist(false); - } - }); + if (liveBean == null) { + return; } - mCheckLivePresenter.checkLive(liveBean); + 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(liveTypeVal), Integer.parseInt(liveSdk)); + NoviceInstructorManager.get(mContext).setFrist(false); + } + }); } else { MainActivity.forward(RegisterActivity.this, false); } 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 396c397d8..9734ad6fe 100644 --- a/main/src/main/java/com/yunbao/main/activity/WeekWebViewActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/WeekWebViewActivity.java @@ -36,7 +36,6 @@ import com.yunbao.common.utils.L; import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; -import com.yunbao.live.activity.LiveAudienceActivity; import com.yunbao.live.activity.WebViewActivityMedal; import com.yunbao.live.dialog.LiveUserDialogFragment; import com.yunbao.live.http.LiveHttpUtil; @@ -144,29 +143,21 @@ public class WeekWebViewActivity extends AbsActivity { } - private LiveRoomCheckLivePresenter mCheckLivePresenter; - private void gotoLive(final String live_id) { LiveHttpUtil.getLiveInfo(live_id, new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { if (code == 0 && info.length > 0) { LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); - - if (mCheckLivePresenter == null) { - mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() { - @Override - public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) { - if (liveBean == null) { - return; - } - - LiveAudienceActivity.forward(mContext, liveBean, liveType, liveTypeVal, "", 0, liveSdk); - - } - }); + if (liveBean == null) { + return; } - mCheckLivePresenter.checkLive(liveBean); + 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(liveTypeVal), Integer.parseInt(liveSdk)); + } + }); } 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 cec95d4d2..0a3957c48 100644 --- a/main/src/main/java/com/yunbao/main/adapter/SearchAdapter.java +++ b/main/src/main/java/com/yunbao/main/adapter/SearchAdapter.java @@ -1,19 +1,21 @@ package com.yunbao.main.adapter; import android.content.Context; -import androidx.annotation.NonNull; -import androidx.recyclerview.widget.RecyclerView; import android.text.TextUtils; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + import com.alibaba.fastjson.JSON; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; import com.yunbao.common.adapter.RefreshAdapter; import com.yunbao.common.bean.LevelBean; +import com.yunbao.common.bean.LiveBean; import com.yunbao.common.custom.MyRadioButton; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.CommonHttpUtil; @@ -21,8 +23,6 @@ import com.yunbao.common.http.HttpCallback; import com.yunbao.common.utils.CommonIconUtil; import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.WordUtil; -import com.yunbao.live.activity.LiveAudienceActivity; -import com.yunbao.common.bean.LiveBean; import com.yunbao.live.bean.SearchUserBean; import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; @@ -188,7 +188,6 @@ public class SearchAdapter extends RefreshAdapter { } - private LiveRoomCheckLivePresenter mCheckLivePresenter; private void gotoLive(final String live_id) { LiveHttpUtil.getLiveInfo(live_id, new HttpCallback() { @@ -196,21 +195,16 @@ public class SearchAdapter extends RefreshAdapter { public void onSuccess(int code, String msg, String[] info) { if (code == 0 && info.length > 0) { LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); - - if (mCheckLivePresenter == null) { - mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() { - @Override - public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) { - if (liveBean == null) { - return; - } - - LiveAudienceActivity.forward(mContext, liveBean, liveType, liveTypeVal, "", 0, liveSdk); - - } - }); + if (liveBean == null) { + return; } - mCheckLivePresenter.checkLive(liveBean); + + 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(liveTypeVal), Integer.parseInt(liveSdk)); + } + }); } 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 cae570931..2cccd7901 100644 --- a/main/src/main/java/com/yunbao/main/dialog/OneLoginDialog.java +++ b/main/src/main/java/com/yunbao/main/dialog/OneLoginDialog.java @@ -12,6 +12,7 @@ import android.widget.Button; import android.widget.TextView; import androidx.annotation.Nullable; + import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.makeramen.roundedimageview.RoundedImageView; @@ -23,10 +24,10 @@ import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpClient; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.NoviceInstructorManager; +import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; -import com.yunbao.live.activity.LiveAudienceActivity; import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; import com.yunbao.main.R; @@ -138,28 +139,22 @@ public class OneLoginDialog extends AbsDialogFragment { } - private LiveRoomCheckLivePresenter mCheckLivePresenter; - private void gotoLive(final String live_id) { LiveHttpUtil.getLiveInfo(live_id, new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { if (code == 0 && info.length > 0) { LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); - - if (mCheckLivePresenter == null) { - mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() { - @Override - public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) { - if (liveBean == null) { - return; - } - LiveAudienceActivity.forward(mContext, liveBean, liveType, liveTypeVal, "", 0, liveSdk); - NoviceInstructorManager.get(mContext).setFrist(false); - } - }); + if (liveBean == null) { + return; } - mCheckLivePresenter.checkLive(liveBean); + 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(liveTypeVal), Integer.parseInt(liveSdk)); + NoviceInstructorManager.get(mContext).setFrist(false); + } + }); } 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 60a4a2050..67bd50923 100644 --- a/main/src/main/java/com/yunbao/main/views/AbsMainListChildViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/AbsMainListChildViewHolder.java @@ -139,32 +139,21 @@ public abstract class AbsMainListChildViewHolder extends AbsMainViewHolder imple } } - private LiveRoomCheckLivePresenter mCheckLivePresenter; @Override public void onItemClick(ListBean bean, int position) { if (bean.getIslive() == 1) { - - LiveHttpUtil.getLiveInfo(bean.getUid(), new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { if (code == 0 && info.length > 0) { LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); - - if (mCheckLivePresenter == null) { - mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() { - @Override - public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) { - if (liveBean == null) { - return; - } - LiveAudienceActivity.forward(mContext, liveBean, liveType, liveTypeVal, "", 0, liveSdk); - NoviceInstructorManager.get(mContext).setFrist(false); - } - }); - } - mCheckLivePresenter.checkLive(liveBean); + 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(liveTypeVal), Integer.parseInt(liveSdk)); + } + }); } else { MainActivity.forward(mContext, false); } @@ -367,6 +356,7 @@ public abstract class AbsMainListChildViewHolder extends AbsMainViewHolder imple if (bean.isHide()) { ToastUtil.show(R.string.can_not_go); } else { + if (bean.getIslive() == 1) { LiveHttpUtil.getLiveInfo(bean.getUid(), new HttpCallback() { @Override @@ -374,19 +364,12 @@ public abstract class AbsMainListChildViewHolder extends AbsMainViewHolder imple if (code == 0 && info.length > 0) { LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); - if (mCheckLivePresenter == null) { - mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() { - @Override - public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) { - if (liveBean == null) { - return; - } - LiveAudienceActivity.forward(mContext, liveBean, liveType, liveTypeVal, "", 0, liveSdk); - NoviceInstructorManager.get(mContext).setFrist(false); - } - }); - } - mCheckLivePresenter.checkLive(liveBean); + 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(liveTypeVal), Integer.parseInt(liveSdk)); + } + }); } else { MainActivity.forward(mContext, false); } 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 570a00ddd..eadb8fe0c 100644 --- a/main/src/main/java/com/yunbao/main/views/MainHomeLiveViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainHomeLiveViewHolder.java @@ -26,6 +26,7 @@ import com.yunbao.common.adapter.RefreshAdapter; import com.yunbao.common.bean.AnchorRecommendModel; import com.yunbao.common.bean.BannerBean; import com.yunbao.common.bean.ConfigBean; +import com.yunbao.common.bean.LiveBean; import com.yunbao.common.bean.LiveClassBean; import com.yunbao.common.bean.WeekListBean; import com.yunbao.common.custom.CommonRefreshView; @@ -36,8 +37,6 @@ import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.views.CustomViewHolder; -import com.yunbao.live.activity.LiveAudienceActivity; -import com.yunbao.common.bean.LiveBean; import com.yunbao.live.event.LiveRoomChangeEvent; import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; @@ -312,7 +311,6 @@ public class MainHomeLiveViewHolder extends AbsMainHomeChildViewHolder implement } - private LiveRoomCheckLivePresenter mCheckLivePresenter; private void gotoLive(final String live_id) { LiveHttpUtil.getLiveInfo(live_id, new HttpCallback() { @@ -320,24 +318,20 @@ public class MainHomeLiveViewHolder extends AbsMainHomeChildViewHolder implement public void onSuccess(int code, String msg, String[] info) { if (code == 0 && info.length > 0) { LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); - - if (mCheckLivePresenter == null) { - mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() { - @Override - public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) { - if (liveBean == null) { - return; - } - intoIndex = 1; - if (gotoRoomKey != null && gotoRoomKey.isEmpty()) { - gotoRoomKey = null; - } - LiveAudienceActivity.forward(mContext, liveBean, liveType, liveTypeVal, "", gotoRoomKey, 0, liveSdk); - - } - }); + if (liveBean == null) { + return; } - mCheckLivePresenter.checkLive(liveBean); + intoIndex = 1; + if (gotoRoomKey != null && gotoRoomKey.isEmpty()) { + gotoRoomKey = null; + } + 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(liveTypeVal), Integer.parseInt(liveSdk)); + } + }); + } else { intoIndex = 1; RouteUtil.forwardUserHome(mContext, live_id, 0); @@ -411,25 +405,24 @@ public class MainHomeLiveViewHolder extends AbsMainHomeChildViewHolder implement if (code == 0 && info.length > 0) { LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); - if (mCheckLivePresenter == null) { - mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() { - @Override - public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) { - if (liveBean == null) { - return; - } - if (LiveRoomViewHolder.mHandler != null) { - LiveRoomViewHolder.mHandler.removeCallbacksAndMessages(null); - } - if (!"".endsWith(Constants.mStream)) { - EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, liveTypeVal)); - } else { - LiveAudienceActivity.forward(mContext, liveBean, liveType, liveTypeVal, "", 0, liveSdk); - } - } - }); + if (liveBean == null) { + return; } - mCheckLivePresenter.checkLive(liveBean); + 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 (LiveRoomViewHolder.mHandler != null) { + LiveRoomViewHolder.mHandler.removeCallbacksAndMessages(null); + } + if (!"".endsWith(Constants.mStream)) { + EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal))); + } else { + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk)); + } + } + }); + } else { ToastUtil.show(msg); } 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 fa972ccab..dc240690a 100644 --- a/main/src/main/java/com/yunbao/main/views/MainMessageViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainMessageViewHolder.java @@ -416,13 +416,12 @@ 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); - LiveRoomCheckLivePresenter mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, (liveBean1, liveType, liveTypeVal, liveSdk) -> { - if (liveBean1 == 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(liveTypeVal), Integer.parseInt(liveSdk)); } - LiveAudienceActivity.forward(mContext, liveBean1, liveType, liveTypeVal, "", 0, liveSdk); }); - mCheckLivePresenter.checkLive(liveBean); } 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 2bbca4b31..67d4ed4ec 100644 --- a/main/src/main/java/com/yunbao/main/views/UserHomeViewHolder2.java +++ b/main/src/main/java/com/yunbao/main/views/UserHomeViewHolder2.java @@ -7,8 +7,6 @@ import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.os.Build; -import androidx.core.content.ContextCompat; -import androidx.viewpager.widget.ViewPager; import android.text.TextUtils; import android.util.Log; import android.view.KeyEvent; @@ -21,6 +19,9 @@ import android.widget.LinearLayout; import android.widget.PopupWindow; import android.widget.TextView; +import androidx.core.content.ContextCompat; +import androidx.viewpager.widget.ViewPager; + import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.opensource.svgaplayer.SVGADrawable; @@ -33,6 +34,7 @@ import com.yunbao.common.activity.AbsActivity; import com.yunbao.common.adapter.ViewPagerAdapter; import com.yunbao.common.bean.ConfigBean; import com.yunbao.common.bean.LevelBean; +import com.yunbao.common.bean.LiveBean; import com.yunbao.common.event.FollowEvent; import com.yunbao.common.event.UpdateFieldEvent; import com.yunbao.common.glide.ImgLoader; @@ -42,13 +44,12 @@ import com.yunbao.common.http.HttpCallback; import com.yunbao.common.utils.CommonIconUtil; import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.DpUtil; +import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.SVGAViewUtils; import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; -import com.yunbao.live.activity.LiveAudienceActivity; import com.yunbao.live.activity.LiveReportActivity; -import com.yunbao.common.bean.LiveBean; import com.yunbao.live.bean.SearchUserBean; import com.yunbao.live.dialog.LiveShareDialogFragment; import com.yunbao.live.event.LiveRoomChangeEvent; @@ -59,7 +60,6 @@ import com.yunbao.live.presenter.UserHomeSharePresenter; import com.yunbao.live.views.AbsLivePageViewHolder; import com.yunbao.live.views.AbsUserHomeViewHolder; import com.yunbao.live.views.LiveRecordViewHolder; -import com.yunbao.live.views.LiveRoomViewHolder; import com.yunbao.live.views.ShowBigPhoto; import com.yunbao.main.R; import com.yunbao.main.activity.EditProfileActivity; @@ -766,27 +766,21 @@ public class UserHomeViewHolder2 extends AbsLivePageViewHolder implements LiveSh public void onSuccess(int code, String msg, String[] info) { if (code == 0 && info.length > 0) { LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); - - if (mCheckLivePresenter == null) { - mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() { - @Override - public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) { - if (liveBean == null) { - return; - } - if (LiveRoomViewHolder.mHandler != null) { - LiveRoomViewHolder.mHandler.removeCallbacksAndMessages(null); - } - if (mFromLiveRoom) { - ((UserHomeActivity) mContext).onBackPressed(); - EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, liveTypeVal)); - } else { - LiveAudienceActivity.forward(mContext, liveBean, liveType, liveTypeVal, "", 0, liveSdk); - } - } - }); + if (liveBean == null) { + return; } - mCheckLivePresenter.checkLive(liveBean); + 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 (mFromLiveRoom) { + ((UserHomeActivity) mContext).onBackPressed(); + EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal))); + } else { + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk)); + } + } + }); } } });