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);