diff --git a/live/src/main/java/com/yunbao/live/activity/LiveActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveActivity.java index 4832c1d38..c2af9d68e 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveActivity.java @@ -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,13 +47,12 @@ 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.LiveRedPackListDialogFragment; @@ -69,7 +66,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 +87,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 +132,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL private LiveChatRoomDialogFragment mLiveChatRoomDialogFragment;//私信聊天窗口 protected LiveGuardInfo mLiveGuardInfo; private HashSet mDialogFragmentSet; - public boolean isRy = false; +// public static boolean isRy = true; @Override protected void main() { @@ -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); +// } } } } @@ -364,15 +358,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 +609,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 +682,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 +724,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 +766,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 +850,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 +902,6 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL } - /** * 发 弹幕 消息 */ @@ -939,11 +932,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 +956,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 +981,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 +993,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 +1027,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 +1050,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 +1071,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 +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(); 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; diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAnchorActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAnchorActivity.java index 99ae87e51..a9bee7241 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAnchorActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAnchorActivity.java @@ -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); @@ -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); } diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java index 761ebb78a..3714e0bb2 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -149,11 +149,11 @@ 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; - } +// if (getIntent().getIntExtra("isry", 0) == 1) { +// isRy = true; +// } else { +// isRy = false; +// } setVolumeControlStream(AudioManager.STREAM_MUSIC); manager = new PortraitLiveManager(this, intent); initView(); @@ -809,6 +809,8 @@ public class LiveAudienceActivity extends LiveActivity { break; case LIVE_ROOM_EXCEPTION: //主播未直播时自动下滑至下一个直播间 + itemModelList.remove(mCurrentPage); + mPagerAdapter.notifyDataSetChanged(); verticalViewPager.setCurrentItem(mCurrentPage + 1); break; @@ -834,7 +836,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); } diff --git a/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java index a133ccf82..2cc99572a 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java @@ -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); @@ -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); diff --git a/live/src/main/java/com/yunbao/live/adapter/VerticalPagerAdapter.java b/live/src/main/java/com/yunbao/live/adapter/VerticalPagerAdapter.java index 419c9041c..8329841b6 100644 --- a/live/src/main/java/com/yunbao/live/adapter/VerticalPagerAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/VerticalPagerAdapter.java @@ -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; diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveFunctionDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveFunctionDialogFragment.java index 8b569d3e0..1afe6f482 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveFunctionDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveFunctionDialogFragment.java @@ -24,7 +24,7 @@ import com.yunbao.live.interfaces.LiveFunctionClickListener; public class LiveFunctionDialogFragment extends AbsDialogFragment implements OnItemClickListener { 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(); } } diff --git a/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java b/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java index 0ca597137..50fbf8d0a 100644 --- a/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java @@ -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; diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java index 3399f1d06..8e9c3929c 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -100,7 +100,6 @@ 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 pl.droidsonroids.gif.GifImageView; @@ -230,13 +229,13 @@ 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; 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; @@ -1107,7 +1106,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis */ public void setUserList(List 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); } } @@ -1175,20 +1174,22 @@ 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) { ImgLoader.displayAvatar(mContext, guard.getAvatar(), userGuard); 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) { ((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(); @@ -1266,8 +1267,8 @@ 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); } } @@ -1346,34 +1347,30 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis * 退出直播间 */ private void close() { - 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(); - } +// 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(); @@ -1382,7 +1379,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis LiveRyAnchorActivity.backIndex = 1; ((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(); - params.width=width; + params.width = width; mUserRecyclerView.setLayoutParams(params); } diff --git a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java index d5a4a3b1a..01e85098a 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -36,7 +36,6 @@ import com.yunbao.common.http.HttpCallback; 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; @@ -68,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; @@ -85,7 +83,6 @@ import io.rong.imlib.chatroom.base.RongChatRoomClient; 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.LiveRoomViewHolder.isStayRoomfive; /** @@ -202,11 +199,9 @@ 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 LivePlayKsyViewHolder(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,11 +213,9 @@ 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); @@ -234,11 +227,9 @@ 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(), ""); - } + + mLiveRyLinkMicPkPresenter.setLiveUid(data.getUid(), ""); + mLiveLinkMicPresenter.setLiveUid(data.getUid()); //心愿单 LiveHttpUtil.getWishList(mLiveBean.getUid(), new HttpCallback() { @@ -264,17 +255,12 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe 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 (mSocketRyClient != null) { + mSocketRyClient.disConnect(); } + mSocketRyClient = null; + //结束播放 if (mLivePlayViewHolder != null) { @@ -387,17 +373,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()); } } } @@ -498,14 +478,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); + } } @@ -813,17 +789,12 @@ 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 @@ -931,7 +902,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe } List 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(); @@ -970,18 +941,14 @@ 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) { @@ -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); } } 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) { @@ -1009,11 +974,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe } //多人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")); } @@ -1135,17 +1098,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) { @@ -1265,11 +1223,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(); @@ -1323,10 +1278,8 @@ 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); + } } diff --git a/live/src/main/res/drawable/live_loading.gif b/live/src/main/res/drawable/live_loading.gif new file mode 100644 index 000000000..c3802a88b Binary files /dev/null and b/live/src/main/res/drawable/live_loading.gif differ diff --git a/live/src/main/res/drawable/loading_00000.png b/live/src/main/res/drawable/loading_00000.png new file mode 100644 index 000000000..e54a417e2 Binary files /dev/null and b/live/src/main/res/drawable/loading_00000.png differ diff --git a/live/src/main/res/drawable/loading_00001.png b/live/src/main/res/drawable/loading_00001.png new file mode 100644 index 000000000..6e1023d84 Binary files /dev/null and b/live/src/main/res/drawable/loading_00001.png differ diff --git a/live/src/main/res/drawable/loading_00002.png b/live/src/main/res/drawable/loading_00002.png new file mode 100644 index 000000000..88e175b08 Binary files /dev/null and b/live/src/main/res/drawable/loading_00002.png differ diff --git a/live/src/main/res/drawable/loading_00003.png b/live/src/main/res/drawable/loading_00003.png new file mode 100644 index 000000000..f4733ef60 Binary files /dev/null and b/live/src/main/res/drawable/loading_00003.png differ diff --git a/live/src/main/res/drawable/loading_00004.png b/live/src/main/res/drawable/loading_00004.png new file mode 100644 index 000000000..4fbd57ebc Binary files /dev/null and b/live/src/main/res/drawable/loading_00004.png differ diff --git a/live/src/main/res/drawable/loading_00005.png b/live/src/main/res/drawable/loading_00005.png new file mode 100644 index 000000000..229bdc2aa Binary files /dev/null and b/live/src/main/res/drawable/loading_00005.png differ diff --git a/live/src/main/res/drawable/loading_00006.png b/live/src/main/res/drawable/loading_00006.png new file mode 100644 index 000000000..651a8e94d Binary files /dev/null and b/live/src/main/res/drawable/loading_00006.png differ diff --git a/live/src/main/res/drawable/loading_00007.png b/live/src/main/res/drawable/loading_00007.png new file mode 100644 index 000000000..e972df8ee Binary files /dev/null and b/live/src/main/res/drawable/loading_00007.png differ diff --git a/live/src/main/res/drawable/loading_00008.png b/live/src/main/res/drawable/loading_00008.png new file mode 100644 index 000000000..bbb7a49af Binary files /dev/null and b/live/src/main/res/drawable/loading_00008.png differ diff --git a/live/src/main/res/drawable/loading_00009.png b/live/src/main/res/drawable/loading_00009.png new file mode 100644 index 000000000..a04be6772 Binary files /dev/null and b/live/src/main/res/drawable/loading_00009.png differ diff --git a/live/src/main/res/drawable/loading_00010.png b/live/src/main/res/drawable/loading_00010.png new file mode 100644 index 000000000..1fbbc70a6 Binary files /dev/null and b/live/src/main/res/drawable/loading_00010.png differ diff --git a/live/src/main/res/drawable/loading_00011.png b/live/src/main/res/drawable/loading_00011.png new file mode 100644 index 000000000..f3e14f0fb Binary files /dev/null and b/live/src/main/res/drawable/loading_00011.png differ diff --git a/live/src/main/res/drawable/loading_00012.png b/live/src/main/res/drawable/loading_00012.png new file mode 100644 index 000000000..668f158b7 Binary files /dev/null and b/live/src/main/res/drawable/loading_00012.png differ diff --git a/live/src/main/res/drawable/loading_00013.png b/live/src/main/res/drawable/loading_00013.png new file mode 100644 index 000000000..f40771758 Binary files /dev/null and b/live/src/main/res/drawable/loading_00013.png differ diff --git a/live/src/main/res/drawable/loading_00014.png b/live/src/main/res/drawable/loading_00014.png new file mode 100644 index 000000000..b1c0e4685 Binary files /dev/null and b/live/src/main/res/drawable/loading_00014.png differ diff --git a/live/src/main/res/drawable/loading_00015.png b/live/src/main/res/drawable/loading_00015.png new file mode 100644 index 000000000..8bc567693 Binary files /dev/null and b/live/src/main/res/drawable/loading_00015.png differ diff --git a/live/src/main/res/drawable/loading_animation.xml b/live/src/main/res/drawable/loading_animation.xml index ee74d0819..e5e8157eb 100644 --- a/live/src/main/res/drawable/loading_animation.xml +++ b/live/src/main/res/drawable/loading_animation.xml @@ -2,13 +2,53 @@ + android:drawable="@drawable/loading_00000" + android:duration="200" /> + android:drawable="@drawable/loading_00001" + android:duration="200" /> + android:drawable="@drawable/loading_00002" + android:duration="200" /> + + + + + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/layout_portrait_live_item.xml b/live/src/main/res/layout/layout_portrait_live_item.xml index a1f63e882..021e2cc7a 100644 --- a/live/src/main/res/layout/layout_portrait_live_item.xml +++ b/live/src/main/res/layout/layout_portrait_live_item.xml @@ -12,8 +12,8 @@