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 60d1475d8..a5f335d3e 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveActivity.java @@ -772,13 +772,14 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL pr = new pkRunnable(pkUid, pkhead, pkname, isLadders); mHandler.postDelayed(pr, 4000);//3秒后执行Runnable中的run方法 mLiveRoomViewHolder.initAnchorSay(); + mLiveRoomViewHolder.closePrankView(); } } else { if (mLiveRyLinkMicPkPresenter != null && mLiveRoomViewHolder != null) { mLiveRyLinkMicPkPresenter.onLinkMicPkStart(pkUid, 1); pr = new pkRunnable(pkUid, pkhead, pkname, isLadders); mHandler.postDelayed(pr, 4000);//3秒后执行Runnable中的run方法 - + mLiveRoomViewHolder.closePrankView(); } } } 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 e7c8ed5f9..ab2800dc6 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java @@ -266,7 +266,6 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl mContainerWrap = (ViewGroup) findViewById(R.id.container_wrap); mContainer = (ViewGroup) findViewById(R.id.container); mLiveRyLinkMicPkPresenter = new LiveRyLinkMicPkPresenter(mContext, mLivePushViewHolder, true, mContainer); - RandomPkManager.getInstance().addOnRandomPkTimer(onRandomPkTimer); //添加开播前设置控件 @@ -814,6 +813,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl mLiveRoomViewHolder.initAnchorSay(); mLiveRoomViewHolder.setGiftWall(obj.getString("gift_wall_lighten_number"), obj.getString("gift_wall_lighten_total")); } + mLiveRyLinkMicPkPresenter.setmLiveRoomViewHolder(mLiveRoomViewHolder); if (mLiveAnchorViewHolder == null) { mLiveAnchorViewHolder = new LiveRyAnchorViewHolder(mContext, mContainer); mLiveAnchorViewHolder.setLiveBean(mLiveBean); diff --git a/live/src/main/java/com/yunbao/live/activity/LiveSwAnchorActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveSwAnchorActivity.java index aca49e322..ac6adf962 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveSwAnchorActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveSwAnchorActivity.java @@ -879,6 +879,7 @@ public class LiveSwAnchorActivity extends LiveActivity implements LiveFunctionCl mLiveRoomViewHolder.initPrankProgress(); mLiveRoomViewHolder.sendMsgPrank(); } + mLiveSwLinkMicPkPresenter.setmLiveRoomViewHolder(mLiveRoomViewHolder); } /** diff --git a/live/src/main/java/com/yunbao/live/adapter/FreePkRecyclerAdapter.java b/live/src/main/java/com/yunbao/live/adapter/FreePkRecyclerAdapter.java index 6ce23c031..4e255eded 100644 --- a/live/src/main/java/com/yunbao/live/adapter/FreePkRecyclerAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/FreePkRecyclerAdapter.java @@ -146,31 +146,13 @@ public class FreePkRecyclerAdapter extends RefreshAdapter { if (code == 0 && info.length > 0) { JSONObject obj = JSON.parseObject(info[0]); if (obj != null) { - if (TextUtils.equals(obj.getString("ispk"), "0")) {//自己不在PK,可以发起邀请 - + if(mDrPkNum!=-1){ LiveHttpUtil.getMicList(liveUid, 0, new com.yunbao.common.http.HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { System.out.println("code = " + code + ", msg = " + msg + ", info = " + Arrays.deepToString(info)); //非0认为未开通连麦权限 if (code != 0) { - if (mDrPkNum == -1) { - if (WordUtil.isNewZh()) { - ToastUtil.show("邀请 " + bean.getUserNiceName() + " 发送成功"); - } else { - ToastUtil.show("invite " + bean.getUserNiceName() + " successful"); - } - mOnItemClickListener.onItemClick(bean, -1); - if(mContext instanceof LiveSwAnchorActivity){ - ((LiveSwAnchorActivity) mContext).linkMicAnchorApply(bean.getId(), bean.getId(), - false); - }else{ - ((LiveRyAnchorActivity) mContext).linkMicAnchorApply(bean.getId(), bean.getId(), - ((LiveRyAnchorActivity) mContext).buildLinkMicJSON().toString() - ); - } - return; - } if (mDrPkNum <= 0) { if (WordUtil.isNewZh()) { ToastUtil.show("多人次數已用完"); @@ -203,10 +185,44 @@ public class FreePkRecyclerAdapter extends RefreshAdapter { } }); }else{ - if (WordUtil.isNewZh()) { - ToastUtil.show("請先關閉PK"); - } else { - ToastUtil.show("Please disable the PK"); + if (TextUtils.equals(obj.getString("ispk"), "0")) {//自己不在PK,可以发起邀请 + LiveHttpUtil.getMicList(liveUid, 0, new com.yunbao.common.http.HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + System.out.println("code = " + code + ", msg = " + msg + ", info = " + Arrays.deepToString(info)); + //非0认为未开通连麦权限 + if (code != 0) { + if (mDrPkNum == -1) { + if (WordUtil.isNewZh()) { + ToastUtil.show("邀请 " + bean.getUserNiceName() + " 发送成功"); + } else { + ToastUtil.show("invite " + bean.getUserNiceName() + " successful"); + } + mOnItemClickListener.onItemClick(bean, -1); + if(mContext instanceof LiveSwAnchorActivity){ + ((LiveSwAnchorActivity) mContext).linkMicAnchorApply(bean.getId(), bean.getId(), + false); + }else{ + ((LiveRyAnchorActivity) mContext).linkMicAnchorApply(bean.getId(), bean.getId(), + ((LiveRyAnchorActivity) mContext).buildLinkMicJSON().toString() + ); + } + } + } else { + if (WordUtil.isNewZh()) { + ToastUtil.show("請先關閉語音連麥"); + } else { + ToastUtil.show("Please disable the voice connection first"); + } + } + } + }); + }else{ + if (WordUtil.isNewZh()) { + ToastUtil.show("請先關閉PK"); + } else { + ToastUtil.show("Please disable the PK"); + } } } } diff --git a/live/src/main/java/com/yunbao/live/dialog/LivePrankDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LivePrankDialogFragment.java index c7de8f06e..76e2011f8 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LivePrankDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LivePrankDialogFragment.java @@ -173,11 +173,9 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O if (giftBeans.size() < 6) { mBtnAddGift.setVisibility(View.VISIBLE); mGiftNotDate.setVisibility(View.VISIBLE); - mPrankBtn.setVisibility(View.VISIBLE); } else { mBtnAddGift.setVisibility(View.GONE); mGiftNotDate.setVisibility(View.GONE); - mPrankBtn.setVisibility(View.GONE); } } } @@ -248,7 +246,6 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O giftBeans = new ArrayList<>(); recyclerAdapter.setList(giftBeans); recyclerAdapter.notifyDataSetChanged(); - mPrankBtn.setVisibility(View.VISIBLE); mBtnAddGift.setVisibility(View.VISIBLE); mGiftNotDate.setVisibility(View.VISIBLE); setGiftBean(recyclerAdapter.getList(),"1"); @@ -287,7 +284,6 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O mBtnAddGift.setVisibility(View.GONE); mGiftNotDate.setVisibility(View.GONE); recyclerAdapter.setViewType(TYPE_TURNTABLE); - mPrankBtn.setVisibility(View.VISIBLE); mPrankBtn.setBackgroundResource(R.drawable.bg_live_prank_turntable_save); if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { mPrankBtn.setText("發送圖標"); @@ -298,6 +294,7 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O mPrankBtn.setTag(0); recyclerAdapter.clearList(); initTurntableData(); + mPrankBtn.setVisibility(View.VISIBLE); } else { mTurntableConfigLayout.setVisibility(View.GONE); mGiftConfigLayout.setVisibility(View.VISIBLE); @@ -306,14 +303,15 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O recyclerAdapter.setViewType(LivePrankRecyclerAdapter.TYPE_GIFT); mPrankBtn.setBackgroundResource(R.drawable.bg_live_prank_turntable_save); - if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { + /*if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { mPrankBtn.setText("添加禮物"); } else { mPrankBtn.setText("Add gift"); - } + }*/ mPrankBtn.setTag(1); recyclerAdapter.clearList(); initGiftData(); + mPrankBtn.setVisibility(View.GONE); } } @@ -341,11 +339,9 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O if (giftBeans.size() < 6) { mBtnAddGift.setVisibility(View.VISIBLE); mGiftNotDate.setVisibility(View.VISIBLE); - mPrankBtn.setVisibility(View.VISIBLE); } else { mBtnAddGift.setVisibility(View.GONE); mGiftNotDate.setVisibility(View.GONE); - mPrankBtn.setVisibility(View.GONE); } } }); @@ -419,10 +415,12 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O @Override public void onSuccess(PrankHttpTurntableBean data) { initGiftData(); - if (WordUtil.isNewZh()) { - ToastUtil.show("保存成功!"); - } else { - ToastUtil.show("successful"); + if(!is_cleared.equals("1")){ + if (WordUtil.isNewZh()) { + ToastUtil.show("保存成功!"); + } else { + ToastUtil.show("successful"); + } } //通知主播刷新整蛊信息、 if(onPrankResultListener!=null){ @@ -462,7 +460,6 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O } else { mBtnAddGift.setVisibility(View.GONE); mGiftNotDate.setVisibility(View.GONE); - mPrankBtn.setVisibility(View.GONE); } mPrankRecyclerView.setVisibility(View.VISIBLE); recyclerAdapter.setViewType(LivePrankRecyclerAdapter.TYPE_GIFT); @@ -543,14 +540,23 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O return; } } + if(isClear){ + bean.setTurntable1(""); + bean.setTurntable2(""); + bean.setTurntable3(""); + bean.setTurntable4(""); + bean.setTurntable5(""); + bean.setTurntable6(""); + } LiveNetManager.get(mContext).setAnchorPrankTurntable(mLiveUid, bean.getCoin() + "", bean.getTurntable1(), bean.getTurntable2(), bean.getTurntable3(), bean.getTurntable4(), bean.getTurntable5(), bean.getTurntable6(), bean.getStatus() + "", new HttpCallback() { @Override public void onSuccess(Object data) { - - if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { - ToastUtil.show("保存成功"); - } else { - ToastUtil.show("Save success"); + if(!isClear){ + if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { + ToastUtil.show("保存成功"); + } else { + ToastUtil.show("Save success"); + } } } diff --git a/live/src/main/java/com/yunbao/live/presenter/AbsLinkMicPkPresenter.java b/live/src/main/java/com/yunbao/live/presenter/AbsLinkMicPkPresenter.java index 8b1602252..c99610974 100644 --- a/live/src/main/java/com/yunbao/live/presenter/AbsLinkMicPkPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/AbsLinkMicPkPresenter.java @@ -11,6 +11,7 @@ import com.yunbao.common.http.LiveHttpUtil; import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.AppManager; +import com.yunbao.live.views.LiveRoomViewHolder; public abstract class AbsLinkMicPkPresenter { private boolean isSw = false; @@ -29,6 +30,7 @@ public abstract class AbsLinkMicPkPresenter { protected String mApplyNmae;//正在申请Pk的主播的名字 protected boolean mIsApplyDialogShow;//是否显示了申请PK的弹窗 + public LiveRoomViewHolder mLiveRoomViewHolder; /** * 主播与主播PK 主播收到其他主播发过来的多人PK申请的回调 @@ -38,6 +40,10 @@ public abstract class AbsLinkMicPkPresenter { showDRApplyDialogTmp(u); } + public void setmLiveRoomViewHolder(LiveRoomViewHolder mLiveRoomViewHolder) { + this.mLiveRoomViewHolder = mLiveRoomViewHolder; + } + /** * 主播与主播PK 主播收到其他主播发过来的PK申请的回调 */ diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java index 191620881..7a70b0f8c 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java @@ -72,6 +72,7 @@ import com.yunbao.live.socket.SocketRyLinkMicPkUtil; import com.yunbao.live.socket.SocketSendBean; import com.yunbao.live.views.LiveLinkMicPkViewHolder; import com.yunbao.live.views.LivePushRyViewHolder; +import com.yunbao.live.views.LiveRoomViewHolder; import org.greenrobot.eventbus.EventBus; @@ -247,6 +248,10 @@ public class LiveRyLinkMicPkPresenter extends AbsLinkMicPkPresenter implements V } + + + + public LiveRyLinkMicPkPresenter(Context context, LivePushRyViewHolder linkMicViewHolder, boolean isAnchor, View root) { super(false); mContext = context; @@ -1043,6 +1048,10 @@ public class LiveRyLinkMicPkPresenter extends AbsLinkMicPkPresenter implements V } } } + //收起整蛊列表 + if(mLiveRoomViewHolder!=null){ + mLiveRoomViewHolder.closePrankView(); + } } }); } @@ -1826,6 +1835,10 @@ public class LiveRyLinkMicPkPresenter extends AbsLinkMicPkPresenter implements V } }); + //收起整蛊列表 + if(mLiveRoomViewHolder!=null){ + mLiveRoomViewHolder.closePrankView(); + } } }); diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveSwLinkMicPkPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveSwLinkMicPkPresenter.java index 26132c1ab..db9add4f7 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveSwLinkMicPkPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveSwLinkMicPkPresenter.java @@ -607,6 +607,10 @@ public class LiveSwLinkMicPkPresenter extends AbsLinkMicPkPresenter implements V dRjoinOtherRoom(u); //展示结束连麦按钮 mLiveAnchorViewHolder.showEndPkBt(); + //收起整蛊列表 + if(mLiveRoomViewHolder!=null){ + mLiveRoomViewHolder.closePrankView(); + } } @@ -831,9 +835,15 @@ public class LiveSwLinkMicPkPresenter extends AbsLinkMicPkPresenter implements V //设置多人PK 房主ROOM UID mLiveAnchorViewHolder.setDrpkRoomId(mApplyUid); mLiveAnchorViewHolder.showEndPkBt(); + + //收起整蛊列表 + if(mLiveRoomViewHolder!=null){ + mLiveRoomViewHolder.closePrankView(); + } } } }); + } }); } 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 30f39031a..852c2838c 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -1763,6 +1763,16 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis initPrankAdapter(); } + /** + * 收起整蛊列表 + */ + public void closePrankView(){ + if(prank_group.getVisibility()==View.VISIBLE){ + prank_group.setVisibility(View.GONE); + prank_small_icon.setVisibility(View.VISIBLE); + } + } + public void sendMsgPrank(){ new Handler().postDelayed(new Runnable() { @@ -5021,7 +5031,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis countDownTimerTrickery.cancel(); countDownTimerTrickery = null; lt_trickery.setVisibility(View.GONE); - prank_group_turntable_icon.setVisibility(View.VISIBLE); + if(!CommonAppConfig.getInstance().getUid().equals(mLiveUid)){ + prank_group_turntable_icon.setVisibility(View.VISIBLE); + } LiveNetManager.get(mContext).endPrankTurntable(mLiveUid, new com.yunbao.common.http.base.HttpCallback() { @Override public void onSuccess(BaseModel data) { @@ -5056,7 +5068,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis starTimeloud(2, time); } else { lt_trickery.setVisibility(View.GONE); - prank_group_turntable_icon.setVisibility(View.VISIBLE); + if(!CommonAppConfig.getInstance().getUid().equals(mLiveUid)){ + prank_group_turntable_icon.setVisibility(View.VISIBLE); + } timeOver(); } } 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 c3d7058bf..c7ba39f48 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -642,6 +642,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe //初始化整蛊进度列表 mLiveRoomViewHolder.initPrankProgress(); + isattention = Integer.parseInt(data.getEnterRoomInfo().getIsattention()); if (isattention == 0) { if (countDownTimer != null) { @@ -727,6 +728,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe mLivePlayViewHolder.setPkView(connection_info.getPkuid()); } } + //收起整蠱列表 + mLiveRoomViewHolder.closePrankView(); } if (mLiveRoomViewHolder != null) { mLiveRoomViewHolder.pkHandler = false; @@ -777,6 +780,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe mLiveRoomViewHolder.initPkRank(null); } } + //收起整蠱列表 + mLiveRoomViewHolder.closePrankView(); //多人PK } else if (pkInfo != null && pkInfo.getIntValue("drpk_status") == 1) { if (mLiveRoomViewHolder != null) { @@ -809,6 +814,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe } upDataPkScore(pkInfo.getJSONArray("userlist"), pkInfo.getIntValue("drpk_time")); + //收起整蠱列表 + mLiveRoomViewHolder.closePrankView(); } if (data.getEnterRoomInfo().getGuard() != null) { if (mLiveRoomViewHolder != null) {