合并接口第四次上传

This commit is contained in:
18401019693 2022-11-26 11:37:03 +08:00
parent 082c9d7d12
commit 03a4054ee5
21 changed files with 225 additions and 405 deletions

View File

@ -17,6 +17,7 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.manager.imrongcloud.MessageIMManager; 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.R;
import com.yunbao.live.adapter.SystemChatMessageAdapter; import com.yunbao.live.adapter.SystemChatMessageAdapter;
import com.yunbao.live.bean.ImUserBean; 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.event.RecommendLiveRoomEvent;
import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.http.LiveHttpUtil;
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
@ -196,14 +195,12 @@ public class PDLIiveChatActivity extends FragmentActivity {
public void onSuccess(int code, String msg, String[] info) { public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) { if (code == 0 && info.length > 0) {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
LiveRoomCheckLivePresenter mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, (liveBean1, liveType, liveTypeVal, liveSdk) -> { new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
if (liveBean1 == null) { @Override
return; 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 { } else {
RouteUtil.forwardUserHome(mContext, event.getLiveuid(), 0); RouteUtil.forwardUserHome(mContext, event.getLiveuid(), 0);
} }

View File

@ -43,11 +43,9 @@ import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.activity.LiveAudienceActivity; import com.yunbao.live.activity.LiveAudienceActivity;
import com.yunbao.live.activity.LiveRyAnchorActivity; import com.yunbao.live.activity.LiveRyAnchorActivity;
import com.yunbao.live.event.LiveRoomChangeEvent;
import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.http.LiveHttpUtil;
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode; import org.greenrobot.eventbus.ThreadMode;
@ -289,8 +287,6 @@ public class LiveGameDialogFragment extends AbsDialogFragment {
} }
private LiveRoomCheckLivePresenter mCheckLivePresenter;
private void gotoLive(final String live_id) { private void gotoLive(final String live_id) {
if (!TextUtils.equals(roomId, live_id)) { if (!TextUtils.equals(roomId, live_id)) {
LiveHttpUtil.getLiveInfo(live_id, new HttpCallback() { LiveHttpUtil.getLiveInfo(live_id, new HttpCallback() {
@ -298,20 +294,12 @@ public class LiveGameDialogFragment extends AbsDialogFragment {
public void onSuccess(int code, String msg, String[] info) { public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) { if (code == 0 && info.length > 0) {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
if (mCheckLivePresenter == null) { new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() {
@Override @Override
public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) { public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
if (liveBean == null) { RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk));
return;
}
dismiss();
EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, liveTypeVal));
} }
}); });
}
mCheckLivePresenter.checkLive(liveBean);
} else { } else {
RouteUtil.forwardUserHome(mContext, live_id, 0); RouteUtil.forwardUserHome(mContext, live_id, 0);
} }

View File

@ -226,7 +226,6 @@ public class LiveHDDialogFragment extends AbsDialogFragment {
} }
private LiveRoomCheckLivePresenter mCheckLivePresenter;
private void gotoLive(final String live_id) { private void gotoLive(final String live_id) {
if (!TextUtils.equals(roomId, 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) { public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) { if (code == 0 && info.length > 0) {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
if (mCheckLivePresenter == null) { new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() {
@Override @Override
public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) { public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
if (liveBean == null) { RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk));
return;
}
dismiss();
if(MicStatusManager.getInstance().isMic()){
MicStatusManager.getInstance().showDownMicDialog(mContext);
return;
}
EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, liveTypeVal));
} }
}); });
}
mCheckLivePresenter.checkLive(liveBean);
} else { } else {
RouteUtil.forwardUserHome(mContext, live_id, 0); RouteUtil.forwardUserHome(mContext, live_id, 0);
} }

View File

@ -137,7 +137,6 @@ public class LiveOldUserDialogFragment extends AbsDialogFragment implements View
return true; return true;
} }
private LiveRoomCheckLivePresenter mCheckLivePresenter;
private void gotoLive(String live_id) { private void gotoLive(String live_id) {
DialogUitl.showSimpleDialog(mContext, "是否確認前往對方直播間?", new DialogUitl.SimpleCallback() { DialogUitl.showSimpleDialog(mContext, "是否確認前往對方直播間?", new DialogUitl.SimpleCallback() {
@ -185,27 +184,13 @@ public class LiveOldUserDialogFragment extends AbsDialogFragment implements View
public void onSuccess(int code, String msg, String[] info) { public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) { if (code == 0 && info.length > 0) {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
if (mCheckLivePresenter == null) {
mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() {
@Override @Override
public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) { public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
if (liveBean == null) { RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk));
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);
}
} }
}); });

View File

@ -153,7 +153,6 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
return true; return true;
} }
private LiveRoomCheckLivePresenter mCheckLivePresenter;
@Override @Override
@ -614,22 +613,13 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
public void onSuccess(int code, String msg, String[] info) { public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) { if (code == 0 && info.length > 0) {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
if (mCheckLivePresenter == null) {
mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() {
@Override @Override
public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) { public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
if (liveBean == null) { RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk));
return;
}
LiveRoomViewHolder.mHandler.removeCallbacksAndMessages(null);
dismiss();
EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, liveTypeVal));
} }
}); });
} }
mCheckLivePresenter.checkLive(liveBean);
}
} }
}); });

View File

@ -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 @Override
public void onDismiss(DialogInterface dialog) { public void onDismiss(DialogInterface dialog) {

View File

@ -47,10 +47,10 @@ import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.GiftCacheUtil; import com.yunbao.common.utils.GiftCacheUtil;
import com.yunbao.common.utils.HtmlTagHandler; import com.yunbao.common.utils.HtmlTagHandler;
import com.yunbao.common.utils.L; import com.yunbao.common.utils.L;
import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.activity.LiveAudienceActivity;
import com.yunbao.live.bean.LiveGiftPrizePoolWinBean; import com.yunbao.live.bean.LiveGiftPrizePoolWinBean;
import com.yunbao.live.bean.LiveLuckGiftWinBean; import com.yunbao.live.bean.LiveLuckGiftWinBean;
import com.yunbao.live.bean.LiveReceiveGiftBean; import com.yunbao.live.bean.LiveReceiveGiftBean;
@ -374,20 +374,13 @@ public class LiveGiftAnimPresenter {
if (code == 0 && info.length > 0) { if (code == 0 && info.length > 0) {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
if (mCheckLivePresenter == null) { new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() {
@Override @Override
public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) { public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
if (liveBean == null) { RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk));
return;
}
((LiveAudienceActivity) mContext).onBackPressed();
LiveAudienceActivity.forward(mContext, liveBean, liveType, liveTypeVal, "", 0, liveSdk);
} }
}); });
} }
mCheckLivePresenter.checkLive(liveBean);
}
} }
}); });
} }

View File

@ -19,7 +19,6 @@ import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.views.SlideInBannerViewHolder; import com.yunbao.common.views.SlideInBannerViewHolder;
import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.activity.LiveAudienceActivity;
import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.http.LiveHttpUtil;
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; 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) { public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) { if (code == 0 && info.length > 0) {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
LiveRoomCheckLivePresenter mCheckLivePresenter = new LiveRoomCheckLivePresenter(itemView.getContext(), (liveBean1, liveType, liveTypeVal, liveSdk) -> { if (liveBean == null) {
if (liveBean1 == null) {
if (mShowLoadingDialog != null && mShowLoadingDialog.isShowing()) if (mShowLoadingDialog != null && mShowLoadingDialog.isShowing())
mShowLoadingDialog.dismiss(); mShowLoadingDialog.dismiss();
return; 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<String, String> map = null; Map<String, String> map = null;
if (type == 2) { if (type == 2) {
map = new HashMap<>(); map = new HashMap<>();
map.put("OPEN", "NEWUSER"); map.put("OPEN", "NEWUSER");
} }
LiveAudienceActivity.forward(itemView.getContext(), liveBean1, liveType, liveTypeVal, "", map, 0, liveSdk); RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk));
if (mShowLoadingDialog != null && mShowLoadingDialog.isShowing()) if (mShowLoadingDialog != null && mShowLoadingDialog.isShowing())
mShowLoadingDialog.dismiss(); mShowLoadingDialog.dismiss();
((Activity) itemView.getContext()).finish(); ((Activity) itemView.getContext()).finish();
}
}); });
mCheckLivePresenter.checkLive(liveBean);
} else { } else {
if (mShowLoadingDialog != null && mShowLoadingDialog.isShowing()) if (mShowLoadingDialog != null && mShowLoadingDialog.isShowing())
mShowLoadingDialog.dismiss(); mShowLoadingDialog.dismiss();

View File

@ -87,7 +87,6 @@ import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.activity.LiveAudienceActivity;
import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.http.LiveHttpUtil;
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
import com.yunbao.main.R; import com.yunbao.main.R;
@ -674,7 +673,6 @@ public class EntryActivity extends AppCompatActivity {
}); });
} }
private LiveRoomCheckLivePresenter mCheckLivePresenter;
private void gotoLive(final String live_id) { private void gotoLive(final String live_id) {
LiveHttpUtil.getLiveInfo(live_id, new HttpCallback() { LiveHttpUtil.getLiveInfo(live_id, new HttpCallback() {
@ -682,20 +680,17 @@ public class EntryActivity extends AppCompatActivity {
public void onSuccess(int code, String msg, String[] info) { public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) { if (code == 0 && info.length > 0) {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); 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) { if (liveBean == null) {
return; return;
} }
LiveAudienceActivity.forward(EntryActivity.this, liveBean, liveType, liveTypeVal, "", 0, liveSdk); 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); NoviceInstructorManager.get(activity).setFrist(false);
} }
}); });
}
mCheckLivePresenter.checkLive(liveBean);
} else { } else {
MainActivity.forward(EntryActivity.this, false); MainActivity.forward(EntryActivity.this, false);
} }

View File

@ -46,9 +46,9 @@ import com.yunbao.common.interfaces.CommonCallback;
import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.manager.NoviceInstructorManager; import com.yunbao.common.manager.NoviceInstructorManager;
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager; import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.activity.LiveAudienceActivity;
import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.http.LiveHttpUtil;
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
import com.yunbao.main.R; import com.yunbao.main.R;
@ -230,7 +230,6 @@ public class LoginActivity extends AbsActivity {
WebViewActivity.forward(mContext, HtmlConfig.LOGIN_PRIVCAY); WebViewActivity.forward(mContext, HtmlConfig.LOGIN_PRIVCAY);
} }
private LiveRoomCheckLivePresenter mCheckLivePresenter;
private void gotoLive(final String live_id) { private void gotoLive(final String live_id) {
LiveHttpUtil.getLiveInfo(live_id, new HttpCallback() { LiveHttpUtil.getLiveInfo(live_id, new HttpCallback() {
@ -238,20 +237,17 @@ public class LoginActivity extends AbsActivity {
public void onSuccess(int code, String msg, String[] info) { public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) { if (code == 0 && info.length > 0) {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); 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) { if (liveBean == null) {
return; return;
} }
LiveAudienceActivity.forward(LoginActivity.this, liveBean, liveType, liveTypeVal, "", 0, liveSdk); 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); NoviceInstructorManager.get(activity).setFrist(false);
} }
}); });
}
mCheckLivePresenter.checkLive(liveBean);
} else { } else {
MainActivity.forward(LoginActivity.this, false); MainActivity.forward(LoginActivity.this, false);
} }

View File

@ -237,19 +237,12 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
public void onSuccess(int code, String msg, String[] info) { public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) { if (code == 0 && info.length > 0) {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
LiveRoomCheckLivePresenter mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() {
@Override @Override
public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) { public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
if (liveBean == null) { RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk));
return;
}
LiveAudienceActivity.forward(mContext, liveBean, liveType, liveTypeVal, "", 0, liveSdk);
} }
}); });
mCheckLivePresenter.checkLive(liveBean);
} else { } else {
ToastUtil.show("直播已结束"); ToastUtil.show("直播已结束");
} }
@ -420,20 +413,12 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
public void onSuccess(int code, String msg, String[] info) { public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) { if (code == 0 && info.length > 0) {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
LiveRoomCheckLivePresenter mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() {
@Override @Override
public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) { public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
if (liveBean == null) { RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk));
return;
}
LiveAudienceActivity.forward(mContext, liveBean, liveType, liveTypeVal, "", 0, liveSdk);
} }
}); });
mCheckLivePresenter.checkLive(liveBean);
} else { } else {
RouteUtil.forwardUserHome(mContext, Uid, 0); RouteUtil.forwardUserHome(mContext, Uid, 0);
} }

View File

@ -23,6 +23,7 @@ import android.widget.LinearLayout;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import androidx.annotation.RequiresApi; import androidx.annotation.RequiresApi;
import com.alibaba.android.arouter.facade.annotation.Route; import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; 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.RouteUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.activity.LiveAudienceActivity;
import com.yunbao.live.event.LiveRoomChangeEvent; import com.yunbao.live.event.LiveRoomChangeEvent;
import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.http.LiveHttpUtil;
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
@ -247,27 +247,25 @@ public class MyWebViewActivity extends AbsActivity {
if (code == 0 && info.length > 0) { if (code == 0 && info.length > 0) {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); 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) { if (liveBean == null) {
return; 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 (LiveRoomViewHolder.mHandler != null) { if (LiveRoomViewHolder.mHandler != null) {
LiveRoomViewHolder.mHandler.removeCallbacksAndMessages(null); LiveRoomViewHolder.mHandler.removeCallbacksAndMessages(null);
} }
if (!"".equals(Constants.mStream)) { if (!"".endsWith(Constants.mStream)) {
finish(); finish();
EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, liveTypeVal)); EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)));
} else { } else {
LiveAudienceActivity.forward(mContext, liveBean, liveType, liveTypeVal, "", 0, liveSdk); RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk));
} }
} }
}); });
} }
mCheckLivePresenter.checkLive(liveBean);
}
} }
}); });

View File

@ -38,7 +38,6 @@ import com.yunbao.common.utils.L;
import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.activity.LiveAudienceActivity;
import com.yunbao.live.activity.SystemMessageActivity; import com.yunbao.live.activity.SystemMessageActivity;
import com.yunbao.live.event.LiveRoomChangeEvent; import com.yunbao.live.event.LiveRoomChangeEvent;
import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.http.LiveHttpUtil;
@ -225,28 +224,25 @@ public class MyWebViewActivity2 extends AbsActivity {
public void onSuccess(int code, String msg, String[] info) { public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) { if (code == 0 && info.length > 0) {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); 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) { if (liveBean == null) {
return; 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 (LiveRoomViewHolder.mHandler != null) { if (LiveRoomViewHolder.mHandler != null) {
LiveRoomViewHolder.mHandler.removeCallbacksAndMessages(null); LiveRoomViewHolder.mHandler.removeCallbacksAndMessages(null);
} }
if (!"".endsWith(Constants.mStream)) { if (!"".endsWith(Constants.mStream)) {
finish(); finish();
EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, liveTypeVal)); EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)));
} else { } else {
LiveAudienceActivity.forward(mContext, liveBean, liveType, liveTypeVal, "", 0, liveSdk); RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk));
} }
} }
}); });
} }
mCheckLivePresenter.checkLive(liveBean);
}
} }
}); });
} }

View File

@ -20,6 +20,7 @@ import android.widget.EditText;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.blankj.utilcode.util.DeviceUtils; 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.NoviceInstructorManager;
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager; import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.activity.LiveAudienceActivity;
import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.http.LiveHttpUtil;
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
import com.yunbao.main.R; import com.yunbao.main.R;
@ -492,7 +493,6 @@ public class RegisterActivity extends AbsActivity {
startActivity(intent); startActivity(intent);
} }
private LiveRoomCheckLivePresenter mCheckLivePresenter;
private void gotoLive(final String live_id) { private void gotoLive(final String live_id) {
LiveHttpUtil.getLiveInfo(live_id, new HttpCallback() { LiveHttpUtil.getLiveInfo(live_id, new HttpCallback() {
@ -500,20 +500,16 @@ public class RegisterActivity extends AbsActivity {
public void onSuccess(int code, String msg, String[] info) { public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) { if (code == 0 && info.length > 0) {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); 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) { if (liveBean == null) {
return; return;
} }
LiveAudienceActivity.forward(RegisterActivity.this, liveBean, liveType, liveTypeVal, "", 0, liveSdk); new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
NoviceInstructorManager.get(activity).setFrist(false); @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);
} }
}); });
}
mCheckLivePresenter.checkLive(liveBean);
} else { } else {
MainActivity.forward(RegisterActivity.this, false); MainActivity.forward(RegisterActivity.this, false);
} }

View File

@ -36,7 +36,6 @@ import com.yunbao.common.utils.L;
import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.activity.LiveAudienceActivity;
import com.yunbao.live.activity.WebViewActivityMedal; import com.yunbao.live.activity.WebViewActivityMedal;
import com.yunbao.live.dialog.LiveUserDialogFragment; import com.yunbao.live.dialog.LiveUserDialogFragment;
import com.yunbao.live.http.LiveHttpUtil; 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) { private void gotoLive(final String live_id) {
LiveHttpUtil.getLiveInfo(live_id, new HttpCallback() { LiveHttpUtil.getLiveInfo(live_id, new HttpCallback() {
@Override @Override
public void onSuccess(int code, String msg, String[] info) { public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) { if (code == 0 && info.length > 0) {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); 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) { if (liveBean == null) {
return; return;
} }
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
LiveAudienceActivity.forward(mContext, liveBean, liveType, liveTypeVal, "", 0, liveSdk); @Override
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 { } else {
RouteUtil.forwardUserHome(mContext, live_id, 0); RouteUtil.forwardUserHome(mContext, live_id, 0);
} }

View File

@ -1,19 +1,21 @@
package com.yunbao.main.adapter; package com.yunbao.main.adapter;
import android.content.Context; import android.content.Context;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants; import com.yunbao.common.Constants;
import com.yunbao.common.adapter.RefreshAdapter; import com.yunbao.common.adapter.RefreshAdapter;
import com.yunbao.common.bean.LevelBean; import com.yunbao.common.bean.LevelBean;
import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.custom.MyRadioButton; import com.yunbao.common.custom.MyRadioButton;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.CommonHttpUtil; 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.CommonIconUtil;
import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.WordUtil; 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.bean.SearchUserBean;
import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.http.LiveHttpUtil;
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
@ -188,7 +188,6 @@ public class SearchAdapter extends RefreshAdapter<SearchUserBean> {
} }
private LiveRoomCheckLivePresenter mCheckLivePresenter;
private void gotoLive(final String live_id) { private void gotoLive(final String live_id) {
LiveHttpUtil.getLiveInfo(live_id, new HttpCallback() { LiveHttpUtil.getLiveInfo(live_id, new HttpCallback() {
@ -196,21 +195,16 @@ public class SearchAdapter extends RefreshAdapter<SearchUserBean> {
public void onSuccess(int code, String msg, String[] info) { public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) { if (code == 0 && info.length > 0) {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); 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) { if (liveBean == null) {
return; return;
} }
LiveAudienceActivity.forward(mContext, liveBean, liveType, liveTypeVal, "", 0, 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(liveTypeVal), Integer.parseInt(liveSdk));
} }
}); });
}
mCheckLivePresenter.checkLive(liveBean);
} else { } else {
RouteUtil.forwardUserHome(mContext, live_id, 0); RouteUtil.forwardUserHome(mContext, live_id, 0);
} }

View File

@ -12,6 +12,7 @@ import android.widget.Button;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.makeramen.roundedimageview.RoundedImageView; 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.http.HttpClient;
import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.manager.NoviceInstructorManager; import com.yunbao.common.manager.NoviceInstructorManager;
import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.activity.LiveAudienceActivity;
import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.http.LiveHttpUtil;
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
import com.yunbao.main.R; import com.yunbao.main.R;
@ -138,28 +139,22 @@ public class OneLoginDialog extends AbsDialogFragment {
} }
private LiveRoomCheckLivePresenter mCheckLivePresenter;
private void gotoLive(final String live_id) { private void gotoLive(final String live_id) {
LiveHttpUtil.getLiveInfo(live_id, new HttpCallback() { LiveHttpUtil.getLiveInfo(live_id, new HttpCallback() {
@Override @Override
public void onSuccess(int code, String msg, String[] info) { public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) { if (code == 0 && info.length > 0) {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); 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) { if (liveBean == null) {
return; return;
} }
LiveAudienceActivity.forward(mContext, liveBean, liveType, liveTypeVal, "", 0, 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(liveTypeVal), Integer.parseInt(liveSdk));
NoviceInstructorManager.get(mContext).setFrist(false); NoviceInstructorManager.get(mContext).setFrist(false);
} }
}); });
}
mCheckLivePresenter.checkLive(liveBean);
} else { } else {
MainActivity.forward(mContext, false); MainActivity.forward(mContext, false);
} }

View File

@ -139,32 +139,21 @@ public abstract class AbsMainListChildViewHolder extends AbsMainViewHolder imple
} }
} }
private LiveRoomCheckLivePresenter mCheckLivePresenter;
@Override @Override
public void onItemClick(ListBean bean, int position) { public void onItemClick(ListBean bean, int position) {
if (bean.getIslive() == 1) { if (bean.getIslive() == 1) {
LiveHttpUtil.getLiveInfo(bean.getUid(), new HttpCallback() { LiveHttpUtil.getLiveInfo(bean.getUid(), new HttpCallback() {
@Override @Override
public void onSuccess(int code, String msg, String[] info) { public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) { if (code == 0 && info.length > 0) {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
if (mCheckLivePresenter == null) {
mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() {
@Override @Override
public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) { public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
if (liveBean == null) { RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk));
return;
}
LiveAudienceActivity.forward(mContext, liveBean, liveType, liveTypeVal, "", 0, liveSdk);
NoviceInstructorManager.get(mContext).setFrist(false);
} }
}); });
}
mCheckLivePresenter.checkLive(liveBean);
} else { } else {
MainActivity.forward(mContext, false); MainActivity.forward(mContext, false);
} }
@ -367,6 +356,7 @@ public abstract class AbsMainListChildViewHolder extends AbsMainViewHolder imple
if (bean.isHide()) { if (bean.isHide()) {
ToastUtil.show(R.string.can_not_go); ToastUtil.show(R.string.can_not_go);
} else { } else {
if (bean.getIslive() == 1) { if (bean.getIslive() == 1) {
LiveHttpUtil.getLiveInfo(bean.getUid(), new HttpCallback() { LiveHttpUtil.getLiveInfo(bean.getUid(), new HttpCallback() {
@Override @Override
@ -374,19 +364,12 @@ public abstract class AbsMainListChildViewHolder extends AbsMainViewHolder imple
if (code == 0 && info.length > 0) { if (code == 0 && info.length > 0) {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
if (mCheckLivePresenter == null) { new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() {
@Override @Override
public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) { public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
if (liveBean == null) { RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk));
return;
}
LiveAudienceActivity.forward(mContext, liveBean, liveType, liveTypeVal, "", 0, liveSdk);
NoviceInstructorManager.get(mContext).setFrist(false);
} }
}); });
}
mCheckLivePresenter.checkLive(liveBean);
} else { } else {
MainActivity.forward(mContext, false); MainActivity.forward(mContext, false);
} }

View File

@ -26,6 +26,7 @@ import com.yunbao.common.adapter.RefreshAdapter;
import com.yunbao.common.bean.AnchorRecommendModel; import com.yunbao.common.bean.AnchorRecommendModel;
import com.yunbao.common.bean.BannerBean; import com.yunbao.common.bean.BannerBean;
import com.yunbao.common.bean.ConfigBean; import com.yunbao.common.bean.ConfigBean;
import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.bean.LiveClassBean; import com.yunbao.common.bean.LiveClassBean;
import com.yunbao.common.bean.WeekListBean; import com.yunbao.common.bean.WeekListBean;
import com.yunbao.common.custom.CommonRefreshView; 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.RouteUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.CustomViewHolder; 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.event.LiveRoomChangeEvent;
import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.http.LiveHttpUtil;
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; 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) { private void gotoLive(final String live_id) {
LiveHttpUtil.getLiveInfo(live_id, new HttpCallback() { LiveHttpUtil.getLiveInfo(live_id, new HttpCallback() {
@ -320,11 +318,6 @@ public class MainHomeLiveViewHolder extends AbsMainHomeChildViewHolder implement
public void onSuccess(int code, String msg, String[] info) { public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) { if (code == 0 && info.length > 0) {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); 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) { if (liveBean == null) {
return; return;
} }
@ -332,12 +325,13 @@ public class MainHomeLiveViewHolder extends AbsMainHomeChildViewHolder implement
if (gotoRoomKey != null && gotoRoomKey.isEmpty()) { if (gotoRoomKey != null && gotoRoomKey.isEmpty()) {
gotoRoomKey = null; gotoRoomKey = null;
} }
LiveAudienceActivity.forward(mContext, liveBean, liveType, liveTypeVal, "", gotoRoomKey, 0, 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(liveTypeVal), Integer.parseInt(liveSdk));
} }
}); });
}
mCheckLivePresenter.checkLive(liveBean);
} else { } else {
intoIndex = 1; intoIndex = 1;
RouteUtil.forwardUserHome(mContext, live_id, 0); RouteUtil.forwardUserHome(mContext, live_id, 0);
@ -411,25 +405,24 @@ public class MainHomeLiveViewHolder extends AbsMainHomeChildViewHolder implement
if (code == 0 && info.length > 0) { if (code == 0 && info.length > 0) {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); 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) { if (liveBean == null) {
return; 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 (LiveRoomViewHolder.mHandler != null) { if (LiveRoomViewHolder.mHandler != null) {
LiveRoomViewHolder.mHandler.removeCallbacksAndMessages(null); LiveRoomViewHolder.mHandler.removeCallbacksAndMessages(null);
} }
if (!"".endsWith(Constants.mStream)) { if (!"".endsWith(Constants.mStream)) {
EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, liveTypeVal)); EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)));
} else { } else {
LiveAudienceActivity.forward(mContext, liveBean, liveType, liveTypeVal, "", 0, liveSdk); RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk));
} }
} }
}); });
}
mCheckLivePresenter.checkLive(liveBean);
} else { } else {
ToastUtil.show(msg); ToastUtil.show(msg);
} }

View File

@ -416,13 +416,12 @@ public class MainMessageViewHolder extends AbsMainViewHolder {
public void onSuccess(int code, String msg, String[] info) { public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) { if (code == 0 && info.length > 0) {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
LiveRoomCheckLivePresenter mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, (liveBean1, liveType, liveTypeVal, liveSdk) -> { new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
if (liveBean1 == null) { @Override
return; 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 { } else {
RouteUtil.forwardUserHome(mContext, event.getLiveuid(), 0); RouteUtil.forwardUserHome(mContext, event.getLiveuid(), 0);
} }

View File

@ -7,8 +7,6 @@ import android.graphics.Color;
import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Build; import android.os.Build;
import androidx.core.content.ContextCompat;
import androidx.viewpager.widget.ViewPager;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import android.view.KeyEvent; import android.view.KeyEvent;
@ -21,6 +19,9 @@ import android.widget.LinearLayout;
import android.widget.PopupWindow; import android.widget.PopupWindow;
import android.widget.TextView; import android.widget.TextView;
import androidx.core.content.ContextCompat;
import androidx.viewpager.widget.ViewPager;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.opensource.svgaplayer.SVGADrawable; 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.adapter.ViewPagerAdapter;
import com.yunbao.common.bean.ConfigBean; import com.yunbao.common.bean.ConfigBean;
import com.yunbao.common.bean.LevelBean; import com.yunbao.common.bean.LevelBean;
import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.event.FollowEvent; import com.yunbao.common.event.FollowEvent;
import com.yunbao.common.event.UpdateFieldEvent; import com.yunbao.common.event.UpdateFieldEvent;
import com.yunbao.common.glide.ImgLoader; 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.CommonIconUtil;
import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.SVGAViewUtils; import com.yunbao.common.utils.SVGAViewUtils;
import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.activity.LiveAudienceActivity;
import com.yunbao.live.activity.LiveReportActivity; import com.yunbao.live.activity.LiveReportActivity;
import com.yunbao.common.bean.LiveBean;
import com.yunbao.live.bean.SearchUserBean; import com.yunbao.live.bean.SearchUserBean;
import com.yunbao.live.dialog.LiveShareDialogFragment; import com.yunbao.live.dialog.LiveShareDialogFragment;
import com.yunbao.live.event.LiveRoomChangeEvent; 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.AbsLivePageViewHolder;
import com.yunbao.live.views.AbsUserHomeViewHolder; import com.yunbao.live.views.AbsUserHomeViewHolder;
import com.yunbao.live.views.LiveRecordViewHolder; import com.yunbao.live.views.LiveRecordViewHolder;
import com.yunbao.live.views.LiveRoomViewHolder;
import com.yunbao.live.views.ShowBigPhoto; import com.yunbao.live.views.ShowBigPhoto;
import com.yunbao.main.R; import com.yunbao.main.R;
import com.yunbao.main.activity.EditProfileActivity; import com.yunbao.main.activity.EditProfileActivity;
@ -766,28 +766,22 @@ public class UserHomeViewHolder2 extends AbsLivePageViewHolder implements LiveSh
public void onSuccess(int code, String msg, String[] info) { public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) { if (code == 0 && info.length > 0) {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); 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) { if (liveBean == null) {
return; return;
} }
if (LiveRoomViewHolder.mHandler != null) { new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
LiveRoomViewHolder.mHandler.removeCallbacksAndMessages(null); @Override
} public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
if (mFromLiveRoom) { if (mFromLiveRoom) {
((UserHomeActivity) mContext).onBackPressed(); ((UserHomeActivity) mContext).onBackPressed();
EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, liveTypeVal)); EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)));
} else { } else {
LiveAudienceActivity.forward(mContext, liveBean, liveType, liveTypeVal, "", 0, liveSdk); RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk));
} }
} }
}); });
} }
mCheckLivePresenter.checkLive(liveBean);
}
} }
}); });
} }