From 56475e729c0b12183f61df6f345f9afd74baedf8 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Thu, 10 Nov 2022 15:04:42 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A6=81=E6=AD=A2PK=E8=BF=87=E7=A8=8B=E4=B8=AD?= =?UTF-8?q?=E4=B8=BB=E6=92=AD=E7=82=B9=E7=A6=BB=E5=BC=80=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../live/activity/LiveRyAnchorActivity.java | 11 +++++++---- .../dialog/LiveNewFunctionDialogFragment.java | 19 +++++++++++++------ 2 files changed, 20 insertions(+), 10 deletions(-) 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 64f97f8a3..54b17425b 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java @@ -532,6 +532,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl } bundle.putBoolean(Constants.HAS_GAME, hasGame); bundle.putInt("leave", leave); + bundle.putBoolean("isPk", isDRPK == 1 || PKing); bundle.putBoolean(Constants.OPEN_FLASH, mLivePushViewHolder != null && mLivePushViewHolder.isFlashOpen()); fragment.setArguments(bundle); fragment.setFunctionClickListener(this); @@ -851,11 +852,13 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl } super.release(); } - private boolean isKeyBack=false; + + private boolean isKeyBack = false; + @Override public boolean onKeyUp(int keyCode, KeyEvent event) { - if(keyCode==KeyEvent.KEYCODE_BACK){ - isKeyBack=true; + if (keyCode == KeyEvent.KEYCODE_BACK) { + isKeyBack = true; finish(); } return super.onKeyUp(keyCode, event); @@ -891,7 +894,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl mLiveRoomViewHolder.anchorPause(); } super.onPause(); - if(isKeyBack) { + if (isKeyBack) { sendSystemMessage(WordUtil.getString(R.string.live_anchor_leave)); } mPaused = true; diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveNewFunctionDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveNewFunctionDialogFragment.java index d9614c43b..63db923f8 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveNewFunctionDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveNewFunctionDialogFragment.java @@ -13,6 +13,7 @@ import android.widget.TextView; import com.yunbao.common.Constants; import com.yunbao.common.dialog.AbsDialogFragment; import com.yunbao.common.utils.DpUtil; +import com.yunbao.common.utils.ToastUtil; import com.yunbao.live.R; import com.yunbao.live.activity.LiveRyAnchorActivity; import com.yunbao.live.interfaces.LiveFunctionClickListener; @@ -26,6 +27,7 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements private View mWishView, mPrankView, mWksView, mBeautyView, mCameraView, mLeaveView, mOnePkView, mMultiPkView, mMicView; private LiveFunctionClickListener mFunctionClickListener; private int leave = 0; + private boolean isPk; // boolean isRy = false; @@ -65,6 +67,7 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements hasGame = bundle.getBoolean(Constants.HAS_GAME, false); openFlash = bundle.getBoolean(Constants.OPEN_FLASH, false); leave = bundle.getInt("leave", 0); + isPk = bundle.getBoolean("isPk", false); // isRy = bundle.getBoolean("isRy", false); } mWishView = findViewById(R.id.live_tool_wish); @@ -87,12 +90,12 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements mMultiPkView.setOnClickListener(this); mMicView.setOnClickListener(this); - if(leave==0){ - ((ImageView)mLeaveView.findViewById(R.id.live_tool_leave_img)).setImageResource(R.mipmap.icon_leave); - ((TextView)mLeaveView.findViewById(R.id.live_tool_leave_text)).setText(R.string.live_zslk); - }else { - ((ImageView)mLeaveView.findViewById(R.id.live_tool_leave_img)).setImageResource(R.mipmap.icon_leave_p); - ((TextView)mLeaveView.findViewById(R.id.live_tool_leave_text)).setText(R.string.live_zslk1); + if (leave == 0) { + ((ImageView) mLeaveView.findViewById(R.id.live_tool_leave_img)).setImageResource(R.mipmap.icon_leave); + ((TextView) mLeaveView.findViewById(R.id.live_tool_leave_text)).setText(R.string.live_zslk); + } else { + ((ImageView) mLeaveView.findViewById(R.id.live_tool_leave_img)).setImageResource(R.mipmap.icon_leave_p); + ((TextView) mLeaveView.findViewById(R.id.live_tool_leave_text)).setText(R.string.live_zslk1); } } @@ -126,6 +129,10 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements } else if (id == R.id.live_tool_camera) { mFunctionClickListener.onClick(LIVE_FUNC_CAMERA); } else if (id == R.id.live_tool_leave) { + if (isPk) { + ToastUtil.show("PK中禁止离开"); + return; + } mFunctionClickListener.onClick(LIVE_FUNC_ZSLK); } else if (id == R.id.live_tool_one_pk) { mFunctionClickListener.onClick(LIVE_FUNC_LINK_MIC);