优化:

修改直播间loading,去除腾讯IM
This commit is contained in:
18401019693 2022-08-24 18:01:32 +08:00
parent cff66d234d
commit 0dd33d9dec
28 changed files with 356 additions and 365 deletions

View File

@ -6,9 +6,6 @@ import android.content.ClipboardManager;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import androidx.fragment.app.DialogFragment;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
@ -16,9 +13,10 @@ import android.view.ViewGroup;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.TextView; import android.widget.TextView;
import androidx.fragment.app.DialogFragment;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.tencent.imsdk.conversation.ConversationManager;
import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants; import com.yunbao.common.Constants;
import com.yunbao.common.activity.AbsActivity; import com.yunbao.common.activity.AbsActivity;
@ -49,13 +47,12 @@ import com.yunbao.live.bean.LivePKUserListBean;
import com.yunbao.live.bean.LiveReceiveGiftBean; import com.yunbao.live.bean.LiveReceiveGiftBean;
import com.yunbao.live.bean.LiveUserGiftBean; import com.yunbao.live.bean.LiveUserGiftBean;
import com.yunbao.live.dialog.GiftPrizePoolFragment; import com.yunbao.live.dialog.GiftPrizePoolFragment;
import com.yunbao.live.dialog.LiveChatListDialogFragment;
import com.yunbao.live.dialog.LiveChatRoomDialogFragment; import com.yunbao.live.dialog.LiveChatRoomDialogFragment;
import com.yunbao.live.dialog.LiveFansFragment; import com.yunbao.live.dialog.LiveFansFragment;
import com.yunbao.live.dialog.LiveFansMedalOkDialogFragment; import com.yunbao.live.dialog.LiveFansMedalOkDialogFragment;
import com.yunbao.live.dialog.LiveGiveHotDialogFragment;
import com.yunbao.live.dialog.LiveGuardBuyDialogFragment; import com.yunbao.live.dialog.LiveGuardBuyDialogFragment;
import com.yunbao.live.dialog.LiveGuardDialogFragment; import com.yunbao.live.dialog.LiveGuardDialogFragment;
import com.yunbao.live.dialog.LiveGiveHotDialogFragment;
import com.yunbao.live.dialog.LiveInputDialogFragment; import com.yunbao.live.dialog.LiveInputDialogFragment;
import com.yunbao.live.dialog.LiveMoreDialogFragment; import com.yunbao.live.dialog.LiveMoreDialogFragment;
import com.yunbao.live.dialog.LiveRedPackListDialogFragment; import com.yunbao.live.dialog.LiveRedPackListDialogFragment;
@ -69,7 +66,6 @@ import com.yunbao.live.presenter.LiveLinkMicAnchorPresenter;
import com.yunbao.live.presenter.LiveLinkMicPkPresenter; import com.yunbao.live.presenter.LiveLinkMicPkPresenter;
import com.yunbao.live.presenter.LiveLinkMicPresenter; import com.yunbao.live.presenter.LiveLinkMicPresenter;
import com.yunbao.live.presenter.LiveRyLinkMicPkPresenter; import com.yunbao.live.presenter.LiveRyLinkMicPkPresenter;
import com.yunbao.live.socket.SocketChatUtil;
import com.yunbao.live.socket.SocketClient; import com.yunbao.live.socket.SocketClient;
import com.yunbao.live.socket.SocketMessageListener; import com.yunbao.live.socket.SocketMessageListener;
import com.yunbao.live.socket.SocketRyChatUtil; import com.yunbao.live.socket.SocketRyChatUtil;
@ -91,8 +87,6 @@ import org.greenrobot.eventbus.ThreadMode;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import io.rong.imkit.utils.RouteUtils;
/** /**
* Created by cxf on 2018/10/7. * Created by cxf on 2018/10/7.
*/ */
@ -138,7 +132,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
private LiveChatRoomDialogFragment mLiveChatRoomDialogFragment;//私信聊天窗口 private LiveChatRoomDialogFragment mLiveChatRoomDialogFragment;//私信聊天窗口
protected LiveGuardInfo mLiveGuardInfo; protected LiveGuardInfo mLiveGuardInfo;
private HashSet<DialogFragment> mDialogFragmentSet; private HashSet<DialogFragment> mDialogFragmentSet;
public boolean isRy = false; // public static boolean isRy = true;
@Override @Override
protected void main() { protected void main() {
@ -205,17 +199,17 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
if (!mFirstConnectSocket) { if (!mFirstConnectSocket) {
mFirstConnectSocket = true; mFirstConnectSocket = true;
if (mLiveType == Constants.LIVE_TYPE_PAY || mLiveType == Constants.LIVE_TYPE_TIME) { if (mLiveType == Constants.LIVE_TYPE_PAY || mLiveType == Constants.LIVE_TYPE_TIME) {
if (isRy == false) { // if (isRy == false) {
SocketChatUtil.sendUpdateVotesMessage(mLiveUid, mLiveTypeVal, 1); // SocketChatUtil.sendUpdateVotesMessage(mLiveUid, mLiveTypeVal, 1);
} else { // } else {
SocketRyChatUtil.sendUpdateVotesMessage(mLiveUid, mLiveTypeVal, 1); SocketRyChatUtil.sendUpdateVotesMessage(mLiveUid, mLiveTypeVal, 1);
} // }
}
if (isRy == false) {
SocketChatUtil.getFakeFans(mLiveUid);
} else {
SocketRyChatUtil.getFakeFans(mLiveUid);
} }
// if (isRy == false) {
// SocketChatUtil.getFakeFans(mLiveUid);
// } else {
SocketRyChatUtil.getFakeFans(mLiveUid);
// }
} }
} }
} }
@ -364,15 +358,15 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
*/ */
@Override @Override
public void onSendGiftPk(long leftGift, long rightGift, LivePKUserListBean bean) { public void onSendGiftPk(long leftGift, long rightGift, LivePKUserListBean bean) {
if (isRy == false) { // if (isRy == false) {
if (mLiveLinkMicPkPresenter != null) { // if (mLiveLinkMicPkPresenter != null) {
mLiveLinkMicPkPresenter.onPkProgressChanged(leftGift, rightGift, bean); // mLiveLinkMicPkPresenter.onPkProgressChanged(leftGift, rightGift, bean);
} // }
} else { // } else {
if (mLiveRyLinkMicPkPresenter != null) { if (mLiveRyLinkMicPkPresenter != null) {
mLiveRyLinkMicPkPresenter.onPkProgressChanged(leftGift, rightGift, bean); mLiveRyLinkMicPkPresenter.onPkProgressChanged(leftGift, rightGift, bean);
}
} }
// }
} }
/** /**
@ -615,21 +609,21 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
*/ */
@Override @Override
public void onLinkMicAnchorClose() { public void onLinkMicAnchorClose() {
if (isRy == false) { // if (isRy == false) {
if (mLiveLinkMicAnchorPresenter != null) { // if (mLiveLinkMicAnchorPresenter != null) {
mLiveLinkMicAnchorPresenter.onLinkMicAnchorClose(); // mLiveLinkMicAnchorPresenter.onLinkMicAnchorClose();
} // }
if (mLiveLinkMicPkPresenter != null) { // if (mLiveLinkMicPkPresenter != null) {
mLiveLinkMicPkPresenter.onLinkMicPkClose(1); // mLiveLinkMicPkPresenter.onLinkMicPkClose(1);
} // }
} else { // } else {
if (mLiveLinkMicAnchorPresenter != null) { if (mLiveLinkMicAnchorPresenter != null) {
mLiveLinkMicAnchorPresenter.onLinkMicAnchorClose(); mLiveLinkMicAnchorPresenter.onLinkMicAnchorClose();
}
if (mLiveRyLinkMicPkPresenter != null) {
mLiveRyLinkMicPkPresenter.onLinkMicPkClose(1);
}
} }
if (mLiveRyLinkMicPkPresenter != null) {
mLiveRyLinkMicPkPresenter.onLinkMicPkClose(1);
}
// }
if (this instanceof LiveAudienceActivity) { if (this instanceof LiveAudienceActivity) {
@ -688,40 +682,40 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
@Override @Override
public void onLinkMicPkStart(final String pkUid, final String pkhead, final String pkname) { public void onLinkMicPkStart(final String pkUid, final String pkhead, final String pkname) {
Log.e("ry", "pkUid" + pkUid + "pkhead" + pkhead + "pkname" + pkname); Log.e("ry", "pkUid" + pkUid + "pkhead" + pkhead + "pkname" + pkname);
if (isRy == false) { // if (isRy == false) {
if (mLiveLinkMicPkPresenter != null && mLiveRoomViewHolder != null) { // if (mLiveLinkMicPkPresenter != null && mLiveRoomViewHolder != null) {
mLiveLinkMicPkPresenter.onLinkMicPkStart(pkUid, pkhead, pkname); // mLiveLinkMicPkPresenter.onLinkMicPkStart(pkUid, pkhead, pkname);
Handler handler = new Handler(); // Handler handler = new Handler();
handler.postDelayed(new Runnable() { // handler.postDelayed(new Runnable() {
@Override // @Override
public void run() { // public void run() {
if (mLiveRoomViewHolder != null) { // if (mLiveRoomViewHolder != null) {
if (mIsAnchor == false) { // if (mIsAnchor == false) {
mLiveRoomViewHolder.setOtherInfo(pkUid, pkhead, pkname); // 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 +724,16 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
*/ */
@Override @Override
public void onLinkMicPkClose(int i) { public void onLinkMicPkClose(int i) {
if (isRy == false) { // if (isRy == false) {
if (mLiveLinkMicPkPresenter != null) { // if (mLiveLinkMicPkPresenter != null) {
mLiveLinkMicPkPresenter.onLinkMicPkClose(i); // mLiveLinkMicPkPresenter.onLinkMicPkClose(i);
} // }
} else { // } else {
if (mLiveRyLinkMicPkPresenter != null) { if (mLiveRyLinkMicPkPresenter != null) {
mLiveRyLinkMicPkPresenter.onLinkMicPkClose(i); mLiveRyLinkMicPkPresenter.onLinkMicPkClose(i);
} else if (mLiveLinkMicPkPresenter != null) { } else if (mLiveLinkMicPkPresenter != null) {
mLiveLinkMicPkPresenter.onLinkMicPkClose(i); mLiveLinkMicPkPresenter.onLinkMicPkClose(i);
} // }
} }
} }
@ -772,20 +766,20 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
*/ */
@Override @Override
public void onLinkMicPkEnd(String winUid) { public void onLinkMicPkEnd(String winUid) {
if (isRy == false) { // if (isRy == false) {
if (mLiveLinkMicPkPresenter != null) { // if (mLiveLinkMicPkPresenter != null) {
mLiveLinkMicPkPresenter.onLinkMicPkEnd(winUid); // mLiveLinkMicPkPresenter.onLinkMicPkEnd(winUid);
mLiveRoomViewHolder.setDelOtherInfo(); // mLiveRoomViewHolder.setDelOtherInfo();
} // }
} else { // } else {
if (mLiveRyLinkMicPkPresenter != null) { if (mLiveRyLinkMicPkPresenter != null) {
mLiveRyLinkMicPkPresenter.onLinkMicPkEnd(winUid); mLiveRyLinkMicPkPresenter.onLinkMicPkEnd(winUid);
mLiveRoomViewHolder.setDelOtherInfo(); mLiveRoomViewHolder.setDelOtherInfo();
} else if (mLiveLinkMicPkPresenter != null) { } else if (mLiveLinkMicPkPresenter != null) {
mLiveLinkMicPkPresenter.onLinkMicPkEnd(winUid); mLiveLinkMicPkPresenter.onLinkMicPkEnd(winUid);
mLiveRoomViewHolder.setDelOtherInfo(); mLiveRoomViewHolder.setDelOtherInfo();
}
} }
// }
} }
@ -856,20 +850,20 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
* 打开聊天输入框 * 打开聊天输入框
*/ */
public void openChatWindow() { public void openChatWindow() {
if (mKeyBoardHeightUtil == null) { if (mKeyBoardHeightUtil == null) {
mKeyBoardHeightUtil = new KeyBoardHeightUtil2(mContext, super.findViewById(android.R.id.content), this); mKeyBoardHeightUtil = new KeyBoardHeightUtil2(mContext, super.findViewById(android.R.id.content), this);
mKeyBoardHeightUtil.start(); mKeyBoardHeightUtil.start();
} }
if (mLiveRoomViewHolder != null) { if (mLiveRoomViewHolder != null) {
mLiveRoomViewHolder.chatScrollToBottom(); mLiveRoomViewHolder.chatScrollToBottom();
} }
LiveInputDialogFragment fragment = new LiveInputDialogFragment(); LiveInputDialogFragment fragment = new LiveInputDialogFragment();
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
bundle.putString(Constants.LIVE_DANMU_PRICE, mDanmuPrice); bundle.putString(Constants.LIVE_DANMU_PRICE, mDanmuPrice);
bundle.putString(Constants.COIN_NAME, mCoinName); bundle.putString(Constants.COIN_NAME, mCoinName);
bundle.putString(Constants.LIVE_UID, mLiveUid); bundle.putString(Constants.LIVE_UID, mLiveUid);
fragment.setArguments(bundle); fragment.setArguments(bundle);
fragment.show(getSupportFragmentManager(), "LiveInputDialogFragment"); fragment.show(getSupportFragmentManager(), "LiveInputDialogFragment");
} }
private void showTaskDialog() { private void showTaskDialog() {
@ -908,7 +902,6 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
} }
/** /**
* 弹幕 消息 * 弹幕 消息
*/ */
@ -939,11 +932,11 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
onCoinChanged(coin); onCoinChanged(coin);
} }
String[] data = new String[]{obj.getString("barragetoken")}; String[] data = new String[]{obj.getString("barragetoken")};
if (isRy == false) { // if (isRy == false) {
SocketChatUtil.sendDanmuMessage(mLiveUid, contents); // SocketChatUtil.sendDanmuMessage(mLiveUid, contents);
} else { // } else {
SocketRyChatUtil.sendDanmuMessage(mLiveUid, contents); SocketRyChatUtil.sendDanmuMessage(mLiveUid, contents);
} // }
} else { } else {
ToastUtil.show(msg); ToastUtil.show(msg);
} }
@ -963,20 +956,20 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
} }
} }
int guardType = mLiveGuardInfo != null ? mLiveGuardInfo.getMyGuardType() : Constants.GUARD_TYPE_NONE; int guardType = mLiveGuardInfo != null ? mLiveGuardInfo.getMyGuardType() : Constants.GUARD_TYPE_NONE;
if (isRy == false) { // if (isRy == false) {
SocketChatUtil.sendChatMessage(mLiveUid, content, mIsAnchor, mSocketUserType, guardType); // SocketChatUtil.sendChatMessage(mLiveUid, content, mIsAnchor, mSocketUserType, guardType);
} else { // } else {
SocketRyChatUtil.sendChatMessage(mLiveUid, content, mIsAnchor, mSocketUserType, guardType); SocketRyChatUtil.sendChatMessage(mLiveUid, content, mIsAnchor, mSocketUserType, guardType);
} // }
} }
/** /**
* 系统 消息 * 系统 消息
*/ */
public static void sendSystemMessage(String content) { public static void sendSystemMessage(String content) {
// if(isRy == false) { // if (isRy == false) {
SocketChatUtil.sendSystemMessage(mLiveUid, content); // SocketChatUtil.sendSystemMessage(mLiveUid, content);
// }else{ // } else {
SocketRyChatUtil.sendSystemMessage(mLiveUid, content); SocketRyChatUtil.sendSystemMessage(mLiveUid, content);
// } // }
} }
@ -988,11 +981,11 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
public void sendGiftMessage(LiveGiftBean giftBean, String giftToken, String ancherName, String by) { public void sendGiftMessage(LiveGiftBean giftBean, String giftToken, String ancherName, String by) {
int guardType = mLiveGuardInfo != null ? mLiveGuardInfo.getMyGuardType() : Constants.GUARD_TYPE_NONE; int guardType = mLiveGuardInfo != null ? mLiveGuardInfo.getMyGuardType() : Constants.GUARD_TYPE_NONE;
if (isRy == false) { // if (isRy == false) {
SocketChatUtil.sendGiftMessage(giftBean.getType(), giftToken, mLiveUid, ancherName, guardType, by); // SocketChatUtil.sendGiftMessage(giftBean.getType(), giftToken, mLiveUid, ancherName, guardType, by);
} else { // } else {
SocketRyChatUtil.sendGiftMessage(giftBean.getType(), giftToken, mLiveUid, ancherName, guardType, by); SocketRyChatUtil.sendGiftMessage(giftBean.getType(), giftToken, mLiveUid, ancherName, guardType, by);
} // }
} }
@ -1000,33 +993,33 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
* 主播或管理员踢人 * 主播或管理员踢人
*/ */
public void kickUser(String toUid, String toName) { public void kickUser(String toUid, String toName) {
if (isRy == false) { // if (isRy == false) {
SocketChatUtil.sendKickMessage(mLiveUid, toUid, toName); // SocketChatUtil.sendKickMessage(mLiveUid, toUid, toName);
} else { // } else {
SocketRyChatUtil.sendKickMessage(mLiveUid, toUid, toName); SocketRyChatUtil.sendKickMessage(mLiveUid, toUid, toName);
} // }
} }
/** /**
* 禁言 * 禁言
*/ */
public void setShutUp(String toUid, String toName, int type) { public void setShutUp(String toUid, String toName, int type) {
if (isRy == false) { // if (isRy == false) {
SocketChatUtil.sendShutUpMessage(mLiveUid, toUid, toName, type); // SocketChatUtil.sendShutUpMessage(mLiveUid, toUid, toName, type);
} else { // } else {
SocketRyChatUtil.sendShutUpMessage(mLiveUid, toUid, toName, type); SocketRyChatUtil.sendShutUpMessage(mLiveUid, toUid, toName, type);
} // }
} }
/** /**
* 设置或取消管理员消息 * 设置或取消管理员消息
*/ */
public void sendSetAdminMessage(int action, String toUid, String toName) { public void sendSetAdminMessage(int action, String toUid, String toName) {
if (isRy == false) { // if (isRy == false) {
SocketChatUtil.sendSetAdminMessage(mLiveUid, action, toUid, toName); // SocketChatUtil.sendSetAdminMessage(mLiveUid, action, toUid, toName);
} else { // } else {
SocketRyChatUtil.sendSetAdminMessage(mLiveUid, action, toUid, toName); SocketRyChatUtil.sendSetAdminMessage(mLiveUid, action, toUid, toName);
} // }
} }
@ -1034,22 +1027,22 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
* 超管关闭直播间 * 超管关闭直播间
*/ */
public void superCloseRoom() { public void superCloseRoom() {
if (isRy == false) { // if (isRy == false) {
SocketChatUtil.superCloseRoom(mLiveUid); // SocketChatUtil.superCloseRoom(mLiveUid);
} else { // } else {
SocketRyChatUtil.superCloseRoom(mLiveUid); SocketRyChatUtil.superCloseRoom(mLiveUid);
} // }
} }
/** /**
* 更新主播映票数 * 更新主播映票数
*/ */
public void sendUpdateVotesMessage(int deltaVal) { public void sendUpdateVotesMessage(int deltaVal) {
if (isRy == false) { // if (isRy == false) {
SocketChatUtil.sendUpdateVotesMessage(mLiveUid, deltaVal); // SocketChatUtil.sendUpdateVotesMessage(mLiveUid, deltaVal);
} else { // } else {
SocketRyChatUtil.sendUpdateVotesMessage(mLiveUid, deltaVal); SocketRyChatUtil.sendUpdateVotesMessage(mLiveUid, deltaVal);
} // }
} }
@ -1057,20 +1050,20 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
* 发送购买守护成功消息 * 发送购买守护成功消息
*/ */
public void sendBuyGuardMessage(String votes, int guardNum, int guardType) { public void sendBuyGuardMessage(String votes, int guardNum, int guardType) {
if (isRy == false) { // if (isRy == false) {
SocketChatUtil.sendBuyGuardMessage(mLiveUid, votes, guardNum, guardType); // SocketChatUtil.sendBuyGuardMessage(mLiveUid, votes, guardNum, guardType);
} else { // } else {
SocketRyChatUtil.sendBuyGuardMessage(mLiveUid, votes, guardNum, guardType); SocketRyChatUtil.sendBuyGuardMessage(mLiveUid, votes, guardNum, guardType);
} // }
} }
public void sendBuyGuardMessage2(String votes, int guardNum, int guardType, String ancherName, String liveId) { public void sendBuyGuardMessage2(String votes, int guardNum, int guardType, String ancherName, String liveId) {
if (guardType != 1) { if (guardType != 1) {
if (isRy == false) { // if (isRy == false) {
SocketChatUtil.sendBuyGuardMessage2(mLiveUid, votes, guardNum, guardType, ancherName, liveId); // SocketChatUtil.sendBuyGuardMessage2(mLiveUid, votes, guardNum, guardType, ancherName, liveId);
} else { // } else {
SocketRyChatUtil.sendBuyGuardMessage2(mLiveUid, votes, guardNum, guardType, ancherName, liveId); SocketRyChatUtil.sendBuyGuardMessage2(mLiveUid, votes, guardNum, guardType, ancherName, liveId);
} // }
} }
} }
@ -1078,11 +1071,11 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
* 发送发红包成功消息 * 发送发红包成功消息
*/ */
public void sendRedPackMessage() { public void sendRedPackMessage() {
if (isRy == false) { // if (isRy == false) {
SocketChatUtil.sendRedPackMessage(mLiveUid); // SocketChatUtil.sendRedPackMessage(mLiveUid);
} else { // } else {
SocketRyChatUtil.sendRedPackMessage(mLiveUid); SocketRyChatUtil.sendRedPackMessage(mLiveUid);
} // }
} }
@ -1214,7 +1207,6 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
} }
/** /**
* 监听关注变化事件 * 监听关注变化事件
*/ */
@ -1278,14 +1270,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(); LiveUserMoreDialogFragment fragment = new LiveUserMoreDialogFragment();
fragment.setLiveGuardInfo(mLiveGuardInfo); fragment.setLiveGuardInfo(mLiveGuardInfo);
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
bundle.putString(Constants.LIVE_UID, mLiveUid); bundle.putString(Constants.LIVE_UID, mLiveUid);
bundle.putString(Constants.STREAM, mStream); bundle.putString(Constants.STREAM, mStream);
bundle.putString("By", i + ""); bundle.putString("By", i + "");
bundle.putBoolean("only",isOnly); bundle.putBoolean("only", isOnly);
fragment.setArguments(bundle); fragment.setArguments(bundle);
fragment.show(getSupportFragmentManager(), "LiveUserMoreDialogFragment"); fragment.show(getSupportFragmentManager(), "LiveUserMoreDialogFragment");
LiveUserMoreDialogFragment.activity = this; LiveUserMoreDialogFragment.activity = this;

View File

@ -4,11 +4,12 @@ import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import androidx.fragment.app.DialogFragment;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import androidx.fragment.app.DialogFragment;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.lzy.okgo.callback.Callback; import com.lzy.okgo.callback.Callback;
@ -122,7 +123,7 @@ public class LiveAnchorActivity extends LiveActivity implements LiveFunctionClic
@Override @Override
protected void main() { protected void main() {
super.main(); super.main();
isRy = false; // isRy = false;
Intent intent = getIntent(); Intent intent = getIntent();
mLiveSDK = intent.getIntExtra(Constants.LIVE_SDK, Constants.LIVE_SDK_KSY); mLiveSDK = intent.getIntExtra(Constants.LIVE_SDK, Constants.LIVE_SDK_KSY);
mLiveKsyConfigBean = intent.getParcelableExtra(Constants.LIVE_KSY_CONFIG); mLiveKsyConfigBean = intent.getParcelableExtra(Constants.LIVE_KSY_CONFIG);
@ -413,7 +414,7 @@ public class LiveAnchorActivity extends LiveActivity implements LiveFunctionClic
hasGame = mGameList.size() > 0; hasGame = mGameList.size() > 0;
} }
bundle.putBoolean(Constants.HAS_GAME, hasGame); bundle.putBoolean(Constants.HAS_GAME, hasGame);
bundle.putBoolean("isRy", false); // bundle.putBoolean("isRy", true);
bundle.putBoolean(Constants.OPEN_FLASH, mLivePushViewHolder != null && mLivePushViewHolder.isFlashOpen()); bundle.putBoolean(Constants.OPEN_FLASH, mLivePushViewHolder != null && mLivePushViewHolder.isFlashOpen());
fragment.setArguments(bundle); fragment.setArguments(bundle);
fragment.setFunctionClickListener(this); fragment.setFunctionClickListener(this);
@ -507,7 +508,7 @@ public class LiveAnchorActivity extends LiveActivity implements LiveFunctionClic
mLiveLinkMicPkPresenter.setLiveUid(mLiveUid, mUrl); mLiveLinkMicPkPresenter.setLiveUid(mLiveUid, mUrl);
mLiveLinkMicPkPresenter.setSelfStream(mStream); mLiveLinkMicPkPresenter.setSelfStream(mStream);
} }
if(mLiveRyLinkMicPkPresenter!=null) { if (mLiveRyLinkMicPkPresenter != null) {
mLiveRyLinkMicPkPresenter.setLiveUid(mLiveUid, ""); mLiveRyLinkMicPkPresenter.setLiveUid(mLiveUid, "");
} }
@ -597,30 +598,30 @@ public class LiveAnchorActivity extends LiveActivity implements LiveFunctionClic
@Override @Override
public void onSuccess(int code, String msg, String[] info) { public void onSuccess(int code, String msg, String[] info) {
if (code == 0) { if (code == 0) {
if (isRy == false) { // if (isRy == false) {
SocketChatUtil.closeLive(mLiveUid, mSocketClient); // SocketChatUtil.closeLive(mLiveUid, mSocketClient);
//
//断开socket // //断开socket
if (mSocketClient != null) { // if (mSocketClient != null) {
mSocketClient.disConnect(); // mSocketClient.disConnect();
} // }
//
if (LivePushTxViewHolder.mTRTCCloud != null) { // if (LivePushTxViewHolder.mTRTCCloud != null) {
//
LivePushTxViewHolder.mTRTCCloud.exitRoom(); // LivePushTxViewHolder.mTRTCCloud.exitRoom();
} // }
//
if (LiveLinkMicPkPresenter.mTRTCCloud1 != null) { // if (LiveLinkMicPkPresenter.mTRTCCloud1 != null) {
LiveLinkMicPkPresenter.mTRTCCloud1.exitRoom(); // LiveLinkMicPkPresenter.mTRTCCloud1.exitRoom();
LiveLinkMicPkPresenter.mTRTCCloud1.stopLocalPreview(); // LiveLinkMicPkPresenter.mTRTCCloud1.stopLocalPreview();
} // }
if (LivePushTxViewHolder.mTRTCCloud != null) { // if (LivePushTxViewHolder.mTRTCCloud != null) {
//
LivePushTxViewHolder.mTRTCCloud.exitRoom(); // LivePushTxViewHolder.mTRTCCloud.exitRoom();
LivePushTxViewHolder.mTRTCCloud.stopLocalPreview(); // LivePushTxViewHolder.mTRTCCloud.stopLocalPreview();
//
} // }
} else { // } else {
// SocketRyChatUtil.closeLive(mLiveUid, mSocketRyClient); // SocketRyChatUtil.closeLive(mLiveUid, mSocketRyClient);
//断开socket //断开socket
if (mSocketRyClient != null) { if (mSocketRyClient != null) {
@ -628,7 +629,7 @@ public class LiveAnchorActivity extends LiveActivity implements LiveFunctionClic
} }
} }
if (mLiveEndViewHolder == null) { if (mLiveEndViewHolder == null) {
mLiveEndViewHolder = new LiveEndViewHolder(mContext, mRoot,mLiveBean.getUid()); mLiveEndViewHolder = new LiveEndViewHolder(mContext, mRoot, mLiveBean.getUid());
mLiveEndViewHolder.subscribeActivityLifeCycle(); mLiveEndViewHolder.subscribeActivityLifeCycle();
mLiveEndViewHolder.addToParent(); mLiveEndViewHolder.addToParent();
mLiveEndViewHolder.showData(mLiveBean, mStream); mLiveEndViewHolder.showData(mLiveBean, mStream);
@ -644,7 +645,7 @@ public class LiveAnchorActivity extends LiveActivity implements LiveFunctionClic
} }
mLivePushViewHolder = null; mLivePushViewHolder = null;
mLiveLinkMicPresenter = null; mLiveLinkMicPresenter = null;
} // }
} else { } else {
ToastUtil.show(msg); ToastUtil.show(msg);
} }

View File

@ -149,11 +149,11 @@ public class LiveAudienceActivity extends LiveActivity {
mLiveBean = intent.getParcelableExtra(Constants.LIVE_BEAN); mLiveBean = intent.getParcelableExtra(Constants.LIVE_BEAN);
mLiveUid = mLiveBean.getUid(); mLiveUid = mLiveBean.getUid();
mStream = mLiveBean.getStream(); mStream = mLiveBean.getStream();
if (getIntent().getIntExtra("isry", 0) == 1) { // if (getIntent().getIntExtra("isry", 0) == 1) {
isRy = true; // isRy = true;
} else { // } else {
isRy = false; // isRy = false;
} // }
setVolumeControlStream(AudioManager.STREAM_MUSIC); setVolumeControlStream(AudioManager.STREAM_MUSIC);
manager = new PortraitLiveManager(this, intent); manager = new PortraitLiveManager(this, intent);
initView(); initView();
@ -809,6 +809,8 @@ public class LiveAudienceActivity extends LiveActivity {
break; break;
case LIVE_ROOM_EXCEPTION: case LIVE_ROOM_EXCEPTION:
//主播未直播时自动下滑至下一个直播间 //主播未直播时自动下滑至下一个直播间
itemModelList.remove(mCurrentPage);
mPagerAdapter.notifyDataSetChanged();
verticalViewPager.setCurrentItem(mCurrentPage + 1); verticalViewPager.setCurrentItem(mCurrentPage + 1);
break; break;
@ -834,7 +836,7 @@ public class LiveAudienceActivity extends LiveActivity {
intent.putExtra(Constants.LIVE_SDK, liveSdk); intent.putExtra(Constants.LIVE_SDK, liveSdk);
intent.putExtra(Constants.LIVE_SDK, liveSdk); intent.putExtra(Constants.LIVE_SDK, liveSdk);
intent.putExtra("landscape", liveBean.getLandscape()); intent.putExtra("landscape", liveBean.getLandscape());
intent.putExtra("isry", liveBean.getIs_rong()); // intent.putExtra("isry", true);
context.startActivity(intent); context.startActivity(intent);
} }

View File

@ -146,7 +146,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
@Override @Override
protected void main() { protected void main() {
super.main(); super.main();
isRy = true; // isRy = true;
Intent intent = getIntent(); Intent intent = getIntent();
mLiveSDK = intent.getIntExtra(Constants.LIVE_SDK, Constants.LIVE_SDK_KSY); mLiveSDK = intent.getIntExtra(Constants.LIVE_SDK, Constants.LIVE_SDK_KSY);
mLiveKsyConfigBean = intent.getParcelableExtra(Constants.LIVE_KSY_CONFIG); mLiveKsyConfigBean = intent.getParcelableExtra(Constants.LIVE_KSY_CONFIG);
@ -590,7 +590,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
hasGame = mGameList.size() > 0; hasGame = mGameList.size() > 0;
} }
bundle.putBoolean(Constants.HAS_GAME, hasGame); bundle.putBoolean(Constants.HAS_GAME, hasGame);
bundle.putBoolean("isRy", true); // bundle.putBoolean("isRy", true);
bundle.putBoolean(Constants.OPEN_FLASH, mLivePushViewHolder != null && mLivePushViewHolder.isFlashOpen()); bundle.putBoolean(Constants.OPEN_FLASH, mLivePushViewHolder != null && mLivePushViewHolder.isFlashOpen());
fragment.setArguments(bundle); fragment.setArguments(bundle);
fragment.setFunctionClickListener(this); fragment.setFunctionClickListener(this);

View File

@ -50,7 +50,7 @@ public class VerticalPagerAdapter extends androidx.viewpager.widget.PagerAdapter
ImageView ivLoading = view.findViewById(R.id.iv_loading); ImageView ivLoading = view.findViewById(R.id.iv_loading);
AnimationDrawable frameAnimation = (AnimationDrawable) ivLoading.getBackground(); AnimationDrawable frameAnimation = (AnimationDrawable) ivLoading.getBackground();
frameAnimation.start(); frameAnimation.start();
// ImgLoader.displayGif(mContext, R.drawable.live_loading, ivLoading);
view.setId(position); view.setId(position);
container.addView(view); container.addView(view);
return view; return view;

View File

@ -24,7 +24,7 @@ import com.yunbao.live.interfaces.LiveFunctionClickListener;
public class LiveFunctionDialogFragment extends AbsDialogFragment implements OnItemClickListener<Integer> { public class LiveFunctionDialogFragment extends AbsDialogFragment implements OnItemClickListener<Integer> {
private LiveFunctionClickListener mFunctionClickListener; private LiveFunctionClickListener mFunctionClickListener;
boolean isRy = false; // boolean isRy = false;
@Override @Override
protected int getLayoutId() { protected int getLayoutId() {
return R.layout.dialog_live_function; return R.layout.dialog_live_function;
@ -60,7 +60,7 @@ public class LiveFunctionDialogFragment extends AbsDialogFragment implements OnI
if (bundle != null) { if (bundle != null) {
hasGame = bundle.getBoolean(Constants.HAS_GAME, false); hasGame = bundle.getBoolean(Constants.HAS_GAME, false);
openFlash = bundle.getBoolean(Constants.OPEN_FLASH, 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 recyclerView = (RecyclerView) mRootView.findViewById(R.id.recyclerView);
recyclerView.setHasFixedSize(true); recyclerView.setHasFixedSize(true);
@ -85,11 +85,11 @@ public class LiveFunctionDialogFragment extends AbsDialogFragment implements OnI
@Override @Override
public void onDestroy() { public void onDestroy() {
mFunctionClickListener = null; mFunctionClickListener = null;
if(isRy == false) { // if(isRy == false) {
((LiveAnchorActivity) mContext).setBtnFunctionDark(); // ((LiveAnchorActivity) mContext).setBtnFunctionDark();
}else{ // }else{
((LiveRyAnchorActivity) mContext).setBtnFunctionDark(); ((LiveRyAnchorActivity) mContext).setBtnFunctionDark();
} // }
super.onDestroy(); super.onDestroy();
} }
} }

View File

@ -226,6 +226,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
} }
public static void setViewUP(int i) { public static void setViewUP(int i) {
if (mVideoView == null) return;
Log.i("", "整理" + i); Log.i("", "整理" + i);
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams(); RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams();
params.height = vHeight; params.height = vHeight;

View File

@ -100,7 +100,6 @@ import java.lang.ref.WeakReference;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import pl.droidsonroids.gif.GifImageView; import pl.droidsonroids.gif.GifImageView;
@ -230,13 +229,13 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
public static RelativeLayout lt_pk_line; public static RelativeLayout lt_pk_line;
public WindowManager windowManager; public WindowManager windowManager;
public boolean isRy = false; // public boolean isRy = false;
public LiveRoomViewHolder(boolean isRys, int forActivity, Context context, ViewGroup parentView, GifImageView gifImageView, SVGAImageView svgaImageView, ViewGroup liveGiftPrizePoolContainer, WindowManager windowManager) { public LiveRoomViewHolder(boolean isRys, int forActivity, Context context, ViewGroup parentView, GifImageView gifImageView, SVGAImageView svgaImageView, ViewGroup liveGiftPrizePoolContainer, WindowManager windowManager) {
super(context, parentView); super(context, parentView);
Contexts = context; Contexts = context;
this.forAct = forActivity; this.forAct = forActivity;
this.isRy = isRys; // this.isRy = isRys;
mGifImageView = gifImageView; mGifImageView = gifImageView;
mSVGAImageView = svgaImageView; mSVGAImageView = svgaImageView;
mLiveGiftPrizePoolContainer = liveGiftPrizePoolContainer; mLiveGiftPrizePoolContainer = liveGiftPrizePoolContainer;
@ -1107,7 +1106,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
*/ */
public void setUserList(List<LiveUserGiftBean> list) { public void setUserList(List<LiveUserGiftBean> list) {
if (mLiveUserAdapter != null) { if (mLiveUserAdapter != null) {
resetUserListWidth(DpUtil.dp2px((Math.min(list.size(), 3))*38)); resetUserListWidth(DpUtil.dp2px((Math.min(list.size(), 3)) * 38));
mLiveUserAdapter.refreshList(list); mLiveUserAdapter.refreshList(list);
} }
} }
@ -1175,20 +1174,22 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
getIsHot(); getIsHot();
getGuardInfo(); getGuardInfo();
} }
private void getGuardInfo(){
private void getGuardInfo() {
LiveHttpUtil.getUserList(mLiveUid, mStream, "guard", 1, new HttpCallback() { LiveHttpUtil.getUserList(mLiveUid, mStream, "guard", 1, new HttpCallback() {
@Override @Override
public void onSuccess(int code, String msg, String[] info) { 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"); JSONArray userlist = json.getJSONArray("userlist");
if(userlist.size()!=0){ if (userlist.size() != 0) {
setGuardIcon(JSONArray.parseArray(userlist.toJSONString(),LiveUserGiftBean.class).get(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) {
ImgLoader.displayAvatar(mContext, guard.getAvatar(), userGuard); ImgLoader.displayAvatar(mContext, guard.getAvatar(), userGuard);
gift_svga.setVisibility(View.VISIBLE); gift_svga.setVisibility(View.VISIBLE);
} }
@ -1255,9 +1256,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
} else if (i == R.id.btn_prize_pool_level) { } else if (i == R.id.btn_prize_pool_level) {
((LiveActivity) mContext).openPrizePoolWindow(); ((LiveActivity) mContext).openPrizePoolWindow();
} else if (i == R.id.user_more) { } else if (i == R.id.user_more) {
((LiveActivity) mContext).openUserMoreListWindow(4,false); ((LiveActivity) mContext).openUserMoreListWindow(4, false);
} else if (i == R.id.hot_btn) { } else if (i == R.id.hot_btn) {
((LiveActivity) mContext).openUserMoreListWindow(1,false); ((LiveActivity) mContext).openUserMoreListWindow(1, false);
} else if (i == R.id.btn_close) { } else if (i == R.id.btn_close) {
close(); close();
@ -1266,8 +1267,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
((LiveActivity) mContext).openLuckGiftTip(); ((LiveActivity) mContext).openLuckGiftTip();
} else if (i == R.id.ft_hot_add) { } else if (i == R.id.ft_hot_add) {
((LiveActivity) mContext).openHotListWindow(1); ((LiveActivity) mContext).openHotListWindow(1);
} else if (i == R.id.user_guard){ } else if (i == R.id.user_guard) {
((LiveActivity) mContext).openUserMoreListWindow(2,true); ((LiveActivity) mContext).openUserMoreListWindow(2, true);
} }
} }
@ -1346,34 +1347,30 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
* 退出直播间 * 退出直播间
*/ */
private void close() { private void close() {
if (isRy == false) { // if (isRy == false) {
if (forAct == 1) { // if (forAct == 1) {
//是否关注0==没关注 // //是否关注0==没关注
if (isAttention == 0) { // if (isAttention == 0) {
if (isStayRoomfive) { // if (isStayRoomfive) {
showFollowDialog(mNameText, mAvatarUrl, mContext); // showFollowDialog(mNameText, mAvatarUrl, mContext);
} else { // } else {
((LiveAudienceActivity) mContext).setBackIndex(1); // ((LiveAudienceActivity) mContext).setBackIndex(1);
((LiveAudienceActivity) mContext).onBackPressed(); // ((LiveAudienceActivity) mContext).onBackPressed();
} // }
} else { // } else {
((LiveAudienceActivity) mContext).setBackIndex(1); // ((LiveAudienceActivity) mContext).setBackIndex(1);
((LiveAudienceActivity) mContext).onBackPressed(); // ((LiveAudienceActivity) mContext).onBackPressed();
} // }
} else { // } else {
((LiveAudienceActivity) mContext).setBackIndex(1); // ((LiveAudienceActivity) mContext).setBackIndex(1);
((LiveAnchorActivity) mContext).onBackPressed(); // ((LiveAnchorActivity) mContext).onBackPressed();
} // }
} else { // } else {
if (forAct == 1) { if (forAct == 1) {
//是否关注0==没关注 //是否关注0==没关注
if (isAttention == 0) { if (isAttention == 0) {
if (isStayRoomfive) { if (isStayRoomfive) {
showFollowDialog(mNameText, mAvatarUrl, mContext); showFollowDialog(mNameText, mAvatarUrl, mContext);
} else {
LiveRyAnchorActivity.backIndex = 1;
((LiveRyAnchorActivity) mContext).onBackPressed();
}
} else { } else {
LiveRyAnchorActivity.backIndex = 1; LiveRyAnchorActivity.backIndex = 1;
((LiveRyAnchorActivity) mContext).onBackPressed(); ((LiveRyAnchorActivity) mContext).onBackPressed();
@ -1382,7 +1379,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
LiveRyAnchorActivity.backIndex = 1; LiveRyAnchorActivity.backIndex = 1;
((LiveRyAnchorActivity) mContext).onBackPressed(); ((LiveRyAnchorActivity) mContext).onBackPressed();
} }
} else {
LiveRyAnchorActivity.backIndex = 1;
((LiveRyAnchorActivity) mContext).onBackPressed();
} }
// }
} }
/** /**
@ -1823,9 +1824,10 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
} }
}); });
} }
public void resetUserListWidth(int width){
public void resetUserListWidth(int width) {
ViewGroup.LayoutParams params = mUserRecyclerView.getLayoutParams(); ViewGroup.LayoutParams params = mUserRecyclerView.getLayoutParams();
params.width=width; params.width = width;
mUserRecyclerView.setLayoutParams(params); mUserRecyclerView.setLayoutParams(params);
} }

View File

@ -36,7 +36,6 @@ import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.RandomUtil; import com.yunbao.common.utils.RandomUtil;
import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
@ -68,7 +67,6 @@ import com.yunbao.live.presenter.LiveLinkMicAnchorPresenter;
import com.yunbao.live.presenter.LiveLinkMicPkPresenter; import com.yunbao.live.presenter.LiveLinkMicPkPresenter;
import com.yunbao.live.presenter.LiveLinkMicPresenter; import com.yunbao.live.presenter.LiveLinkMicPresenter;
import com.yunbao.live.presenter.LiveRyLinkMicPkPresenter; import com.yunbao.live.presenter.LiveRyLinkMicPkPresenter;
import com.yunbao.live.socket.SocketChatUtil;
import com.yunbao.live.socket.SocketClient; import com.yunbao.live.socket.SocketClient;
import com.yunbao.live.socket.SocketMessageListener; import com.yunbao.live.socket.SocketMessageListener;
import com.yunbao.live.socket.SocketRyChatUtil; import com.yunbao.live.socket.SocketRyChatUtil;
@ -85,7 +83,6 @@ import io.rong.imlib.chatroom.base.RongChatRoomClient;
import static com.yunbao.common.CommonAppContext.logger; import static com.yunbao.common.CommonAppContext.logger;
import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics; import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics;
import static com.yunbao.live.presenter.LiveLinkMicPresenter.mBannerList2; import static com.yunbao.live.presenter.LiveLinkMicPresenter.mBannerList2;
import static com.yunbao.live.views.LivePlayKsyViewHolder.setViewUP;
import static com.yunbao.live.views.LiveRoomViewHolder.isStayRoomfive; import static com.yunbao.live.views.LiveRoomViewHolder.isStayRoomfive;
/** /**
@ -202,11 +199,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
.setParametersModel(new OpenParametersModel() .setParametersModel(new OpenParametersModel()
.setmLiveType(mLiveType) .setmLiveType(mLiveType)
.setmLiveTypeVal(mLiveTypeVal))); .setmLiveTypeVal(mLiveTypeVal)));
if (mIntent.getIntExtra("isry", 0) == 1) {
mLivePlayViewHolder = new LivePlayRyViewHolder(mContext, playContainer, mIntent.getIntExtra("landscape", 0)); mLivePlayViewHolder = new LivePlayKsyViewHolder(mContext, playContainer, mIntent.getIntExtra("landscape", 0));
} else {
mLivePlayViewHolder = new LivePlayKsyViewHolder(mContext, playContainer, mIntent.getIntExtra("landscape", 0));
}
mLivePlayViewHolder.addToParent(); mLivePlayViewHolder.addToParent();
mLivePlayViewHolder.subscribeActivityLifeCycle(); mLivePlayViewHolder.subscribeActivityLifeCycle();
mLiveRoomViewHolder = new LiveRoomViewHolder(false, 1, mContext, mContainer, mSecondPage.findViewById(R.id.gift_gif), mSecondPage.findViewById(R.id.gift_svga), mContainerWrap, mContext.getWindowManager()); mLiveRoomViewHolder = new LiveRoomViewHolder(false, 1, mContext, mContainer, mSecondPage.findViewById(R.id.gift_gif), mSecondPage.findViewById(R.id.gift_svga), mContainerWrap, mContext.getWindowManager());
@ -218,11 +213,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveAudienceViewHolder.subscribeActivityLifeCycle(); mLiveAudienceViewHolder.subscribeActivityLifeCycle();
mLiveLinkMicPresenter = new LiveLinkMicPresenter(mContext, mLivePlayViewHolder, false, mLiveSDK, mLiveAudienceViewHolder.getContentView()); mLiveLinkMicPresenter = new LiveLinkMicPresenter(mContext, mLivePlayViewHolder, false, mLiveSDK, mLiveAudienceViewHolder.getContentView());
mLiveLinkMicAnchorPresenter = new LiveLinkMicAnchorPresenter(mContext, mLivePlayViewHolder, false, mLiveSDK, null); mLiveLinkMicAnchorPresenter = new LiveLinkMicAnchorPresenter(mContext, mLivePlayViewHolder, false, mLiveSDK, null);
if (!(mIntent.getIntExtra("isry", 0) == 1)) {
mLiveLinkMicPkPresenter = new LiveLinkMicPkPresenter(mContext, mLivePlayViewHolder, false, null); mLiveRyLinkMicPkPresenter = new LiveRyLinkMicPkPresenter(mContext, mLivePlayViewHolder, false, null);
} else {
mLiveRyLinkMicPkPresenter = new LiveRyLinkMicPkPresenter(mContext, mLivePlayViewHolder, false, null);
}
//直播间背景 //直播间背景
ImgLoader.displayBlurLive(mContext, mLiveBean.getAvatar(), liveBack); ImgLoader.displayBlurLive(mContext, mLiveBean.getAvatar(), liveBack);
@ -234,11 +227,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveRoomViewHolder.setName(data.getUserNiceName()); mLiveRoomViewHolder.setName(data.getUserNiceName());
mLiveRoomViewHolder.setRoomNum(data.getLiangNameTip()); mLiveRoomViewHolder.setRoomNum(data.getLiangNameTip());
mLiveRoomViewHolder.setTitle(data.getTitle()); mLiveRoomViewHolder.setTitle(data.getTitle());
if (!(mIntent.getIntExtra("isry", 0) == 1)) {
mLiveLinkMicPkPresenter.setLiveUid(data.getUid(), ""); mLiveRyLinkMicPkPresenter.setLiveUid(data.getUid(), "");
} else {
mLiveRyLinkMicPkPresenter.setLiveUid(data.getUid(), "");
}
mLiveLinkMicPresenter.setLiveUid(data.getUid()); mLiveLinkMicPresenter.setLiveUid(data.getUid());
//心愿单 //心愿单
LiveHttpUtil.getWishList(mLiveBean.getUid(), new HttpCallback() { LiveHttpUtil.getWishList(mLiveBean.getUid(), new HttpCallback() {
@ -264,17 +255,12 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
public void onRemove() { public void onRemove() {
mLiveAudienceViewHolder.removeCallbacks(); mLiveAudienceViewHolder.removeCallbacks();
//断开socket //断开socket
if (!(mIntent.getIntExtra("isry", 0) == 1)) {
if (mSocketClient != null) { if (mSocketRyClient != null) {
mSocketClient.disConnect(); mSocketRyClient.disConnect();
}
mSocketClient = null;
} else {
if (mSocketRyClient != null) {
mSocketRyClient.disConnect();
}
mSocketRyClient = null;
} }
mSocketRyClient = null;
//结束播放 //结束播放
if (mLivePlayViewHolder != null) { if (mLivePlayViewHolder != null) {
@ -387,17 +373,11 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
if (!mFirstConnectSocket) { if (!mFirstConnectSocket) {
mFirstConnectSocket = true; mFirstConnectSocket = true;
if (mLiveType == Constants.LIVE_TYPE_PAY || mLiveType == Constants.LIVE_TYPE_TIME) { if (mLiveType == Constants.LIVE_TYPE_PAY || mLiveType == Constants.LIVE_TYPE_TIME) {
if (!(mIntent.getIntExtra("isry", 0) == 1)) {
SocketChatUtil.sendUpdateVotesMessage(mLiveBean.getUid(), mLiveTypeVal, 1); SocketRyChatUtil.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.getFakeFans(mLiveBean.getUid());
} }
} }
} }
@ -498,14 +478,10 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
@Override @Override
public void onSendGiftPk(long leftGift, long rightGift, LivePKUserListBean bean) { public void onSendGiftPk(long leftGift, long rightGift, LivePKUserListBean bean) {
if (!(mIntent.getIntExtra("isry", 0) == 1)) {
if (mLiveLinkMicPkPresenter != null) { if (mLiveRyLinkMicPkPresenter != null) {
mLiveLinkMicPkPresenter.onPkProgressChanged(leftGift, rightGift, bean); mLiveRyLinkMicPkPresenter.onPkProgressChanged(leftGift, rightGift, bean);
}
} else {
if (mLiveRyLinkMicPkPresenter != null) {
mLiveRyLinkMicPkPresenter.onPkProgressChanged(leftGift, rightGift, bean);
}
} }
} }
@ -813,17 +789,12 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
private void enterRoom() { private void enterRoom() {
//进入直播间IM //进入直播间IM
if (!(mIntent.getIntExtra("isry", 0) == 1)) {
mSocketClient = new SocketClient(mLiveBean.getUid(), this); mSocketRyClient = new SocketRyClient(mLiveBean.getUid(), this);
if (mLiveLinkMicPresenter != null) { if (mLiveLinkMicPresenter != null) {
mLiveLinkMicPresenter.setSocketClient(mSocketClient); mLiveLinkMicPresenter.setSocketClient(mSocketClient);
}
} else {
mSocketRyClient = new SocketRyClient(mLiveBean.getUid(), this);
if (mLiveLinkMicPresenter != null) {
mLiveLinkMicPresenter.setSocketClient(mSocketClient);
}
} }
timeIndex = 0; timeIndex = 0;
LiveHttpUtil.enterRoom(mLiveBean.getUid(), mLiveBean.getStream(), new HttpCallback() { LiveHttpUtil.enterRoom(mLiveBean.getUid(), mLiveBean.getStream(), new HttpCallback() {
@Override @Override
@ -931,7 +902,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
} }
List<LiveUserGiftBean> list = JSON.parseArray(obj.getString("userlists"), LiveUserGiftBean.class); List<LiveUserGiftBean> list = JSON.parseArray(obj.getString("userlists"), LiveUserGiftBean.class);
mLiveRoomViewHolder.setUserList(list); mLiveRoomViewHolder.setUserList(list);
// resetUserListWidth(list); // resetUserListWidth(list);
mLiveRoomViewHolder.startRefreshUserList(); mLiveRoomViewHolder.startRefreshUserList();
if (mLiveType == Constants.LIVE_TYPE_TIME) {//计时收费 if (mLiveType == Constants.LIVE_TYPE_TIME) {//计时收费
mLiveRoomViewHolder.startRequestTimeCharge(); mLiveRoomViewHolder.startRequestTimeCharge();
@ -970,18 +941,14 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
} }
if (obj.getString("isconnection") != null && obj.getString("isconnection").equals("1")) { if (obj.getString("isconnection") != null && obj.getString("isconnection").equals("1")) {
if (!(mIntent.getIntExtra("isry", 0) == 1)) {
setViewUP(); LivePlayRyViewHolder.setViewUP(1);
} else {
LivePlayRyViewHolder.setViewUP(1);
}
} }
if (pkInfo.getIntValue("ifpk") == 1 && pkInfo.getString("end_pk_time").equals("0")) {//pk开始了 if (pkInfo.getIntValue("ifpk") == 1 && pkInfo.getString("end_pk_time").equals("0")) {//pk开始了
if (!(mIntent.getIntExtra("isry", 0) == 1)) {
setViewUP(); LivePlayRyViewHolder.setViewUP(2);
} else {
LivePlayRyViewHolder.setViewUP(2);
}
//pk排名数据 //pk排名数据
LivePKUserListBean livePKUserListBean = JSON.parseObject(pkInfo.getString("pk_top_users"), LivePKUserListBean.class); LivePKUserListBean livePKUserListBean = JSON.parseObject(pkInfo.getString("pk_top_users"), LivePKUserListBean.class);
if (mLiveRoomViewHolder != null) { if (mLiveRoomViewHolder != null) {
@ -993,11 +960,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
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")) { } else if (!pkInfo.getString("end_pk_time").equals("0")) {
if (!(mIntent.getIntExtra("isry", 0) == 1)) {
setViewUP(); LivePlayRyViewHolder.setViewUP(3);
} else {
LivePlayRyViewHolder.setViewUP(3);
}
//pk排名数据 //pk排名数据
LivePKUserListBean livePKUserListBean = JSON.parseObject(pkInfo.getString("pk_top_users"), LivePKUserListBean.class); LivePKUserListBean livePKUserListBean = JSON.parseObject(pkInfo.getString("pk_top_users"), LivePKUserListBean.class);
if (mLiveLinkMicPkPresenter != null) { if (mLiveLinkMicPkPresenter != null) {
@ -1009,11 +974,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
} }
//多人PK //多人PK
} else if (pkInfo != null && pkInfo.getIntValue("drpk_status") == 1) { } else if (pkInfo != null && pkInfo.getIntValue("drpk_status") == 1) {
if (!(mIntent.getIntExtra("isry", 0) == 1)) {
setViewUP(); LivePlayRyViewHolder.setViewUP(4);
} else {
LivePlayRyViewHolder.setViewUP(4);
}
mLiveRoomViewHolder.UpPkBar(pkInfo.getJSONArray("userlist"), mLiveBean.getUid(), pkInfo.getIntValue("drpk_time")); mLiveRoomViewHolder.UpPkBar(pkInfo.getJSONArray("userlist"), mLiveBean.getUid(), pkInfo.getIntValue("drpk_time"));
} }
@ -1135,17 +1098,12 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
} }
mEnd = true; mEnd = true;
//断开socket //断开socket
if (!(mIntent.getIntExtra("isry", 0) == 1)) {
if (mSocketClient != null) { if (mSocketRyClient != null) {
mSocketClient.disConnect(); mSocketRyClient.disConnect();
}
mSocketClient = null;
} else {
if (mSocketRyClient != null) {
mSocketRyClient.disConnect();
}
mSocketRyClient = null;
} }
mSocketRyClient = null;
//结束播放 //结束播放
if (mLivePlayViewHolder != null) { if (mLivePlayViewHolder != null) {
@ -1265,11 +1223,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
if (!mLighted) { if (!mLighted) {
mLighted = true; mLighted = true;
int guardType = mLiveGuardInfo != null ? mLiveGuardInfo.getMyGuardType() : Constants.GUARD_TYPE_NONE; int guardType = mLiveGuardInfo != null ? mLiveGuardInfo.getMyGuardType() : Constants.GUARD_TYPE_NONE;
if (!(mIntent.getIntExtra("isry", 0) == 1)) { SocketRyChatUtil.sendLightMessage(mLiveBean.getUid(), 1 + RandomUtil.nextInt(6), guardType);
SocketChatUtil.sendLightMessage(mLiveBean.getUid(), 1 + RandomUtil.nextInt(6), guardType);
} else {
SocketRyChatUtil.sendLightMessage(mLiveBean.getUid(), 1 + RandomUtil.nextInt(6), guardType);
}
} }
if (mLiveRoomViewHolder != null) { if (mLiveRoomViewHolder != null) {
mLiveRoomViewHolder.playLightAnim(); mLiveRoomViewHolder.playLightAnim();
@ -1323,10 +1278,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
* 更新主播映票数 * 更新主播映票数
*/ */
public void sendUpdateVotesMessage() { public void sendUpdateVotesMessage() {
if (!(mIntent.getIntExtra("isry", 0) == 1)) {
SocketChatUtil.sendUpdateVotesMessage(mLiveBean.getUid(), mLiveTypeVal); SocketRyChatUtil.sendUpdateVotesMessage(mLiveBean.getUid(), mLiveTypeVal);
} else {
SocketRyChatUtil.sendUpdateVotesMessage(mLiveBean.getUid(), mLiveTypeVal);
}
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 482 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

View File

@ -2,13 +2,53 @@
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"> <animation-list xmlns:android="http://schemas.android.com/apk/res/android">
<item <item
android:drawable="@drawable/img_loading_01" android:drawable="@drawable/loading_00000"
android:duration="350" /> android:duration="200" />
<item <item
android:drawable="@drawable/img_loading_02" android:drawable="@drawable/loading_00001"
android:duration="350" /> android:duration="200" />
<item <item
android:drawable="@drawable/img_loading_03" android:drawable="@drawable/loading_00002"
android:duration="350" /> android:duration="200" />
<item
android:drawable="@drawable/loading_00003"
android:duration="200" />
<item
android:drawable="@drawable/loading_00004"
android:duration="200" />
<item
android:drawable="@drawable/loading_00005"
android:duration="200" />
<item
android:drawable="@drawable/loading_00006"
android:duration="200" />
<item
android:drawable="@drawable/loading_00007"
android:duration="200" />
<item
android:drawable="@drawable/loading_00008"
android:duration="200" />
<item
android:drawable="@drawable/loading_00009"
android:duration="200" />
<item
android:drawable="@drawable/loading_00010"
android:duration="200" />
<item
android:drawable="@drawable/loading_00011"
android:duration="200" />
<item
android:drawable="@drawable/loading_00012"
android:duration="200" />
<item
android:drawable="@drawable/loading_00013"
android:duration="200" />
<item
android:drawable="@drawable/loading_00014"
android:duration="200" />
<item
android:drawable="@drawable/loading_00015"
android:duration="200" />
</animation-list> </animation-list>

View File

@ -12,8 +12,8 @@
<ImageView <ImageView
android:id="@+id/iv_loading" android:id="@+id/iv_loading"
android:layout_width="50dp" android:layout_width="150dp"
android:layout_height="10dp" android:layout_height="188dp"
android:layout_centerInParent="true" android:layout_centerInParent="true"
android:background="@drawable/loading_animation" /> android:background="@drawable/loading_animation" />