修复多次调用检查直播间接口问题

This commit is contained in:
18401019693 2022-11-28 18:09:20 +08:00
parent 3bd4301cda
commit e9fa533e5a
31 changed files with 428 additions and 125 deletions

View File

@ -2,6 +2,7 @@ package com.yunbao.common.http.live;
import android.content.Context; import android.content.Context;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log;
import com.yunbao.common.Constants; import com.yunbao.common.Constants;
import com.yunbao.common.R; import com.yunbao.common.R;
@ -372,6 +373,7 @@ public class LiveNetManager {
.subscribe(new Consumer<ResponseModel<EnterRoomNewModel>>() { .subscribe(new Consumer<ResponseModel<EnterRoomNewModel>>() {
@Override @Override
public void accept(ResponseModel<EnterRoomNewModel> enterRoomNewModelResponseModel) throws Exception { public void accept(ResponseModel<EnterRoomNewModel> enterRoomNewModelResponseModel) throws Exception {
Log.e("进入房间","enterRoomNew--------------------------------------------");
enterRoomDisposable = null; enterRoomDisposable = null;
if (callback != null) { if (callback != null) {
callback.onSuccess(enterRoomNewModelResponseModel.getData().getInfo()); callback.onSuccess(enterRoomNewModelResponseModel.getData().getInfo());
@ -404,6 +406,7 @@ public class LiveNetManager {
.subscribe(new Consumer<ResponseModel<String>>() { .subscribe(new Consumer<ResponseModel<String>>() {
@Override @Override
public void accept(ResponseModel<String> stringResponseModel) throws Exception { public void accept(ResponseModel<String> stringResponseModel) throws Exception {
Log.e("进入房间","userJoinRoomNew--------------------------------------------");
userJoinDisposable = null; userJoinDisposable = null;
} }
}, new Consumer<Throwable>() { }, new Consumer<Throwable>() {

View File

@ -301,42 +301,59 @@ public class LiveAudienceActivity extends LiveActivity {
@Override @Override
public void run() { public void run() {
AnchorRecommendItemModel data = itemModelList.get(mCurrentPage); AnchorRecommendItemModel data = itemModelList.get(mCurrentPage);
new LiveRoomCheckLivePresenter(mContext, data.getUid(), data.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { if (mCurrentPage==0){
@Override View rootView = manager.getRootView();
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { if (rootView.getParent() != null && rootView.getParent() instanceof ViewGroup) {
((ViewGroup) (rootView.getParent())).removeView(rootView);
try { manager.onRemove(false);
mLiveSDK = Integer.parseInt(liveSdk);
mLiveTypeVal = Integer.parseInt(liveTypeVal);
} catch (NumberFormatException e) {
mLiveSDK = 0;
mLiveTypeVal = 0;
}
mLiveType = liveType;
String json = GsonUtils.toJson(data);
mLiveBean = GsonUtils.fromJson(json, LiveBean.class);
mLiveBean.setUserNiceName(data.getUserNicename());
mLiveUid = mLiveBean.getUid();
mStream = mLiveBean.getStream();
mAncherName = mLiveBean.getUserNiceName();
mAncherIcon = mLiveBean.getAvatar();
Log.e(TAG, "mLiveUid--------------------------->" + mLiveUid);
//加载当前页面数据
View rootView = manager.getRootView();
if (rootView.getParent() != null && rootView.getParent() instanceof ViewGroup) {
((ViewGroup) (rootView.getParent())).removeView(rootView);
manager.onRemove(false);
}
mViewGroup.addView(manager.getRootView());
manager.onAdd(mLiveBean, liveType, mLiveTypeVal, mLiveSDK);
//加载完页面后再后台静默下载礼物svga
downloadAllGift();
over();
} }
}); mViewGroup.addView(manager.getRootView());
manager.onAdd(mLiveBean, mLiveType, mLiveTypeVal, mLiveSDK);
//加载完页面后再后台静默下载礼物svga
downloadAllGift();
over();
}else {
new LiveRoomCheckLivePresenter(mContext, data.getUid(), data.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
try {
mLiveSDK = Integer.parseInt(liveSdk);
mLiveTypeVal = Integer.parseInt(liveTypeVal);
} catch (NumberFormatException e) {
mLiveSDK = 0;
mLiveTypeVal = 0;
}
mLiveType = liveType;
String json = GsonUtils.toJson(data);
mLiveBean = GsonUtils.fromJson(json, LiveBean.class);
mLiveBean.setUserNiceName(data.getUserNicename());
mLiveUid = mLiveBean.getUid();
mStream = mLiveBean.getStream();
mAncherName = mLiveBean.getUserNiceName();
mAncherIcon = mLiveBean.getAvatar();
Log.e(TAG, "mLiveUid--------------------------->" + mLiveUid);
//加载当前页面数据
View rootView = manager.getRootView();
if (rootView.getParent() != null && rootView.getParent() instanceof ViewGroup) {
((ViewGroup) (rootView.getParent())).removeView(rootView);
manager.onRemove(false);
}
mViewGroup.addView(manager.getRootView());
manager.onAdd(mLiveBean, liveType, mLiveTypeVal, mLiveSDK);
//加载完页面后再后台静默下载礼物svga
downloadAllGift();
over();
}
@Override
public void onCheckError(String contextError) {
finish();
}
});
}
} }
}; };
@ -731,15 +748,23 @@ public class LiveAudienceActivity extends LiveActivity {
@Override @Override
public void onSuccess(int code, String msg, String[] info) { public void onSuccess(int code, String msg, String[] info) {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), (liveUid, stream, liveType, liveTypeVal, liveSdk) -> { new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
if (liveBean == null) { @Override
return; public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
if (liveBean == null) {
return;
}
if(MicStatusManager.getInstance().isMic(liveUid)){
MicStatusManager.getInstance().showDownMicDialog(mContext);
return;
}
EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)).setLiveEnd(true));
} }
if(MicStatusManager.getInstance().isMic(liveUid)){
MicStatusManager.getInstance().showDownMicDialog(mContext); @Override
return; public void onCheckError(String contextError) {
} }
EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)).setLiveEnd(true));
}); });
} }
}); });
@ -1028,9 +1053,7 @@ public class LiveAudienceActivity extends LiveActivity {
break; break;
case LIVE_ROOM_EXCEPTION: case LIVE_ROOM_EXCEPTION:
//主播未直播时自动下滑至下一个直播间 //主播未直播时自动下滑至下一个直播间
itemModelList.remove(mCurrentPage); onBackPressed();
mPagerAdapter.notifyDataSetChanged();
verticalViewPager.setCurrentItem(mCurrentPage + 1);
break; break;
case REFRESH_THE_LIVEl_PAGE: case REFRESH_THE_LIVEl_PAGE:
getDrawer(); getDrawer();

View File

@ -28,6 +28,7 @@ import com.yunbao.live.adapter.SystemChatMessageAdapter;
import com.yunbao.live.bean.ImUserBean; import com.yunbao.live.bean.ImUserBean;
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 org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.Subscribe;
@ -194,7 +195,18 @@ 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);
RouteUtil.forwardLiveAudienceActivity(liveBean, 0, 0, 0); new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
}
@Override
public void onCheckError(String contextError) {
}
});
} else { } else {
RouteUtil.forwardUserHome(mContext, event.getLiveuid(), 0); RouteUtil.forwardUserHome(mContext, event.getLiveuid(), 0);
} }

View File

@ -166,7 +166,17 @@ public class WebViewActivityMedal 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);
RouteUtil.forwardLiveAudienceActivity(liveBean,0 , 0,0); new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
}
@Override
public void onCheckError(String contextError) {
}
});
} else { } else {
RouteUtil.forwardUserHome(mContext, String.valueOf(live_id), 0); RouteUtil.forwardUserHome(mContext, String.valueOf(live_id), 0);
} }

View File

@ -319,17 +319,10 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
} }
} else if (bean.getType() == -2) {//自动消息点击发言 } else if (bean.getType() == -2) {//自动消息点击发言
boolean isContains = false;
for (LiveChatBean model : mList) {
if (bean.getType() == -2) {
isContains = true;
}
}
if (isContains) {
mBg.setBackgroundResource(R.drawable.bg_chat_automatic_item); mBg.setBackgroundResource(R.drawable.bg_chat_automatic_item);
mTextView.setText(R.string.automatic_chat); mTextView.setText(R.string.automatic_chat);
bean.setHeart(position); bean.setHeart(position);
}
} else if (bean.getType() == MSG_HOUR_RANK_CHANGE) { } else if (bean.getType() == MSG_HOUR_RANK_CHANGE) {
mBg.setBackgroundResource(R.drawable.bg_chat_automatic_item); mBg.setBackgroundResource(R.drawable.bg_chat_automatic_item);
mTextView.setText(bean.getContent()); mTextView.setText(bean.getContent());

View File

@ -294,7 +294,17 @@ 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);
RouteUtil.forwardLiveAudienceActivity(liveBean,0 , 0,0); new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
}
@Override
public void onCheckError(String contextError) {
}
});
} else { } else {
RouteUtil.forwardUserHome(mContext, live_id, 0); RouteUtil.forwardUserHome(mContext, live_id, 0);
} }

View File

@ -245,6 +245,12 @@ public class LiveHDDialogFragment extends AbsDialogFragment {
return; return;
} }
EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)).setLiveEnd(true)); EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)).setLiveEnd(true));
dismiss();
}
@Override
public void onCheckError(String contextError) {
} }
}); });
} else { } else {

View File

@ -184,7 +184,17 @@ 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);
RouteUtil.forwardLiveAudienceActivity(liveBean,0 , 0,0); new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
}
@Override
public void onCheckError(String contextError) {
}
});
} }
} }
}); });

View File

@ -626,6 +626,11 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
} }
EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)).setLiveEnd(true)); EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)).setLiveEnd(true));
} }
@Override
public void onCheckError(String contextError) {
}
}); });
} }
} }

View File

@ -373,7 +373,17 @@ public class LiveGiftAnimPresenter {
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);
RouteUtil.forwardLiveAudienceActivity(liveBean,0 , 0,0); new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
}
@Override
public void onCheckError(String contextError) {
}
});
} }
} }
}); });

View File

@ -59,7 +59,7 @@ public class LiveRoomCheckLivePresenter {
@Override @Override
public void forwardPwdRoom(CheckLiveModel model) { public void forwardPwdRoom(CheckLiveModel model) {
DialogUitl.showSimpleInputDialog(mContext, WordUtil.getString(R.string.live_input_password), DialogUitl.INPUT_TYPE_NUMBER_PASSWORD, new DialogUitl.SimpleCallback2() { DialogUitl.showSimpleInputDialog(context, WordUtil.getString(R.string.live_input_password), DialogUitl.INPUT_TYPE_NUMBER_PASSWORD, new DialogUitl.SimpleCallback2() {
@Override @Override
public void onCancelClick() { public void onCancelClick() {
if (mContext instanceof Activity) { if (mContext instanceof Activity) {
@ -74,7 +74,7 @@ public class LiveRoomCheckLivePresenter {
return; return;
} }
String password = MD5Util.getMD5(content); String password = MD5Util.getMD5(content);
if (mLiveTypeMsg.equalsIgnoreCase(password)) { if (model.getTypeMsg().equalsIgnoreCase(password)) {
dialog.dismiss(); dialog.dismiss();
if (actionListener != null) { if (actionListener != null) {
actionListener.onLiveRoomChanged(liveUid, stream, model.getType(), model.getTypeVal(), model.getLiveSdk()); actionListener.onLiveRoomChanged(liveUid, stream, model.getType(), model.getTypeVal(), model.getLiveSdk());
@ -88,7 +88,7 @@ public class LiveRoomCheckLivePresenter {
@Override @Override
public void forwardPayRoom(CheckLiveModel model) { public void forwardPayRoom(CheckLiveModel model) {
DialogUitl.showSimpleDialog(mContext, mLiveTypeMsg, new DialogUitl.SimpleCallback() { DialogUitl.showSimpleDialog(context, mLiveTypeMsg, new DialogUitl.SimpleCallback() {
@Override @Override
public void onConfirmClick(Dialog dialog, String content) { public void onConfirmClick(Dialog dialog, String content) {
LiveHttpUtil.roomCharge(liveUid, stream, new HttpCallback() { LiveHttpUtil.roomCharge(liveUid, stream, new HttpCallback() {
@ -277,5 +277,7 @@ public class LiveRoomCheckLivePresenter {
public interface NewActionListener { public interface NewActionListener {
void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk); void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk);
void onCheckError(String contextError);
} }
} }

View File

@ -337,6 +337,11 @@ public class LiveEndViewHolder extends AbsViewHolder implements View.OnClickList
} }
EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)).setLiveEnd(true)); EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)).setLiveEnd(true));
} }
@Override
public void onCheckError(String contextError) {
}
}); });
Bus.get().post(new CloseEvent()); Bus.get().post(new CloseEvent());
} else { } else {

View File

@ -3581,6 +3581,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal))); EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)));
} }
} }
@Override
public void onCheckError(String contextError) {
}
}); });
} else { } else {
RouteUtil.forwardUserHome(mContext, liveId, 0); RouteUtil.forwardUserHome(mContext, liveId, 0);

View File

@ -15,7 +15,6 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.RelativeLayout;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.drawerlayout.widget.DrawerLayout; import androidx.drawerlayout.widget.DrawerLayout;
@ -287,6 +286,14 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
} }
private Runnable sendFIm = new Runnable() {
@Override
public void run() {
//加入房间发送Im消息
LiveNetManager.get(mContext).userJoinRoomNew(mLiveBean.getStream(), mLiveBean.getUid());
}
};
/** /**
* 新进入房间接口 * 新进入房间接口
*/ */
@ -298,8 +305,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
public void onSuccess(EnterRoomNewModel data) { public void onSuccess(EnterRoomNewModel data) {
mLivePlayViewHolder.setLiveBeanLandscape(data.getLiveInfo().getLandscape()); mLivePlayViewHolder.setLiveBeanLandscape(data.getLiveInfo().getLandscape());
isEnterRoom = true; isEnterRoom = true;
//加入房间发送Im消息 //延时1秒发送
LiveNetManager.get(mContext).userJoinRoomNew(mLiveBean.getStream(), mLiveBean.getUid()); liveHandler.postDelayed(sendFIm, 700);
//新人任務 //新人任務
mLiveRoomViewHolder.configBanner3(data.getNewPeopleTask()); mLiveRoomViewHolder.configBanner3(data.getNewPeopleTask());
//小时榜 //小时榜
@ -508,6 +516,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
public void removeLiveEnd() { public void removeLiveEnd() {
if (mLiveAudienceViewHolder != null) { if (mLiveAudienceViewHolder != null) {
mLiveAudienceViewHolder.removeFromParent(); mLiveAudienceViewHolder.removeFromParent();
mLiveAudienceViewHolder.removeCallbacks(); mLiveAudienceViewHolder.removeCallbacks();
mLiveAudienceViewHolder.release(); mLiveAudienceViewHolder.release();
@ -539,6 +548,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
@Override @Override
public void onRemove(boolean isQuit) { public void onRemove(boolean isQuit) {
LiveNetManager.get(mContext).cancelLive(); LiveNetManager.get(mContext).cancelLive();
liveHandler.removeCallbacks(sendFIm);
LiveHttpUtil.cancel(LiveHttpConsts.CHECK_LIVE); LiveHttpUtil.cancel(LiveHttpConsts.CHECK_LIVE);
LiveHttpUtil.cancel(LiveHttpConsts.ENTER_ROOM); LiveHttpUtil.cancel(LiveHttpConsts.ENTER_ROOM);
LiveHttpUtil.cancel(LiveHttpConsts.ROOM_CHARGE); LiveHttpUtil.cancel(LiveHttpConsts.ROOM_CHARGE);
@ -546,8 +556,10 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
CommonHttpUtil.cancel(LiveHttpConsts.GET_WISH_LIST); CommonHttpUtil.cancel(LiveHttpConsts.GET_WISH_LIST);
IMLoginManager.get(mContext).setisNewUserOne(false); IMLoginManager.get(mContext).setisNewUserOne(false);
//子线程执行退出操作 //子线程执行退出操作
exitLiveRoom(false); exitLiveRoom(isEnterRoom);
if (mLiveAudienceViewHolder != null) {
mLiveAudienceViewHolder.removeCallbacks();
}
//断开socket //断开socket
@ -1414,65 +1426,57 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
* 退出直播间 * 退出直播间
*/ */
public void exitLiveRoom(boolean isQuitF) { public void exitLiveRoom(boolean isQuitF) {
if (mLiveBean == null && !isEnterRoom) { if (!isEnterRoom) {
return; return;
} }
RongChatRoomClient.getInstance().quitChatRoom("g" + mLiveBean.getUid(), new IRongCoreCallback.OperationCallback() { if (mLiveBean != null) {
@Override isEnterRoom = false;
public void onSuccess() { RongChatRoomClient.getInstance().quitChatRoom("g" + mLiveBean.getUid(), new IRongCoreCallback.OperationCallback() {
Log.i("tx", "退出成功"); @Override
LiveNetManager.get(mContext) public void onSuccess() {
.leaveRoomNew(mLiveBean.getStream(), mLiveBean.getUid(), new com.yunbao.common.http.base.HttpCallback<String>() { try {
V2TIMManager.getInstance().quitGroup("g" + mLiveBean.getUid(), new V2TIMCallback() {
@Override @Override
public void onSuccess(String data) { public void onSuccess() {
if (isQuitF) {
onRemove(true); Log.i("tx", "退出成功" + mLiveBean.getUid());
} LiveNetManager.get(mContext)
.leaveRoomNew(mLiveBean.getStream(), mLiveBean.getUid(), new com.yunbao.common.http.base.HttpCallback<String>() {
@Override
public void onSuccess(String data) {
if (isQuitF) {
onRemove(true);
}
}
@Override
public void onError(String error) {
}
});
} }
@Override @Override
public void onError(String error) { public void onError(int code, String desc) {
Log.i("tx", "退出失败");
} }
}); });
} } catch (Exception e) {
e.printStackTrace();
}
@Override
public void onError(IRongCoreEnum.CoreErrorCode coreErrorCode) {
}
});
try {
V2TIMManager.getInstance().quitGroup("g" + mLiveBean.getUid(), new V2TIMCallback() {
@Override
public void onSuccess() {
Log.i("tx", "退出成功" + mLiveBean.getUid());
LiveNetManager.get(mContext)
.leaveRoomNew(mLiveBean.getStream(), mLiveBean.getUid(), new com.yunbao.common.http.base.HttpCallback<String>() {
@Override
public void onSuccess(String data) {
}
@Override
public void onError(String error) {
}
});
} }
@Override @Override
public void onError(int code, String desc) { public void onError(IRongCoreEnum.CoreErrorCode coreErrorCode) {
Log.i("tx", "退出失败");
} }
}); });
} catch (Exception e) {
e.printStackTrace();
} }
} }

View File

@ -20,6 +20,7 @@ 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.http.LiveHttpUtil; import com.yunbao.live.http.LiveHttpUtil;
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
import java.util.List; import java.util.List;
@ -99,7 +100,17 @@ public class SidebarViewHoler extends RecyclerView.ViewHolder {
mShowLoadingDialog.dismiss(); mShowLoadingDialog.dismiss();
return; return;
} }
RouteUtil.forwardLiveAudienceActivity(liveBean, 0, 0, 0); new LiveRoomCheckLivePresenter(itemView.getContext(), liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
}
@Override
public void onCheckError(String contextError) {
}
});
if (mShowLoadingDialog != null && mShowLoadingDialog.isShowing()) if (mShowLoadingDialog != null && mShowLoadingDialog.isShowing())
mShowLoadingDialog.dismiss(); mShowLoadingDialog.dismiss();
((Activity) itemView.getContext()).finish(); ((Activity) itemView.getContext()).finish();

View File

@ -683,7 +683,17 @@ public class EntryActivity extends AppCompatActivity {
if (liveBean == null) { if (liveBean == null) {
return; return;
} }
RouteUtil.forwardLiveAudienceActivity(liveBean, 0, 0, 0); new LiveRoomCheckLivePresenter(activity, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
}
@Override
public void onCheckError(String contextError) {
}
});
NoviceInstructorManager.get(activity).setFrist(false); NoviceInstructorManager.get(activity).setFrist(false);

View File

@ -116,7 +116,17 @@ public class LiveClassActivity extends AbsActivity implements OnItemClickListene
* 观看直播 * 观看直播
*/ */
public void watchLive(LiveBean liveBean, int position) { public void watchLive(LiveBean liveBean, int position) {
RouteUtil.forwardLiveAudienceActivity(liveBean, 0, 0, 0); new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
}
@Override
public void onCheckError(String contextError) {
}
});
} }

View File

@ -50,6 +50,7 @@ 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.http.LiveHttpUtil; import com.yunbao.live.http.LiveHttpUtil;
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
import com.yunbao.main.R; import com.yunbao.main.R;
import com.yunbao.main.event.RegSuccessEvent; import com.yunbao.main.event.RegSuccessEvent;
import com.yunbao.main.http.MainHttpConsts; import com.yunbao.main.http.MainHttpConsts;
@ -239,7 +240,17 @@ public class LoginActivity extends AbsActivity {
if (liveBean == null) { if (liveBean == null) {
return; return;
} }
RouteUtil.forwardLiveAudienceActivity(liveBean, 0, 0, 0); new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
}
@Override
public void onCheckError(String contextError) {
}
});
NoviceInstructorManager.get(activity).setFrist(false); NoviceInstructorManager.get(activity).setFrist(false);
} else { } else {

View File

@ -237,7 +237,17 @@ 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);
RouteUtil.forwardLiveAudienceActivity(liveBean, 0, 0, 0); new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
}
@Override
public void onCheckError(String contextError) {
}
});
} else { } else {
ToastUtil.show("直播已结束"); ToastUtil.show("直播已结束");
} }
@ -408,7 +418,17 @@ 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);
RouteUtil.forwardLiveAudienceActivity(liveBean, 0, 0, 0); new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
}
@Override
public void onCheckError(String contextError) {
}
});
} else { } else {
RouteUtil.forwardUserHome(mContext, Uid, 0); RouteUtil.forwardUserHome(mContext, Uid, 0);
} }
@ -877,7 +897,17 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
* 观看直播 * 观看直播
*/ */
public void watchLive(LiveBean liveBean, String key, int position) { public void watchLive(LiveBean liveBean, String key, int position) {
RouteUtil.forwardLiveAudienceActivity(liveBean, 0, 0, 0); new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
}
@Override
public void onCheckError(String contextError) {
}
});
} }

View File

@ -269,6 +269,11 @@ public class MyWebViewActivity extends AbsActivity {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk)); RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk));
} }
} }
@Override
public void onCheckError(String contextError) {
}
}); });
} }
} }

View File

@ -246,6 +246,11 @@ public class MyWebViewActivity2 extends AbsActivity {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk)); RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk));
} }
} }
@Override
public void onCheckError(String contextError) {
}
}); });
} }
} }

View File

@ -50,6 +50,7 @@ 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.http.LiveHttpUtil; import com.yunbao.live.http.LiveHttpUtil;
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
import com.yunbao.main.R; import com.yunbao.main.R;
import com.yunbao.main.event.RegSuccessEvent; import com.yunbao.main.event.RegSuccessEvent;
import com.yunbao.main.http.MainHttpConsts; import com.yunbao.main.http.MainHttpConsts;
@ -502,8 +503,19 @@ public class RegisterActivity extends AbsActivity {
if (liveBean == null) { if (liveBean == null) {
return; return;
} }
RouteUtil.forwardLiveAudienceActivity(liveBean, 0, 0, 0); new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
NoviceInstructorManager.get(mContext).setFrist(false); @Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
NoviceInstructorManager.get(mContext).setFrist(false);
}
@Override
public void onCheckError(String contextError) {
}
});
} else { } else {
MainActivity.forward(RegisterActivity.this, false); MainActivity.forward(RegisterActivity.this, false);

View File

@ -21,11 +21,13 @@ import com.yunbao.common.activity.AbsActivity;
import com.yunbao.common.bean.LiveBean; import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.event.CloseEvent; import com.yunbao.common.event.CloseEvent;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.manager.NoviceInstructorManager;
import com.yunbao.common.manager.SearchHistoryRecordManager; import com.yunbao.common.manager.SearchHistoryRecordManager;
import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.WordsTypeUtil; import com.yunbao.common.utils.WordsTypeUtil;
import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.http.LiveHttpUtil;
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
import com.yunbao.main.R; import com.yunbao.main.R;
import com.yunbao.main.event.JumpUserHomeEvent; import com.yunbao.main.event.JumpUserHomeEvent;
import com.yunbao.main.fragment.SearchRecommendFragment; import com.yunbao.main.fragment.SearchRecommendFragment;
@ -172,7 +174,17 @@ public class SearchActivity 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);
RouteUtil.forwardLiveAudienceActivity(liveBean, 0, 0, 0); new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
}
@Override
public void onCheckError(String contextError) {
}
});
} else { } else {
//跳转到个人资料 //跳转到个人资料

View File

@ -152,7 +152,17 @@ public class WeekWebViewActivity extends AbsActivity {
if (liveBean == null) { if (liveBean == null) {
return; return;
} }
RouteUtil.forwardLiveAudienceActivity(liveBean, 0, 0, 0); new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
}
@Override
public void onCheckError(String contextError) {
}
});
} else { } else {
RouteUtil.forwardUserHome(mContext, live_id, 0); RouteUtil.forwardUserHome(mContext, live_id, 0);
} }

View File

@ -198,8 +198,17 @@ public class SearchAdapter extends RefreshAdapter<SearchUserBean> {
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) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
}
RouteUtil.forwardLiveAudienceActivity(liveBean, 0, 0, 0); @Override
public void onCheckError(String contextError) {
}
});
} else { } else {
RouteUtil.forwardUserHome(mContext, live_id, 0); RouteUtil.forwardUserHome(mContext, live_id, 0);
} }

View File

@ -148,9 +148,29 @@ public class OneLoginDialog extends AbsDialogFragment {
if (liveBean == null) { if (liveBean == null) {
return; return;
} }
RouteUtil.forwardLiveAudienceActivity(liveBean, 0, 0, 0);
NoviceInstructorManager.get(mContext).setFrist(false);
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
NoviceInstructorManager.get(mContext).setFrist(false);
}
@Override
public void onCheckError(String contextError) {
}
});
}
@Override
public void onCheckError(String contextError) {
}
});
} else { } else {
MainActivity.forward(mContext, false); MainActivity.forward(mContext, false);
} }

View File

@ -148,7 +148,17 @@ public abstract class AbsMainListChildViewHolder extends AbsMainViewHolder imple
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);
RouteUtil.forwardLiveAudienceActivity(liveBean, 0, 0, 0); new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
}
@Override
public void onCheckError(String contextError) {
}
});
} else { } else {
MainActivity.forward(mContext, false); MainActivity.forward(mContext, false);
} }
@ -359,7 +369,17 @@ 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);
RouteUtil.forwardLiveAudienceActivity(liveBean, 0, 0, 0); new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
}
@Override
public void onCheckError(String contextError) {
}
});
} else { } else {
MainActivity.forward(mContext, false); MainActivity.forward(mContext, false);
} }

View File

@ -235,7 +235,17 @@ public class MainHomeCommunityViewHolder extends AbsMainHomeChildViewHolder impl
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);
RouteUtil.forwardLiveAudienceActivity(liveBean, 0, 0, 0); new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
}
@Override
public void onCheckError(String contextError) {
}
});
} else { } else {
RouteUtil.forwardUserHome(mContext, String.valueOf(live_id), 0); RouteUtil.forwardUserHome(mContext, String.valueOf(live_id), 0);

View File

@ -327,7 +327,17 @@ public class MainHomeLiveViewHolder extends AbsMainHomeChildViewHolder implement
gotoRoomKey = null; gotoRoomKey = null;
} }
liveBean.setParams(gotoRoomKey); liveBean.setParams(gotoRoomKey);
RouteUtil.forwardLiveAudienceActivity(liveBean, 0, 0, 0); new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
}
@Override
public void onCheckError(String contextError) {
}
});
} else { } else {
intoIndex = 1; intoIndex = 1;
@ -422,6 +432,11 @@ public class MainHomeLiveViewHolder extends AbsMainHomeChildViewHolder implement
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk)); RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk));
} }
} }
@Override
public void onCheckError(String contextError) {
}
}); });
} else { } else {

View File

@ -416,7 +416,17 @@ 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);
RouteUtil.forwardLiveAudienceActivity(liveBean, 0, 0, 0); new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
}
@Override
public void onCheckError(String contextError) {
}
});
} else { } else {
RouteUtil.forwardUserHome(mContext, event.getLiveuid(), 0); RouteUtil.forwardUserHome(mContext, event.getLiveuid(), 0);

View File

@ -785,6 +785,11 @@ public class UserHomeViewHolder2 extends AbsLivePageViewHolder implements LiveSh
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk)); RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk));
} }
} }
@Override
public void onCheckError(String contextError) {
}
}); });
} }
} }