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 5654ff869..48fd10a09 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java @@ -96,9 +96,7 @@ import static com.yunbao.live.views.LiveRyAnchorViewHolder.btn_dr_pk_nub; import static com.yunbao.live.views.LiveRyAnchorViewHolder.btn_start_dr_pk; import static com.yunbao.live.views.LiveRyAnchorViewHolder.btn_start_dr_pk_view; -//import cn.rongcloud.rtc.jni.video.RCRect; -//import cn.rongcloud.rtc.jni.video.RCRect; /** * Created by cxf on 2018/10/7. @@ -146,7 +144,6 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl @Override protected void main() { super.main(); -// isRy = true; Intent intent = getIntent(); mLiveSDK = intent.getIntExtra(Constants.LIVE_SDK, Constants.LIVE_SDK_KSY); mLiveKsyConfigBean = intent.getParcelableExtra(Constants.LIVE_KSY_CONFIG); @@ -164,21 +161,9 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl mLiveBean.setGoodNum(u.getGoodName()); mLiveBean.setCity(u.getCity()); mBeautySdkType = CommonAppConfig.getInstance().getBeautySdkType(); - //添加推流预览控件 -// if (mLiveSDK == Constants.LIVE_SDK_TX) { -// if ("3".equals(mBeautySdkType)){ -// mLivePushViewHolder = new LivePushTxViewHolder360Beauty(mContext, (ViewGroup) findViewById(R.id.preview_container)); -// } -// else { mLivePushViewHolder = new LivePushRyViewHolder(mContext, (ViewGroup) findViewById(R.id.preview_container)); - -// } -// } else { -// mLivePushViewHolder = new LivePushKsyViewHolder(mContext, (ViewGroup) findViewById(R.id.preview_container), mLiveKsyConfigBean); -// } - mLivePushViewHolder.addToParent(); mLivePushViewHolder.subscribeActivityLifeCycle(); mContainerWrap = (ViewGroup) findViewById(R.id.container_wrap); @@ -190,7 +175,6 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl mLiveReadyViewHolder.addToParent(); mLiveReadyViewHolder.subscribeActivityLifeCycle(); mLiveLinkMicPresenter = new LiveLinkMicPresenter(mContext, mLivePushViewHolder, true, mLiveSDK, mContainer); -// mLiveLinkMicPresenter.setLiveUid(mLiveUid); mLiveLinkMicAnchorPresenter = new LiveLinkMicAnchorPresenter(mContext, mLivePushViewHolder, true, mLiveSDK, mContainer); mLivePushViewHolder.setLivePushListener(new LivePushListener() { @Override @@ -268,10 +252,6 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl public void onSuccess(int code, String msg, String[] info) { if (code == 0) { - //添加水印 -// RCRect rect = new RCRect(0.5f, 0.5f, 0.2f); -// boolean e = RCRTCEngine.getInstance().getDefaultVideoStream().setWatermark(fromText(50, mNameText), rect); -// Log.e("ry", e + "设置Watermark"); btn_start_dr_pk.setVisibility(View.VISIBLE); dr_pk_view.setVisibility(View.VISIBLE); final SocketSendBean msg1 = new SocketSendBean() @@ -437,7 +417,6 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl mrr = 0; t.mirrorType = TRTC_VIDEO_MIRROR_TYPE_DISABLE; } -// mTRTCCloud.setLocalRenderParams(t); break; default: break; @@ -485,41 +464,6 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl * 设置美颜 */ public void beauty() { -// Log.d("设置美颜","type="+mBeautySdkType); -// if (mLiveBeautyViewHolder == null) { -//// if (CommonAppConfig.getInstance().isTiBeautyEnable()) { -//// mLiveBeautyViewHolder = new TiBeautyViewHolder(mContext, mContainer); -//// } else { -//// mLiveBeautyViewHolder = new DefaultBeautyViewHolder(mContext, mContainer); -//// } -//// String mBeautySdkType= CommonAppConfig.getInstance().getBeautySdkType(); -// if ("2".equals(mBeautySdkType)) { -// mLiveBeautyViewHolder = new TiBeautyViewHolder(mContext, mContainer); -// } else if ("3".equals(mBeautySdkType)){ -//// mLiveBeautyViewHolder = new Beauty360ViewHolder(mContext, mContainer); -// mLiveBeautyViewHolder = new Beauty360ViewHolder(this, mContainer); -// }else { -// mLiveBeautyViewHolder = new DefaultBeautyViewHolder(mContext, mContainer); -// } -// -// -// mLiveBeautyViewHolder.setVisibleListener(new BeautyViewHolder.VisibleListener() { -// @Override -// public void onVisibleChanged(boolean visible) { -// if (mLiveReadyViewHolder != null) { -// if (visible) { -// mLiveReadyViewHolder.hide(); -// } else { -// mLiveReadyViewHolder.show(); -// } -// } -// } -// }); -// if (mLivePushViewHolder != null) { -// mLiveBeautyViewHolder.setEffectListener(mLivePushViewHolder.getEffectListener()); -// } -// } -// mLiveBeautyViewHolder.show(); if (mLiveReadyViewHolder != null) { mLiveReadyViewHolder.hide(); } @@ -590,7 +534,6 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl hasGame = mGameList.size() > 0; } bundle.putBoolean(Constants.HAS_GAME, hasGame); -// bundle.putBoolean("isRy", true); bundle.putBoolean(Constants.OPEN_FLASH, mLivePushViewHolder != null && mLivePushViewHolder.isFlashOpen()); fragment.setArguments(bundle); fragment.setFunctionClickListener(this); @@ -620,11 +563,6 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl ToastUtil.show(R.string.live_link_mic_cannot_game); return; } -// if (mGamePresenter != null) { -// GameDialogFragment fragment = new GameDialogFragment(); -// fragment.setGamePresenter(mGamePresenter); -// fragment.show(getSupportFragmentManager(), "GameDialogFragment"); -// } } /** @@ -677,13 +615,8 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl if (mLiveAnchorViewHolder == null) { mLiveAnchorViewHolder = new LiveRyAnchorViewHolder(mContext, mContainer); mLiveAnchorViewHolder.addToParent(); -// mLiveAnchorViewHolder.setUnReadCount(((LiveActivity) mContext).getImUnReadCount()); } mLiveBottomViewHolder = mLiveAnchorViewHolder; - - //连接socket -// if (mSocketClient == null) { - mSocketRyClient = new SocketRyClient(mLiveUid, this); CommonAppContext.Ingroup = 1; @@ -696,8 +629,6 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl mLiveLinkMicAnchorPresenter.setSelfStream(mStream); } if (mLiveRyLinkMicPkPresenter != null) { -// mLiveRyLinkMicPkPresenter.setSocketClient(mSocketRyClient); -// mLiveRyLinkMicPkPresenter.setLiveUid(mLiveUid); mLiveRyLinkMicPkPresenter.setSelfStream(mStream); } // } @@ -734,19 +665,6 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl //游戏相关 if (CommonAppConfig.GAME_ENABLE) { mGameList = JSON.parseArray(obj.getString("game_switch"), Integer.class); -// GameParam param = new GameParam(); -// param.setContext(mContext); -// param.setParentView(mContainerWrap); -// param.setTopView(mContainer); -// param.setInnerContainer(mLiveRoomViewHolder.getInnerContainer()); -// param.setGameActionListener(new GameActionListenerImpl(LiveAnchorActivity.this, mSocketClient)); -// param.setLiveUid(mLiveUid); -// param.setStream(mStream); -// param.setAnchor(true); -// param.setCoinName(mCoinName); -// param.setObj(obj); -// mGamePresenter = new GamePresenter(param); -// mGamePresenter.setGameList(mGameList); } } @@ -850,7 +768,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl } 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); @@ -926,15 +844,10 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl if (mLiveLinkMicPresenter != null) { mLiveLinkMicPresenter.release(); } - -// if (mGamePresenter != null) { -// mGamePresenter.release(); -// } mLiveMusicViewHolder = null; mLiveReadyViewHolder = null; mLivePushViewHolder = null; mLiveLinkMicPresenter = null; -// mGamePresenter = null; super.release(); } @@ -993,16 +906,6 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl release(); } -// @Subscribe(threadMode = ThreadMode.MAIN) -// public void onGameWindowChangedEvent(GameWindowChangedEvent e) { -// if (mLiveRoomViewHolder != null) { -// mLiveRoomViewHolder.setOffsetY(e.getGameViewHeight()); -// } -// if (mLiveAnchorViewHolder != null) { -// mLiveAnchorViewHolder.setGameBtnVisible(e.isOpen()); -// } -// } - public void setBtnFunctionDark() { if (mLiveAnchorViewHolder != null) { mLiveAnchorViewHolder.setBtnFunctionDark(); @@ -1272,15 +1175,6 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl */ @Subscribe(threadMode = ThreadMode.MAIN) public void onLinkMicTxMixStreamEvent(LinkMicTxMixStreamEvent e) { -// if ("3".equals(mBeautySdkType)) { -// if (mLivePushViewHolder != null && mLivePushViewHolder instanceof LivePushTxViewHolder360Beauty) { -// ((LivePushTxViewHolder360Beauty) mLivePushViewHolder).onLinkMicTxMixStreamEvent(e.getType(), e.getToStream()); -// } -// } else { -// if (mLivePushViewHolder != null && mLivePushViewHolder instanceof LivePushTxViewHolder) { -//// ((LivePushTxViewHolder) mLivePushViewHolder).onLinkMicTxMixStreamEvent(e.getType(), e.getToStream()); -// } -// } } diff --git a/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java b/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java index 6fa41d05a..a433d55c2 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java @@ -118,7 +118,7 @@ public class SocketRyChatUtil { @Override public void onSuccess(Message message) { - Log.i("tx", "ssss"+"发送成功" + mLiveUid); + Log.i("tx", "ssss" + "发送成功" + mLiveUid); //首发言成功 AdjustEvent adjustEvent1 = new AdjustEvent("j7isvr"); Adjust.trackEvent(adjustEvent1); @@ -141,7 +141,7 @@ public class SocketRyChatUtil { @Override public void onError(Message message, RongIMClient.ErrorCode errorCode) { - Log.e("tx","aaa"+errorCode.toString()); + Log.e("tx", "aaa" + errorCode.toString()); } }); @@ -543,7 +543,8 @@ public class SocketRyChatUtil { @Override public void onSuccess(Message message) { Log.i("tx", "发送成功"); - SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + ""); + if (SocketRyClient.mSocketHandler != null) + SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + ""); } @Override 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 d7bba56d2..82a6d9788 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -877,6 +877,13 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis mChatRecyclerView.setLayoutParams(params1); } // fastMsgRecyclerView.setItemAnimator(new DefaultItemAnimator()); + //主播页面隐藏头部 + if (mContext instanceof LiveRyAnchorActivity) { + findViewById(R.id.hour_rank_layout).setVisibility(View.GONE); + findViewById(R.id.live_wks_layout).setVisibility(View.GONE); + findViewById(R.id.wish_list_layout).setVisibility(View.GONE); + findViewById(R.id.open_sidebar).setVisibility(View.GONE); + } } private void showBanner2() { @@ -1101,8 +1108,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis mHotText.setGravity(Gravity.CENTER); mHourRank.setGravity(Gravity.CENTER); setHourRankData(info.get(0).getRank()); - hotPic.setImageResource(WordUtil.isZh()?R.drawable.live_tags_hot:R.drawable.live_tags_hot_en); - hourPic.setImageResource(WordUtil.isZh()?R.drawable.live_tags_hour_list:R.drawable.live_tags_hour_list_en); + hotPic.setImageResource(WordUtil.isZh() ? R.drawable.live_tags_hot : R.drawable.live_tags_hot_en); + hourPic.setImageResource(WordUtil.isZh() ? R.drawable.live_tags_hour_list : R.drawable.live_tags_hour_list_en); hotPic.setLayoutParams(params); hourPic.setLayoutParams(params); flipper.addView(hotView); @@ -1120,7 +1127,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis bundle.putString("url", url); bundle.putInt("height", DpUtil.dp2px(500)); bundle.putInt("show_type", 0); - bundle.putString("roomId",mLiveUid); + bundle.putString("roomId", mLiveUid); LiveHDDialogFragment liveHDDialogFragment = new LiveHDDialogFragment(); liveHDDialogFragment.setArguments(bundle); liveHDDialogFragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment"); @@ -1156,7 +1163,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis if (rank == 0) { mHourRank.setText(R.string.no_rank_data); } else { - mHourRank.setText(String.format(WordUtil.getString(R.string.hour_rank),formatBigNum.formatBigNum(rank + ""))); + mHourRank.setText(String.format(WordUtil.getString(R.string.hour_rank), formatBigNum.formatBigNum(rank + ""))); } } } @@ -1167,7 +1174,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis * @param hot 热度值 */ public void setHotData(String hot) { - if (mHotText != null&&!TextUtils.isEmpty(hot)) { + if (mHotText != null && !TextUtils.isEmpty(hot)) { mHotText.setText(hot); } 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 9024371d3..1fa94e2e6 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -855,7 +855,22 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe @Override public void onLinkMicPkStart(String pkUid, String pkhead, String pkname) { + 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", liveID + "1111" + CommonAppConfig.getInstance().getUid()); + if (!liveID.equals(CommonAppConfig.getInstance().getUid())) { + mLiveRoomViewHolder.setOtherInfo(pkUid, pkhead, pkname); + } + } + } + }, 4000);//3秒后执行Runnable中的run方法 + } } @Override @@ -880,7 +895,10 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe @Override public void onLinkMicPkEnd(String winUid) { - + if (mLiveRyLinkMicPkPresenter != null) { + mLiveRyLinkMicPkPresenter.onLinkMicPkEnd(winUid); + mLiveRoomViewHolder.setDelOtherInfo(); + } } @Override diff --git a/live/src/main/res/layout/view_live_room.xml b/live/src/main/res/layout/view_live_room.xml index 50f840fa0..e71f357c1 100644 --- a/live/src/main/res/layout/view_live_room.xml +++ b/live/src/main/res/layout/view_live_room.xml @@ -197,39 +197,39 @@ - + + + android:layout_height="40dp" + android:layout_gravity="end|center" + android:layout_marginRight="-3dp" + android:layout_weight="1" + android:overScrollMode="never" + android:visibility="visible" /> - + - - - - + +