合并接口第一次上传
This commit is contained in:
@@ -51,7 +51,7 @@ import com.yunbao.live.bean.LiveGuardInfo;
|
||||
import com.yunbao.live.bean.LiveLuckGiftWinBean;
|
||||
import com.yunbao.live.bean.LivePKUserListBean;
|
||||
import com.yunbao.live.bean.LiveReceiveGiftBean;
|
||||
import com.yunbao.live.bean.LiveUserGiftBean;
|
||||
import com.yunbao.common.bean.LiveUserGiftBean;
|
||||
import com.yunbao.live.dialog.GiftPrizePoolFragment;
|
||||
import com.yunbao.live.dialog.LiveChatRoomDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveFansFragment;
|
||||
|
||||
@@ -170,15 +170,14 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
L.e(TAG, "直播sdk----->" + (mLiveSDK == Constants.LIVE_SDK_KSY ? "金山云" : "腾讯云"));
|
||||
mLiveType = intent.getIntExtra(Constants.LIVE_TYPE, Constants.LIVE_TYPE_NORMAL);
|
||||
mLiveTypeVal = intent.getIntExtra(Constants.LIVE_TYPE_VAL, 0);
|
||||
initView();
|
||||
setVolumeControlStream(AudioManager.STREAM_MUSIC);
|
||||
manager = new PortraitLiveManager(this, intent);
|
||||
mLiveBean = intent.getParcelableExtra(Constants.LIVE_BEAN);
|
||||
mLiveUid = mLiveBean.getUid();
|
||||
mStream = mLiveBean.getStream();
|
||||
setVolumeControlStream(AudioManager.STREAM_MUSIC);
|
||||
manager = new PortraitLiveManager(this, intent);
|
||||
initView();
|
||||
initData();
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化界面
|
||||
*/
|
||||
@@ -303,11 +302,42 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
private Runnable liveRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
AnchorRecommendItemModel data = itemModelList.get(mCurrentPage);
|
||||
new LiveRoomCheckLivePresenter(mContext, data.getUid(), data.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
|
||||
@Override
|
||||
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
|
||||
|
||||
try {
|
||||
mLiveSDK = Integer.parseInt(liveSdk);
|
||||
mLiveTypeVal = Integer.parseInt(liveTypeVal);
|
||||
} catch (NumberFormatException e) {
|
||||
mLiveSDK = 0;
|
||||
mLiveTypeVal = 0;
|
||||
}
|
||||
mLiveType = liveType;
|
||||
String json = GsonUtils.toJson(data);
|
||||
mLiveBean = GsonUtils.fromJson(json, LiveBean.class);
|
||||
mLiveBean.setUserNiceName(data.getUserNicename());
|
||||
mLiveUid = mLiveBean.getUid();
|
||||
mStream = mLiveBean.getStream();
|
||||
mAncherName = mLiveBean.getUserNiceName();
|
||||
mAncherIcon = mLiveBean.getAvatar();
|
||||
Log.e(TAG, "mLiveUid--------------------------->" + mLiveUid);
|
||||
//加载当前页面数据
|
||||
View rootView = manager.getRootView();
|
||||
if (rootView.getParent() != null && rootView.getParent() instanceof ViewGroup) {
|
||||
((ViewGroup) (rootView.getParent())).removeView(rootView);
|
||||
manager.onRemove(false);
|
||||
}
|
||||
mViewGroup.addView(manager.getRootView());
|
||||
|
||||
manager.onAdd(mLiveBean, liveType, mLiveTypeVal, mLiveSDK);
|
||||
//加载完页面后再后台静默下载礼物svga
|
||||
downloadAllGift();
|
||||
over();
|
||||
}
|
||||
});
|
||||
|
||||
//获取直播间状态
|
||||
LiveHttpUtil.getLiveInfo(data.getUid(), liveInfo);
|
||||
|
||||
}
|
||||
};
|
||||
@@ -315,51 +345,50 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
/**
|
||||
* 获取直播间状态
|
||||
*/
|
||||
private HttpCallback liveInfo = 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(mContext, (liveBean1, liveType, liveTypeVal, liveSdk) -> {
|
||||
//主播正在直播
|
||||
if (liveBean1 == null) {
|
||||
return;
|
||||
}
|
||||
runOnUiThread(() -> {
|
||||
mLiveSDK = liveSdk;
|
||||
mLiveType = liveType;
|
||||
mLiveTypeVal = liveTypeVal;
|
||||
mLiveBean = liveBean1;
|
||||
mLiveUid = liveBean1.getUid();
|
||||
mStream = liveBean1.getStream();
|
||||
mAncherName = liveBean1.getUserNiceName();
|
||||
mAncherIcon = liveBean1.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(liveBean1, liveType, liveTypeVal, liveSdk);
|
||||
//加载完页面后再后台静默下载礼物svga
|
||||
downloadAllGift();
|
||||
over();
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
mCheckLivePresenter.checkLive(liveBean);
|
||||
} else {
|
||||
//主播未直播时自动下滑至下一个直播间
|
||||
verticalViewPager.setCurrentItem(mCurrentPage + 1);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// private HttpCallback liveInfo = 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(mContext, (liveBean1, liveType, liveTypeVal, liveSdk) -> {
|
||||
// //主播正在直播
|
||||
// if (liveBean1 == null) {
|
||||
// return;
|
||||
// }
|
||||
// runOnUiThread(() -> {
|
||||
// mLiveSDK = liveSdk;
|
||||
// mLiveType = liveType;
|
||||
// mLiveTypeVal = liveTypeVal;
|
||||
// mLiveBean = liveBean1;
|
||||
// mLiveUid = liveBean1.getUid();
|
||||
// mStream = liveBean1.getStream();
|
||||
// mAncherName = liveBean1.getUserNiceName();
|
||||
// mAncherIcon = liveBean1.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(liveBean1, liveType, liveTypeVal, liveSdk);
|
||||
// //加载完页面后再后台静默下载礼物svga
|
||||
// downloadAllGift();
|
||||
// over();
|
||||
// });
|
||||
//
|
||||
//
|
||||
// });
|
||||
//
|
||||
// mCheckLivePresenter.checkLive(liveBean);
|
||||
// } else {
|
||||
// //主播未直播时自动下滑至下一个直播间
|
||||
// verticalViewPager.setCurrentItem(mCurrentPage + 1);
|
||||
// }
|
||||
// }
|
||||
// };
|
||||
private void over() {
|
||||
if ("NEWUSER".equals(getIntent().getStringExtra("OPEN"))) {
|
||||
Intent intent = getIntent();
|
||||
@@ -529,21 +558,30 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
manager.onPause();
|
||||
if (manager != null) {
|
||||
manager.onPause();
|
||||
}
|
||||
|
||||
GiftCacheUtil.getInstance().pause();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
manager.onStop();
|
||||
if (manager != null) {
|
||||
manager.onStop();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 点亮
|
||||
*/
|
||||
public void light() {
|
||||
manager.light();
|
||||
if (manager != null) {
|
||||
manager.light();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -551,21 +589,24 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
* 计时收费更新主播映票数
|
||||
*/
|
||||
public void roomChargeUpdateVotes() {
|
||||
manager.sendUpdateVotesMessage();
|
||||
if (manager != null)
|
||||
manager.sendUpdateVotesMessage();
|
||||
}
|
||||
|
||||
/**
|
||||
* 暂停播放
|
||||
*/
|
||||
public void pausePlay() {
|
||||
manager.pausePlay();
|
||||
if (manager != null)
|
||||
manager.pausePlay();
|
||||
}
|
||||
|
||||
/**
|
||||
* 恢复播放
|
||||
*/
|
||||
public void resumePlay() {
|
||||
manager.resumePlay();
|
||||
if (manager != null)
|
||||
manager.resumePlay();
|
||||
}
|
||||
|
||||
public CountDownTimer getCountDownTimer() {
|
||||
@@ -576,7 +617,8 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
* 充值成功
|
||||
*/
|
||||
public void onChargeSuccess() {
|
||||
manager.onChargeSuccess();
|
||||
if (manager != null)
|
||||
manager.onChargeSuccess();
|
||||
}
|
||||
|
||||
public void setCoinNotEnough(boolean coinNotEnough) {
|
||||
@@ -663,7 +705,9 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
manager.onResume();
|
||||
if (manager != null) {
|
||||
manager.onResume();
|
||||
}
|
||||
GiftCacheUtil.getInstance().restart();
|
||||
}
|
||||
|
||||
@@ -732,7 +776,7 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
@Override
|
||||
public void goToLive(AnchorRecommendItemModel model) {
|
||||
//获取直播间状态
|
||||
LiveHttpUtil.getLiveInfo(model.getUid(), liveInfo);
|
||||
// LiveHttpUtil.getLiveInfo(model.getUid(), liveInfo);
|
||||
customDrawerPopupView.dismiss();
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ import com.yunbao.live.R;
|
||||
import com.yunbao.live.bean.LiveGuardInfo;
|
||||
import com.yunbao.live.bean.LiveKsyConfigBean;
|
||||
import com.yunbao.live.bean.LiveReceiveGiftBean;
|
||||
import com.yunbao.live.bean.LiveUserGiftBean;
|
||||
import com.yunbao.common.bean.LiveUserGiftBean;
|
||||
import com.yunbao.live.bean.MicUserBean;
|
||||
import com.yunbao.live.dialog.LiveLinkMicListDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveMicAnchorDialogFragment;
|
||||
|
||||
@@ -24,7 +24,7 @@ import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.common.utils.SVGAViewUtils;
|
||||
import com.yunbao.common.views.weight.ClipPathCircleImage;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.bean.LiveUserGiftBean;
|
||||
import com.yunbao.common.bean.LiveUserGiftBean;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
@@ -35,7 +35,7 @@ import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.views.weight.ClipPathCircleImage;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.activity.LiveActivity;
|
||||
import com.yunbao.live.bean.LiveUserGiftBean;
|
||||
import com.yunbao.common.bean.LiveUserGiftBean;
|
||||
import com.yunbao.live.dialog.LiveUserMoreDialogFragment;
|
||||
import com.yunbao.live.utils.LiveTextRender;
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.yunbao.live.bean;
|
||||
|
||||
import com.yunbao.common.bean.LiveUserGiftBean;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/10/12.
|
||||
*/
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
package com.yunbao.live.bean;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/10/27.
|
||||
* 直播间用户列表实体类
|
||||
*/
|
||||
|
||||
public class LiveUserGiftBean extends UserBean {
|
||||
|
||||
private String contribution;
|
||||
private int guardType;
|
||||
private int nub;
|
||||
|
||||
|
||||
|
||||
public int getNub() {
|
||||
return nub;
|
||||
}
|
||||
|
||||
public void setNub(int nub) {
|
||||
this.nub = nub;
|
||||
}
|
||||
|
||||
public String getContribution() {
|
||||
return contribution;
|
||||
}
|
||||
|
||||
public void setContribution(String contribution) {
|
||||
this.contribution = contribution;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否送过礼物
|
||||
*/
|
||||
public boolean hasContribution() {
|
||||
return !TextUtils.isEmpty(this.contribution) && !"0".equals(this.contribution);
|
||||
}
|
||||
|
||||
@JSONField(name = "guard_type")
|
||||
public int getGuardType() {
|
||||
return guardType;
|
||||
}
|
||||
|
||||
@JSONField(name = "guard_type")
|
||||
public void setGuardType(int guardType) {
|
||||
this.guardType = guardType;
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,7 @@ import com.yunbao.live.R;
|
||||
import com.yunbao.live.activity.LiveActivity;
|
||||
import com.yunbao.live.adapter.AnchorUserMicInfoAdapter;
|
||||
import com.yunbao.live.bean.LiveGuardInfo;
|
||||
import com.yunbao.live.bean.LiveUserGiftBean;
|
||||
import com.yunbao.common.bean.LiveUserGiftBean;
|
||||
import com.yunbao.live.bean.MicUserBean;
|
||||
import com.yunbao.live.http.LiveHttpUtil;
|
||||
import com.yunbao.live.utils.LiveImDeletUtil;
|
||||
|
||||
@@ -38,7 +38,7 @@ import com.yunbao.live.activity.LiveActivity;
|
||||
import com.yunbao.live.activity.LiveRyAnchorActivity;
|
||||
import com.yunbao.live.adapter.UserMoreInfoAdapter;
|
||||
import com.yunbao.live.bean.LiveGuardInfo;
|
||||
import com.yunbao.live.bean.LiveUserGiftBean;
|
||||
import com.yunbao.common.bean.LiveUserGiftBean;
|
||||
import com.yunbao.live.http.LiveHttpUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -9,14 +9,17 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.bean.CheckLiveModel;
|
||||
import com.yunbao.common.bean.LiveBean;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.base.CheckLiveCallBack;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
import com.yunbao.common.utils.MD5Util;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.common.bean.LiveBean;
|
||||
import com.yunbao.live.event.LiveAudienceEvent;
|
||||
import com.yunbao.live.http.LiveHttpConsts;
|
||||
import com.yunbao.live.http.LiveHttpUtil;
|
||||
@@ -37,6 +40,83 @@ public class LiveRoomCheckLivePresenter {
|
||||
//搜索页面不提示密码
|
||||
public static boolean isRoom = false;
|
||||
|
||||
/**
|
||||
* 新的检查直播间状态方法
|
||||
*
|
||||
* @param context 上下文
|
||||
* @param liveUid 直播间ID
|
||||
* @param stream
|
||||
*/
|
||||
public LiveRoomCheckLivePresenter(Context context, String liveUid, String stream, NewActionListener actionListener) {
|
||||
LiveNetManager.get(context)
|
||||
.checkLive(liveUid, stream, new CheckLiveCallBack() {
|
||||
@Override
|
||||
public void forwardNormalRoom(CheckLiveModel model) {
|
||||
if (actionListener != null) {
|
||||
actionListener.onLiveRoomChanged(liveUid, stream, model.getType(), model.getTypeVal(), model.getLiveSdk());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forwardPwdRoom(CheckLiveModel model) {
|
||||
DialogUitl.showSimpleInputDialog(mContext, WordUtil.getString(R.string.live_input_password), DialogUitl.INPUT_TYPE_NUMBER_PASSWORD, new DialogUitl.SimpleCallback2() {
|
||||
@Override
|
||||
public void onCancelClick() {
|
||||
if (mContext instanceof Activity) {
|
||||
((Activity) mContext).finish();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
if (TextUtils.isEmpty(content)) {
|
||||
ToastUtil.show(WordUtil.getString(R.string.live_input_password));
|
||||
return;
|
||||
}
|
||||
String password = MD5Util.getMD5(content);
|
||||
if (mLiveTypeMsg.equalsIgnoreCase(password)) {
|
||||
dialog.dismiss();
|
||||
if (actionListener != null) {
|
||||
actionListener.onLiveRoomChanged(liveUid, stream, model.getType(), model.getTypeVal(), model.getLiveSdk());
|
||||
}
|
||||
} else {
|
||||
ToastUtil.show(WordUtil.getString(R.string.live_password_error));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forwardPayRoom(CheckLiveModel model) {
|
||||
DialogUitl.showSimpleDialog(mContext, mLiveTypeMsg, new DialogUitl.SimpleCallback() {
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
LiveHttpUtil.roomCharge(liveUid, stream, new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0) {
|
||||
if (actionListener != null) {
|
||||
actionListener.onLiveRoomChanged(liveUid, stream, model.getType(), model.getTypeVal(), model.getLiveSdk());
|
||||
}
|
||||
} else {
|
||||
ToastUtil.show(msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
Bus.get().post(new LiveAudienceEvent()
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.LIVE_ROOM_EXCEPTION));
|
||||
ToastUtil.show(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public LiveRoomCheckLivePresenter(Context context, ActionListener actionListener) {
|
||||
mContext = context;
|
||||
mActionListener = actionListener;
|
||||
@@ -110,7 +190,7 @@ public class LiveRoomCheckLivePresenter {
|
||||
DialogUitl.showSimpleInputDialog(mContext, WordUtil.getString(R.string.live_input_password), DialogUitl.INPUT_TYPE_NUMBER_PASSWORD, new DialogUitl.SimpleCallback2() {
|
||||
@Override
|
||||
public void onCancelClick() {
|
||||
if(mContext instanceof Activity) {
|
||||
if (mContext instanceof Activity) {
|
||||
((Activity) mContext).finish();
|
||||
}
|
||||
}
|
||||
@@ -194,4 +274,8 @@ public class LiveRoomCheckLivePresenter {
|
||||
public interface ActionListener {
|
||||
void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk);
|
||||
}
|
||||
|
||||
public interface NewActionListener {
|
||||
void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ import com.yunbao.live.bean.LiveGiftPrizePoolWinBean;
|
||||
import com.yunbao.live.bean.LiveLuckGiftWinBean;
|
||||
import com.yunbao.live.bean.LivePKUserListBean;
|
||||
import com.yunbao.live.bean.LiveReceiveGiftBean;
|
||||
import com.yunbao.live.bean.LiveUserGiftBean;
|
||||
import com.yunbao.common.bean.LiveUserGiftBean;
|
||||
import com.yunbao.live.presenter.LiveLinkMicPkPresenter;
|
||||
import com.yunbao.live.views.LivePlayKsyViewHolder;
|
||||
import com.yunbao.live.views.LivePushTxViewHolder;
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.yunbao.live.bean.LiveGiftPrizePoolWinBean;
|
||||
import com.yunbao.live.bean.LiveLuckGiftWinBean;
|
||||
import com.yunbao.live.bean.LivePKUserListBean;
|
||||
import com.yunbao.live.bean.LiveReceiveGiftBean;
|
||||
import com.yunbao.live.bean.LiveUserGiftBean;
|
||||
import com.yunbao.common.bean.LiveUserGiftBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -19,12 +19,14 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.blankj.utilcode.util.GsonUtils;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.bean.AiAutomaticSpeechModel;
|
||||
import com.yunbao.common.bean.FansMedalBean;
|
||||
import com.yunbao.common.bean.LinkMicUserBean;
|
||||
import com.yunbao.common.bean.LiveUserGiftBean;
|
||||
import com.yunbao.common.bean.MsgModel;
|
||||
import com.yunbao.common.bean.PkRankBean;
|
||||
import com.yunbao.common.bean.SocketModel;
|
||||
@@ -47,7 +49,6 @@ import com.yunbao.live.bean.LiveGiftPrizePoolWinBean;
|
||||
import com.yunbao.live.bean.LiveLuckGiftWinBean;
|
||||
import com.yunbao.live.bean.LivePKUserListBean;
|
||||
import com.yunbao.live.bean.LiveReceiveGiftBean;
|
||||
import com.yunbao.live.bean.LiveUserGiftBean;
|
||||
import com.yunbao.live.event.LiveAudienceEvent;
|
||||
import com.yunbao.live.views.LiveEndViewHolder;
|
||||
import com.yunbao.live.views.LivePlayKsyViewHolder;
|
||||
@@ -174,7 +175,7 @@ public class SocketRyClient {
|
||||
LiveRoomViewHolder.updataMicList(mic_data.getJSONArray("userlist"));
|
||||
EventBus.getDefault().post(new LiveAudienceEvent()
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.LINK_MIC_UPDATE_MIC_LIST)
|
||||
.setObject(JSONArray.parseArray(mic_data.getJSONArray("userlist").toString(),LinkMicUserBean.class))
|
||||
.setObject(JSONArray.parseArray(mic_data.getJSONArray("userlist").toString(), LinkMicUserBean.class))
|
||||
);
|
||||
} else if (actions == 6) {
|
||||
ToastUtil.show("主播已關閉當前語音連麥功能");
|
||||
@@ -183,12 +184,12 @@ public class SocketRyClient {
|
||||
} else if (actions == 8) {
|
||||
ToastUtil.show("您已被移出多人語音連麥");
|
||||
EventBus.getDefault().post("endMic");
|
||||
}else if(actions==3){
|
||||
} else if (actions == 3) {
|
||||
Bus.get().post(new LiveAudienceEvent()
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.LINK_MIC)
|
||||
.setObject(map.toJavaObject(LinkMicUserBean.class))
|
||||
);
|
||||
}else if (actions==7){//取消连麦
|
||||
} else if (actions == 7) {//取消连麦
|
||||
EventBus.getDefault().post(new LiveAudienceEvent()
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.LINK_MIC_CANCEL)
|
||||
.setObject(map.toJavaObject(LinkMicUserBean.class))
|
||||
@@ -199,7 +200,8 @@ public class SocketRyClient {
|
||||
mListener.onUpUserList(map.getJSONObject("ct"));
|
||||
EventBus.getDefault().post(new LiveAudienceEvent()
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.LINK_MIC_UPDATE_AUDIENCE_LIST)
|
||||
.setObject(JSON.parseArray(map.getJSONObject("ct").getString("userlist"), LiveUserGiftBean.class))
|
||||
.setObject( GsonUtils.fromJson(map.getJSONObject("ct").getString("userlist"), new TypeToken<List<LiveUserGiftBean>>() {
|
||||
}.getType()))
|
||||
);
|
||||
break;
|
||||
case Constants.CARD:
|
||||
@@ -537,9 +539,9 @@ public class SocketRyClient {
|
||||
.setMsgModel(GsonUtils.fromJson(map.getJSONObject("ct").toString(), MsgModel.class)));
|
||||
break;
|
||||
case Constants.PK_RANK_UPDATE:
|
||||
Log.i("PK排位",map.toString());
|
||||
JSONObject item=map.getJSONObject("ct");
|
||||
PkRankBean pkRankBean=new PkRankBean();
|
||||
Log.i("PK排位", map.toString());
|
||||
JSONObject item = map.getJSONObject("ct");
|
||||
PkRankBean pkRankBean = new PkRankBean();
|
||||
pkRankBean.setId(Integer.parseInt(item.getString("new_rank_id")));
|
||||
pkRankBean.setName(item.getString("new_rank_name"));
|
||||
pkRankBean.setImg(item.getString("new_rank_img"));
|
||||
@@ -708,7 +710,7 @@ public class SocketRyClient {
|
||||
mListener.onChat(chatBean, 1);
|
||||
} else if ("0".equals(msgtype)) {//用户进入房间
|
||||
JSONObject obj = JSON.parseObject(map.getString("ct"));
|
||||
LiveUserGiftBean u = JSON.toJavaObject(obj, LiveUserGiftBean.class);
|
||||
LiveUserGiftBean u = GsonUtils.fromJson(obj.toJSONString(), LiveUserGiftBean.class);
|
||||
UserBean.Vip vip = new UserBean.Vip();
|
||||
int vipType = obj.getIntValue("vip_type");
|
||||
vip.setType(vipType);
|
||||
@@ -751,6 +753,7 @@ public class SocketRyClient {
|
||||
chatBean.setBubbleSrc(obj.getString("bubbleSrc"));//氣泡
|
||||
//增加粉丝徽章信息
|
||||
chatBean.setMedalNmae(obj.getString("medal_name"));
|
||||
chatBean.setUserNiceName(obj.getString("user_nicename"));//名字
|
||||
FansMedalBean fansMedalBean = CommonAppConfig.getInstance().getAnchorFansMedal(obj.getIntValue("medal_level"));
|
||||
if (fansMedalBean != null)
|
||||
chatBean.setMedalLevelImageUrl(fansMedalBean.getThumb());
|
||||
@@ -1024,13 +1027,13 @@ public class SocketRyClient {
|
||||
break;
|
||||
case 2://收到对方主播PK回调
|
||||
mListener.onLinkMicToPk(map.getString("uid"), map.getString("pkhead"), map.getString("pkname"));
|
||||
mListener.onLinkMicPkStart(map.getString("uid"), map.getString("pkhead"), map.getString("pkname"),map.getString("is_ladders"));// mListener.onLinkMicPkStart(map.getString("uid"));
|
||||
mListener.onLinkMicPkStart(map.getString("uid"), map.getString("pkhead"), map.getString("pkname"), map.getString("is_ladders"));// mListener.onLinkMicPkStart(map.getString("uid"));
|
||||
break;
|
||||
case 3://对方主播拒绝PK的回调
|
||||
mListener.onLinkMicPkRefuse();
|
||||
break;
|
||||
case 4://所有人收到PK开始址的回调
|
||||
mListener.onLinkMicPkStart(map.getString("pkuid"), map.getString("pkhead"), map.getString("pkname"),map.getString("is_ladders"));
|
||||
mListener.onLinkMicPkStart(map.getString("pkuid"), map.getString("pkhead"), map.getString("pkname"), map.getString("is_ladders"));
|
||||
break;
|
||||
case 5://PK时候断开连麦的回调
|
||||
if (rtcRoom != null) {
|
||||
@@ -1071,7 +1074,7 @@ public class SocketRyClient {
|
||||
msg1.put("pkuid", CommonAppConfig.getInstance().getUid());
|
||||
msg1.put("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName());
|
||||
msg1.put("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatar());
|
||||
if(rtcRoom==null){
|
||||
if (rtcRoom == null) {
|
||||
return;
|
||||
}
|
||||
rtcRoom.getLocalUser().requestJoinOtherRoom(map.getString("uid"), map.getString("uid"), true, msg1.toString(), new IRCRTCResultCallback() {
|
||||
|
||||
@@ -39,6 +39,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.blankj.utilcode.util.GsonUtils;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.DataSource;
|
||||
import com.bumptech.glide.load.engine.GlideException;
|
||||
@@ -46,6 +47,7 @@ import com.bumptech.glide.load.resource.gif.GifDrawable;
|
||||
import com.bumptech.glide.request.RequestListener;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.bumptech.glide.request.target.Target;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.makeramen.roundedimageview.RoundedImageView;
|
||||
import com.ms.banner.Banner;
|
||||
import com.ms.banner.BannerConfig;
|
||||
@@ -59,14 +61,18 @@ import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.activity.AbsActivity;
|
||||
import com.yunbao.common.bean.AiAutomaticSpeechModel;
|
||||
import com.yunbao.common.bean.BannerBean;
|
||||
import com.yunbao.common.bean.GuardUserModel;
|
||||
import com.yunbao.common.bean.HourRank;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.bean.LevelBean;
|
||||
import com.yunbao.common.bean.LiveBean;
|
||||
import com.yunbao.common.bean.LiveGiftBean;
|
||||
import com.yunbao.common.bean.LiveRoomActivityBanner;
|
||||
import com.yunbao.common.bean.LiveUserGiftBean;
|
||||
import com.yunbao.common.bean.MsgModel;
|
||||
import com.yunbao.common.bean.NewLevelModel;
|
||||
import com.yunbao.common.bean.PkRankBean;
|
||||
import com.yunbao.common.bean.RankHourModel;
|
||||
import com.yunbao.common.bean.StarChallengeStatusModel;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
@@ -112,7 +118,6 @@ import com.yunbao.live.bean.LiveGiftPrizePoolWinBean;
|
||||
import com.yunbao.live.bean.LiveLuckGiftWinBean;
|
||||
import com.yunbao.live.bean.LivePKUserListBean;
|
||||
import com.yunbao.live.bean.LiveReceiveGiftBean;
|
||||
import com.yunbao.live.bean.LiveUserGiftBean;
|
||||
import com.yunbao.live.bean.LiveWishlistBean;
|
||||
import com.yunbao.live.bean.WishlistItemModel;
|
||||
import com.yunbao.live.custom.LiveLightView;
|
||||
@@ -313,6 +318,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
private TextView mRedVal, mBlueVal;
|
||||
private String pkUid = "";
|
||||
|
||||
//接口整合新加参数
|
||||
private GuardUserModel guardUserModel;
|
||||
|
||||
public LiveRoomViewHolder(boolean isRys, int forActivity, Context context, ViewGroup parentView, GifImageView gifImageView, SVGAImageView svgaImageView, ViewGroup liveGiftPrizePoolContainer, WindowManager windowManager) {
|
||||
super(context, parentView);
|
||||
Contexts = context;
|
||||
@@ -1145,8 +1153,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
msgLayout.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
public void addWishList(BannerBean bannerModel) {
|
||||
mBannerList2.add(bannerModel);
|
||||
/**
|
||||
* 添加心愿单轮播he活动
|
||||
*/
|
||||
public void addWishListActivity(List<BannerBean> bannerModels) {
|
||||
mBannerList2.addAll(bannerModels);
|
||||
if (mBanner2.isStart()) {
|
||||
mBanner2.update(mBannerList2);
|
||||
} else {
|
||||
@@ -1476,6 +1487,49 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
});
|
||||
}
|
||||
|
||||
public void initHourRank(RankHourModel model) {
|
||||
ViewFlipper flipper = (ViewFlipper) findViewById(R.id.hour_rank_list);
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(DpUtil.dp2px(44), DpUtil.dp2px(16));
|
||||
LinearLayout.LayoutParams textParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
textParams.leftMargin = DpUtil.dp2px(5);
|
||||
View hotView = LayoutInflater.from(mContext).inflate(R.layout.view_wish_list, null);
|
||||
View hourView = LayoutInflater.from(mContext).inflate(R.layout.view_wish_list, null);
|
||||
ImageView hotPic = hotView.findViewById(R.id.wish_pic);
|
||||
ImageView hourPic = hourView.findViewById(R.id.wish_pic);
|
||||
mHotText = hotView.findViewById(R.id.wish_index);
|
||||
mHourRank = hourView.findViewById(R.id.wish_index);
|
||||
mHotText.setText("0");
|
||||
mHotText.setLayoutParams(textParams);
|
||||
mHourRank.setLayoutParams(textParams);
|
||||
mHotText.setGravity(Gravity.CENTER);
|
||||
mHourRank.setGravity(Gravity.CENTER);
|
||||
setHourRankData(Long.parseLong(model.getRank()));
|
||||
hotPic.setImageResource(WordUtil.isZh() ? R.drawable.live_tags_hot : R.drawable.live_tags_hot_en);
|
||||
hourPic.setImageResource(WordUtil.isZh() ? R.drawable.live_tags_hour_list : R.drawable.live_tags_hour_list_en);
|
||||
hotPic.setLayoutParams(params);
|
||||
hourPic.setLayoutParams(params);
|
||||
flipper.addView(hotView);
|
||||
flipper.addView(hourView);
|
||||
flipper.startFlipping();
|
||||
flipper.setOnClickListener(view -> {
|
||||
Bundle bundle = new Bundle();
|
||||
String path = model.getHourchartH5Url();
|
||||
if (!path.startsWith("/")) {
|
||||
path = "/" + path;
|
||||
}
|
||||
String url = CommonAppConfig.HOST + path;
|
||||
url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token="
|
||||
+ CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid;
|
||||
bundle.putString("url", url);
|
||||
bundle.putInt("height", DpUtil.dp2px(500));
|
||||
bundle.putInt("show_type", 0);
|
||||
bundle.putString("roomId", mLiveUid);
|
||||
LiveHDDialogFragment liveHDDialogFragment = new LiveHDDialogFragment();
|
||||
liveHDDialogFragment.setArguments(bundle);
|
||||
liveHDDialogFragment.show(((AbsActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment");
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化小时榜
|
||||
*/
|
||||
@@ -2068,6 +2122,23 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 接口整合守护展示
|
||||
*
|
||||
* @param model
|
||||
*/
|
||||
public void setGuardIcon(GuardUserModel model) {
|
||||
if (model != null && !TextUtils.isEmpty(model.getGuardUserAvatar())) {
|
||||
guardUserModel = model;
|
||||
ViewGroup.LayoutParams params = userGuard.getLayoutParams();
|
||||
params.height = DpUtil.dp2px(30);
|
||||
params.width = DpUtil.dp2px(30);
|
||||
userGuard.setLayoutParams(params);
|
||||
ImgLoader.displayAvatar(mContext, model.getGuardUserAvatar(), userGuard);
|
||||
gift_svga.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 守护信息发生变化
|
||||
@@ -2403,7 +2474,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
* 刷新用户列表
|
||||
*/
|
||||
public void refreshUserList(JSONObject obj) {
|
||||
List<LiveUserGiftBean> list = JSON.parseArray(obj.getString("userlist"), LiveUserGiftBean.class);
|
||||
List<LiveUserGiftBean> list = GsonUtils.fromJson(obj.getString("userlist"), new TypeToken<List<LiveUserGiftBean>>() {
|
||||
}.getType());
|
||||
mLiveUserAdapter.refreshList(list);
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,10 @@ import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.bean.AiAutomaticSpeechModel;
|
||||
import com.yunbao.common.bean.BannerBean;
|
||||
import com.yunbao.common.bean.EnterRoomNewModel;
|
||||
import com.yunbao.common.bean.LiveBean;
|
||||
import com.yunbao.common.bean.LiveRoomActivityModel;
|
||||
import com.yunbao.common.bean.LiveUserGiftBean;
|
||||
import com.yunbao.common.bean.MsgModel;
|
||||
import com.yunbao.common.bean.StarChallengeStatusModel;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
@@ -46,6 +49,7 @@ import com.yunbao.common.http.CommonHttpConsts;
|
||||
import com.yunbao.common.http.CommonHttpUtil;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.HttpClient;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
@@ -67,9 +71,7 @@ import com.yunbao.live.bean.LiveGuardInfo;
|
||||
import com.yunbao.live.bean.LiveLuckGiftWinBean;
|
||||
import com.yunbao.live.bean.LivePKUserListBean;
|
||||
import com.yunbao.live.bean.LiveReceiveGiftBean;
|
||||
import com.yunbao.live.bean.LiveUserGiftBean;
|
||||
import com.yunbao.live.bean.OpenParametersModel;
|
||||
import com.yunbao.live.bean.WishlistModel;
|
||||
import com.yunbao.live.dialog.BlowkissDialog;
|
||||
import com.yunbao.live.dialog.NewUserDialog;
|
||||
import com.yunbao.live.event.LinkMicTxAccEvent;
|
||||
@@ -275,46 +277,253 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
mLiveRoomViewHolder.clearGuardIcon();
|
||||
mLiveRoomViewHolder.releaseGift();
|
||||
mLiveRyLinkMicPkPresenter.setLiveUid(data.getUid(), "");
|
||||
|
||||
mLiveRoomViewHolder.setLiveUid(data.getUid());
|
||||
|
||||
mSocketRyClient = new SocketRyClient(mLiveBean.getUid(), PortraitLiveManager.this);
|
||||
if (mLiveLinkMicPresenter != null) {
|
||||
mLiveLinkMicPresenter.setSocketClient(mSocketClient);
|
||||
}
|
||||
//心愿单
|
||||
LiveHttpUtil.getWishList(mLiveBean.getUid(), new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (info.length > 0) {
|
||||
String json = info[0];
|
||||
WishlistModel model = GsonUtils.fromJson(json, WishlistModel.class);
|
||||
if (mLiveRoomViewHolder != null && model != null && model.getWishlist().size() > 0) {
|
||||
BannerBean bannerModel = new BannerBean();
|
||||
bannerModel.setShow_type("2");
|
||||
bannerModel.setLink(CommonAppConfig.HOST + "/index.php");
|
||||
bannerModel.setImageUrl(model.getImg());
|
||||
mLiveRoomViewHolder.addWishList(bannerModel);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
enterRoom();
|
||||
mLiveRoomViewHolder.initHourRankList();
|
||||
mLiveRoomViewHolder.showLiveRoomActivityBanner();
|
||||
enterRoomNew();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void enterRoom() {
|
||||
//进入直播间IM
|
||||
|
||||
|
||||
timeIndex = 0;
|
||||
LiveHttpUtil.enterRoom(mLiveBean.getUid(), mLiveBean.getStream(), new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
isEnterRoom = true;
|
||||
if (code == 0 && info.length > 0) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
|
||||
|
||||
//连接socket
|
||||
LiveHttpUtil.enterBackRoom(mLiveBean.getUid(), mLiveBean.getStream(), new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
//链接上socket以后隐藏Loading加载直播间内容
|
||||
}
|
||||
});
|
||||
if (mLiveRoomViewHolder != null) {
|
||||
LivePlayKsyViewHolder.setLandscape(obj.getIntValue("landscape"));
|
||||
|
||||
mLiveRoomViewHolder.setLiveInfo(mLiveBean.getUid(), mLiveBean.getStream(), obj.getIntValue("userlist_time") * 4000);
|
||||
mLiveRoomViewHolder.setFastMessage(greetings);
|
||||
mLiveRoomViewHolder.setVotes(obj.getString("votestotal"));
|
||||
//真爱排行 数量
|
||||
mLiveRoomViewHolder.setMedaRankNum(obj.getString("medalRankNum"));
|
||||
isattention = obj.getIntValue("isattention");
|
||||
if (isattention == 0) {
|
||||
if (countDownTimer != null) {
|
||||
countDownTimer.cancel();
|
||||
timeIndex = 0;
|
||||
countDownTimer = null;
|
||||
setTime();
|
||||
} else {
|
||||
setTime();
|
||||
}
|
||||
} else {
|
||||
if (countDownTimer != null) {
|
||||
countDownTimer.cancel();
|
||||
countDownTimer = null;
|
||||
}
|
||||
}
|
||||
mLiveAudienceViewHolder.setLiveInfo(mLiveBean.getUid(), mLiveBean.getStream(), mLiveBean.getAvatar(), isattention);
|
||||
mLiveRoomViewHolder.setAttention(isattention);
|
||||
if (obj.containsKey("lminfo")) {
|
||||
JSONObject mic_data = obj.getJSONObject("lminfo");
|
||||
if (mic_data.containsKey("userlist")) {
|
||||
mLiveRoomViewHolder.updataMicList(mic_data.getJSONArray("userlist"));
|
||||
}
|
||||
}
|
||||
List<LiveUserGiftBean> list = JSON.parseArray(obj.getString("userlists"), LiveUserGiftBean.class);
|
||||
mLiveRoomViewHolder.setUserList(list);
|
||||
// resetUserListWidth(list);
|
||||
mLiveRoomViewHolder.startRefreshUserList();
|
||||
if (mLiveType == Constants.LIVE_TYPE_TIME) {//计时收费
|
||||
mLiveRoomViewHolder.startRequestTimeCharge();
|
||||
}
|
||||
}
|
||||
if (leave == 1) {
|
||||
if (LivePlayRyViewHolder.leave != null) {
|
||||
LivePlayRyViewHolder.leave.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
//判断是否有连麦,要显示连麦窗口
|
||||
String linkMicUid = obj.getString("linkmic_uid");
|
||||
String linkMicPull = obj.getString("linkmic_pull");
|
||||
if (!TextUtils.isEmpty(linkMicUid) && !"0".equals(linkMicUid) && !TextUtils.isEmpty(linkMicPull)) {
|
||||
if (mLiveSDK != Constants.LIVE_SDK_TX && mLiveLinkMicPresenter != null) {
|
||||
mLiveLinkMicPresenter.onLinkMicPlay(linkMicUid, linkMicPull);
|
||||
}
|
||||
}
|
||||
//判断是否有主播连麦
|
||||
pkInfo = JSON.parseObject(obj.getString("pkinfo"));
|
||||
if (pkInfo != null && pkInfo.getIntValue("drpk_status") != 1) {
|
||||
String pkUid = pkInfo.getString("pkuid");
|
||||
anyway = "1";
|
||||
if (!TextUtils.isEmpty(pkUid) && !"0".equals(pkUid) && anyway.equals("0")) {
|
||||
if (mLiveSDK != Constants.LIVE_SDK_TX) {
|
||||
String pkPull = pkInfo.getString("pkpull");
|
||||
if (!TextUtils.isEmpty(pkPull) && mLiveLinkMicAnchorPresenter != null) {
|
||||
mLiveLinkMicAnchorPresenter.onLinkMicAnchorPlayUrl(pkUid, pkPull);
|
||||
}
|
||||
} else {
|
||||
if (mLivePlayViewHolder instanceof LivePlayTxViewHolder) {
|
||||
((LivePlayTxViewHolder) mLivePlayViewHolder).setAnchorLinkMic(true, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (obj.getString("isconnection") != null && obj.getString("isconnection").equals("1")) {
|
||||
|
||||
LivePlayRyViewHolder.setViewUP(1);
|
||||
|
||||
}
|
||||
if (pkInfo.getIntValue("ifpk") == 1 && pkInfo.getString("end_pk_time").equals("0")) {//pk开始了
|
||||
|
||||
LivePlayRyViewHolder.setViewUP(2);
|
||||
|
||||
//pk排名数据
|
||||
LivePKUserListBean livePKUserListBean = JSON.parseObject(pkInfo.getString("pk_top_users"), LivePKUserListBean.class);
|
||||
if (mLiveRoomViewHolder != null) {
|
||||
mLiveRoomViewHolder.setOtherInfo(pkInfo.getString("pkuid"), pkInfo.getString("pkuimg"), pkInfo.getString("pkuname"));
|
||||
}
|
||||
mLiveRyLinkMicPkPresenter.onEnterRoomPkStart(pkUid, pkInfo.getLongValue("pk_gift_liveuid"), pkInfo.getLongValue("pk_gift_pkuid"), pkInfo.getIntValue("pk_time"), livePKUserListBean);
|
||||
} else if (!pkInfo.getString("end_pk_time").equals("0")) {
|
||||
|
||||
LivePlayRyViewHolder.setViewUP(3);
|
||||
|
||||
//pk排名数据
|
||||
LivePKUserListBean livePKUserListBean = JSON.parseObject(pkInfo.getString("pk_top_users"), LivePKUserListBean.class);
|
||||
mLiveRyLinkMicPkPresenter.onEnterRoomCFStart(pkUid, pkInfo.getLongValue("pk_gift_liveuid"), pkInfo.getLongValue("pk_gift_pkuid"), pkInfo.getIntValue("end_pk_time"), livePKUserListBean);
|
||||
}
|
||||
//多人PK
|
||||
} else if (pkInfo != null && pkInfo.getIntValue("drpk_status") == 1) {
|
||||
|
||||
LivePlayRyViewHolder.setViewUP(4);
|
||||
|
||||
mLiveRoomViewHolder.UpPkBar(pkInfo.getJSONArray("userlist"), mLiveBean.getUid(), pkInfo.getIntValue("drpk_time"));
|
||||
}
|
||||
|
||||
//守护相关
|
||||
mLiveGuardInfo = new LiveGuardInfo();
|
||||
int guardNum = obj.getIntValue("guard_nums");
|
||||
fansNum = obj.getIntValue("count_fans");
|
||||
is_fans = obj.getString("is_fans") + "";
|
||||
mLiveGuardInfo.setGuardNum(guardNum);
|
||||
JSONObject guardObj = obj.getJSONObject("guard");
|
||||
if (guardObj != null) {
|
||||
mLiveGuardInfo.setMyGuardType(guardObj.getIntValue("type"));
|
||||
mLiveGuardInfo.setMyGuardEndTime(guardObj.getString("endtime"));
|
||||
}
|
||||
Bus.get().post(new LiveAudienceEvent()
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.OPEN_PARAMETERS)
|
||||
.setParametersModel(openParametersModel.setmLiveGuardInfo(mLiveGuardInfo)
|
||||
.setFansNum(fansNum)
|
||||
.setIs_fans(is_fans)));
|
||||
if (mLiveRoomViewHolder != null) {
|
||||
mLiveRoomViewHolder.setGuardNum(guardNum);
|
||||
mLiveRoomViewHolder.setFansNum(fansNum);
|
||||
//红包相关
|
||||
mLiveRoomViewHolder.setRedPackBtnVisible(obj.getIntValue("isred") == 1);
|
||||
}
|
||||
//奖池等级
|
||||
int giftPrizePoolLevel = obj.getIntValue("jackpot_level");
|
||||
if (giftPrizePoolLevel >= 0) {
|
||||
if (mLiveRoomViewHolder != null) {
|
||||
mLiveRoomViewHolder.showPrizePoolLevel(String.valueOf(giftPrizePoolLevel));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 新进入房间接口
|
||||
*/
|
||||
private void enterRoomNew() {
|
||||
LiveNetManager.get(mContext)
|
||||
.enterRoomNew(mLiveBean.getStream(), mLiveBean.getUid(), mLiveBean.getCity(), new com.yunbao.common.http.base.HttpCallback<EnterRoomNewModel>() {
|
||||
@Override
|
||||
public void onSuccess(EnterRoomNewModel data) {
|
||||
//小时榜
|
||||
mLiveRoomViewHolder.initHourRank(data.getRankHour());
|
||||
//守护
|
||||
mLiveRoomViewHolder.setGuardIcon(data.getGuardUserAvatar());
|
||||
//在线列表
|
||||
mLiveRoomViewHolder.setUserList(data.getEnterRoomInfo().getUserlists());
|
||||
List<BannerBean> bannerBeans = new ArrayList<>();
|
||||
//心愿单
|
||||
if (data.getWishList().getWishList().size() > 0) {
|
||||
BannerBean bannerModel = new BannerBean();
|
||||
bannerModel.setShow_type("2");
|
||||
bannerModel.setLink(CommonAppConfig.HOST + "/index.php");
|
||||
bannerModel.setImageUrl(data.getWishList().getImg());
|
||||
bannerBeans.add(bannerModel);
|
||||
}
|
||||
//活动列表
|
||||
if (data.getLiveRoomActivityModels().size() > 0) {
|
||||
|
||||
for (LiveRoomActivityModel model : data.getLiveRoomActivityModels()) {
|
||||
BannerBean bannerModel = new BannerBean();
|
||||
bannerModel.setShow_type(model.getShowType());
|
||||
bannerModel.setStart(false);
|
||||
bannerModel.setLink(model.getLink());
|
||||
bannerModel.setImageUrl(model.getImg());
|
||||
bannerBeans.add(bannerModel);
|
||||
}
|
||||
|
||||
}
|
||||
//底部轮播
|
||||
mLiveRoomViewHolder.addWishListActivity(bannerBeans);
|
||||
//直播间上部轮播【新人特惠】【趣味游戏】【幸运天使】 轮播接口
|
||||
mLiveRoomViewHolder.showLiveRoomActivityBanner();
|
||||
//兼容老接口数据
|
||||
mDanmuPrice = data.getEnterRoomInfo().getBarrageFee();
|
||||
mSocketUserType = Integer.parseInt(data.getEnterRoomInfo().getUsertype());
|
||||
mChatLevel = Integer.parseInt(data.getEnterRoomInfo().getSpeakLimit());
|
||||
mDanMuLevel = Integer.parseInt(data.getEnterRoomInfo().getBarrageLimit());
|
||||
|
||||
leave = Integer.parseInt(data.getEnterRoomInfo().getIsleave());
|
||||
if (!data.getEnterRoomInfo().getGreetings().isEmpty()) {
|
||||
greetings = data.getEnterRoomInfo().getGreetings();
|
||||
}
|
||||
if (!TextUtils.isEmpty(data.getEnterRoomInfo().getLiveBg())) {
|
||||
if (liveBg == 0) {
|
||||
|
||||
//直播间背景
|
||||
ImgLoader.display(mContext, R.mipmap.live_bg, liveBack);
|
||||
mask.setVisibility(View.GONE);
|
||||
}
|
||||
} else {
|
||||
liveBg = -1;
|
||||
}
|
||||
//回传参数
|
||||
Bus.get().post(new LiveAudienceEvent()
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.OPEN_PARAMETERS)
|
||||
.setParametersModel(openParametersModel.setmDanmuPrice(mDanmuPrice)
|
||||
.setmSocketUserType(mSocketUserType)
|
||||
.setmChatLevel(mChatLevel)
|
||||
.setmDanMuLevel(mDanMuLevel)
|
||||
.setLiveBg(liveBg)));
|
||||
//加入房间发送Im消息
|
||||
LiveNetManager.get(mContext).userJoinRoomNew(mLiveBean.getStream(), mLiveBean.getUid());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(error);
|
||||
//直播间上部轮播【新人特惠】【趣味游戏】【幸运天使】 轮播接口
|
||||
mLiveRoomViewHolder.showLiveRoomActivityBanner();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void removeLiveEnd() {
|
||||
if (mLiveAudienceViewHolder != null) {
|
||||
mLiveAudienceViewHolder.removeFromParent();
|
||||
@@ -1098,186 +1307,6 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
};
|
||||
|
||||
|
||||
private void enterRoom() {
|
||||
//进入直播间IM
|
||||
|
||||
|
||||
timeIndex = 0;
|
||||
LiveHttpUtil.enterRoom(mLiveBean.getUid(), mLiveBean.getStream(), new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
isEnterRoom = true;
|
||||
if (code == 0 && info.length > 0) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
mDanmuPrice = obj.getString("barrage_fee");
|
||||
mSocketUserType = obj.getIntValue("usertype");
|
||||
mChatLevel = obj.getIntValue("speak_limit");
|
||||
mDanMuLevel = obj.getIntValue("barrage_limit");
|
||||
liveBg = obj.getIntValue("live_bg");
|
||||
leave = obj.getInteger("isleave");
|
||||
if (obj.containsKey("greetings")) {
|
||||
greetings = JSONArray.parseArray(obj.getJSONArray("greetings").toJSONString(), String.class);
|
||||
}
|
||||
if (obj.containsKey("live_bg")) {
|
||||
if (liveBg == 0) {
|
||||
|
||||
//直播间背景
|
||||
ImgLoader.display(mContext, R.mipmap.live_bg, liveBack);
|
||||
mask.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
//回传参数
|
||||
Bus.get().post(new LiveAudienceEvent()
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.OPEN_PARAMETERS)
|
||||
.setParametersModel(openParametersModel.setmDanmuPrice(mDanmuPrice)
|
||||
.setmSocketUserType(mSocketUserType)
|
||||
.setmChatLevel(mChatLevel)
|
||||
.setmDanMuLevel(mDanMuLevel)
|
||||
.setLiveBg(liveBg)));
|
||||
|
||||
//连接socket
|
||||
LiveHttpUtil.enterBackRoom(mLiveBean.getUid(), mLiveBean.getStream(), new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
//链接上socket以后隐藏Loading加载直播间内容
|
||||
}
|
||||
});
|
||||
if (mLiveRoomViewHolder != null) {
|
||||
LivePlayKsyViewHolder.setLandscape(obj.getIntValue("landscape"));
|
||||
|
||||
mLiveRoomViewHolder.setLiveInfo(mLiveBean.getUid(), mLiveBean.getStream(), obj.getIntValue("userlist_time") * 4000);
|
||||
mLiveRoomViewHolder.setFastMessage(greetings);
|
||||
mLiveRoomViewHolder.setVotes(obj.getString("votestotal"));
|
||||
//真爱排行 数量
|
||||
mLiveRoomViewHolder.setMedaRankNum(obj.getString("medalRankNum"));
|
||||
isattention = obj.getIntValue("isattention");
|
||||
if (isattention == 0) {
|
||||
if (countDownTimer != null) {
|
||||
countDownTimer.cancel();
|
||||
timeIndex = 0;
|
||||
countDownTimer = null;
|
||||
setTime();
|
||||
} else {
|
||||
setTime();
|
||||
}
|
||||
} else {
|
||||
if (countDownTimer != null) {
|
||||
countDownTimer.cancel();
|
||||
countDownTimer = null;
|
||||
}
|
||||
}
|
||||
mLiveAudienceViewHolder.setLiveInfo(mLiveBean.getUid(), mLiveBean.getStream(), mLiveBean.getAvatar(), isattention);
|
||||
mLiveRoomViewHolder.setAttention(isattention);
|
||||
if (obj.containsKey("lminfo")) {
|
||||
JSONObject mic_data = obj.getJSONObject("lminfo");
|
||||
if (mic_data.containsKey("userlist")) {
|
||||
mLiveRoomViewHolder.updataMicList(mic_data.getJSONArray("userlist"));
|
||||
}
|
||||
}
|
||||
List<LiveUserGiftBean> list = JSON.parseArray(obj.getString("userlists"), LiveUserGiftBean.class);
|
||||
mLiveRoomViewHolder.setUserList(list);
|
||||
// resetUserListWidth(list);
|
||||
mLiveRoomViewHolder.startRefreshUserList();
|
||||
if (mLiveType == Constants.LIVE_TYPE_TIME) {//计时收费
|
||||
mLiveRoomViewHolder.startRequestTimeCharge();
|
||||
}
|
||||
}
|
||||
if (leave == 1) {
|
||||
if (LivePlayRyViewHolder.leave != null) {
|
||||
LivePlayRyViewHolder.leave.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
//判断是否有连麦,要显示连麦窗口
|
||||
String linkMicUid = obj.getString("linkmic_uid");
|
||||
String linkMicPull = obj.getString("linkmic_pull");
|
||||
if (!TextUtils.isEmpty(linkMicUid) && !"0".equals(linkMicUid) && !TextUtils.isEmpty(linkMicPull)) {
|
||||
if (mLiveSDK != Constants.LIVE_SDK_TX && mLiveLinkMicPresenter != null) {
|
||||
mLiveLinkMicPresenter.onLinkMicPlay(linkMicUid, linkMicPull);
|
||||
}
|
||||
}
|
||||
//判断是否有主播连麦
|
||||
pkInfo = JSON.parseObject(obj.getString("pkinfo"));
|
||||
if (pkInfo != null && pkInfo.getIntValue("drpk_status") != 1) {
|
||||
String pkUid = pkInfo.getString("pkuid");
|
||||
anyway = "1";
|
||||
if (!TextUtils.isEmpty(pkUid) && !"0".equals(pkUid) && anyway.equals("0")) {
|
||||
if (mLiveSDK != Constants.LIVE_SDK_TX) {
|
||||
String pkPull = pkInfo.getString("pkpull");
|
||||
if (!TextUtils.isEmpty(pkPull) && mLiveLinkMicAnchorPresenter != null) {
|
||||
mLiveLinkMicAnchorPresenter.onLinkMicAnchorPlayUrl(pkUid, pkPull);
|
||||
}
|
||||
} else {
|
||||
if (mLivePlayViewHolder instanceof LivePlayTxViewHolder) {
|
||||
((LivePlayTxViewHolder) mLivePlayViewHolder).setAnchorLinkMic(true, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (obj.getString("isconnection") != null && obj.getString("isconnection").equals("1")) {
|
||||
|
||||
LivePlayRyViewHolder.setViewUP(1);
|
||||
|
||||
}
|
||||
if (pkInfo.getIntValue("ifpk") == 1 && pkInfo.getString("end_pk_time").equals("0")) {//pk开始了
|
||||
|
||||
LivePlayRyViewHolder.setViewUP(2);
|
||||
|
||||
//pk排名数据
|
||||
LivePKUserListBean livePKUserListBean = JSON.parseObject(pkInfo.getString("pk_top_users"), LivePKUserListBean.class);
|
||||
if (mLiveRoomViewHolder != null) {
|
||||
mLiveRoomViewHolder.setOtherInfo(pkInfo.getString("pkuid"), pkInfo.getString("pkuimg"), pkInfo.getString("pkuname"));
|
||||
}
|
||||
mLiveRyLinkMicPkPresenter.onEnterRoomPkStart(pkUid, pkInfo.getLongValue("pk_gift_liveuid"), pkInfo.getLongValue("pk_gift_pkuid"), pkInfo.getIntValue("pk_time"), livePKUserListBean);
|
||||
} else if (!pkInfo.getString("end_pk_time").equals("0")) {
|
||||
|
||||
LivePlayRyViewHolder.setViewUP(3);
|
||||
|
||||
//pk排名数据
|
||||
LivePKUserListBean livePKUserListBean = JSON.parseObject(pkInfo.getString("pk_top_users"), LivePKUserListBean.class);
|
||||
mLiveRyLinkMicPkPresenter.onEnterRoomCFStart(pkUid, pkInfo.getLongValue("pk_gift_liveuid"), pkInfo.getLongValue("pk_gift_pkuid"), pkInfo.getIntValue("end_pk_time"), livePKUserListBean);
|
||||
}
|
||||
//多人PK
|
||||
} else if (pkInfo != null && pkInfo.getIntValue("drpk_status") == 1) {
|
||||
|
||||
LivePlayRyViewHolder.setViewUP(4);
|
||||
|
||||
mLiveRoomViewHolder.UpPkBar(pkInfo.getJSONArray("userlist"), mLiveBean.getUid(), pkInfo.getIntValue("drpk_time"));
|
||||
}
|
||||
|
||||
//守护相关
|
||||
mLiveGuardInfo = new LiveGuardInfo();
|
||||
int guardNum = obj.getIntValue("guard_nums");
|
||||
fansNum = obj.getIntValue("count_fans");
|
||||
is_fans = obj.getString("is_fans") + "";
|
||||
mLiveGuardInfo.setGuardNum(guardNum);
|
||||
JSONObject guardObj = obj.getJSONObject("guard");
|
||||
if (guardObj != null) {
|
||||
mLiveGuardInfo.setMyGuardType(guardObj.getIntValue("type"));
|
||||
mLiveGuardInfo.setMyGuardEndTime(guardObj.getString("endtime"));
|
||||
}
|
||||
Bus.get().post(new LiveAudienceEvent()
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.OPEN_PARAMETERS)
|
||||
.setParametersModel(openParametersModel.setmLiveGuardInfo(mLiveGuardInfo)
|
||||
.setFansNum(fansNum)
|
||||
.setIs_fans(is_fans)));
|
||||
if (mLiveRoomViewHolder != null) {
|
||||
mLiveRoomViewHolder.setGuardNum(guardNum);
|
||||
mLiveRoomViewHolder.setFansNum(fansNum);
|
||||
//红包相关
|
||||
mLiveRoomViewHolder.setRedPackBtnVisible(obj.getIntValue("isred") == 1);
|
||||
}
|
||||
//奖池等级
|
||||
int giftPrizePoolLevel = obj.getIntValue("jackpot_level");
|
||||
if (giftPrizePoolLevel >= 0) {
|
||||
if (mLiveRoomViewHolder != null) {
|
||||
mLiveRoomViewHolder.showPrizePoolLevel(String.valueOf(giftPrizePoolLevel));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//定时器
|
||||
public CountDownTimer countDownTimer = null;
|
||||
private int timeIndex = 1;
|
||||
|
||||
Reference in New Issue
Block a user