Merge branch 'master' into dev_hour_rank
This commit is contained in:
@@ -6,9 +6,6 @@ import android.content.ClipboardManager;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
@@ -16,9 +13,10 @@ import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.tencent.imsdk.conversation.ConversationManager;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.activity.AbsActivity;
|
||||
@@ -49,15 +47,15 @@ import com.yunbao.live.bean.LivePKUserListBean;
|
||||
import com.yunbao.live.bean.LiveReceiveGiftBean;
|
||||
import com.yunbao.live.bean.LiveUserGiftBean;
|
||||
import com.yunbao.live.dialog.GiftPrizePoolFragment;
|
||||
import com.yunbao.live.dialog.LiveChatListDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveChatRoomDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveFansFragment;
|
||||
import com.yunbao.live.dialog.LiveFansMedalOkDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveGiveHotDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveGuardBuyDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveGuardDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveGiveHotDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveInputDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveMoreDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveNewGuardBuyDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveRedPackListDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveRedPackSendDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveShareDialogFragment;
|
||||
@@ -69,7 +67,6 @@ import com.yunbao.live.presenter.LiveLinkMicAnchorPresenter;
|
||||
import com.yunbao.live.presenter.LiveLinkMicPkPresenter;
|
||||
import com.yunbao.live.presenter.LiveLinkMicPresenter;
|
||||
import com.yunbao.live.presenter.LiveRyLinkMicPkPresenter;
|
||||
import com.yunbao.live.socket.SocketChatUtil;
|
||||
import com.yunbao.live.socket.SocketClient;
|
||||
import com.yunbao.live.socket.SocketMessageListener;
|
||||
import com.yunbao.live.socket.SocketRyChatUtil;
|
||||
@@ -91,8 +88,6 @@ import org.greenrobot.eventbus.ThreadMode;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import io.rong.imkit.utils.RouteUtils;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/10/7.
|
||||
*/
|
||||
@@ -138,7 +133,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
||||
private LiveChatRoomDialogFragment mLiveChatRoomDialogFragment;//私信聊天窗口
|
||||
protected LiveGuardInfo mLiveGuardInfo;
|
||||
private HashSet<DialogFragment> mDialogFragmentSet;
|
||||
public boolean isRy = false;
|
||||
// public static boolean isRy = true;
|
||||
|
||||
@Override
|
||||
protected void main() {
|
||||
@@ -149,7 +144,6 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
||||
EventBus.getDefault().register(this);
|
||||
mImageUtil = new ProcessImageUtil(this);
|
||||
mDialogFragmentSet = new HashSet<>();
|
||||
|
||||
//解压 美颜模型
|
||||
try {
|
||||
CommonAppConfig.VIDEO_TIE_MODEl_PATH = getFilesDir().getAbsolutePath() + "/model";//app安装路径
|
||||
@@ -205,17 +199,17 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
||||
if (!mFirstConnectSocket) {
|
||||
mFirstConnectSocket = true;
|
||||
if (mLiveType == Constants.LIVE_TYPE_PAY || mLiveType == Constants.LIVE_TYPE_TIME) {
|
||||
if (isRy == false) {
|
||||
SocketChatUtil.sendUpdateVotesMessage(mLiveUid, mLiveTypeVal, 1);
|
||||
} else {
|
||||
SocketRyChatUtil.sendUpdateVotesMessage(mLiveUid, mLiveTypeVal, 1);
|
||||
}
|
||||
}
|
||||
if (isRy == false) {
|
||||
SocketChatUtil.getFakeFans(mLiveUid);
|
||||
} else {
|
||||
SocketRyChatUtil.getFakeFans(mLiveUid);
|
||||
// if (isRy == false) {
|
||||
// SocketChatUtil.sendUpdateVotesMessage(mLiveUid, mLiveTypeVal, 1);
|
||||
// } else {
|
||||
SocketRyChatUtil.sendUpdateVotesMessage(mLiveUid, mLiveTypeVal, 1);
|
||||
// }
|
||||
}
|
||||
// if (isRy == false) {
|
||||
// SocketChatUtil.getFakeFans(mLiveUid);
|
||||
// } else {
|
||||
SocketRyChatUtil.getFakeFans(mLiveUid);
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -333,6 +327,8 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onBuyLiangName(LiveReceiveGiftBean bean) {
|
||||
if (mLiveRoomViewHolder != null) {
|
||||
@@ -364,15 +360,15 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
||||
*/
|
||||
@Override
|
||||
public void onSendGiftPk(long leftGift, long rightGift, LivePKUserListBean bean) {
|
||||
if (isRy == false) {
|
||||
if (mLiveLinkMicPkPresenter != null) {
|
||||
mLiveLinkMicPkPresenter.onPkProgressChanged(leftGift, rightGift, bean);
|
||||
}
|
||||
} else {
|
||||
if (mLiveRyLinkMicPkPresenter != null) {
|
||||
mLiveRyLinkMicPkPresenter.onPkProgressChanged(leftGift, rightGift, bean);
|
||||
}
|
||||
// if (isRy == false) {
|
||||
// if (mLiveLinkMicPkPresenter != null) {
|
||||
// mLiveLinkMicPkPresenter.onPkProgressChanged(leftGift, rightGift, bean);
|
||||
// }
|
||||
// } else {
|
||||
if (mLiveRyLinkMicPkPresenter != null) {
|
||||
mLiveRyLinkMicPkPresenter.onPkProgressChanged(leftGift, rightGift, bean);
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -615,21 +611,21 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
||||
*/
|
||||
@Override
|
||||
public void onLinkMicAnchorClose() {
|
||||
if (isRy == false) {
|
||||
if (mLiveLinkMicAnchorPresenter != null) {
|
||||
mLiveLinkMicAnchorPresenter.onLinkMicAnchorClose();
|
||||
}
|
||||
if (mLiveLinkMicPkPresenter != null) {
|
||||
mLiveLinkMicPkPresenter.onLinkMicPkClose(1);
|
||||
}
|
||||
} else {
|
||||
if (mLiveLinkMicAnchorPresenter != null) {
|
||||
mLiveLinkMicAnchorPresenter.onLinkMicAnchorClose();
|
||||
}
|
||||
if (mLiveRyLinkMicPkPresenter != null) {
|
||||
mLiveRyLinkMicPkPresenter.onLinkMicPkClose(1);
|
||||
}
|
||||
// if (isRy == false) {
|
||||
// if (mLiveLinkMicAnchorPresenter != null) {
|
||||
// mLiveLinkMicAnchorPresenter.onLinkMicAnchorClose();
|
||||
// }
|
||||
// if (mLiveLinkMicPkPresenter != null) {
|
||||
// mLiveLinkMicPkPresenter.onLinkMicPkClose(1);
|
||||
// }
|
||||
// } else {
|
||||
if (mLiveLinkMicAnchorPresenter != null) {
|
||||
mLiveLinkMicAnchorPresenter.onLinkMicAnchorClose();
|
||||
}
|
||||
if (mLiveRyLinkMicPkPresenter != null) {
|
||||
mLiveRyLinkMicPkPresenter.onLinkMicPkClose(1);
|
||||
}
|
||||
// }
|
||||
|
||||
|
||||
if (this instanceof LiveAudienceActivity) {
|
||||
@@ -688,40 +684,40 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
||||
@Override
|
||||
public void onLinkMicPkStart(final String pkUid, final String pkhead, final String pkname) {
|
||||
Log.e("ry", "pkUid" + pkUid + "pkhead" + pkhead + "pkname" + pkname);
|
||||
if (isRy == false) {
|
||||
if (mLiveLinkMicPkPresenter != null && mLiveRoomViewHolder != null) {
|
||||
mLiveLinkMicPkPresenter.onLinkMicPkStart(pkUid, pkhead, pkname);
|
||||
Handler handler = new Handler();
|
||||
handler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (mLiveRoomViewHolder != null) {
|
||||
if (mIsAnchor == false) {
|
||||
mLiveRoomViewHolder.setOtherInfo(pkUid, pkhead, pkname);
|
||||
}
|
||||
// if (isRy == false) {
|
||||
// if (mLiveLinkMicPkPresenter != null && mLiveRoomViewHolder != null) {
|
||||
// mLiveLinkMicPkPresenter.onLinkMicPkStart(pkUid, pkhead, pkname);
|
||||
// Handler handler = new Handler();
|
||||
// handler.postDelayed(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// if (mLiveRoomViewHolder != null) {
|
||||
// if (mIsAnchor == false) {
|
||||
// mLiveRoomViewHolder.setOtherInfo(pkUid, pkhead, pkname);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }, 4000);//3秒后执行Runnable中的run方法
|
||||
//
|
||||
// }
|
||||
// } else {
|
||||
if (mLiveRyLinkMicPkPresenter != null && mLiveRoomViewHolder != null) {
|
||||
mLiveRyLinkMicPkPresenter.onLinkMicPkStart(pkUid, 1);
|
||||
Handler handler = new Handler();
|
||||
handler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (mLiveRoomViewHolder != null) {
|
||||
Log.e("tasdsdg", mLiveUid + "1111" + CommonAppConfig.getInstance().getUid());
|
||||
if (!mLiveUid.equals(CommonAppConfig.getInstance().getUid())) {
|
||||
mLiveRoomViewHolder.setOtherInfo(pkUid, pkhead, pkname);
|
||||
}
|
||||
}
|
||||
}, 4000);//3秒后执行Runnable中的run方法
|
||||
}
|
||||
}, 4000);//3秒后执行Runnable中的run方法
|
||||
|
||||
}
|
||||
} else {
|
||||
if (mLiveRyLinkMicPkPresenter != null && mLiveRoomViewHolder != null) {
|
||||
mLiveRyLinkMicPkPresenter.onLinkMicPkStart(pkUid, 1);
|
||||
Handler handler = new Handler();
|
||||
handler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (mLiveRoomViewHolder != null) {
|
||||
Log.e("tasdsdg", mLiveUid + "1111" + CommonAppConfig.getInstance().getUid());
|
||||
if (!mLiveUid.equals(CommonAppConfig.getInstance().getUid())) {
|
||||
mLiveRoomViewHolder.setOtherInfo(pkUid, pkhead, pkname);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 4000);//3秒后执行Runnable中的run方法
|
||||
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
@@ -730,16 +726,16 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
||||
*/
|
||||
@Override
|
||||
public void onLinkMicPkClose(int i) {
|
||||
if (isRy == false) {
|
||||
if (mLiveLinkMicPkPresenter != null) {
|
||||
mLiveLinkMicPkPresenter.onLinkMicPkClose(i);
|
||||
}
|
||||
} else {
|
||||
if (mLiveRyLinkMicPkPresenter != null) {
|
||||
mLiveRyLinkMicPkPresenter.onLinkMicPkClose(i);
|
||||
} else if (mLiveLinkMicPkPresenter != null) {
|
||||
mLiveLinkMicPkPresenter.onLinkMicPkClose(i);
|
||||
}
|
||||
// if (isRy == false) {
|
||||
// if (mLiveLinkMicPkPresenter != null) {
|
||||
// mLiveLinkMicPkPresenter.onLinkMicPkClose(i);
|
||||
// }
|
||||
// } else {
|
||||
if (mLiveRyLinkMicPkPresenter != null) {
|
||||
mLiveRyLinkMicPkPresenter.onLinkMicPkClose(i);
|
||||
} else if (mLiveLinkMicPkPresenter != null) {
|
||||
mLiveLinkMicPkPresenter.onLinkMicPkClose(i);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -772,20 +768,20 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
||||
*/
|
||||
@Override
|
||||
public void onLinkMicPkEnd(String winUid) {
|
||||
if (isRy == false) {
|
||||
if (mLiveLinkMicPkPresenter != null) {
|
||||
mLiveLinkMicPkPresenter.onLinkMicPkEnd(winUid);
|
||||
mLiveRoomViewHolder.setDelOtherInfo();
|
||||
}
|
||||
} else {
|
||||
if (mLiveRyLinkMicPkPresenter != null) {
|
||||
mLiveRyLinkMicPkPresenter.onLinkMicPkEnd(winUid);
|
||||
mLiveRoomViewHolder.setDelOtherInfo();
|
||||
} else if (mLiveLinkMicPkPresenter != null) {
|
||||
mLiveLinkMicPkPresenter.onLinkMicPkEnd(winUid);
|
||||
mLiveRoomViewHolder.setDelOtherInfo();
|
||||
}
|
||||
// if (isRy == false) {
|
||||
// if (mLiveLinkMicPkPresenter != null) {
|
||||
// mLiveLinkMicPkPresenter.onLinkMicPkEnd(winUid);
|
||||
// mLiveRoomViewHolder.setDelOtherInfo();
|
||||
// }
|
||||
// } else {
|
||||
if (mLiveRyLinkMicPkPresenter != null) {
|
||||
mLiveRyLinkMicPkPresenter.onLinkMicPkEnd(winUid);
|
||||
mLiveRoomViewHolder.setDelOtherInfo();
|
||||
} else if (mLiveLinkMicPkPresenter != null) {
|
||||
mLiveLinkMicPkPresenter.onLinkMicPkEnd(winUid);
|
||||
mLiveRoomViewHolder.setDelOtherInfo();
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
@@ -856,20 +852,20 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
||||
* 打开聊天输入框
|
||||
*/
|
||||
public void openChatWindow() {
|
||||
if (mKeyBoardHeightUtil == null) {
|
||||
mKeyBoardHeightUtil = new KeyBoardHeightUtil2(mContext, super.findViewById(android.R.id.content), this);
|
||||
mKeyBoardHeightUtil.start();
|
||||
}
|
||||
if (mLiveRoomViewHolder != null) {
|
||||
mLiveRoomViewHolder.chatScrollToBottom();
|
||||
}
|
||||
LiveInputDialogFragment fragment = new LiveInputDialogFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(Constants.LIVE_DANMU_PRICE, mDanmuPrice);
|
||||
bundle.putString(Constants.COIN_NAME, mCoinName);
|
||||
bundle.putString(Constants.LIVE_UID, mLiveUid);
|
||||
fragment.setArguments(bundle);
|
||||
fragment.show(getSupportFragmentManager(), "LiveInputDialogFragment");
|
||||
if (mKeyBoardHeightUtil == null) {
|
||||
mKeyBoardHeightUtil = new KeyBoardHeightUtil2(mContext, super.findViewById(android.R.id.content), this);
|
||||
mKeyBoardHeightUtil.start();
|
||||
}
|
||||
if (mLiveRoomViewHolder != null) {
|
||||
mLiveRoomViewHolder.chatScrollToBottom();
|
||||
}
|
||||
LiveInputDialogFragment fragment = new LiveInputDialogFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(Constants.LIVE_DANMU_PRICE, mDanmuPrice);
|
||||
bundle.putString(Constants.COIN_NAME, mCoinName);
|
||||
bundle.putString(Constants.LIVE_UID, mLiveUid);
|
||||
fragment.setArguments(bundle);
|
||||
fragment.show(getSupportFragmentManager(), "LiveInputDialogFragment");
|
||||
}
|
||||
|
||||
private void showTaskDialog() {
|
||||
@@ -908,7 +904,6 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 发 弹幕 消息
|
||||
*/
|
||||
@@ -939,11 +934,11 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
||||
onCoinChanged(coin);
|
||||
}
|
||||
String[] data = new String[]{obj.getString("barragetoken")};
|
||||
if (isRy == false) {
|
||||
SocketChatUtil.sendDanmuMessage(mLiveUid, contents);
|
||||
} else {
|
||||
SocketRyChatUtil.sendDanmuMessage(mLiveUid, contents);
|
||||
}
|
||||
// if (isRy == false) {
|
||||
// SocketChatUtil.sendDanmuMessage(mLiveUid, contents);
|
||||
// } else {
|
||||
SocketRyChatUtil.sendDanmuMessage(mLiveUid, contents);
|
||||
// }
|
||||
} else {
|
||||
ToastUtil.show(msg);
|
||||
}
|
||||
@@ -963,20 +958,20 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
||||
}
|
||||
}
|
||||
int guardType = mLiveGuardInfo != null ? mLiveGuardInfo.getMyGuardType() : Constants.GUARD_TYPE_NONE;
|
||||
if (isRy == false) {
|
||||
SocketChatUtil.sendChatMessage(mLiveUid, content, mIsAnchor, mSocketUserType, guardType);
|
||||
} else {
|
||||
SocketRyChatUtil.sendChatMessage(mLiveUid, content, mIsAnchor, mSocketUserType, guardType);
|
||||
}
|
||||
// if (isRy == false) {
|
||||
// SocketChatUtil.sendChatMessage(mLiveUid, content, mIsAnchor, mSocketUserType, guardType);
|
||||
// } else {
|
||||
SocketRyChatUtil.sendChatMessage(mLiveUid, content, mIsAnchor, mSocketUserType, guardType);
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* 发 系统 消息
|
||||
*/
|
||||
public static void sendSystemMessage(String content) {
|
||||
// if(isRy == false) {
|
||||
SocketChatUtil.sendSystemMessage(mLiveUid, content);
|
||||
// }else{
|
||||
// if (isRy == false) {
|
||||
// SocketChatUtil.sendSystemMessage(mLiveUid, content);
|
||||
// } else {
|
||||
SocketRyChatUtil.sendSystemMessage(mLiveUid, content);
|
||||
// }
|
||||
}
|
||||
@@ -988,11 +983,11 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
||||
public void sendGiftMessage(LiveGiftBean giftBean, String giftToken, String ancherName, String by) {
|
||||
int guardType = mLiveGuardInfo != null ? mLiveGuardInfo.getMyGuardType() : Constants.GUARD_TYPE_NONE;
|
||||
|
||||
if (isRy == false) {
|
||||
SocketChatUtil.sendGiftMessage(giftBean.getType(), giftToken, mLiveUid, ancherName, guardType, by);
|
||||
} else {
|
||||
SocketRyChatUtil.sendGiftMessage(giftBean.getType(), giftToken, mLiveUid, ancherName, guardType, by);
|
||||
}
|
||||
// if (isRy == false) {
|
||||
// SocketChatUtil.sendGiftMessage(giftBean.getType(), giftToken, mLiveUid, ancherName, guardType, by);
|
||||
// } else {
|
||||
SocketRyChatUtil.sendGiftMessage(giftBean.getType(), giftToken, mLiveUid, ancherName, guardType, by);
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@@ -1000,33 +995,33 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
||||
* 主播或管理员踢人
|
||||
*/
|
||||
public void kickUser(String toUid, String toName) {
|
||||
if (isRy == false) {
|
||||
SocketChatUtil.sendKickMessage(mLiveUid, toUid, toName);
|
||||
} else {
|
||||
SocketRyChatUtil.sendKickMessage(mLiveUid, toUid, toName);
|
||||
}
|
||||
// if (isRy == false) {
|
||||
// SocketChatUtil.sendKickMessage(mLiveUid, toUid, toName);
|
||||
// } else {
|
||||
SocketRyChatUtil.sendKickMessage(mLiveUid, toUid, toName);
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* 禁言
|
||||
*/
|
||||
public void setShutUp(String toUid, String toName, int type) {
|
||||
if (isRy == false) {
|
||||
SocketChatUtil.sendShutUpMessage(mLiveUid, toUid, toName, type);
|
||||
} else {
|
||||
SocketRyChatUtil.sendShutUpMessage(mLiveUid, toUid, toName, type);
|
||||
}
|
||||
// if (isRy == false) {
|
||||
// SocketChatUtil.sendShutUpMessage(mLiveUid, toUid, toName, type);
|
||||
// } else {
|
||||
SocketRyChatUtil.sendShutUpMessage(mLiveUid, toUid, toName, type);
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置或取消管理员消息
|
||||
*/
|
||||
public void sendSetAdminMessage(int action, String toUid, String toName) {
|
||||
if (isRy == false) {
|
||||
SocketChatUtil.sendSetAdminMessage(mLiveUid, action, toUid, toName);
|
||||
} else {
|
||||
SocketRyChatUtil.sendSetAdminMessage(mLiveUid, action, toUid, toName);
|
||||
}
|
||||
// if (isRy == false) {
|
||||
// SocketChatUtil.sendSetAdminMessage(mLiveUid, action, toUid, toName);
|
||||
// } else {
|
||||
SocketRyChatUtil.sendSetAdminMessage(mLiveUid, action, toUid, toName);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
@@ -1034,22 +1029,22 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
||||
* 超管关闭直播间
|
||||
*/
|
||||
public void superCloseRoom() {
|
||||
if (isRy == false) {
|
||||
SocketChatUtil.superCloseRoom(mLiveUid);
|
||||
} else {
|
||||
SocketRyChatUtil.superCloseRoom(mLiveUid);
|
||||
}
|
||||
// if (isRy == false) {
|
||||
// SocketChatUtil.superCloseRoom(mLiveUid);
|
||||
// } else {
|
||||
SocketRyChatUtil.superCloseRoom(mLiveUid);
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新主播映票数
|
||||
*/
|
||||
public void sendUpdateVotesMessage(int deltaVal) {
|
||||
if (isRy == false) {
|
||||
SocketChatUtil.sendUpdateVotesMessage(mLiveUid, deltaVal);
|
||||
} else {
|
||||
SocketRyChatUtil.sendUpdateVotesMessage(mLiveUid, deltaVal);
|
||||
}
|
||||
// if (isRy == false) {
|
||||
// SocketChatUtil.sendUpdateVotesMessage(mLiveUid, deltaVal);
|
||||
// } else {
|
||||
SocketRyChatUtil.sendUpdateVotesMessage(mLiveUid, deltaVal);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
@@ -1057,20 +1052,20 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
||||
* 发送购买守护成功消息
|
||||
*/
|
||||
public void sendBuyGuardMessage(String votes, int guardNum, int guardType) {
|
||||
if (isRy == false) {
|
||||
SocketChatUtil.sendBuyGuardMessage(mLiveUid, votes, guardNum, guardType);
|
||||
} else {
|
||||
SocketRyChatUtil.sendBuyGuardMessage(mLiveUid, votes, guardNum, guardType);
|
||||
}
|
||||
// if (isRy == false) {
|
||||
// SocketChatUtil.sendBuyGuardMessage(mLiveUid, votes, guardNum, guardType);
|
||||
// } else {
|
||||
SocketRyChatUtil.sendBuyGuardMessage(mLiveUid, votes, guardNum, guardType);
|
||||
// }
|
||||
}
|
||||
|
||||
public void sendBuyGuardMessage2(String votes, int guardNum, int guardType, String ancherName, String liveId) {
|
||||
if (guardType != 1) {
|
||||
if (isRy == false) {
|
||||
SocketChatUtil.sendBuyGuardMessage2(mLiveUid, votes, guardNum, guardType, ancherName, liveId);
|
||||
} else {
|
||||
SocketRyChatUtil.sendBuyGuardMessage2(mLiveUid, votes, guardNum, guardType, ancherName, liveId);
|
||||
}
|
||||
// if (isRy == false) {
|
||||
// SocketChatUtil.sendBuyGuardMessage2(mLiveUid, votes, guardNum, guardType, ancherName, liveId);
|
||||
// } else {
|
||||
SocketRyChatUtil.sendBuyGuardMessage2(mLiveUid, votes, guardNum, guardType, ancherName, liveId);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1078,11 +1073,11 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
||||
* 发送发红包成功消息
|
||||
*/
|
||||
public void sendRedPackMessage() {
|
||||
if (isRy == false) {
|
||||
SocketChatUtil.sendRedPackMessage(mLiveUid);
|
||||
} else {
|
||||
SocketRyChatUtil.sendRedPackMessage(mLiveUid);
|
||||
}
|
||||
// if (isRy == false) {
|
||||
// SocketChatUtil.sendRedPackMessage(mLiveUid);
|
||||
// } else {
|
||||
SocketRyChatUtil.sendRedPackMessage(mLiveUid);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
@@ -1214,7 +1209,6 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 监听关注变化事件
|
||||
*/
|
||||
@@ -1225,6 +1219,9 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
||||
mLiveRoomViewHolder.setAttention(e.getIsAttention());
|
||||
}
|
||||
}
|
||||
if (this instanceof LiveAudienceActivity) {
|
||||
((LiveAudienceActivity) this).onFollowEvent(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1278,14 +1275,14 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
||||
/**
|
||||
* 打开观看列表弹窗
|
||||
*/
|
||||
public void openUserMoreListWindow(int i,boolean isOnly) {
|
||||
public void openUserMoreListWindow(int i, boolean isOnly) {
|
||||
LiveUserMoreDialogFragment fragment = new LiveUserMoreDialogFragment();
|
||||
fragment.setLiveGuardInfo(mLiveGuardInfo);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(Constants.LIVE_UID, mLiveUid);
|
||||
bundle.putString(Constants.STREAM, mStream);
|
||||
bundle.putString("By", i + "");
|
||||
bundle.putBoolean("only",isOnly);
|
||||
bundle.putBoolean("only", isOnly);
|
||||
fragment.setArguments(bundle);
|
||||
fragment.show(getSupportFragmentManager(), "LiveUserMoreDialogFragment");
|
||||
LiveUserMoreDialogFragment.activity = this;
|
||||
@@ -1304,6 +1301,23 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
||||
fragment.show(getSupportFragmentManager(), "LiveHotDialogFragment");
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开购买新版守护的弹窗
|
||||
*/
|
||||
public void openNewBuyGuardWindow() {
|
||||
if (TextUtils.isEmpty(mLiveUid) || TextUtils.isEmpty(mStream) || mLiveGuardInfo == null) {
|
||||
return;
|
||||
}
|
||||
LiveNewGuardBuyDialogFragment fragment = new LiveNewGuardBuyDialogFragment();
|
||||
fragment.setLiveGuardInfo(mLiveGuardInfo);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(Constants.COIN_NAME, mCoinName);
|
||||
bundle.putString(Constants.LIVE_UID, mLiveUid);
|
||||
bundle.putString(Constants.LIVE_ANCHER_NAME, mAncherName);
|
||||
bundle.putString(Constants.STREAM, mStream);
|
||||
fragment.setArguments(bundle);
|
||||
fragment.show(getSupportFragmentManager(), "LiveGuardBuyDialogFragment");
|
||||
}
|
||||
/**
|
||||
* 打开购买守护的弹窗
|
||||
*/
|
||||
|
||||
@@ -4,11 +4,12 @@ import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.lzy.okgo.callback.Callback;
|
||||
@@ -122,7 +123,7 @@ public class LiveAnchorActivity extends LiveActivity implements LiveFunctionClic
|
||||
@Override
|
||||
protected void main() {
|
||||
super.main();
|
||||
isRy = false;
|
||||
// isRy = false;
|
||||
Intent intent = getIntent();
|
||||
mLiveSDK = intent.getIntExtra(Constants.LIVE_SDK, Constants.LIVE_SDK_KSY);
|
||||
mLiveKsyConfigBean = intent.getParcelableExtra(Constants.LIVE_KSY_CONFIG);
|
||||
@@ -170,7 +171,7 @@ public class LiveAnchorActivity extends LiveActivity implements LiveFunctionClic
|
||||
mLiveReadyViewHolder.addToParent();
|
||||
mLiveReadyViewHolder.subscribeActivityLifeCycle();
|
||||
mLiveLinkMicPresenter = new LiveLinkMicPresenter(mContext, mLivePushViewHolder, true, mLiveSDK, mContainer);
|
||||
mLiveLinkMicPresenter.setLiveUid(mLiveUid);
|
||||
// mLiveLinkMicPresenter.setLiveUid(mLiveUid);
|
||||
mLiveLinkMicAnchorPresenter = new LiveLinkMicAnchorPresenter(mContext, mLivePushViewHolder, true, mLiveSDK, mContainer);
|
||||
mLiveLinkMicPkPresenter = new LiveLinkMicPkPresenter(mContext, mLivePushViewHolder, true, mContainer);
|
||||
}
|
||||
@@ -413,7 +414,7 @@ public class LiveAnchorActivity extends LiveActivity implements LiveFunctionClic
|
||||
hasGame = mGameList.size() > 0;
|
||||
}
|
||||
bundle.putBoolean(Constants.HAS_GAME, hasGame);
|
||||
bundle.putBoolean("isRy", false);
|
||||
// bundle.putBoolean("isRy", true);
|
||||
bundle.putBoolean(Constants.OPEN_FLASH, mLivePushViewHolder != null && mLivePushViewHolder.isFlashOpen());
|
||||
fragment.setArguments(bundle);
|
||||
fragment.setFunctionClickListener(this);
|
||||
@@ -507,7 +508,7 @@ public class LiveAnchorActivity extends LiveActivity implements LiveFunctionClic
|
||||
mLiveLinkMicPkPresenter.setLiveUid(mLiveUid, mUrl);
|
||||
mLiveLinkMicPkPresenter.setSelfStream(mStream);
|
||||
}
|
||||
if(mLiveRyLinkMicPkPresenter!=null) {
|
||||
if (mLiveRyLinkMicPkPresenter != null) {
|
||||
mLiveRyLinkMicPkPresenter.setLiveUid(mLiveUid, "");
|
||||
}
|
||||
|
||||
@@ -597,30 +598,30 @@ public class LiveAnchorActivity extends LiveActivity implements LiveFunctionClic
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0) {
|
||||
if (isRy == false) {
|
||||
SocketChatUtil.closeLive(mLiveUid, mSocketClient);
|
||||
|
||||
//断开socket
|
||||
if (mSocketClient != null) {
|
||||
mSocketClient.disConnect();
|
||||
}
|
||||
|
||||
if (LivePushTxViewHolder.mTRTCCloud != null) {
|
||||
|
||||
LivePushTxViewHolder.mTRTCCloud.exitRoom();
|
||||
}
|
||||
|
||||
if (LiveLinkMicPkPresenter.mTRTCCloud1 != null) {
|
||||
LiveLinkMicPkPresenter.mTRTCCloud1.exitRoom();
|
||||
LiveLinkMicPkPresenter.mTRTCCloud1.stopLocalPreview();
|
||||
}
|
||||
if (LivePushTxViewHolder.mTRTCCloud != null) {
|
||||
|
||||
LivePushTxViewHolder.mTRTCCloud.exitRoom();
|
||||
LivePushTxViewHolder.mTRTCCloud.stopLocalPreview();
|
||||
|
||||
}
|
||||
} else {
|
||||
// if (isRy == false) {
|
||||
// SocketChatUtil.closeLive(mLiveUid, mSocketClient);
|
||||
//
|
||||
// //断开socket
|
||||
// if (mSocketClient != null) {
|
||||
// mSocketClient.disConnect();
|
||||
// }
|
||||
//
|
||||
// if (LivePushTxViewHolder.mTRTCCloud != null) {
|
||||
//
|
||||
// LivePushTxViewHolder.mTRTCCloud.exitRoom();
|
||||
// }
|
||||
//
|
||||
// if (LiveLinkMicPkPresenter.mTRTCCloud1 != null) {
|
||||
// LiveLinkMicPkPresenter.mTRTCCloud1.exitRoom();
|
||||
// LiveLinkMicPkPresenter.mTRTCCloud1.stopLocalPreview();
|
||||
// }
|
||||
// if (LivePushTxViewHolder.mTRTCCloud != null) {
|
||||
//
|
||||
// LivePushTxViewHolder.mTRTCCloud.exitRoom();
|
||||
// LivePushTxViewHolder.mTRTCCloud.stopLocalPreview();
|
||||
//
|
||||
// }
|
||||
// } else {
|
||||
// SocketRyChatUtil.closeLive(mLiveUid, mSocketRyClient);
|
||||
//断开socket
|
||||
if (mSocketRyClient != null) {
|
||||
@@ -628,7 +629,7 @@ public class LiveAnchorActivity extends LiveActivity implements LiveFunctionClic
|
||||
}
|
||||
}
|
||||
if (mLiveEndViewHolder == null) {
|
||||
mLiveEndViewHolder = new LiveEndViewHolder(mContext, mRoot,mLiveBean.getUid());
|
||||
mLiveEndViewHolder = new LiveEndViewHolder(mContext, mRoot, mLiveBean.getUid());
|
||||
mLiveEndViewHolder.subscribeActivityLifeCycle();
|
||||
mLiveEndViewHolder.addToParent();
|
||||
mLiveEndViewHolder.showData(mLiveBean, mStream);
|
||||
@@ -644,7 +645,7 @@ public class LiveAnchorActivity extends LiveActivity implements LiveFunctionClic
|
||||
}
|
||||
mLivePushViewHolder = null;
|
||||
mLiveLinkMicPresenter = null;
|
||||
}
|
||||
// }
|
||||
} else {
|
||||
ToastUtil.show(msg);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.yunbao.live.activity;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.media.AudioManager;
|
||||
@@ -30,6 +29,7 @@ import com.yunbao.common.bean.SlideInfoModel;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.dialog.EffectsSettingsDialog;
|
||||
import com.yunbao.common.dialog.LiveChargeDialogFragment;
|
||||
import com.yunbao.common.event.FollowEvent;
|
||||
import com.yunbao.common.http.CommonHttpConsts;
|
||||
import com.yunbao.common.http.CommonHttpUtil;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
@@ -61,28 +61,15 @@ import com.yunbao.live.event.LiveRoomChangeEvent;
|
||||
import com.yunbao.live.http.LiveHttpConsts;
|
||||
import com.yunbao.live.http.LiveHttpUtil;
|
||||
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
|
||||
import com.yunbao.live.socket.SocketSendBean;
|
||||
import com.yunbao.live.utils.LiveImDeletUtil;
|
||||
import com.yunbao.live.views.LiveRoomPlayViewHolder;
|
||||
import com.yunbao.live.views.LoadingView;
|
||||
import com.yunbao.live.views.PortraitLiveManager;
|
||||
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import cn.rongcloud.rtc.api.RCRTCEngine;
|
||||
import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback;
|
||||
import cn.rongcloud.rtc.api.callback.IRCRTCSwitchRoleCallback;
|
||||
import cn.rongcloud.rtc.base.RTCErrorCode;
|
||||
import io.rong.imlib.IRongCallback;
|
||||
import io.rong.imlib.RongIMClient;
|
||||
import io.rong.imlib.model.Conversation;
|
||||
import io.rong.message.TextMessage;
|
||||
|
||||
import static com.yunbao.live.views.LivePlayRyViewHolder.Micing;
|
||||
|
||||
/**
|
||||
@@ -111,7 +98,7 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
public static int fansNum;
|
||||
|
||||
public static ProcessResultUtil mProcessResultUtil;
|
||||
private LiveImDeletUtil liveImDeletUtil;
|
||||
|
||||
public static int isattention;
|
||||
|
||||
private LiveBean mLiveBean;
|
||||
@@ -121,7 +108,7 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
private int mLastPosition = -1;
|
||||
|
||||
private ViewGroup mViewGroup;
|
||||
private LoadingView loadingView;
|
||||
private int liveBg = 0;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -140,7 +127,7 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
Bus.getOn(this);
|
||||
super.main();
|
||||
liveAudienceActivity = this;
|
||||
liveImDeletUtil = new LiveImDeletUtil();
|
||||
|
||||
mProcessResultUtil = new ProcessResultUtil(this);
|
||||
Intent intent = getIntent();
|
||||
mLiveSDK = intent.getIntExtra(Constants.LIVE_SDK, Constants.LIVE_SDK_KSY);
|
||||
@@ -150,11 +137,6 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
mLiveBean = intent.getParcelableExtra(Constants.LIVE_BEAN);
|
||||
mLiveUid = mLiveBean.getUid();
|
||||
mStream = mLiveBean.getStream();
|
||||
if (getIntent().getIntExtra("isry", 0) == 1) {
|
||||
isRy = true;
|
||||
} else {
|
||||
isRy = false;
|
||||
}
|
||||
setVolumeControlStream(AudioManager.STREAM_MUSIC);
|
||||
manager = new PortraitLiveManager(this, intent);
|
||||
initView();
|
||||
@@ -167,8 +149,6 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
private void initView() {
|
||||
// 竖直滑动 ViewPager
|
||||
verticalViewPager = findViewById(R.id.view_pager);
|
||||
loadingView = findViewById(R.id.loading);
|
||||
loadingView.show();
|
||||
}
|
||||
|
||||
public void setBackIndex(int backIndex) {
|
||||
@@ -187,58 +167,47 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
* 初始化数据
|
||||
*/
|
||||
private void initData() {
|
||||
//直播间列表
|
||||
MainNetManager.get(mContext)
|
||||
.anchorRecommend("30", new com.yunbao.common.http.base.HttpCallback<AnchorRecommendModel>() {
|
||||
@Override
|
||||
public void onSuccess(AnchorRecommendModel data) {
|
||||
itemModelList = data.getList();
|
||||
//查询直播间状态
|
||||
int index = -1;
|
||||
for (int i = 0; i < itemModelList.size(); i++) {
|
||||
AnchorRecommendItemModel model = itemModelList.get(i);
|
||||
if (TextUtils.equals(mLiveBean.getUid(), model.getUid())) {
|
||||
index = i;
|
||||
}
|
||||
}
|
||||
if (index > -1) {
|
||||
Collections.swap(itemModelList, index, 0);
|
||||
} else {
|
||||
String json = GsonUtils.toJson(mLiveBean);
|
||||
AnchorRecommendItemModel model = GsonUtils.fromJson(json, AnchorRecommendItemModel.class);
|
||||
itemModelList.add(0, model);
|
||||
}
|
||||
mPagerAdapter = new VerticalPagerAdapter(itemModelList, mContext);
|
||||
verticalViewPager.setAdapter(mPagerAdapter);
|
||||
loadingView.hide();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
String json = GsonUtils.toJson(mLiveBean);
|
||||
AnchorRecommendItemModel model = GsonUtils.fromJson(json, AnchorRecommendItemModel.class);
|
||||
itemModelList.add(0, model);
|
||||
mPagerAdapter = new VerticalPagerAdapter(itemModelList, mContext);
|
||||
verticalViewPager.setAdapter(mPagerAdapter);
|
||||
verticalViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
|
||||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||
mCurrentItem = position;
|
||||
Log.e(TAG, "mCurrentItem:" + mCurrentItem);
|
||||
if (mCurrentItem == itemModelList.size() - 1) {
|
||||
MainNetManager.get(mContext)
|
||||
.anchorRecommend("30", new com.yunbao.common.http.base.HttpCallback<AnchorRecommendModel>() {
|
||||
@Override
|
||||
public void onSuccess(AnchorRecommendModel data) {
|
||||
|
||||
itemModelList.addAll(data.getList());
|
||||
mPagerAdapter.notifyDataSetChanged();
|
||||
}
|
||||
if (Micing == 1) {
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
}
|
||||
});
|
||||
manager.micIngTypeOne(mLiveBean, mLiveType, mLiveTypeVal);
|
||||
verticalViewPager.setEnableScroll(false);
|
||||
} else if (Micing == 2) {
|
||||
verticalViewPager.setEnableScroll(false);
|
||||
manager.micIngTypeTwo(mLiveBean, mLiveType, mLiveTypeVal);
|
||||
|
||||
} else {
|
||||
verticalViewPager.setEnableScroll(true);
|
||||
mCurrentItem = position;
|
||||
Log.e(TAG, "mCurrentItem:" + mCurrentItem);
|
||||
if (mCurrentItem == itemModelList.size() - 1) {
|
||||
MainNetManager.get(mContext)
|
||||
.anchorRecommendType("30", new com.yunbao.common.http.base.HttpCallback<AnchorRecommendModel>() {
|
||||
@Override
|
||||
public void onSuccess(AnchorRecommendModel data) {
|
||||
if (TextUtils.equals(data.getList().get(0).getUid(), mLiveBean.getUid())) {
|
||||
data.getList().remove(0);
|
||||
}
|
||||
itemModelList.addAll(data.getList());
|
||||
mPagerAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -266,7 +235,6 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
|
||||
// 满足此种条件,表明需要加载直播视频,以及聊天室了
|
||||
if (viewGroup.getId() == mCurrentItem && (position == 0) && mCurrentItem != mLastPosition) {
|
||||
|
||||
loadData(viewGroup, mCurrentItem);
|
||||
}
|
||||
}
|
||||
@@ -443,115 +411,15 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
manager.onBackPressed();
|
||||
if (Micing == 1) {
|
||||
DialogUitl.showSimpleDialog(mContext, "您已申請,退出將取消語音連麥申請!", new DialogUitl.SimpleCallback() {
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
Micing = 0;
|
||||
//用户申请联麦
|
||||
final SocketSendBean msg = new SocketSendBean()
|
||||
.param("_method_", Constants.LIAN_MAI)
|
||||
.param("action", 7)
|
||||
.param("uname", CommonAppConfig.getInstance().getUserBean().getUserNiceName())
|
||||
.param("avatar", CommonAppConfig.getInstance().getUserBean().getAvatar())
|
||||
.param("uid", CommonAppConfig.getInstance().getUid());
|
||||
msg.create();
|
||||
|
||||
String targetId = mLiveUid;
|
||||
Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE;
|
||||
TextMessage messageContent = TextMessage.obtain(msg.mResult.toString());
|
||||
io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(targetId, conversationType, messageContent);
|
||||
|
||||
RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
|
||||
@Override
|
||||
public void onAttached(io.rong.imlib.model.Message message) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(io.rong.imlib.model.Message message) {
|
||||
Log.e("ry", "发送成功");
|
||||
liveImDeletUtil.deleteMessages(message.getTargetId(), message.getMessageId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
|
||||
Log.e("ry", "发送失敗" + errorCode.toString());
|
||||
liveImDeletUtil.deleteMessages(message.getTargetId(), message.getMessageId());
|
||||
}
|
||||
});
|
||||
end();
|
||||
}
|
||||
});
|
||||
return;
|
||||
manager.micIngTypeOne(mLiveBean, mLiveType, mLiveTypeVal);
|
||||
} else if (Micing == 2) {
|
||||
DialogUitl.showSimpleDialog(mContext, "連麥中,退出將斷開語音連麥!", new DialogUitl.SimpleCallback() {
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
ToastUtil.show("下麥中,稍等.....");
|
||||
RCRTCEngine.getInstance().getRoom().getLocalUser().switchToAudience(new IRCRTCSwitchRoleCallback() {
|
||||
|
||||
/**
|
||||
* 当切换失败且SDK处于无法回退状态时回调,该角色已经无法使用当前角色继续进行音视频。
|
||||
* SDK内部会退出房间并清理所有资源,该用户只能重新加入房间才能继续音视频。
|
||||
*/
|
||||
@Override
|
||||
public void onKicked() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Log.e("ry", "下麦成功");
|
||||
// 该用户切换为观众成功,可以以观众身份进行音视频
|
||||
//退出多人房间
|
||||
HttpClient.getInstance().get("live.leaveDrLm", "live.leaveDrLm")
|
||||
.params("roomid", LiveActivity.mLiveUid)
|
||||
.execute(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
Log.e("ry", code + "退出多人");
|
||||
|
||||
}
|
||||
});
|
||||
//退出rtc播放
|
||||
RCRTCEngine.getInstance().leaveRoom(new IRCRTCResultCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Log.e("ry", "退出多人房间成功");
|
||||
new Handler(Looper.getMainLooper()).post(new Runnable() {
|
||||
public void run() {
|
||||
Micing = 0;
|
||||
end();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(RTCErrorCode errorCode) {
|
||||
Log.e("ry", errorCode + "退出多人房间失敗");
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 当切换失败且不影响当前角色继续音视频时回调
|
||||
* @param errorCode 失败错误码
|
||||
*/
|
||||
@Override
|
||||
public void onFailed(RTCErrorCode errorCode) {
|
||||
Log.e("ry", "下麦失败" + errorCode);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
return;
|
||||
manager.micIngTypeTwo(mLiveBean, mLiveType, mLiveTypeVal);
|
||||
} else {
|
||||
super.onBackPressed();
|
||||
}
|
||||
end();
|
||||
|
||||
}
|
||||
|
||||
public void end() {
|
||||
@@ -664,20 +532,34 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
fragment.show(getSupportFragmentManager(), "ChatChargeDialogFragment");
|
||||
}
|
||||
|
||||
public void setEnableScroll(boolean enableScroll) {
|
||||
verticalViewPager.setEnableScroll(enableScroll);
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onLiveRoomChangeEvent(LiveRoomChangeEvent e) {
|
||||
LiveBean liveBean = e.getLiveBean();
|
||||
if (liveBean != null) {
|
||||
LiveHttpUtil.cancel(LiveHttpConsts.CHECK_LIVE);
|
||||
LiveHttpUtil.cancel(LiveHttpConsts.ENTER_ROOM);
|
||||
LiveHttpUtil.cancel(LiveHttpConsts.ROOM_CHARGE);
|
||||
manager.onRemove();
|
||||
mLiveType = e.getLiveType();
|
||||
mLiveTypeVal = e.getLiveTypeVal();
|
||||
manager.onAdd(liveBean, mLiveType, mLiveTypeVal, mLiveSDK);
|
||||
if (verticalViewPager.ismEnableScroll()) {
|
||||
LiveBean liveBean = e.getLiveBean();
|
||||
if (liveBean != null) {
|
||||
|
||||
LiveHttpUtil.cancel(LiveHttpConsts.CHECK_LIVE);
|
||||
LiveHttpUtil.cancel(LiveHttpConsts.ENTER_ROOM);
|
||||
LiveHttpUtil.cancel(LiveHttpConsts.ROOM_CHARGE);
|
||||
manager.onRemove();
|
||||
mLiveType = e.getLiveType();
|
||||
mLiveTypeVal = e.getLiveTypeVal();
|
||||
mLiveBean = liveBean;
|
||||
mLiveUid = liveBean.getUid();
|
||||
mStream = liveBean.getStream();
|
||||
mAncherName = liveBean.getUserNiceName();
|
||||
manager.onAdd(liveBean, mLiveType, mLiveTypeVal, mLiveSDK);
|
||||
|
||||
}
|
||||
} else {
|
||||
verticalViewPager.setEnableScroll(true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -698,11 +580,21 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo();
|
||||
switch (event.getType()) {
|
||||
case SIDEBAR:
|
||||
int userIndex = -1;
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if (TextUtils.equals(list.get(i).getUid(), PortraitLiveManager.liveID)) {
|
||||
userIndex = i;
|
||||
}
|
||||
}
|
||||
if (userIndex != -1) {
|
||||
list.remove(userIndex);
|
||||
}
|
||||
//从右边打开侧边栏
|
||||
SidebarLiveAudience sidebarLiveAudience = new SidebarLiveAudience();
|
||||
bundle.putString("Avatar", mLiveBean.getAvatar());
|
||||
bundle.putString("banner", GsonUtils.toJson(slideInfoModels));
|
||||
bundle.putString("list", GsonUtils.toJson(list));
|
||||
bundle.putInt("LiveBg", liveBg);
|
||||
sidebarLiveAudience.setArguments(bundle);
|
||||
sidebarLiveAudience.show(getSupportFragmentManager(), "SidebarLiveAudience");
|
||||
// manager.openDrawer();
|
||||
@@ -773,26 +665,32 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
ZhuangBanActivity.forward(mContext, nobleUrl, false);
|
||||
break;
|
||||
case LIAN_MAI:
|
||||
//获取房间连麦状态
|
||||
HttpClient.getInstance().get("live.getDrLm", "live.getDrLm")
|
||||
.params("uid", mLiveUid, true)
|
||||
.execute(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0) {
|
||||
LiveMicUserDialogFragment fragment = new LiveMicUserDialogFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(Constants.LIVE_UID, mLiveUid);
|
||||
bundle.putString(Constants.STREAM, mStream);
|
||||
bundle.putString("By", "1");
|
||||
fragment.setArguments(bundle);
|
||||
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveUserMoreDialogFragment");
|
||||
LiveMicUserDialogFragment.activity = ((LiveAudienceActivity) mContext);
|
||||
} else {
|
||||
ToastUtil.show(R.string.no_mic_opn);
|
||||
if (event.getMicIng() == 1) {
|
||||
manager.micIngTypeOne(event.getBean(), event.getLiveType(), event.getLiveTypeVal());
|
||||
} else if (event.getMicIng() == 2) {
|
||||
manager.micIngTypeTwo(event.getBean(), event.getLiveType(), event.getLiveTypeVal());
|
||||
} else {
|
||||
//获取房间连麦状态
|
||||
HttpClient.getInstance().get("live.getDrLm", "live.getDrLm")
|
||||
.params("uid", mLiveUid, true)
|
||||
.execute(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0) {
|
||||
LiveMicUserDialogFragment fragment = new LiveMicUserDialogFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(Constants.LIVE_UID, mLiveUid);
|
||||
bundle.putString(Constants.STREAM, mStream);
|
||||
bundle.putString("By", "1");
|
||||
fragment.setArguments(bundle);
|
||||
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveUserMoreDialogFragment");
|
||||
LiveMicUserDialogFragment.activity = ((LiveAudienceActivity) mContext);
|
||||
} else {
|
||||
ToastUtil.show(R.string.no_mic_opn);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
break;
|
||||
case EFFECTS_SETTINGS:
|
||||
EffectsSettingsDialog effectsSettingsDialog = new EffectsSettingsDialog();
|
||||
@@ -821,17 +719,33 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
mLiveTypeVal : event.getParametersModel().getmLiveTypeVal();
|
||||
mLiveGuardInfo = event.getParametersModel().getmLiveGuardInfo() == null ?
|
||||
mLiveGuardInfo : event.getParametersModel().getmLiveGuardInfo();
|
||||
liveBg = TextUtils.equals(String.valueOf(liveBg), String.valueOf(event.getParametersModel().getLiveBg())) ?
|
||||
liveBg : event.getParametersModel().getLiveBg();
|
||||
break;
|
||||
case ACTIVITY_CENTER://活动中心
|
||||
String url = CommonAppConfig.HOST + "/h5/live/hallOfFame/index.html?g=Appapi&m=Turntable&a=tricky";
|
||||
url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token="
|
||||
+ CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid;
|
||||
Log.i("tag", url);
|
||||
Intent intent=new Intent(mContext,ZhuangBanActivity.class);
|
||||
Intent intent = new Intent(mContext, ZhuangBanActivity.class);
|
||||
intent.putExtra("url", url);
|
||||
intent.putExtra("isFull",true);
|
||||
intent.putExtra("isFull", true);
|
||||
mContext.startActivity(intent);
|
||||
break;
|
||||
case LIVE_ROOM_EXCEPTION:
|
||||
//主播未直播时自动下滑至下一个直播间
|
||||
itemModelList.remove(mCurrentPage);
|
||||
mPagerAdapter.notifyDataSetChanged();
|
||||
verticalViewPager.setCurrentItem(mCurrentPage + 1);
|
||||
break;
|
||||
case REFRESH_THE_LIVEl_PAGE:
|
||||
// loadingView.show();
|
||||
// AnchorRecommendItemModel model = event.getAnchorRecommendItemModel();
|
||||
// itemModelList.add(0, model);
|
||||
// mPagerAdapter.notifyDataSetChanged();
|
||||
// verticalViewPager.setCurrentItem(0);
|
||||
getDrawer();
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
@@ -855,7 +769,7 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
intent.putExtra(Constants.LIVE_SDK, liveSdk);
|
||||
intent.putExtra(Constants.LIVE_SDK, liveSdk);
|
||||
intent.putExtra("landscape", liveBean.getLandscape());
|
||||
intent.putExtra("isry", liveBean.getIs_rong());
|
||||
// intent.putExtra("isry", true);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
@@ -866,26 +780,19 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
private List<AnchorRecommendItemModel> list = new ArrayList<>();
|
||||
|
||||
private void getDrawer() {
|
||||
//侧边栏轮播
|
||||
MainNetManager.get(mContext)
|
||||
.getHot(1, new com.yunbao.common.http.base.HttpCallback<List<SlideInfoModel>>() {
|
||||
@Override
|
||||
public void onSuccess(List<SlideInfoModel> data) {
|
||||
slideInfoModels = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
//推荐位
|
||||
MainNetManager.get(mContext)
|
||||
.anchorRecommend("10", new com.yunbao.common.http.base.HttpCallback<AnchorRecommendModel>() {
|
||||
.anchorRecommend("12", new com.yunbao.common.http.base.HttpCallback<AnchorRecommendModel>() {
|
||||
@Override
|
||||
public void onSuccess(AnchorRecommendModel anchorRecommendModel) {
|
||||
list = anchorRecommendModel.getList();
|
||||
list.clear();
|
||||
slideInfoModels.clear();
|
||||
List<AnchorRecommendItemModel> models = anchorRecommendModel.getList();
|
||||
|
||||
models.add(0, new AnchorRecommendItemModel());
|
||||
list.addAll(models);
|
||||
slideInfoModels = anchorRecommendModel.getSlide();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -894,4 +801,7 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
});
|
||||
}
|
||||
|
||||
public void onFollowEvent(FollowEvent e) {
|
||||
manager.onFollowEvent(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
||||
@Override
|
||||
protected void main() {
|
||||
super.main();
|
||||
isRy = true;
|
||||
// isRy = true;
|
||||
Intent intent = getIntent();
|
||||
mLiveSDK = intent.getIntExtra(Constants.LIVE_SDK, Constants.LIVE_SDK_KSY);
|
||||
mLiveKsyConfigBean = intent.getParcelableExtra(Constants.LIVE_KSY_CONFIG);
|
||||
@@ -190,7 +190,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
||||
mLiveReadyViewHolder.addToParent();
|
||||
mLiveReadyViewHolder.subscribeActivityLifeCycle();
|
||||
mLiveLinkMicPresenter = new LiveLinkMicPresenter(mContext, mLivePushViewHolder, true, mLiveSDK, mContainer);
|
||||
mLiveLinkMicPresenter.setLiveUid(mLiveUid);
|
||||
// mLiveLinkMicPresenter.setLiveUid(mLiveUid);
|
||||
mLiveLinkMicAnchorPresenter = new LiveLinkMicAnchorPresenter(mContext, mLivePushViewHolder, true, mLiveSDK, mContainer);
|
||||
mLivePushViewHolder.setLivePushListener(new LivePushListener() {
|
||||
@Override
|
||||
@@ -590,7 +590,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
||||
hasGame = mGameList.size() > 0;
|
||||
}
|
||||
bundle.putBoolean(Constants.HAS_GAME, hasGame);
|
||||
bundle.putBoolean("isRy", true);
|
||||
// bundle.putBoolean("isRy", true);
|
||||
bundle.putBoolean(Constants.OPEN_FLASH, mLivePushViewHolder != null && mLivePushViewHolder.isFlashOpen());
|
||||
fragment.setArguments(bundle);
|
||||
fragment.setFunctionClickListener(this);
|
||||
|
||||
@@ -36,6 +36,9 @@ public class GuardRightAdapter extends RecyclerView.Adapter<GuardRightAdapter.Vh
|
||||
// mColor2 = ContextCompat.getColor(context, R.color.gray3);
|
||||
}
|
||||
|
||||
public void setList(List<GuardRightBean> mList) {
|
||||
this.mList = mList;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
package com.yunbao.live.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.bean.GuardBuyBean;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 守护购买列表适配器
|
||||
*/
|
||||
public class LiveNewGuardBuyItemsAdapter extends RecyclerView.Adapter<LiveNewGuardBuyItemsAdapter.Vh> {
|
||||
|
||||
List<GuardBuyBean> items = new ArrayList<>();
|
||||
private final Context context;
|
||||
private int selectId = 1;
|
||||
private OnItemSelectListener itemSelect;
|
||||
|
||||
public LiveNewGuardBuyItemsAdapter(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public void setItems(List<GuardBuyBean> items) {
|
||||
this.items = items;
|
||||
}
|
||||
public void setOnItemSelectListener(OnItemSelectListener listener){
|
||||
this.itemSelect=listener;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Vh onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new Vh(LayoutInflater.from(context).inflate(R.layout.item_dialog_guard_buy, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull Vh holder, int position) {
|
||||
GuardBuyBean bean = items.get(position);
|
||||
holder.setData(bean, bean.getId());
|
||||
}
|
||||
|
||||
public void changeItem(int id) {
|
||||
this.selectId = id;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return items.size();
|
||||
}
|
||||
|
||||
protected class Vh extends RecyclerView.ViewHolder {
|
||||
private LinearLayout buyButton;
|
||||
private TextView title;
|
||||
private TextView msg;
|
||||
private TextView coin;
|
||||
|
||||
public Vh(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
buyButton = itemView.findViewById(R.id.guard_buy_button);
|
||||
title = itemView.findViewById(R.id.guard_buy_title);
|
||||
msg = itemView.findViewById(R.id.guard_buy_goback);
|
||||
coin = itemView.findViewById(R.id.guard_buy_money);
|
||||
|
||||
buyButton.setOnClickListener(view -> {
|
||||
buyButton.setBackgroundResource(R.drawable.img_k_selected);
|
||||
changeItem((int)title.getTag());
|
||||
notifyDataSetChanged();
|
||||
if(itemSelect!=null){
|
||||
itemSelect.onSelectId((int)title.getTag());
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private void setData(GuardBuyBean bean, int id) {
|
||||
String coin = bean.getCoin() + "";
|
||||
title.setText(bean.getName());
|
||||
title.setTag(id);
|
||||
String msgText = WordUtil.getString(R.string.buy_guard_back_coin);
|
||||
msg.setText(msgText + coin);
|
||||
this.coin.setText(coin);
|
||||
if(id==selectId){
|
||||
buyButton.setBackgroundResource(R.drawable.img_k_selected);
|
||||
}else {
|
||||
buyButton.setBackgroundResource(R.drawable.img_k_uncheck);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 用于回调通知当前选择id
|
||||
*/
|
||||
public interface OnItemSelectListener {
|
||||
void onSelectId(int id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package com.yunbao.live.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.live.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 直播间打招呼适配器
|
||||
*/
|
||||
public class LiveRoomFastMessageRecyclerViewAdapter extends RecyclerView.Adapter<LiveRoomFastMessageRecyclerViewAdapter.Vh> {
|
||||
private Context context;
|
||||
private List<String> items;
|
||||
private OnSendMessageListener messageListener;
|
||||
public LiveRoomFastMessageRecyclerViewAdapter(Context context) {
|
||||
this.context = context;
|
||||
this.items=new ArrayList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置点击消息回调
|
||||
* @param messageListener 消息回调
|
||||
*/
|
||||
public void setMessageListener(OnSendMessageListener messageListener) {
|
||||
this.messageListener = messageListener;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加消息
|
||||
* @param msg 消息
|
||||
*/
|
||||
public void addMessage(String msg){
|
||||
items.add(msg);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加消息
|
||||
* @param items 消息组
|
||||
*/
|
||||
public void setMessage(List<String> items){
|
||||
this.items=items;
|
||||
notifyDataSetChanged();
|
||||
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Vh onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new Vh(LayoutInflater.from(context).inflate(R.layout.item_fast_msg,parent,false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull Vh holder, int position) {
|
||||
holder.setData(items.get(position));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return items.size();
|
||||
}
|
||||
|
||||
protected class Vh extends RecyclerView.ViewHolder{
|
||||
private final TextView message;
|
||||
|
||||
public Vh(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
message=itemView.findViewById(R.id.room_fast_message_text_view);
|
||||
ConstraintLayout layout = itemView.findViewById(R.id.room_fast_layout);
|
||||
layout.setOnClickListener(view -> {
|
||||
int position= getPosition((String) message.getTag());
|
||||
if(position==-1){{
|
||||
return;
|
||||
}}
|
||||
if(messageListener!=null){
|
||||
messageListener.onMessage((String) message.getTag());
|
||||
}
|
||||
items.remove(position);
|
||||
notifyItemRemoved(position);
|
||||
});
|
||||
}
|
||||
private int getPosition(String msg){
|
||||
for (int i = 0; i < items.size(); i++) {
|
||||
if(items.get(i).equals(msg)){
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
public void setData(String msg){
|
||||
message.setTag(msg);
|
||||
message.setText(msg);
|
||||
}
|
||||
|
||||
}
|
||||
public interface OnSendMessageListener{
|
||||
void onMessage(String msg);
|
||||
}
|
||||
}
|
||||
@@ -50,7 +50,7 @@ public class VerticalPagerAdapter extends androidx.viewpager.widget.PagerAdapter
|
||||
ImageView ivLoading = view.findViewById(R.id.iv_loading);
|
||||
AnimationDrawable frameAnimation = (AnimationDrawable) ivLoading.getBackground();
|
||||
frameAnimation.start();
|
||||
|
||||
// ImgLoader.displayGif(mContext, R.drawable.live_loading, ivLoading);
|
||||
view.setId(position);
|
||||
container.addView(view);
|
||||
return view;
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.yunbao.live.bean;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.live.R;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/11/6.
|
||||
* 守护商品类型
|
||||
@@ -67,4 +69,15 @@ public class GuardBuyBean {
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GuardBuyBean{" +
|
||||
"id=" + id +
|
||||
", name='" + name + '\'' +
|
||||
", type=" + type +
|
||||
", coin=" + coin +
|
||||
", privilege=" + Arrays.toString(privilege) +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,16 @@ public class OpenParametersModel extends BaseModel {
|
||||
//收费价格,计时收费每次扣费的值
|
||||
private int mLiveTypeVal = 0;
|
||||
private LiveGuardInfo mLiveGuardInfo = null;
|
||||
private int liveBg = 0;
|
||||
|
||||
public int getLiveBg() {
|
||||
return liveBg;
|
||||
}
|
||||
|
||||
public OpenParametersModel setLiveBg(int liveBg) {
|
||||
this.liveBg = liveBg;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getmLiveType() {
|
||||
return mLiveType;
|
||||
|
||||
@@ -24,7 +24,7 @@ import com.yunbao.live.interfaces.LiveFunctionClickListener;
|
||||
public class LiveFunctionDialogFragment extends AbsDialogFragment implements OnItemClickListener<Integer> {
|
||||
|
||||
private LiveFunctionClickListener mFunctionClickListener;
|
||||
boolean isRy = false;
|
||||
// boolean isRy = false;
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.dialog_live_function;
|
||||
@@ -60,7 +60,7 @@ public class LiveFunctionDialogFragment extends AbsDialogFragment implements OnI
|
||||
if (bundle != null) {
|
||||
hasGame = bundle.getBoolean(Constants.HAS_GAME, false);
|
||||
openFlash = bundle.getBoolean(Constants.OPEN_FLASH, false);
|
||||
isRy = bundle.getBoolean("isRy", false);
|
||||
// isRy = bundle.getBoolean("isRy", false);
|
||||
}
|
||||
RecyclerView recyclerView = (RecyclerView) mRootView.findViewById(R.id.recyclerView);
|
||||
recyclerView.setHasFixedSize(true);
|
||||
@@ -85,11 +85,11 @@ public class LiveFunctionDialogFragment extends AbsDialogFragment implements OnI
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
mFunctionClickListener = null;
|
||||
if(isRy == false) {
|
||||
((LiveAnchorActivity) mContext).setBtnFunctionDark();
|
||||
}else{
|
||||
// if(isRy == false) {
|
||||
// ((LiveAnchorActivity) mContext).setBtnFunctionDark();
|
||||
// }else{
|
||||
((LiveRyAnchorActivity) mContext).setBtnFunctionDark();
|
||||
}
|
||||
// }
|
||||
super.onDestroy();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,6 +93,12 @@ public class LiveGuardDialogFragment extends AbsDialogFragment implements View.O
|
||||
mTip = (TextView) mRootView.findViewById(R.id.tip);
|
||||
mBtnBuy = (TextView) mRootView.findViewById(R.id.btn_buy);
|
||||
mBtnBuy.setOnClickListener(this);
|
||||
/* mBtnBuy.setOnLongClickListener(view -> {
|
||||
//长按调用老版购买守护页面,调试用
|
||||
dismiss();
|
||||
((LiveActivity) mContext).openBuyGuardWindow();
|
||||
return false;
|
||||
});*/
|
||||
if (mLiveGuardInfo != null) {
|
||||
mGuardNum.setText(WordUtil.getString(R.string.guard_guard) + "(" + mLiveGuardInfo.getGuardNum() + ")");
|
||||
int guardType = mLiveGuardInfo.getMyGuardType();
|
||||
@@ -158,7 +164,7 @@ public class LiveGuardDialogFragment extends AbsDialogFragment implements View.O
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
dismiss();
|
||||
((LiveActivity) mContext).openBuyGuardWindow();
|
||||
((LiveActivity) mContext).openNewBuyGuardWindow();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -212,7 +212,7 @@ public class LiveMicUserDialogFragment extends AbsDialogFragment implements View
|
||||
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
|
||||
Log.e("ry", "发送失敗" + errorCode.toString());
|
||||
liveImDeletUtil.deleteMessages(message.getTargetId(), message.getMessageId());
|
||||
}
|
||||
}//BIZ_ERROR_DATABASE_ERROR
|
||||
});
|
||||
} else {
|
||||
ToastUtil.show(msg);
|
||||
|
||||
@@ -0,0 +1,316 @@
|
||||
package com.yunbao.live.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
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.UserBean;
|
||||
import com.yunbao.common.dialog.AbsDialogFragment;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.activity.LiveActivity;
|
||||
import com.yunbao.live.adapter.GuardRightAdapter;
|
||||
import com.yunbao.live.adapter.LiveNewGuardBuyItemsAdapter;
|
||||
import com.yunbao.live.bean.GuardBuyBean;
|
||||
import com.yunbao.live.bean.GuardRightBean;
|
||||
import com.yunbao.live.bean.LiveGuardInfo;
|
||||
import com.yunbao.live.http.LiveHttpConsts;
|
||||
import com.yunbao.live.http.LiveHttpUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/11/6.
|
||||
* 直播间购买守护弹窗
|
||||
* 改版后效果
|
||||
*/
|
||||
|
||||
public class LiveNewGuardBuyDialogFragment extends AbsDialogFragment implements View.OnClickListener {
|
||||
|
||||
private RecyclerView mRights;//权益列表
|
||||
private RecyclerView mBuys;//购买列表
|
||||
private TextView anchorName;
|
||||
private TextView mCoin;
|
||||
private String mCoinName;
|
||||
private TextView mCoinNameTextView;
|
||||
private View mBtnBuy;
|
||||
private List<GuardRightBean> mRightList=new ArrayList<>();//权限列表
|
||||
private List<GuardBuyBean> mBuyList;//商品列表
|
||||
private long mCoinVal;//余额
|
||||
private String mLiveUid;
|
||||
private String mStream;
|
||||
private String mAncherName;
|
||||
private LiveGuardInfo mLiveGuardInfo;
|
||||
private GuardBuyBean mTargetBuyBean;
|
||||
|
||||
private LiveNewGuardBuyItemsAdapter buyItemsAdapter;
|
||||
private GuardRightAdapter mGuardRightAdapter;
|
||||
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.dialog_new_guard_buy;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getDialogStyle() {
|
||||
return R.style.dialog2;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canCancel() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setWindowAttributes(Window window) {
|
||||
window.setWindowAnimations(R.style.bottomToTopAnim);
|
||||
WindowManager.LayoutParams params = window.getAttributes();
|
||||
params.width = WindowManager.LayoutParams.MATCH_PARENT;
|
||||
params.height = WindowManager.LayoutParams.WRAP_CONTENT;
|
||||
params.gravity = Gravity.BOTTOM;
|
||||
window.setAttributes(params);
|
||||
}
|
||||
|
||||
public void setLiveGuardInfo(LiveGuardInfo info) {
|
||||
mLiveGuardInfo = info;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
|
||||
mCoinNameTextView = mRootView.findViewById(R.id.guard_coin_name);
|
||||
mCoin = mRootView.findViewById(R.id.guard_coin);
|
||||
mBtnBuy = mRootView.findViewById(R.id.guard_btn_buy);
|
||||
mRights = mRootView.findViewById(R.id.guard_rights);
|
||||
mBuys = mRootView.findViewById(R.id.guard_buys);
|
||||
anchorName = mRootView.findViewById(R.id.guard_anchor_name);
|
||||
mBtnBuy.setOnClickListener(this);
|
||||
mRights.setHasFixedSize(true);
|
||||
mRights.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
|
||||
mBuys.setHasFixedSize(true);
|
||||
mBuys.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false){
|
||||
@Override
|
||||
public boolean canScrollHorizontally() {//购买列表禁止滑动
|
||||
return false;
|
||||
}
|
||||
});
|
||||
mBuys.setItemViewCacheSize(3);
|
||||
|
||||
buyItemsAdapter = new LiveNewGuardBuyItemsAdapter(mContext);
|
||||
mGuardRightAdapter = new GuardRightAdapter(mContext, mRightList);
|
||||
mRights.setAdapter(mGuardRightAdapter);
|
||||
mBuys.setAdapter(buyItemsAdapter);
|
||||
buyItemsAdapter.setOnItemSelectListener(this::refreshList);
|
||||
|
||||
Bundle bundle = getArguments();
|
||||
if (bundle != null) {
|
||||
mLiveUid = bundle.getString(Constants.LIVE_UID);
|
||||
mStream = bundle.getString(Constants.STREAM);
|
||||
mAncherName=bundle.getString(Constants.LIVE_ANCHER_NAME);
|
||||
String coinName = WordUtil.getString(R.string.diamond);
|
||||
mCoinName = coinName;
|
||||
mCoinNameTextView.setText(WordUtil.getString(R.string.guard_my) + coinName + ":");
|
||||
anchorName.setText(String.format("成爲%s的守護", mAncherName));
|
||||
}
|
||||
LiveHttpUtil.getGuardBuyList(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
mRightList = JSON.parseArray(obj.getString("privilege"), GuardRightBean.class);
|
||||
mBuyList = JSON.parseArray(obj.getString("list"), GuardBuyBean.class);
|
||||
try {
|
||||
mCoinVal = obj.getLongValue("coin");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
mCoin.setText(String.valueOf(mCoinVal));
|
||||
buyItemsAdapter.setItems(mBuyList);
|
||||
mGuardRightAdapter.setList(mRightList);
|
||||
buyItemsAdapter.notifyDataSetChanged();
|
||||
|
||||
refreshList(1);
|
||||
|
||||
} else {
|
||||
ToastUtil.show(msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void refreshList(int index) {
|
||||
if (!mRightList.isEmpty()) {
|
||||
GuardBuyBean guardBuyBean = mBuyList.get(index - 1);
|
||||
mTargetBuyBean=guardBuyBean;
|
||||
for (GuardRightBean bean : mRightList) {
|
||||
bean.setChecked(false);
|
||||
}
|
||||
for (int i : guardBuyBean.getPrivilege()) {
|
||||
mRightList.get(i).setChecked(true);
|
||||
}
|
||||
mGuardRightAdapter.notifyDataSetChanged();
|
||||
mBtnBuy.setEnabled(mCoinVal >= guardBuyBean.getCoin());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
int i = view.getId();
|
||||
if (i == R.id.guard_btn_buy) {
|
||||
clickBuyGuard();
|
||||
|
||||
}
|
||||
// else if (i == R.id.coin) {
|
||||
// forwardMyCoin();
|
||||
//
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到我的钻石
|
||||
*/
|
||||
private void forwardMyCoin() {
|
||||
dismiss();
|
||||
RouteUtil.forwardMyCoin(mContext);
|
||||
}
|
||||
|
||||
/**
|
||||
* 点击购买守护按钮
|
||||
*/
|
||||
private void clickBuyGuard() {
|
||||
if (TextUtils.isEmpty(mLiveUid) || TextUtils.isEmpty(mStream) || mLiveGuardInfo == null || mTargetBuyBean == null) {
|
||||
return;
|
||||
}
|
||||
Log.d("ffffff", "" + mLiveGuardInfo.getMyGuardType() + " " + mTargetBuyBean.getType());
|
||||
if (mLiveGuardInfo.getMyGuardType() == Constants.GUARD_TYPE_MONTH && mTargetBuyBean.getType() == Constants.GUARD_TYPE_DAY) {
|
||||
DialogUitl.showSimpleTipDialog(mContext, WordUtil.getString(R.string.guard_buy_tip));
|
||||
return;
|
||||
} else if (mLiveGuardInfo.getMyGuardType() == Constants.GUARD_TYPE_YEAR && mTargetBuyBean.getType() == Constants.GUARD_TYPE_DAY) {
|
||||
DialogUitl.showSimpleTipDialog(mContext, "您為當前主播的年守護無法開通周守護");
|
||||
return;
|
||||
} else if (mLiveGuardInfo.getMyGuardType() == Constants.GUARD_TYPE_YEAR && mTargetBuyBean.getType() == Constants.GUARD_TYPE_MONTH) {
|
||||
DialogUitl.showSimpleTipDialog(mContext, "您為當前主播的年守護無法開通月守護");
|
||||
return;
|
||||
} else {
|
||||
if (mLiveGuardInfo.getMyGuardType() == Constants.GUARD_TYPE_MONTH
|
||||
&& mTargetBuyBean.getType() == Constants.GUARD_TYPE_YEAR) {
|
||||
DialogUitl.showSimpleDialog(mContext, WordUtil.getString(R.string.guard_buy_tip_2), new DialogUitl.SimpleCallback() {
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
doBuyGuard();
|
||||
}
|
||||
});
|
||||
return;
|
||||
} else if (mLiveGuardInfo.getMyGuardType() == Constants.GUARD_TYPE_DAY
|
||||
&& mTargetBuyBean.getType() == Constants.GUARD_TYPE_MONTH) {
|
||||
DialogUitl.showSimpleDialog(mContext, "您為當前主播的周守護,開通月守護將覆蓋您的周守護時長,是否開通?", new DialogUitl.SimpleCallback() {
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
doBuyGuard();
|
||||
}
|
||||
});
|
||||
return;
|
||||
} else if (mLiveGuardInfo.getMyGuardType() == Constants.GUARD_TYPE_DAY
|
||||
&& mTargetBuyBean.getType() == Constants.GUARD_TYPE_YEAR) {
|
||||
DialogUitl.showSimpleDialog(mContext, "您為當前主播的周守護,開通年守護將覆蓋您的周守護時長,是否開通?", new DialogUitl.SimpleCallback() {
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
doBuyGuard();
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
buyGuard();
|
||||
}
|
||||
|
||||
/**
|
||||
* 购买守护
|
||||
*/
|
||||
private void buyGuard() {
|
||||
if (mTargetBuyBean == null) {
|
||||
return;
|
||||
}
|
||||
DialogUitl.showSimpleDialog(mContext,
|
||||
String.format(WordUtil.getString(R.string.guard_buy_tip_3), mTargetBuyBean.getCoin(), mCoinName, mTargetBuyBean.getShopName()),
|
||||
new DialogUitl.SimpleCallback() {
|
||||
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
doBuyGuard();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 购买守护
|
||||
*/
|
||||
private void doBuyGuard() {
|
||||
if (mTargetBuyBean == null) {
|
||||
return;
|
||||
}
|
||||
LiveHttpUtil.buyGuard(mLiveUid, mStream, mTargetBuyBean.getId(), new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
String votes = obj.getString("votestotal");//主播当前的映票数
|
||||
int guardNum = obj.getIntValue("guard_nums");//主播当前的守护人数
|
||||
int guardType = obj.getIntValue("type");
|
||||
String ancherName = obj.getString("ancherName");
|
||||
String liveuid = obj.getString("liveuid");
|
||||
if (mLiveGuardInfo != null) {
|
||||
mLiveGuardInfo.setMyGuardType(guardType);
|
||||
mLiveGuardInfo.setMyGuardEndTime(obj.getString("endtime"));
|
||||
mLiveGuardInfo.setGuardNum(guardNum);
|
||||
}
|
||||
mCoinVal = obj.getLongValue("coin");
|
||||
String coinString = String.valueOf(mCoinVal);
|
||||
mCoin.setText(coinString);
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
if (u != null) {
|
||||
u.setCoin(coinString);
|
||||
u.setLevel(obj.getIntValue("level"));
|
||||
}
|
||||
((LiveActivity) mContext).sendBuyGuardMessage2(votes, guardNum, guardType, ancherName, liveuid);
|
||||
dismiss();
|
||||
}
|
||||
ToastUtil.show(msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
mLiveGuardInfo = null;
|
||||
LiveHttpUtil.cancel(LiveHttpConsts.GET_GUARD_BUY_LIST);
|
||||
super.onDestroy();
|
||||
}
|
||||
}
|
||||
@@ -272,6 +272,9 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
|
||||
}
|
||||
private List<LiveUserGiftBean> processUserData(JSONObject json){
|
||||
List<LiveUserGiftBean> data = JSON.parseArray(json.getString("userlist"), LiveUserGiftBean.class);
|
||||
if(data==null){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
Log.i("tag222", "ssss");
|
||||
if (data.size() > 0 && pg == 1) {
|
||||
nums = 0;
|
||||
@@ -297,6 +300,9 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
|
||||
/**
|
||||
* 由于在线观众和粉丝列表实体结构与榜单结构不一致,做个兼容操作
|
||||
*/
|
||||
if(rank==null){
|
||||
return data;
|
||||
}
|
||||
for (Object o : rank) {
|
||||
JSONObject item= (JSONObject) o;
|
||||
LiveUserRankBean bean=JSON.parseObject(item.getString("userinfo"),LiveUserRankBean.class);
|
||||
@@ -332,8 +338,11 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
|
||||
}
|
||||
|
||||
void Up() {
|
||||
userMoreInfoAdapter.clearData();
|
||||
bottom_msg.setVisibility(View.VISIBLE);
|
||||
title.setVisibility(View.GONE);
|
||||
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) mRefreshView.getLayoutParams();
|
||||
params.bottomMargin=DpUtil.dp2px(65);
|
||||
if (Tips.equals("1")) {
|
||||
tags.setText("開通貴族,尊享超多特權!");
|
||||
btn.setBackgroundResource(R.mipmap.btn_openvip);
|
||||
@@ -361,6 +370,7 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
|
||||
type = "fans";
|
||||
no_more.setImageResource(R.mipmap.bixin);
|
||||
}else if(Tips.equals("4")){
|
||||
params.bottomMargin=DpUtil.dp2px(0);
|
||||
userMoreInfoAdapter.type = "4";
|
||||
bottom_msg.setVisibility(View.GONE);
|
||||
type="dayRank";
|
||||
@@ -368,6 +378,7 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
|
||||
gz_view.setVisibility(View.GONE);
|
||||
no_more.setImageResource(R.drawable.img_rank_empty);
|
||||
}else if (Tips.equals("5")){
|
||||
params.bottomMargin=DpUtil.dp2px(0);
|
||||
userMoreInfoAdapter.type = "5";
|
||||
bottom_msg.setVisibility(View.GONE);
|
||||
type="weekRank";
|
||||
@@ -375,6 +386,7 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
|
||||
no_more.setImageResource(R.drawable.img_rank_empty);
|
||||
setTextColor(weekRank,audience_btn,guard_btn,fans_btn,gz_view,dayRank);
|
||||
}
|
||||
mRefreshView.setLayoutParams(params);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.yunbao.live.dialog;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.Display;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
@@ -22,14 +24,20 @@ import com.yunbao.common.dialog.AbsDialogFragment;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.main.MainNetManager;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.DeviceUtils;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.activity.LiveAudienceActivity;
|
||||
import com.yunbao.live.adapter.SidebarAdapter;
|
||||
import com.yunbao.live.bean.LiveBean;
|
||||
import com.yunbao.live.event.LiveAudienceEvent;
|
||||
import com.yunbao.live.event.LiveRoomChangeEvent;
|
||||
import com.yunbao.live.http.LiveHttpUtil;
|
||||
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
|
||||
import com.yunbao.live.views.LivePlayRyViewHolder;
|
||||
import com.yunbao.live.views.PortraitLiveManager;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -40,6 +48,7 @@ import java.util.List;
|
||||
public class SidebarLiveAudience extends AbsDialogFragment {
|
||||
//侧边栏背景
|
||||
private ImageView sidebarBack;
|
||||
private View mask;
|
||||
//侧边栏刷新列表
|
||||
public CommonRefreshView sidebarList;
|
||||
|
||||
@@ -48,6 +57,8 @@ public class SidebarLiveAudience extends AbsDialogFragment {
|
||||
private List<SlideInfoModel> slideInfoModels = new ArrayList<>();
|
||||
private List<AnchorRecommendItemModel> list = new ArrayList<>();
|
||||
|
||||
private int index = 0;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.view_sidebar_live_audience;
|
||||
@@ -63,14 +74,23 @@ public class SidebarLiveAudience extends AbsDialogFragment {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
Bundle bundle = getArguments();
|
||||
sidebarBack = (ImageView) findViewById(R.id.sidebar_back);
|
||||
mask = findViewById(R.id.mask);
|
||||
if (bundle != null) {
|
||||
String avatar = bundle.getString("Avatar");
|
||||
int liveBg = bundle.getInt("LiveBg");
|
||||
slideInfoModels = GsonUtils.fromJson(bundle.getString("banner"), new TypeToken<List<SlideInfoModel>>() {
|
||||
}.getType());
|
||||
list = GsonUtils.fromJson(bundle.getString("list"), new TypeToken<List<AnchorRecommendItemModel>>() {
|
||||
}.getType());
|
||||
//侧边栏背景
|
||||
ImgLoader.displayBlurLive(mContext, avatar, sidebarBack);
|
||||
if (liveBg == 1) {
|
||||
ImgLoader.displayBlurLive(mContext, avatar, sidebarBack);
|
||||
mask.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
ImgLoader.display(mContext, R.mipmap.live_bg, sidebarBack);
|
||||
mask.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
sidebarList = (CommonRefreshView) findViewById(R.id.sidebarList);
|
||||
@@ -106,39 +126,46 @@ public class SidebarLiveAudience extends AbsDialogFragment {
|
||||
|
||||
@Override
|
||||
public void refresh() {
|
||||
//推荐位
|
||||
MainNetManager.get(getActivity())
|
||||
.anchorRecommend("10", new com.yunbao.common.http.base.HttpCallback<AnchorRecommendModel>() {
|
||||
@Override
|
||||
public void onSuccess(AnchorRecommendModel anchorRecommendModel) {
|
||||
//侧边栏
|
||||
MainNetManager.get(getActivity())
|
||||
.getHot(1, new com.yunbao.common.http.base.HttpCallback<List<SlideInfoModel>>() {
|
||||
@Override
|
||||
public void onSuccess(List<SlideInfoModel> data) {
|
||||
List<AnchorRecommendItemModel> list = anchorRecommendModel.getList();
|
||||
list.add(0, new AnchorRecommendItemModel());
|
||||
sidebarAdapter.addData(list);
|
||||
sidebarList.onFinish();
|
||||
sidebarAdapter.setData(data);
|
||||
}
|
||||
if (index > 0) {
|
||||
//推荐位
|
||||
MainNetManager.get(getActivity())
|
||||
.anchorRecommend("12", new com.yunbao.common.http.base.HttpCallback<AnchorRecommendModel>() {
|
||||
@Override
|
||||
public void onSuccess(AnchorRecommendModel anchorRecommendModel) {
|
||||
List<AnchorRecommendItemModel> list = anchorRecommendModel.getList();
|
||||
int userIndex = -1;
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if (TextUtils.equals(list.get(i).getUid(), PortraitLiveManager.liveID)) {
|
||||
userIndex = i;
|
||||
}
|
||||
}
|
||||
if (userIndex != -1) {
|
||||
list.remove(userIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
list.add(0, new AnchorRecommendItemModel());
|
||||
|
||||
}
|
||||
});
|
||||
sidebarAdapter.addData(list);
|
||||
sidebarAdapter.setData(anchorRecommendModel.getSlide());
|
||||
sidebarList.onFinish();
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
index = index + 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
sidebarList.initData();
|
||||
sidebarAdapter.setOnItemClickListener((bean, position) -> gotoLive(bean.getUid()));
|
||||
sidebarAdapter.setOnItemClickListener((bean, position) -> {
|
||||
|
||||
gotoLive(bean.getUid());
|
||||
dismiss();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -176,16 +203,35 @@ public class SidebarLiveAudience extends AbsDialogFragment {
|
||||
if (liveBean1 == null) {
|
||||
return;
|
||||
}
|
||||
LiveAudienceActivity.forward(getActivity(), liveBean1, liveType, liveTypeVal, "", 0, liveSdk);
|
||||
(getActivity()).finish();
|
||||
if (LivePlayRyViewHolder.Micing == 1) {
|
||||
Bus.get().post(new LiveAudienceEvent()
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.LIAN_MAI)
|
||||
.setMicIng(1)
|
||||
.setBean(liveBean).setLiveType(liveType).setLiveTypeVal(liveTypeVal));
|
||||
} else if (LivePlayRyViewHolder.Micing == 2) {
|
||||
Bus.get().post(new LiveAudienceEvent()
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.LIAN_MAI)
|
||||
.setMicIng(2)
|
||||
.setBean(liveBean).setLiveType(liveType).setLiveTypeVal(liveTypeVal));
|
||||
} else {
|
||||
EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, liveTypeVal));
|
||||
}
|
||||
|
||||
});
|
||||
mCheckLivePresenter.checkLive(liveBean);
|
||||
|
||||
} else {
|
||||
RouteUtil.forwardUserHome(getActivity(), liveId, 0);
|
||||
getActivity().finish();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDismiss(DialogInterface dialog) {
|
||||
super.onDismiss(dialog);
|
||||
Bus.get().post(new LiveAudienceEvent()
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.REFRESH_THE_LIVEl_PAGE)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.yunbao.live.event;
|
||||
|
||||
import com.yunbao.common.bean.ActiveModel;
|
||||
import com.yunbao.common.bean.AnchorRecommendItemModel;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.live.bean.LiveBean;
|
||||
import com.yunbao.live.bean.OpenParametersModel;
|
||||
|
||||
public class LiveAudienceEvent extends BaseModel {
|
||||
@@ -9,6 +11,56 @@ public class LiveAudienceEvent extends BaseModel {
|
||||
private ActiveModel model = new ActiveModel();
|
||||
private String avatar = "";
|
||||
private OpenParametersModel parametersModel = new OpenParametersModel();
|
||||
private AnchorRecommendItemModel anchorRecommendItemModel = new AnchorRecommendItemModel();
|
||||
private int micIng = 0;//连麦状态
|
||||
private LiveBean bean;
|
||||
private int liveType;
|
||||
private int liveTypeVal;
|
||||
|
||||
public int getLiveType() {
|
||||
return liveType;
|
||||
}
|
||||
|
||||
public LiveAudienceEvent setLiveType(int liveType) {
|
||||
this.liveType = liveType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getLiveTypeVal() {
|
||||
return liveTypeVal;
|
||||
}
|
||||
|
||||
public LiveAudienceEvent setLiveTypeVal(int liveTypeVal) {
|
||||
this.liveTypeVal = liveTypeVal;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LiveBean getBean() {
|
||||
return bean;
|
||||
}
|
||||
|
||||
public LiveAudienceEvent setBean(LiveBean bean) {
|
||||
this.bean = bean;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getMicIng() {
|
||||
return micIng;
|
||||
}
|
||||
|
||||
public LiveAudienceEvent setMicIng(int micIng) {
|
||||
this.micIng = micIng;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AnchorRecommendItemModel getAnchorRecommendItemModel() {
|
||||
return anchorRecommendItemModel;
|
||||
}
|
||||
|
||||
public LiveAudienceEvent setAnchorRecommendItemModel(AnchorRecommendItemModel anchorRecommendItemModel) {
|
||||
this.anchorRecommendItemModel = anchorRecommendItemModel;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OpenParametersModel getParametersModel() {
|
||||
return parametersModel;
|
||||
@@ -59,7 +111,9 @@ public class LiveAudienceEvent extends BaseModel {
|
||||
EFFECTS_SETTINGS(10, "特效設置"),
|
||||
WISH_LIST(11, "心愿单"),
|
||||
OPEN_PARAMETERS(12, "开放参数"),
|
||||
ACTIVITY_CENTER(13, "活動中心");
|
||||
ACTIVITY_CENTER(13, "活動中心"),
|
||||
LIVE_ROOM_EXCEPTION(14, "直播间异常"),
|
||||
REFRESH_THE_LIVEl_PAGE(15, "刷新直播页面");
|
||||
|
||||
private int type;
|
||||
private String name;
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.yunbao.live.presenter;
|
||||
import android.Manifest;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Outline;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
@@ -17,7 +16,6 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewOutlineProvider;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.PopupWindow;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
@@ -55,9 +53,6 @@ import com.yunbao.live.R;
|
||||
import com.yunbao.live.activity.LiveActivity;
|
||||
import com.yunbao.live.activity.LiveAnchorActivity;
|
||||
import com.yunbao.live.activity.LiveAudienceActivity;
|
||||
import com.yunbao.live.activity.ZhuangBanActivity;
|
||||
import com.yunbao.live.bean.LiveWishlistBean;
|
||||
import com.yunbao.live.dialog.LiveHDDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveOneDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveTurnTableDialogFragment4Audience;
|
||||
import com.yunbao.live.dialog.LiveWishListDialogFragment4Audience;
|
||||
@@ -72,7 +67,6 @@ import com.yunbao.live.socket.SocketLinkMicUtil;
|
||||
import com.yunbao.live.utils.CountDownView;
|
||||
import com.yunbao.live.views.AbsLiveLinkMicPlayViewHolder;
|
||||
import com.yunbao.live.views.AbsLiveLinkMicPushViewHolder;
|
||||
import com.yunbao.live.views.CustomViewHolder;
|
||||
import com.yunbao.live.views.LiveLinkMicPlayTxViewHolder;
|
||||
import com.yunbao.live.views.LiveLinkMicPushTxViewHolder;
|
||||
|
||||
@@ -83,8 +77,6 @@ import org.greenrobot.eventbus.ThreadMode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.blankj.utilcode.util.ActivityUtils.startActivity;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/10/25.
|
||||
* 观众和主播连麦的逻辑
|
||||
@@ -118,21 +110,21 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
|
||||
private int mLiveSdk;
|
||||
private View btnWishList;
|
||||
private View btnTurnTable;
|
||||
private View btnEvent;
|
||||
|
||||
private View btnEvent3;
|
||||
private View btn_onecz_event;
|
||||
private ImageView imgEvent;
|
||||
|
||||
private String eventUrl;
|
||||
private Banner mBanner1;
|
||||
public static Banner mBanner2, mBanner3;
|
||||
//
|
||||
public Banner mBanner3;
|
||||
private List<BannerBean> mBannerList1 = new ArrayList<>();
|
||||
private List<BannerBean> mBannerList3 = new ArrayList<>();
|
||||
|
||||
public static List<BannerBean> mBannerList2 = new ArrayList<>();
|
||||
|
||||
public static CountDownView date;
|
||||
|
||||
public static String link = "";
|
||||
LinearLayout btn_event2;
|
||||
//
|
||||
public static LiveGiftBean bean1 = new LiveGiftBean();
|
||||
String gold, experience;
|
||||
|
||||
@@ -151,7 +143,7 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if ("stop_svga_new_user_follow".equals(str)&& mBannerList3.size() > 1) {
|
||||
} else if ("stop_svga_new_user_follow".equals(str) && mBannerList3.size() > 1) {
|
||||
mBannerList3.get(1).setLink("1");
|
||||
|
||||
mBanner3.update(mBannerList3);
|
||||
@@ -162,7 +154,7 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if ("stop_new_user_gif".equals(str)&& mBannerList3.size() > 0) {
|
||||
} else if ("stop_new_user_gif".equals(str) && mBannerList3.size() > 0) {
|
||||
IMLoginManager.get(mContext).setNewUserGif(false);
|
||||
mBannerList3.get(0).setLink("1");
|
||||
mBanner3.update(mBannerList3);
|
||||
@@ -298,26 +290,13 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
|
||||
btnLinkMic.setOnClickListener(this);
|
||||
btnWishList.setOnClickListener(this);
|
||||
btnTurnTable.setOnClickListener(this);
|
||||
btnEvent = root.findViewById(R.id.btn_event);
|
||||
|
||||
btnEvent3 = root.findViewById(R.id.btn_event3);
|
||||
mBanner1 = (Banner) root.findViewById(R.id.banner1);
|
||||
mBanner2 = (Banner) root.findViewById(R.id.banner2);
|
||||
|
||||
|
||||
mBanner3 = (Banner) root.findViewById(R.id.banner3);
|
||||
|
||||
|
||||
btn_event2 = root.findViewById(R.id.btn_event2);
|
||||
mBanner1.setOutlineProvider(new ViewOutlineProvider() {
|
||||
@Override
|
||||
public void getOutline(View view, Outline outline) {
|
||||
outline.setRoundRect(0, 0, view.getWidth(), view.getHeight(), 10);
|
||||
}
|
||||
});
|
||||
mBanner2.setOutlineProvider(new ViewOutlineProvider() {
|
||||
@Override
|
||||
public void getOutline(View view, Outline outline) {
|
||||
outline.setRoundRect(0, 0, view.getWidth(), view.getHeight(), 10);
|
||||
}
|
||||
});
|
||||
mBanner3.setOutlineProvider(new ViewOutlineProvider() {
|
||||
@Override
|
||||
public void getOutline(View view, Outline outline) {
|
||||
@@ -397,8 +376,7 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
|
||||
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveOneDialogFragment");
|
||||
}
|
||||
});
|
||||
imgEvent = root.findViewById(R.id.img_event);
|
||||
btnEvent.setOnClickListener(this);
|
||||
|
||||
mLinkMicTip = btnLinkMic.findViewById(R.id.link_mic_tip);
|
||||
}
|
||||
mLinkMicWaitString = WordUtil.getString(R.string.link_mic_wait);
|
||||
@@ -420,12 +398,7 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
|
||||
}
|
||||
}
|
||||
};
|
||||
mHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
loadWishlistData();
|
||||
}
|
||||
}, 500);
|
||||
|
||||
|
||||
String turntableEnable = CommonAppConfig.getInstance().getTurnTableEnable();
|
||||
getEvent();
|
||||
@@ -444,35 +417,6 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
|
||||
mSocketClient = socketClient;
|
||||
}
|
||||
|
||||
public void setLiveUid(String liveUid) {
|
||||
mLiveUid = liveUid;
|
||||
LiveHttpUtil.geteEvent(mLiveUid, new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && imgEvent != null) {
|
||||
for (int i = 0; i < info.length; i++) {
|
||||
JSONObject obj = JSONObject.parseObject(info[i]);
|
||||
if (obj.getString("is_hidden").equals("0")) {
|
||||
BannerBean bannerBean = new BannerBean();
|
||||
bannerBean.setImageUrl(obj.getString("img"));
|
||||
bannerBean.setLink(obj.getString("link"));
|
||||
bannerBean.setShow_type(obj.getString("show_type"));
|
||||
mBannerList2.add(bannerBean);
|
||||
}
|
||||
}
|
||||
if (mBannerList2.size() <= 0) {
|
||||
btn_event2.setVisibility(View.GONE);
|
||||
}
|
||||
showBanner2();
|
||||
} else {
|
||||
if (btn_event2 != null) {
|
||||
btn_event2.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 主播收到观众申请连麦的回调
|
||||
@@ -764,11 +708,7 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
|
||||
anchorCloseLinkMic();
|
||||
|
||||
}
|
||||
//打开活动窗口
|
||||
else if (i == R.id.btn_event) {
|
||||
Log.i("tag", eventUrl);
|
||||
startActivity(new Intent(mContext, ZhuangBanActivity.class).putExtra("url", eventUrl));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -799,43 +739,6 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
|
||||
}
|
||||
|
||||
|
||||
//获取心愿单列表
|
||||
private void loadWishlistData() {
|
||||
LiveHttpUtil.getWishList(mLiveUid, new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
try {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
String giftJson = obj.getString("wishlist");
|
||||
List<LiveWishlistBean> mWishlist = JSON.parseArray(giftJson, LiveWishlistBean.class);
|
||||
if (btnWishList != null) {
|
||||
if (mWishlist.size() > 0) {
|
||||
btnWishList.setVisibility(View.GONE);
|
||||
//心单
|
||||
BannerBean bannerBean2 = new BannerBean();
|
||||
bannerBean2.setImageUrl(obj.getString("img"));
|
||||
bannerBean2.setLink("xyd");
|
||||
mBannerList1.add(bannerBean2);
|
||||
} else {
|
||||
btnWishList.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
showBanner();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void onLinkMicBtnClick() {
|
||||
if (((LiveActivity) mContext).isGamePlaying()) {
|
||||
ToastUtil.show(R.string.live_game_cannot_link_mic);
|
||||
@@ -868,109 +771,6 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
|
||||
});
|
||||
}
|
||||
|
||||
private void showBanner() {
|
||||
if (mBannerList1 == null || mBannerList1.size() == 0 || mBanner1 == null) {
|
||||
return;
|
||||
}
|
||||
mBanner1.setAutoPlay(true)
|
||||
.setPages(mBannerList1, new CustomViewHolder())
|
||||
.setDelayTime(3000)
|
||||
.setBannerStyle(BannerConfig.NOT_INDICATOR)
|
||||
.setOnBannerClickListener(new OnBannerClickListener() {
|
||||
@Override
|
||||
public void onBannerClick(List datas, int p) {
|
||||
if (mBannerList1 != null) {
|
||||
if (p >= 0 && p < mBannerList1.size()) {
|
||||
BannerBean bean = mBannerList1.get(p);
|
||||
if (bean != null) {
|
||||
String link = bean.getLink();
|
||||
if (link.equals("sc")) {
|
||||
String url;
|
||||
if (!"".equals(bean.getmIntoUrl()) && bean.getmIntoUrl() != null) {
|
||||
url = CommonAppConfig.HOST + bean.getmIntoUrl() + "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken();
|
||||
} else {
|
||||
url = CommonAppConfig.HOST + "/h5/activity/firstTopUp/newUp.html?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken();
|
||||
}
|
||||
// Bundle bundle = new Bundle();
|
||||
// bundle.putString("url", url);
|
||||
// LiveOneDialogFragment fragment = new LiveOneDialogFragment();
|
||||
// fragment.setArguments(bundle);
|
||||
// fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveOneDialogFragment");
|
||||
ZhuangBanActivity.forward(mContext, url, false);
|
||||
} else if (link.equals("zxb")) {
|
||||
String url = CommonAppConfig.HOST + "/h5/activity/weekStar/index.html?&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid;
|
||||
ZhuangBanActivity.forward(mContext, url, false);
|
||||
} else if (link.equals("xyd")) {
|
||||
openWishListWindow();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
.start();
|
||||
}
|
||||
|
||||
private void showBanner2() {
|
||||
if (mBannerList2 == null || mBannerList2.size() == 0 || mBanner2 == null) {
|
||||
return;
|
||||
}
|
||||
if (mBannerList2.size() == 1) {
|
||||
mBanner2.setAutoPlay(false)
|
||||
.setPages(mBannerList2, new CustomViewHolder())
|
||||
.setDelayTime(3000)
|
||||
.setBannerStyle(BannerConfig.NOT_INDICATOR)
|
||||
.setOnBannerClickListener(new OnBannerClickListener() {
|
||||
@Override
|
||||
public void onBannerClick(List datas, int p) {
|
||||
if (mBannerList2 != null) {
|
||||
if (p >= 0 && p < mBannerList2.size()) {
|
||||
BannerBean bean = mBannerList2.get(p);
|
||||
if (bean.getShow_type().equals("1")) {
|
||||
String url = bean.getLink() + "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid + "&t=" + System.currentTimeMillis();
|
||||
ZhuangBanActivity.forward(mContext, url, false);
|
||||
} else {
|
||||
String url = bean.getLink() + "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid + "&t=" + System.currentTimeMillis();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("url", url);
|
||||
LiveHDDialogFragment fragment = new LiveHDDialogFragment();
|
||||
fragment.setArguments(bundle);
|
||||
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
.start();
|
||||
} else {
|
||||
mBanner2.setAutoPlay(true)
|
||||
.setPages(mBannerList2, new CustomViewHolder())
|
||||
.setDelayTime(3000)
|
||||
.setBannerStyle(BannerConfig.NOT_INDICATOR)
|
||||
.setOnBannerClickListener(new OnBannerClickListener() {
|
||||
@Override
|
||||
public void onBannerClick(List datas, int p) {
|
||||
if (mBannerList2 != null) {
|
||||
if (p >= 0 && p < mBannerList2.size()) {
|
||||
BannerBean bean = mBannerList2.get(p);
|
||||
if (bean.getShow_type().equals("1")) {
|
||||
String url = bean.getLink() + "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid;
|
||||
ZhuangBanActivity.forward(mContext, url, false);
|
||||
} else {
|
||||
String url = bean.getLink() + "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid;
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("url", url);
|
||||
LiveHDDialogFragment fragment = new LiveHDDialogFragment();
|
||||
fragment.setArguments(bundle);
|
||||
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
.start();
|
||||
}
|
||||
}
|
||||
|
||||
private void showBanner3() {
|
||||
btnEvent3.setVisibility(View.VISIBLE);
|
||||
|
||||
@@ -9,12 +9,14 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
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.live.bean.LiveBean;
|
||||
import com.yunbao.live.event.LiveAudienceEvent;
|
||||
import com.yunbao.live.http.LiveHttpConsts;
|
||||
import com.yunbao.live.http.LiveHttpUtil;
|
||||
|
||||
@@ -76,6 +78,8 @@ public class LiveRoomCheckLivePresenter {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Bus.get().post(new LiveAudienceEvent()
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.LIVE_ROOM_EXCEPTION));
|
||||
ToastUtil.show(msg);
|
||||
}
|
||||
}
|
||||
@@ -119,7 +123,7 @@ public class LiveRoomCheckLivePresenter {
|
||||
}
|
||||
}
|
||||
});
|
||||
}else {
|
||||
} else {
|
||||
enterLiveRoom();
|
||||
isRoom = false;
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ public class SocketChatUtil {
|
||||
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
Log.i("tx", code + "发送失败" + desc);
|
||||
Log.i("tx", code + "发送失败1" + desc);
|
||||
|
||||
}
|
||||
});
|
||||
@@ -114,7 +114,7 @@ public class SocketChatUtil {
|
||||
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
Log.i("tx", code + "发送失败" + desc);
|
||||
Log.i("tx", code + "发送失败2" + desc);
|
||||
|
||||
}
|
||||
});
|
||||
@@ -170,7 +170,7 @@ public class SocketChatUtil {
|
||||
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
Log.i("tx", code + "发送失败" + desc);
|
||||
Log.i("tx", code + "发送失败3" + desc);
|
||||
|
||||
}
|
||||
});
|
||||
@@ -210,7 +210,7 @@ public class SocketChatUtil {
|
||||
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
Log.i("tx", code + "发送失败" + desc);
|
||||
Log.i("tx", code + "发送失败4" + desc);
|
||||
|
||||
}
|
||||
});
|
||||
@@ -339,7 +339,7 @@ public class SocketChatUtil {
|
||||
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
Log.i("tx", code + "发送失败" + desc);
|
||||
Log.i("tx", code + "发送失败5" + desc);
|
||||
|
||||
}
|
||||
});
|
||||
@@ -381,7 +381,7 @@ public class SocketChatUtil {
|
||||
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
Log.i("tx", code + "发送失败" + desc);
|
||||
Log.i("tx", code + "发送失败6" + desc);
|
||||
|
||||
}
|
||||
});
|
||||
@@ -423,7 +423,7 @@ public class SocketChatUtil {
|
||||
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
Log.i("tx", code + "发送失败" + desc);
|
||||
Log.i("tx", code + "发送失败7" + desc);
|
||||
|
||||
}
|
||||
});
|
||||
@@ -456,7 +456,7 @@ public class SocketChatUtil {
|
||||
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
Log.i("tx", code + "发送失败" + desc);
|
||||
Log.i("tx", code + "发送失败7" + desc);
|
||||
|
||||
}
|
||||
});
|
||||
@@ -493,7 +493,7 @@ public class SocketChatUtil {
|
||||
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
Log.i("tx", code + "发送失败" + desc);
|
||||
Log.i("tx", code + "发送失败9" + desc);
|
||||
|
||||
}
|
||||
});
|
||||
@@ -528,7 +528,7 @@ public class SocketChatUtil {
|
||||
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
Log.i("tx", code + "发送失败" + desc);
|
||||
Log.i("tx", code + "发送失败10" + desc);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
@@ -118,7 +118,7 @@ public class SocketRyChatUtil {
|
||||
|
||||
@Override
|
||||
public void onSuccess(Message message) {
|
||||
Log.i("tx", "发送成功" + mLiveUid);
|
||||
Log.i("tx", "ssss"+"发送成功" + mLiveUid);
|
||||
//首发言成功
|
||||
AdjustEvent adjustEvent1 = new AdjustEvent("j7isvr");
|
||||
Adjust.trackEvent(adjustEvent1);
|
||||
@@ -141,7 +141,7 @@ public class SocketRyChatUtil {
|
||||
|
||||
@Override
|
||||
public void onError(Message message, RongIMClient.ErrorCode errorCode) {
|
||||
|
||||
Log.e("tx","aaa"+errorCode.toString());
|
||||
}
|
||||
});
|
||||
|
||||
@@ -543,7 +543,7 @@ public class SocketRyChatUtil {
|
||||
@Override
|
||||
public void onSuccess(Message message) {
|
||||
Log.i("tx", "发送成功");
|
||||
// SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
|
||||
SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -61,7 +61,6 @@ import org.greenrobot.eventbus.ThreadMode;
|
||||
import java.util.Locale;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
@@ -377,7 +376,14 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
|
||||
NewPeopleInfo peopleInfo = stringResponseModel.getData().getInfo();
|
||||
if (peopleInfo.getIsShow()) {
|
||||
liveNewPeople.setVisibility(View.VISIBLE);
|
||||
newPeopleUrl = peopleInfo.getLink();
|
||||
if(peopleInfo.getLink().startsWith("http")){
|
||||
newPeopleUrl = peopleInfo.getLink();
|
||||
if(!newPeopleUrl.contains("?")){
|
||||
newPeopleUrl+="?";
|
||||
}
|
||||
}else {
|
||||
newPeopleUrl = CommonAppConfig.HOST + peopleInfo.getLink();
|
||||
}
|
||||
}
|
||||
}, Throwable::printStackTrace).isDisposed();
|
||||
}
|
||||
@@ -410,7 +416,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
|
||||
showTrickeryDialog();
|
||||
}else if (i==R.id.live_new_people){
|
||||
Bundle bundle=new Bundle();
|
||||
String url= newPeopleUrl+"?g=Appapi&m=Turntable&a=tricky";
|
||||
String url= newPeopleUrl+"&g=Appapi&m=Turntable&a=tricky";
|
||||
url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token="
|
||||
+ CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid;
|
||||
bundle.putString("url", url);
|
||||
|
||||
@@ -226,6 +226,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
}
|
||||
|
||||
public static void setViewUP(int i) {
|
||||
if (mVideoView == null) return;
|
||||
Log.i("收", "整理" + i);
|
||||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams();
|
||||
params.height = vHeight;
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.yunbao.live.views;
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Outline;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
@@ -12,6 +14,7 @@ import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewOutlineProvider;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
@@ -21,6 +24,7 @@ import android.widget.TextView;
|
||||
import android.widget.ViewFlipper;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.DefaultItemAnimator;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
@@ -37,12 +41,16 @@ import com.bumptech.glide.request.RequestListener;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.bumptech.glide.request.target.Target;
|
||||
import com.makeramen.roundedimageview.RoundedImageView;
|
||||
import com.ms.banner.Banner;
|
||||
import com.ms.banner.BannerConfig;
|
||||
import com.ms.banner.listener.OnBannerClickListener;
|
||||
import com.opensource.svgaplayer.SVGADrawable;
|
||||
import com.opensource.svgaplayer.SVGAImageView;
|
||||
import com.opensource.svgaplayer.SVGAParser;
|
||||
import com.opensource.svgaplayer.SVGAVideoEntity;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.bean.BannerBean;
|
||||
import com.yunbao.common.bean.LevelBean;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
@@ -66,7 +74,9 @@ import com.yunbao.live.activity.LiveActivity;
|
||||
import com.yunbao.live.activity.LiveAnchorActivity;
|
||||
import com.yunbao.live.activity.LiveAudienceActivity;
|
||||
import com.yunbao.live.activity.LiveRyAnchorActivity;
|
||||
import com.yunbao.live.activity.ZhuangBanActivity;
|
||||
import com.yunbao.live.adapter.LiveChatAdapter;
|
||||
import com.yunbao.live.adapter.LiveRoomFastMessageRecyclerViewAdapter;
|
||||
import com.yunbao.live.adapter.LiveUserAdapter;
|
||||
import com.yunbao.live.bean.DrPkbean;
|
||||
import com.yunbao.live.bean.LiveBuyGuardMsgBean;
|
||||
@@ -78,6 +88,7 @@ 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;
|
||||
import com.yunbao.live.custom.RightGradual;
|
||||
@@ -85,6 +96,7 @@ import com.yunbao.live.custom.TopGradual;
|
||||
import com.yunbao.live.dialog.LiveFansMedalDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveHDDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveUserDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveWishListDialogFragment4Audience;
|
||||
import com.yunbao.live.event.LiveAudienceEvent;
|
||||
import com.yunbao.live.http.LiveHttpConsts;
|
||||
import com.yunbao.live.http.LiveHttpUtil;
|
||||
@@ -92,7 +104,6 @@ import com.yunbao.live.presenter.LiveDanmuPresenter;
|
||||
import com.yunbao.live.presenter.LiveEnterRoomAnimPresenter;
|
||||
import com.yunbao.live.presenter.LiveGiftAnimPresenter;
|
||||
import com.yunbao.live.presenter.LiveLightAnimPresenter;
|
||||
import com.yunbao.live.socket.SocketChatUtil;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
@@ -100,12 +111,12 @@ import java.lang.ref.WeakReference;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import pl.droidsonroids.gif.GifImageView;
|
||||
|
||||
import static com.blankj.utilcode.util.ActivityUtils.startActivity;
|
||||
import static com.yunbao.common.CommonAppContext.logger;
|
||||
import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics;
|
||||
|
||||
@@ -231,13 +242,23 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
public static RelativeLayout lt_pk_line;
|
||||
|
||||
public WindowManager windowManager;
|
||||
public boolean isRy = false;
|
||||
// public boolean isRy = false;
|
||||
private Banner mBanner1, mBanner2;
|
||||
private List<BannerBean> mBannerList1 = new ArrayList<>();
|
||||
private List<BannerBean> mBannerList2 = new ArrayList<>();
|
||||
private LinearLayout btn_event2;
|
||||
private ImageView imgEvent;
|
||||
private View btnEvent;
|
||||
private RecyclerView fastMsgRecyclerView;
|
||||
private LiveRoomFastMessageRecyclerViewAdapter fastMessageRecyclerViewAdapter;
|
||||
|
||||
private LiveUserGiftBean nowGuardUser;
|
||||
|
||||
public LiveRoomViewHolder(boolean isRys, int forActivity, Context context, ViewGroup parentView, GifImageView gifImageView, SVGAImageView svgaImageView, ViewGroup liveGiftPrizePoolContainer, WindowManager windowManager) {
|
||||
super(context, parentView);
|
||||
Contexts = context;
|
||||
this.forAct = forActivity;
|
||||
this.isRy = isRys;
|
||||
// this.isRy = isRys;
|
||||
mGifImageView = gifImageView;
|
||||
mSVGAImageView = svgaImageView;
|
||||
mLiveGiftPrizePoolContainer = liveGiftPrizePoolContainer;
|
||||
@@ -245,6 +266,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
|
||||
}
|
||||
|
||||
public void clearList() {
|
||||
mBannerList2.clear();
|
||||
}
|
||||
|
||||
//更新连麦人
|
||||
public static List<String> mic_ids = new ArrayList<>();
|
||||
@@ -550,8 +574,12 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
|
||||
btnEvent = findViewById(R.id.btn_event);
|
||||
imgEvent = (ImageView) findViewById(R.id.img_event);
|
||||
btn_event2 = (LinearLayout) findViewById(R.id.btn_event2);
|
||||
mBanner1 = (Banner) findViewById(R.id.banner1);
|
||||
time = (TextView) findViewById(R.id.time);
|
||||
mBanner2 = (Banner) findViewById(R.id.banner2);
|
||||
pkText1 = (TextView) findViewById(R.id.pk_text1);
|
||||
pkText2 = (TextView) findViewById(R.id.pk_text2);
|
||||
pkText3 = (TextView) findViewById(R.id.pk_text3);
|
||||
@@ -811,7 +839,204 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
ViewClicksAntiShake.clicksAntiShake(wishListLayout, () -> Bus.get().post(new LiveAudienceEvent()
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.WISH_LIST)));
|
||||
|
||||
mBanner1.setOutlineProvider(new ViewOutlineProvider() {
|
||||
@Override
|
||||
public void getOutline(View view, Outline outline) {
|
||||
outline.setRoundRect(0, 0, view.getWidth(), view.getHeight(), 10);
|
||||
}
|
||||
});
|
||||
mBanner2.setOutlineProvider(new ViewOutlineProvider() {
|
||||
@Override
|
||||
public void getOutline(View view, Outline outline) {
|
||||
outline.setRoundRect(0, 0, view.getWidth(), view.getHeight(), 10);
|
||||
}
|
||||
});
|
||||
loadWishlistData();
|
||||
//打开活动窗口
|
||||
ViewClicksAntiShake.clicksAntiShake(wishListLayout, () -> startActivity(new Intent(mContext, ZhuangBanActivity.class).putExtra("url", "")));
|
||||
//打招呼消息
|
||||
fastMsgRecyclerView = (RecyclerView) findViewById(R.id.room_fast_msg);
|
||||
fastMsgRecyclerView.setLayoutManager(new LinearLayoutManager(mContext,LinearLayoutManager.HORIZONTAL,false));
|
||||
fastMessageRecyclerViewAdapter=new LiveRoomFastMessageRecyclerViewAdapter(mContext);
|
||||
fastMsgRecyclerView.setAdapter(fastMessageRecyclerViewAdapter);
|
||||
fastMessageRecyclerViewAdapter.setMessageListener(msg -> {
|
||||
//点击的消息发送出去
|
||||
((LiveActivity) mContext).sendChatMessage(msg);
|
||||
fastMsgRecyclerView.setVisibility(View.GONE);
|
||||
});
|
||||
// fastMsgRecyclerView.setItemAnimator(new DefaultItemAnimator());
|
||||
}
|
||||
|
||||
private void showBanner2() {
|
||||
if (mBannerList2 == null || mBannerList2.size() == 0 || mBanner2 == null) {
|
||||
return;
|
||||
}
|
||||
if (mBannerList2.size() == 1) {
|
||||
mBanner2.setAutoPlay(false)
|
||||
.setPages(mBannerList2, new CustomViewHolder())
|
||||
.setDelayTime(3000)
|
||||
.setBannerStyle(BannerConfig.NOT_INDICATOR)
|
||||
.setOnBannerClickListener(new OnBannerClickListener() {
|
||||
@Override
|
||||
public void onBannerClick(List datas, int p) {
|
||||
if (mBannerList2 != null) {
|
||||
if (p >= 0 && p < mBannerList2.size()) {
|
||||
BannerBean bean = mBannerList2.get(p);
|
||||
if (bean.getShow_type().equals("1")) {
|
||||
String url = bean.getLink() + "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid + "&t=" + System.currentTimeMillis();
|
||||
ZhuangBanActivity.forward(mContext, url, false);
|
||||
} else {
|
||||
String url = bean.getLink() + "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid + "&t=" + System.currentTimeMillis();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("url", url);
|
||||
LiveHDDialogFragment fragment = new LiveHDDialogFragment();
|
||||
fragment.setArguments(bundle);
|
||||
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
.start();
|
||||
} else {
|
||||
mBanner2.setAutoPlay(true)
|
||||
.setPages(mBannerList2, new CustomViewHolder())
|
||||
.setDelayTime(3000)
|
||||
.setBannerStyle(BannerConfig.NOT_INDICATOR)
|
||||
.setOnBannerClickListener(new OnBannerClickListener() {
|
||||
@Override
|
||||
public void onBannerClick(List datas, int p) {
|
||||
if (mBannerList2 != null) {
|
||||
if (p >= 0 && p < mBannerList2.size()) {
|
||||
BannerBean bean = mBannerList2.get(p);
|
||||
if (bean.getShow_type().equals("1")) {
|
||||
String url = bean.getLink() + "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid;
|
||||
ZhuangBanActivity.forward(mContext, url, false);
|
||||
} else {
|
||||
String url = bean.getLink() + "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid;
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("url", url);
|
||||
LiveHDDialogFragment fragment = new LiveHDDialogFragment();
|
||||
fragment.setArguments(bundle);
|
||||
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
.start();
|
||||
}
|
||||
}
|
||||
|
||||
public void setLiveUid(String liveUid) {
|
||||
mLiveUid = liveUid;
|
||||
LiveHttpUtil.geteEvent(mLiveUid, new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && imgEvent != null) {
|
||||
for (int i = 0; i < info.length; i++) {
|
||||
JSONObject obj = JSONObject.parseObject(info[i]);
|
||||
if (obj.getString("is_hidden").equals("0")) {
|
||||
BannerBean bannerBean = new BannerBean();
|
||||
bannerBean.setImageUrl(obj.getString("img"));
|
||||
bannerBean.setLink(obj.getString("link"));
|
||||
bannerBean.setShow_type(obj.getString("show_type"));
|
||||
mBannerList2.add(bannerBean);
|
||||
}
|
||||
}
|
||||
if (mBannerList2.size() <= 0) {
|
||||
btn_event2.setVisibility(View.GONE);
|
||||
}
|
||||
showBanner2();
|
||||
} else {
|
||||
if (btn_event2 != null) {
|
||||
btn_event2.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//获取心愿单列表
|
||||
private void loadWishlistData() {
|
||||
LiveHttpUtil.getWishList(mLiveUid, new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
try {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
String giftJson = obj.getString("wishlist");
|
||||
List<LiveWishlistBean> mWishlist = JSON.parseArray(giftJson, LiveWishlistBean.class);
|
||||
if (mWishlist.size() > 0) {
|
||||
//心单
|
||||
BannerBean bannerBean2 = new BannerBean();
|
||||
bannerBean2.setImageUrl(obj.getString("img"));
|
||||
bannerBean2.setLink("xyd");
|
||||
mBannerList1.add(bannerBean2);
|
||||
}
|
||||
|
||||
showBanner();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void showBanner() {
|
||||
if (mBannerList1 == null || mBannerList1.size() == 0 || mBanner1 == null) {
|
||||
return;
|
||||
}
|
||||
mBanner1.setAutoPlay(true)
|
||||
.setPages(mBannerList1, new CustomViewHolder())
|
||||
.setDelayTime(3000)
|
||||
.setBannerStyle(BannerConfig.NOT_INDICATOR)
|
||||
.setOnBannerClickListener(new OnBannerClickListener() {
|
||||
@Override
|
||||
public void onBannerClick(List datas, int p) {
|
||||
if (mBannerList1 != null) {
|
||||
if (p >= 0 && p < mBannerList1.size()) {
|
||||
BannerBean bean = mBannerList1.get(p);
|
||||
if (bean != null) {
|
||||
String link = bean.getLink();
|
||||
if (link.equals("sc")) {
|
||||
String url;
|
||||
if (!"".equals(bean.getmIntoUrl()) && bean.getmIntoUrl() != null) {
|
||||
url = CommonAppConfig.HOST + bean.getmIntoUrl() + "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken();
|
||||
} else {
|
||||
url = CommonAppConfig.HOST + "/h5/activity/firstTopUp/newUp.html?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken();
|
||||
}
|
||||
ZhuangBanActivity.forward(mContext, url, false);
|
||||
} else if (link.equals("zxb")) {
|
||||
String url = CommonAppConfig.HOST + "/h5/activity/weekStar/index.html?&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid;
|
||||
ZhuangBanActivity.forward(mContext, url, false);
|
||||
} else if (link.equals("xyd")) {
|
||||
openWishListWindow();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* 观众打开主播的心愿单窗口
|
||||
*/
|
||||
public void openWishListWindow() {
|
||||
LiveWishListDialogFragment4Audience fragment = new LiveWishListDialogFragment4Audience();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(Constants.LIVE_UID, mLiveUid);
|
||||
fragment.setArguments(bundle);
|
||||
if (mContext instanceof LiveAudienceActivity) {
|
||||
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveWishListDialogFragmentAudience");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1128,7 +1353,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
*/
|
||||
public void setUserList(List<LiveUserGiftBean> list) {
|
||||
if (mLiveUserAdapter != null) {
|
||||
resetUserListWidth(DpUtil.dp2px((Math.min(list.size(), 3))*38));
|
||||
resetUserListWidth(DpUtil.dp2px((Math.min(list.size(), 3)) * 38));
|
||||
mLiveUserAdapter.refreshList(list);
|
||||
}
|
||||
}
|
||||
@@ -1196,20 +1421,23 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
getIsHot();
|
||||
getGuardInfo();
|
||||
}
|
||||
private void getGuardInfo(){
|
||||
|
||||
private void getGuardInfo() {
|
||||
LiveHttpUtil.getUserList(mLiveUid, mStream, "guard", 1, new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
JSONObject json=JSONObject.parseObject(info[0]);
|
||||
JSONObject json = JSONObject.parseObject(info[0]);
|
||||
JSONArray userlist = json.getJSONArray("userlist");
|
||||
if(userlist.size()!=0){
|
||||
setGuardIcon(JSONArray.parseArray(userlist.toJSONString(),LiveUserGiftBean.class).get(0));
|
||||
if (userlist.size() != 0) {
|
||||
setGuardIcon(JSONArray.parseArray(userlist.toJSONString(), LiveUserGiftBean.class).get(0));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
private void setGuardIcon(LiveUserGiftBean guard){
|
||||
if (guard!=null){
|
||||
|
||||
private void setGuardIcon(LiveUserGiftBean guard) {
|
||||
if (guard != null) {
|
||||
nowGuardUser=guard;
|
||||
ImgLoader.displayAvatar(mContext, guard.getAvatar(), userGuard);
|
||||
gift_svga.setVisibility(View.VISIBLE);
|
||||
}
|
||||
@@ -1276,9 +1504,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
} else if (i == R.id.btn_prize_pool_level) {
|
||||
((LiveActivity) mContext).openPrizePoolWindow();
|
||||
} else if (i == R.id.user_more) {
|
||||
((LiveActivity) mContext).openUserMoreListWindow(4,false);
|
||||
((LiveActivity) mContext).openUserMoreListWindow(4, false);
|
||||
} else if (i == R.id.hot_btn) {
|
||||
((LiveActivity) mContext).openUserMoreListWindow(1,false);
|
||||
((LiveActivity) mContext).openUserMoreListWindow(1, false);
|
||||
|
||||
} else if (i == R.id.btn_close) {
|
||||
close();
|
||||
@@ -1287,8 +1515,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
((LiveActivity) mContext).openLuckGiftTip();
|
||||
} else if (i == R.id.ft_hot_add) {
|
||||
((LiveActivity) mContext).openHotListWindow(1);
|
||||
} else if (i == R.id.user_guard){
|
||||
((LiveActivity) mContext).openUserMoreListWindow(2,true);
|
||||
} else if (i == R.id.user_guard) {
|
||||
// ((LiveActivity) mContext).openUserMoreListWindow(2, true);
|
||||
((LiveActivity) mContext).openGuardListWindow();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1322,7 +1551,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
logger.logEvent("FB_Follow", null);
|
||||
AdjustEvent adjustEvent1 = new AdjustEvent("oess6a");
|
||||
Adjust.trackEvent(adjustEvent1);
|
||||
SocketChatUtil.sendSystemMessage(mLiveUid, CommonAppConfig.getInstance().getUserBean().getUserNiceName() + WordUtil.getString(R.string.live_follow_anchor));
|
||||
// SocketChatUtil.sendSystemMessage(mLiveUid, CommonAppConfig.getInstance().getUserBean().getUserNiceName() + WordUtil.getString(R.string.live_follow_anchor));
|
||||
LiveActivity.sendSystemMessage(
|
||||
CommonAppConfig.getInstance().getUserBean().getUserNiceName() + WordUtil.getString(R.string.live_follow_anchor));
|
||||
}
|
||||
@@ -1367,7 +1596,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
* 退出直播间
|
||||
*/
|
||||
private void close() {
|
||||
if (isRy == false) {
|
||||
if (mContext instanceof LiveAudienceActivity) {
|
||||
if (forAct == 1) {
|
||||
//是否关注0==没关注
|
||||
if (isAttention == 0) {
|
||||
@@ -1385,7 +1614,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
((LiveAudienceActivity) mContext).setBackIndex(1);
|
||||
((LiveAnchorActivity) mContext).onBackPressed();
|
||||
}
|
||||
} else {
|
||||
} else if (mContext instanceof LiveRyAnchorActivity) {
|
||||
if (forAct == 1) {
|
||||
//是否关注0==没关注
|
||||
if (isAttention == 0) {
|
||||
@@ -1404,6 +1633,43 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
((LiveRyAnchorActivity) mContext).onBackPressed();
|
||||
}
|
||||
}
|
||||
// if (isRy == false) {
|
||||
// if (forAct == 1) {
|
||||
// //是否关注0==没关注
|
||||
// if (isAttention == 0) {
|
||||
// if (isStayRoomfive) {
|
||||
// showFollowDialog(mNameText, mAvatarUrl, mContext);
|
||||
// } else {
|
||||
// ((LiveAudienceActivity) mContext).setBackIndex(1);
|
||||
// ((LiveAudienceActivity) mContext).onBackPressed();
|
||||
// }
|
||||
// } else {
|
||||
// ((LiveAudienceActivity) mContext).setBackIndex(1);
|
||||
// ((LiveAudienceActivity) mContext).onBackPressed();
|
||||
// }
|
||||
// } else {
|
||||
// ((LiveAudienceActivity) mContext).setBackIndex(1);
|
||||
// ((LiveAnchorActivity) mContext).onBackPressed();
|
||||
// }
|
||||
// } else {
|
||||
// if (forAct == 1) {
|
||||
// //是否关注0==没关注
|
||||
// if (isAttention == 0) {
|
||||
// if (isStayRoomfive) {
|
||||
// showFollowDialog(mNameText, mAvatarUrl, mContext);
|
||||
// } else {
|
||||
// LiveRyAnchorActivity.backIndex = 1;
|
||||
// ((LiveRyAnchorActivity) mContext).onBackPressed();
|
||||
// }
|
||||
// } else {
|
||||
// LiveRyAnchorActivity.backIndex = 1;
|
||||
// ((LiveRyAnchorActivity) mContext).onBackPressed();
|
||||
// }
|
||||
// } else {
|
||||
// LiveRyAnchorActivity.backIndex = 1;
|
||||
// ((LiveRyAnchorActivity) mContext).onBackPressed();
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1422,7 +1688,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
public void refreshUserList(JSONObject obj) {
|
||||
List<LiveUserGiftBean> list = JSON.parseArray(obj.getString("userlist"), LiveUserGiftBean.class);
|
||||
mLiveUserAdapter.refreshList(list);
|
||||
getGuardInfo();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1531,6 +1796,24 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
mLiveEnterRoomAnimPresenter.enterRoom(bean);
|
||||
}
|
||||
room_hot.setText(formatBigNum.formatBigNum(bean.getLiveChatBean().getHot_num()));
|
||||
LiveUserGiftBean chatBean = bean.getUserBean();
|
||||
if(chatBean!=null&&nowGuardUser!=null) {
|
||||
LiveUserGiftBean tmp = null;
|
||||
if (chatBean.getGuardType() != 0 && chatBean.getGuardType() > nowGuardUser.getGuardType()) {
|
||||
tmp = chatBean;
|
||||
} else if (chatBean.getGuardType() != 0 && chatBean.getGuardType() == nowGuardUser.getGuardType() && chatBean.getLevel() > nowGuardUser.getLevel()) {
|
||||
tmp = chatBean;
|
||||
}
|
||||
setGuardIcon(tmp);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户离开房间
|
||||
* @param bean 用户
|
||||
*/
|
||||
public void onExitRoom(UserBean bean){
|
||||
// getGuardInfo();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1844,9 +2127,10 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
}
|
||||
});
|
||||
}
|
||||
public void resetUserListWidth(int width){
|
||||
|
||||
public void resetUserListWidth(int width) {
|
||||
ViewGroup.LayoutParams params = mUserRecyclerView.getLayoutParams();
|
||||
params.width=width;
|
||||
params.width = width;
|
||||
mUserRecyclerView.setLayoutParams(params);
|
||||
}
|
||||
|
||||
@@ -1919,6 +2203,10 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
mLiveRoomHandler.removeCallbacksAndMessages(null);
|
||||
}
|
||||
|
||||
public void setFastMessage(List<String> greetings) {
|
||||
fastMessageRecyclerViewAdapter.setMessage(greetings);
|
||||
}
|
||||
|
||||
private static class LiveRoomHandler extends Handler {
|
||||
|
||||
private LiveRoomViewHolder mLiveRoomViewHolder;
|
||||
|
||||
@@ -36,7 +36,7 @@ public class LoadingView extends FrameLayout {
|
||||
|
||||
private void init(Context context) {
|
||||
this.mContext = context;
|
||||
View view = LayoutInflater.from(mContext).inflate(R.layout.layout_portrait_live_item, this, true);
|
||||
View view = LayoutInflater.from(mContext).inflate(R.layout.layout_portrait_comm_item, this, true);
|
||||
mIvLoading = view.findViewById(R.id.iv_loading);
|
||||
}
|
||||
|
||||
@@ -46,7 +46,6 @@ public class LoadingView extends FrameLayout {
|
||||
ImageView ivLoading = mIvLoading.findViewById(R.id.iv_loading);
|
||||
AnimationDrawable frameAnimation = (AnimationDrawable) ivLoading.getBackground();
|
||||
frameAnimation.start();
|
||||
|
||||
setVisibility(VISIBLE);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@ import android.app.Dialog;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.CountDownTimer;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
@@ -20,6 +22,7 @@ import androidx.viewpager.widget.PagerAdapter;
|
||||
import com.adjust.sdk.Adjust;
|
||||
import com.adjust.sdk.AdjustEvent;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.blankj.utilcode.util.GsonUtils;
|
||||
import com.tencent.imsdk.v2.V2TIMCallback;
|
||||
@@ -29,14 +32,15 @@ import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.custom.MyViewPager;
|
||||
import com.yunbao.common.event.FollowEvent;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
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.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.utils.RandomUtil;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
@@ -62,30 +66,39 @@ import com.yunbao.live.dialog.BlowkissDialog;
|
||||
import com.yunbao.live.dialog.NewUserDialog;
|
||||
import com.yunbao.live.event.LinkMicTxAccEvent;
|
||||
import com.yunbao.live.event.LiveAudienceEvent;
|
||||
import com.yunbao.live.event.LiveRoomChangeEvent;
|
||||
import com.yunbao.live.http.LiveHttpConsts;
|
||||
import com.yunbao.live.http.LiveHttpUtil;
|
||||
import com.yunbao.live.presenter.LiveLinkMicAnchorPresenter;
|
||||
import com.yunbao.live.presenter.LiveLinkMicPkPresenter;
|
||||
import com.yunbao.live.presenter.LiveLinkMicPresenter;
|
||||
import com.yunbao.live.presenter.LiveRyLinkMicPkPresenter;
|
||||
import com.yunbao.live.socket.SocketChatUtil;
|
||||
import com.yunbao.live.socket.SocketClient;
|
||||
import com.yunbao.live.socket.SocketMessageListener;
|
||||
import com.yunbao.live.socket.SocketRyChatUtil;
|
||||
import com.yunbao.live.socket.SocketRyClient;
|
||||
import com.yunbao.live.socket.SocketSendBean;
|
||||
import com.yunbao.live.utils.LiveImDeletUtil;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import cn.rongcloud.rtc.api.RCRTCEngine;
|
||||
import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback;
|
||||
import cn.rongcloud.rtc.api.callback.IRCRTCSwitchRoleCallback;
|
||||
import cn.rongcloud.rtc.base.RTCErrorCode;
|
||||
import io.rong.imlib.IRongCallback;
|
||||
import io.rong.imlib.IRongCoreCallback;
|
||||
import io.rong.imlib.IRongCoreEnum;
|
||||
import io.rong.imlib.RongIMClient;
|
||||
import io.rong.imlib.chatroom.base.RongChatRoomClient;
|
||||
import io.rong.imlib.model.Conversation;
|
||||
import io.rong.message.TextMessage;
|
||||
|
||||
import static com.yunbao.common.CommonAppContext.logger;
|
||||
import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics;
|
||||
import static com.yunbao.live.presenter.LiveLinkMicPresenter.mBannerList2;
|
||||
import static com.yunbao.live.views.LivePlayKsyViewHolder.setViewUP;
|
||||
import static com.yunbao.live.views.LivePlayRyViewHolder.Micing;
|
||||
import static com.yunbao.live.views.LiveRoomViewHolder.isStayRoomfive;
|
||||
|
||||
/**
|
||||
@@ -108,7 +121,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
//直播间背景
|
||||
private ImageView liveBack;
|
||||
|
||||
|
||||
private View mask;
|
||||
//侧滑布局
|
||||
// private DrawerLayout drawerLayout;
|
||||
//直播间拆分布局
|
||||
@@ -125,8 +138,6 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
//主播与主播连麦逻辑
|
||||
private LiveLinkMicAnchorPresenter mLiveLinkMicAnchorPresenter;
|
||||
//主播与主播PK逻辑
|
||||
private LiveLinkMicPkPresenter mLiveLinkMicPkPresenter;
|
||||
//主播与主播PK逻辑
|
||||
private LiveRyLinkMicPkPresenter mLiveRyLinkMicPkPresenter;
|
||||
//直播间的类型 普通 密码 门票 计时等
|
||||
private int mLiveType;
|
||||
@@ -151,10 +162,14 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
private boolean mLighted;
|
||||
private boolean mCoinNotEnough;//余额不足
|
||||
private boolean mFirstConnectSocket;//是否是第一次连接成功socket
|
||||
private int liveBg;
|
||||
private LiveImDeletUtil liveImDeletUtil;
|
||||
private List<String> greetings = new ArrayList<>();
|
||||
|
||||
public PortraitLiveManager(Activity context, Intent intent) {
|
||||
this.mContext = context;
|
||||
this.mIntent = intent;
|
||||
liveImDeletUtil = new LiveImDeletUtil();
|
||||
ininView();
|
||||
}
|
||||
|
||||
@@ -186,6 +201,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
|
||||
//直播页面背景
|
||||
liveBack = mRootContainer.findViewById(R.id.live_back);
|
||||
mask = mRootContainer.findViewById(R.id.mask);
|
||||
|
||||
|
||||
}
|
||||
@@ -202,11 +218,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
.setParametersModel(new OpenParametersModel()
|
||||
.setmLiveType(mLiveType)
|
||||
.setmLiveTypeVal(mLiveTypeVal)));
|
||||
if (mIntent.getIntExtra("isry", 0) == 1) {
|
||||
mLivePlayViewHolder = new LivePlayRyViewHolder(mContext, playContainer, mIntent.getIntExtra("landscape", 0));
|
||||
} else {
|
||||
mLivePlayViewHolder = new LivePlayKsyViewHolder(mContext, playContainer, mIntent.getIntExtra("landscape", 0));
|
||||
}
|
||||
|
||||
mLivePlayViewHolder = new LivePlayRyViewHolder(mContext, playContainer, mIntent.getIntExtra("landscape", 0));
|
||||
mLivePlayViewHolder.addToParent();
|
||||
mLivePlayViewHolder.subscribeActivityLifeCycle();
|
||||
mLiveRoomViewHolder = new LiveRoomViewHolder(false, 1, mContext, mContainer, mSecondPage.findViewById(R.id.gift_gif), mSecondPage.findViewById(R.id.gift_svga), mContainerWrap, mContext.getWindowManager());
|
||||
@@ -218,15 +231,13 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
mLiveAudienceViewHolder.subscribeActivityLifeCycle();
|
||||
mLiveLinkMicPresenter = new LiveLinkMicPresenter(mContext, mLivePlayViewHolder, false, mLiveSDK, mLiveAudienceViewHolder.getContentView());
|
||||
mLiveLinkMicAnchorPresenter = new LiveLinkMicAnchorPresenter(mContext, mLivePlayViewHolder, false, mLiveSDK, null);
|
||||
if (!(mIntent.getIntExtra("isry", 0) == 1)) {
|
||||
mLiveLinkMicPkPresenter = new LiveLinkMicPkPresenter(mContext, mLivePlayViewHolder, false, null);
|
||||
} else {
|
||||
mLiveRyLinkMicPkPresenter = new LiveRyLinkMicPkPresenter(mContext, mLivePlayViewHolder, false, null);
|
||||
}
|
||||
|
||||
mLiveRyLinkMicPkPresenter = new LiveRyLinkMicPkPresenter(mContext, mLivePlayViewHolder, false, null);
|
||||
|
||||
|
||||
//直播间背景
|
||||
ImgLoader.displayBlurLive(mContext, mLiveBean.getAvatar(), liveBack);
|
||||
|
||||
ImgLoader.display(mContext, R.mipmap.live_bg, liveBack);
|
||||
mask.setVisibility(View.GONE);
|
||||
mLivePlayViewHolder.setCover(data.getThumb());
|
||||
mLivePlayViewHolder.play(data.getPull());
|
||||
mLiveRoomViewHolder.setAvatar(data.getAvatar());
|
||||
@@ -234,12 +245,10 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
mLiveRoomViewHolder.setName(data.getUserNiceName());
|
||||
mLiveRoomViewHolder.setRoomNum(data.getLiangNameTip());
|
||||
mLiveRoomViewHolder.setTitle(data.getTitle());
|
||||
if (!(mIntent.getIntExtra("isry", 0) == 1)) {
|
||||
mLiveLinkMicPkPresenter.setLiveUid(data.getUid(), "");
|
||||
} else {
|
||||
mLiveRyLinkMicPkPresenter.setLiveUid(data.getUid(), "");
|
||||
}
|
||||
mLiveLinkMicPresenter.setLiveUid(data.getUid());
|
||||
|
||||
mLiveRyLinkMicPkPresenter.setLiveUid(data.getUid(), "");
|
||||
|
||||
mLiveRoomViewHolder.setLiveUid(data.getUid());
|
||||
//心愿单
|
||||
LiveHttpUtil.getWishList(mLiveBean.getUid(), new HttpCallback() {
|
||||
@Override
|
||||
@@ -263,19 +272,19 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
|
||||
@Override
|
||||
public void onRemove() {
|
||||
mLiveAudienceViewHolder.removeCallbacks();
|
||||
//断开socket
|
||||
if (!(mIntent.getIntExtra("isry", 0) == 1)) {
|
||||
if (mSocketClient != null) {
|
||||
mSocketClient.disConnect();
|
||||
}
|
||||
mSocketClient = null;
|
||||
} else {
|
||||
if (mSocketRyClient != null) {
|
||||
mSocketRyClient.disConnect();
|
||||
}
|
||||
mSocketRyClient = null;
|
||||
if (mLiveAudienceViewHolder != null) {
|
||||
mLiveAudienceViewHolder.removeFromParent();
|
||||
mLiveAudienceViewHolder.countDownTimerTrickery = null;
|
||||
mLiveAudienceViewHolder.removeCallbacks();
|
||||
}
|
||||
mLiveAudienceViewHolder = null;
|
||||
//断开socket
|
||||
|
||||
if (mSocketRyClient != null) {
|
||||
mSocketRyClient.disConnect();
|
||||
}
|
||||
mSocketRyClient = null;
|
||||
|
||||
|
||||
//结束播放
|
||||
if (mLivePlayViewHolder != null) {
|
||||
@@ -314,17 +323,10 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
if (mLiveLinkMicAnchorPresenter != null) {
|
||||
mLiveLinkMicAnchorPresenter.clearData();
|
||||
}
|
||||
if (mLiveLinkMicPkPresenter != null) {
|
||||
mLiveLinkMicPkPresenter.clearData();
|
||||
}
|
||||
if (mLiveRyLinkMicPkPresenter != null) {
|
||||
mLiveRyLinkMicPkPresenter.clearData();
|
||||
}
|
||||
if (mLiveAudienceViewHolder != null) {
|
||||
mLiveAudienceViewHolder.removeFromParent();
|
||||
mLiveAudienceViewHolder.countDownTimerTrickery = null;
|
||||
mLiveAudienceViewHolder = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -377,9 +379,146 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 申请连麦但是主播还未同意的状态
|
||||
*/
|
||||
public void micIngTypeOne(LiveBean bean, int liveType, int liveTypeVal) {
|
||||
DialogUitl.showSimpleDialog(mContext, null, "您已申請,退出將取消語音連麥申請!", false, new DialogUitl.SimpleCallback3() {
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog) {
|
||||
Micing = 0;
|
||||
//用户申请联麦
|
||||
final SocketSendBean msg = new SocketSendBean()
|
||||
.param("_method_", Constants.LIAN_MAI)
|
||||
.param("action", 7)
|
||||
.param("uname", CommonAppConfig.getInstance().getUserBean().getUserNiceName())
|
||||
.param("avatar", CommonAppConfig.getInstance().getUserBean().getAvatar())
|
||||
.param("uid", CommonAppConfig.getInstance().getUid());
|
||||
msg.create();
|
||||
|
||||
Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE;
|
||||
TextMessage messageContent = TextMessage.obtain(msg.mResult.toString());
|
||||
io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(liveID, conversationType, messageContent);
|
||||
|
||||
RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() {
|
||||
@Override
|
||||
public void onAttached(io.rong.imlib.model.Message message) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(io.rong.imlib.model.Message message) {
|
||||
Log.e("ry", "发送成功");
|
||||
liveImDeletUtil.deleteMessages(message.getTargetId(), message.getMessageId());
|
||||
if (isBackPressed) {
|
||||
((LiveAudienceActivity) mContext).onBackPressed();
|
||||
} else {
|
||||
EventBus.getDefault().post(new LiveRoomChangeEvent(bean, liveType, liveTypeVal));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
|
||||
Log.e("ry", "发送失敗" + errorCode.toString());
|
||||
liveImDeletUtil.deleteMessages(message.getTargetId(), message.getMessageId());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel() {
|
||||
((LiveAudienceActivity) mContext).setEnableScroll(true);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 正处于连麦中
|
||||
*/
|
||||
public void micIngTypeTwo(LiveBean bean, int liveType, int liveTypeVal) {
|
||||
DialogUitl.showSimpleDialog(mContext, null, "連麥中,退出將斷開語音連麥!", false, new DialogUitl.SimpleCallback3() {
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog) {
|
||||
ToastUtil.show("下麥中,稍等.....");
|
||||
RCRTCEngine.getInstance().getRoom().getLocalUser().switchToAudience(new IRCRTCSwitchRoleCallback() {
|
||||
|
||||
/**
|
||||
* 当切换失败且SDK处于无法回退状态时回调,该角色已经无法使用当前角色继续进行音视频。
|
||||
* SDK内部会退出房间并清理所有资源,该用户只能重新加入房间才能继续音视频。
|
||||
*/
|
||||
@Override
|
||||
public void onKicked() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Log.e("ry", "下麦成功");
|
||||
// 该用户切换为观众成功,可以以观众身份进行音视频
|
||||
//退出多人房间
|
||||
HttpClient.getInstance().get("live.leaveDrLm", "live.leaveDrLm")
|
||||
.params("roomid", liveID)
|
||||
.execute(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
Log.e("ry", code + "退出多人");
|
||||
|
||||
}
|
||||
});
|
||||
//退出rtc播放
|
||||
RCRTCEngine.getInstance().leaveRoom(new IRCRTCResultCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Log.e("ry", "退出多人房间成功");
|
||||
new Handler(Looper.getMainLooper()).post(new Runnable() {
|
||||
public void run() {
|
||||
Micing = 0;
|
||||
}
|
||||
});
|
||||
if (isBackPressed) {
|
||||
((LiveAudienceActivity) mContext).onBackPressed();
|
||||
} else {
|
||||
EventBus.getDefault().post(new LiveRoomChangeEvent(bean, liveType, liveTypeVal));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(RTCErrorCode errorCode) {
|
||||
Log.e("ry", errorCode + "退出多人房间失敗");
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 当切换失败且不影响当前角色继续音视频时回调
|
||||
* @param errorCode 失败错误码
|
||||
*/
|
||||
@Override
|
||||
public void onFailed(RTCErrorCode errorCode) {
|
||||
Log.e("ry", "下麦失败" + errorCode);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel() {
|
||||
((LiveAudienceActivity) mContext).setEnableScroll(true);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
//是否处于返回键
|
||||
private boolean isBackPressed = false;
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
|
||||
isBackPressed = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -388,17 +527,11 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
if (!mFirstConnectSocket) {
|
||||
mFirstConnectSocket = true;
|
||||
if (mLiveType == Constants.LIVE_TYPE_PAY || mLiveType == Constants.LIVE_TYPE_TIME) {
|
||||
if (!(mIntent.getIntExtra("isry", 0) == 1)) {
|
||||
SocketChatUtil.sendUpdateVotesMessage(mLiveBean.getUid(), mLiveTypeVal, 1);
|
||||
} else {
|
||||
SocketRyChatUtil.sendUpdateVotesMessage(mLiveBean.getUid(), mLiveTypeVal, 1);
|
||||
}
|
||||
}
|
||||
if (!(mIntent.getIntExtra("isry", 0) == 1)) {
|
||||
SocketChatUtil.getFakeFans(mLiveBean.getUid());
|
||||
} else {
|
||||
SocketRyChatUtil.getFakeFans(mLiveBean.getUid());
|
||||
|
||||
SocketRyChatUtil.sendUpdateVotesMessage(mLiveBean.getUid(), mLiveTypeVal, 1);
|
||||
|
||||
}
|
||||
SocketRyChatUtil.getFakeFans(mLiveBean.getUid());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -443,9 +576,12 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
mLiveLinkMicPresenter.onAudienceLeaveRoom(bean);
|
||||
}
|
||||
try {
|
||||
if (mLiveRoomViewHolder.room_hot != null) {
|
||||
if (!"".equals(bean.getHot_num()) && !"0".equals(bean.getHot_num())) {
|
||||
mLiveRoomViewHolder.room_hot.setText(formatBigNum.formatBigNum(bean.getHot_num()));
|
||||
if(mLiveRoomViewHolder!=null){
|
||||
mLiveRoomViewHolder.onExitRoom(bean);
|
||||
if (mLiveRoomViewHolder.room_hot != null) {
|
||||
if (!"".equals(bean.getHot_num()) && !"0".equals(bean.getHot_num())) {
|
||||
mLiveRoomViewHolder.room_hot.setText(formatBigNum.formatBigNum(bean.getHot_num()));
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
@@ -499,14 +635,10 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
|
||||
@Override
|
||||
public void onSendGiftPk(long leftGift, long rightGift, LivePKUserListBean bean) {
|
||||
if (!(mIntent.getIntExtra("isry", 0) == 1)) {
|
||||
if (mLiveLinkMicPkPresenter != null) {
|
||||
mLiveLinkMicPkPresenter.onPkProgressChanged(leftGift, rightGift, bean);
|
||||
}
|
||||
} else {
|
||||
if (mLiveRyLinkMicPkPresenter != null) {
|
||||
mLiveRyLinkMicPkPresenter.onPkProgressChanged(leftGift, rightGift, bean);
|
||||
}
|
||||
|
||||
if (mLiveRyLinkMicPkPresenter != null) {
|
||||
mLiveRyLinkMicPkPresenter.onPkProgressChanged(leftGift, rightGift, bean);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -814,34 +946,41 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
|
||||
private void enterRoom() {
|
||||
//进入直播间IM
|
||||
if (!(mIntent.getIntExtra("isry", 0) == 1)) {
|
||||
mSocketClient = new SocketClient(mLiveBean.getUid(), this);
|
||||
if (mLiveLinkMicPresenter != null) {
|
||||
mLiveLinkMicPresenter.setSocketClient(mSocketClient);
|
||||
}
|
||||
} else {
|
||||
mSocketRyClient = new SocketRyClient(mLiveBean.getUid(), this);
|
||||
if (mLiveLinkMicPresenter != null) {
|
||||
mLiveLinkMicPresenter.setSocketClient(mSocketClient);
|
||||
}
|
||||
|
||||
mSocketRyClient = new SocketRyClient(mLiveBean.getUid(), this);
|
||||
if (mLiveLinkMicPresenter != null) {
|
||||
mLiveLinkMicPresenter.setSocketClient(mSocketClient);
|
||||
}
|
||||
|
||||
timeIndex = 0;
|
||||
LiveHttpUtil.enterRoom(mLiveBean.getUid(), mLiveBean.getStream(), new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
|
||||
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");
|
||||
if (obj.containsKey("greetings")) {
|
||||
greetings = JSONArray.parseArray(obj.getJSONArray("greetings").toJSONString(), String.class);
|
||||
}
|
||||
|
||||
if (liveBg == 1) {
|
||||
//直播间背景
|
||||
ImgLoader.displayBlurLive(mContext, mLiveBean.getAvatar(), liveBack);
|
||||
mask.setVisibility(View.VISIBLE);
|
||||
}
|
||||
//回传参数
|
||||
Bus.get().post(new LiveAudienceEvent()
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.OPEN_PARAMETERS)
|
||||
.setParametersModel(new OpenParametersModel().setmDanmuPrice(mDanmuPrice)
|
||||
.setmSocketUserType(mSocketUserType)
|
||||
.setmChatLevel(mChatLevel)
|
||||
.setmDanMuLevel(mDanMuLevel)));
|
||||
.setmDanMuLevel(mDanMuLevel)
|
||||
.setLiveBg(liveBg)));
|
||||
EventBus.getDefault().post("close_login");
|
||||
EventBus.getDefault().post("oneUesrOver");
|
||||
|
||||
@@ -903,6 +1042,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
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"));
|
||||
@@ -932,7 +1072,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
}
|
||||
List<LiveUserGiftBean> list = JSON.parseArray(obj.getString("userlists"), LiveUserGiftBean.class);
|
||||
mLiveRoomViewHolder.setUserList(list);
|
||||
// resetUserListWidth(list);
|
||||
// resetUserListWidth(list);
|
||||
mLiveRoomViewHolder.startRefreshUserList();
|
||||
if (mLiveType == Constants.LIVE_TYPE_TIME) {//计时收费
|
||||
mLiveRoomViewHolder.startRequestTimeCharge();
|
||||
@@ -971,50 +1111,33 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
}
|
||||
|
||||
if (obj.getString("isconnection") != null && obj.getString("isconnection").equals("1")) {
|
||||
if (!(mIntent.getIntExtra("isry", 0) == 1)) {
|
||||
setViewUP();
|
||||
} else {
|
||||
LivePlayRyViewHolder.setViewUP(1);
|
||||
}
|
||||
|
||||
LivePlayRyViewHolder.setViewUP(1);
|
||||
|
||||
}
|
||||
if (pkInfo.getIntValue("ifpk") == 1 && pkInfo.getString("end_pk_time").equals("0")) {//pk开始了
|
||||
if (!(mIntent.getIntExtra("isry", 0) == 1)) {
|
||||
setViewUP();
|
||||
} else {
|
||||
LivePlayRyViewHolder.setViewUP(2);
|
||||
}
|
||||
|
||||
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"));
|
||||
}
|
||||
if (mLiveLinkMicPkPresenter != null) {
|
||||
mLiveLinkMicPkPresenter.onEnterRoomPkStart(pkUid, pkInfo.getLongValue("pk_gift_liveuid"), pkInfo.getLongValue("pk_gift_pkuid"), pkInfo.getIntValue("pk_time"), livePKUserListBean);
|
||||
} else {
|
||||
mLiveRyLinkMicPkPresenter.onEnterRoomPkStart(pkUid, pkInfo.getLongValue("pk_gift_liveuid"), pkInfo.getLongValue("pk_gift_pkuid"), pkInfo.getIntValue("pk_time"), livePKUserListBean);
|
||||
}
|
||||
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")) {
|
||||
if (!(mIntent.getIntExtra("isry", 0) == 1)) {
|
||||
setViewUP();
|
||||
} else {
|
||||
LivePlayRyViewHolder.setViewUP(3);
|
||||
}
|
||||
|
||||
LivePlayRyViewHolder.setViewUP(3);
|
||||
|
||||
//pk排名数据
|
||||
LivePKUserListBean livePKUserListBean = JSON.parseObject(pkInfo.getString("pk_top_users"), LivePKUserListBean.class);
|
||||
if (mLiveLinkMicPkPresenter != null) {
|
||||
mLiveLinkMicPkPresenter.onEnterRoomCFStart(pkUid, pkInfo.getLongValue("pk_gift_liveuid"), pkInfo.getLongValue("pk_gift_pkuid"), pkInfo.getIntValue("end_pk_time"), livePKUserListBean);
|
||||
} else {
|
||||
mLiveRyLinkMicPkPresenter.onEnterRoomCFStart(pkUid, pkInfo.getLongValue("pk_gift_liveuid"), pkInfo.getLongValue("pk_gift_pkuid"), pkInfo.getIntValue("end_pk_time"), livePKUserListBean);
|
||||
|
||||
}
|
||||
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) {
|
||||
if (!(mIntent.getIntExtra("isry", 0) == 1)) {
|
||||
setViewUP();
|
||||
} else {
|
||||
LivePlayRyViewHolder.setViewUP(4);
|
||||
}
|
||||
|
||||
LivePlayRyViewHolder.setViewUP(4);
|
||||
|
||||
mLiveRoomViewHolder.UpPkBar(pkInfo.getJSONArray("userlist"), mLiveBean.getUid(), pkInfo.getIntValue("drpk_time"));
|
||||
}
|
||||
|
||||
@@ -1136,17 +1259,12 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
}
|
||||
mEnd = true;
|
||||
//断开socket
|
||||
if (!(mIntent.getIntExtra("isry", 0) == 1)) {
|
||||
if (mSocketClient != null) {
|
||||
mSocketClient.disConnect();
|
||||
}
|
||||
mSocketClient = null;
|
||||
} else {
|
||||
if (mSocketRyClient != null) {
|
||||
mSocketRyClient.disConnect();
|
||||
}
|
||||
mSocketRyClient = null;
|
||||
|
||||
if (mSocketRyClient != null) {
|
||||
mSocketRyClient.disConnect();
|
||||
}
|
||||
mSocketRyClient = null;
|
||||
|
||||
|
||||
//结束播放
|
||||
if (mLivePlayViewHolder != null) {
|
||||
@@ -1157,6 +1275,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
}
|
||||
|
||||
public void end() {
|
||||
if (mLiveRoomViewHolder != null)
|
||||
mLiveRoomViewHolder.clearList();
|
||||
boolean canBackPressed = true;
|
||||
if (mContext instanceof LiveAudienceActivity) {
|
||||
canBackPressed = ((LiveAudienceActivity) mContext).canBackPressed();
|
||||
@@ -1185,7 +1305,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
} else {
|
||||
exitLiveRoom();
|
||||
}
|
||||
mBannerList2.clear();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1266,11 +1386,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
if (!mLighted) {
|
||||
mLighted = true;
|
||||
int guardType = mLiveGuardInfo != null ? mLiveGuardInfo.getMyGuardType() : Constants.GUARD_TYPE_NONE;
|
||||
if (!(mIntent.getIntExtra("isry", 0) == 1)) {
|
||||
SocketChatUtil.sendLightMessage(mLiveBean.getUid(), 1 + RandomUtil.nextInt(6), guardType);
|
||||
} else {
|
||||
SocketRyChatUtil.sendLightMessage(mLiveBean.getUid(), 1 + RandomUtil.nextInt(6), guardType);
|
||||
}
|
||||
SocketRyChatUtil.sendLightMessage(mLiveBean.getUid(), 1 + RandomUtil.nextInt(6), guardType);
|
||||
|
||||
}
|
||||
if (mLiveRoomViewHolder != null) {
|
||||
mLiveRoomViewHolder.playLightAnim();
|
||||
@@ -1324,10 +1441,17 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
* 更新主播映票数
|
||||
*/
|
||||
public void sendUpdateVotesMessage() {
|
||||
if (!(mIntent.getIntExtra("isry", 0) == 1)) {
|
||||
SocketChatUtil.sendUpdateVotesMessage(mLiveBean.getUid(), mLiveTypeVal);
|
||||
} else {
|
||||
SocketRyChatUtil.sendUpdateVotesMessage(mLiveBean.getUid(), mLiveTypeVal);
|
||||
|
||||
SocketRyChatUtil.sendUpdateVotesMessage(mLiveBean.getUid(), mLiveTypeVal);
|
||||
|
||||
}
|
||||
|
||||
public void onFollowEvent(FollowEvent e) {
|
||||
if (!TextUtils.isEmpty(liveID) && liveID.equals(e.getToUid())) {
|
||||
if (mLiveRoomViewHolder != null) {
|
||||
mLiveRoomViewHolder.setAttention(e.getIsAttention());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user