禁止PK过程中主播点离开按钮

This commit is contained in:
zlzw 2022-11-10 15:04:42 +08:00
parent 8f0a1a09a6
commit 56475e729c
2 changed files with 20 additions and 10 deletions

View File

@ -532,6 +532,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
} }
bundle.putBoolean(Constants.HAS_GAME, hasGame); bundle.putBoolean(Constants.HAS_GAME, hasGame);
bundle.putInt("leave", leave); bundle.putInt("leave", leave);
bundle.putBoolean("isPk", isDRPK == 1 || PKing);
bundle.putBoolean(Constants.OPEN_FLASH, mLivePushViewHolder != null && mLivePushViewHolder.isFlashOpen()); bundle.putBoolean(Constants.OPEN_FLASH, mLivePushViewHolder != null && mLivePushViewHolder.isFlashOpen());
fragment.setArguments(bundle); fragment.setArguments(bundle);
fragment.setFunctionClickListener(this); fragment.setFunctionClickListener(this);
@ -851,11 +852,13 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
} }
super.release(); super.release();
} }
private boolean isKeyBack=false;
private boolean isKeyBack = false;
@Override @Override
public boolean onKeyUp(int keyCode, KeyEvent event) { public boolean onKeyUp(int keyCode, KeyEvent event) {
if(keyCode==KeyEvent.KEYCODE_BACK){ if (keyCode == KeyEvent.KEYCODE_BACK) {
isKeyBack=true; isKeyBack = true;
finish(); finish();
} }
return super.onKeyUp(keyCode, event); return super.onKeyUp(keyCode, event);
@ -891,7 +894,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
mLiveRoomViewHolder.anchorPause(); mLiveRoomViewHolder.anchorPause();
} }
super.onPause(); super.onPause();
if(isKeyBack) { if (isKeyBack) {
sendSystemMessage(WordUtil.getString(R.string.live_anchor_leave)); sendSystemMessage(WordUtil.getString(R.string.live_anchor_leave));
} }
mPaused = true; mPaused = true;

View File

@ -13,6 +13,7 @@ import android.widget.TextView;
import com.yunbao.common.Constants; import com.yunbao.common.Constants;
import com.yunbao.common.dialog.AbsDialogFragment; import com.yunbao.common.dialog.AbsDialogFragment;
import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.activity.LiveRyAnchorActivity; import com.yunbao.live.activity.LiveRyAnchorActivity;
import com.yunbao.live.interfaces.LiveFunctionClickListener; 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 View mWishView, mPrankView, mWksView, mBeautyView, mCameraView, mLeaveView, mOnePkView, mMultiPkView, mMicView;
private LiveFunctionClickListener mFunctionClickListener; private LiveFunctionClickListener mFunctionClickListener;
private int leave = 0; private int leave = 0;
private boolean isPk;
// boolean isRy = false; // boolean isRy = false;
@ -65,6 +67,7 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements
hasGame = bundle.getBoolean(Constants.HAS_GAME, false); hasGame = bundle.getBoolean(Constants.HAS_GAME, false);
openFlash = bundle.getBoolean(Constants.OPEN_FLASH, false); openFlash = bundle.getBoolean(Constants.OPEN_FLASH, false);
leave = bundle.getInt("leave", 0); leave = bundle.getInt("leave", 0);
isPk = bundle.getBoolean("isPk", false);
// isRy = bundle.getBoolean("isRy", false); // isRy = bundle.getBoolean("isRy", false);
} }
mWishView = findViewById(R.id.live_tool_wish); mWishView = findViewById(R.id.live_tool_wish);
@ -87,12 +90,12 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements
mMultiPkView.setOnClickListener(this); mMultiPkView.setOnClickListener(this);
mMicView.setOnClickListener(this); mMicView.setOnClickListener(this);
if(leave==0){ if (leave == 0) {
((ImageView)mLeaveView.findViewById(R.id.live_tool_leave_img)).setImageResource(R.mipmap.icon_leave); ((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); ((TextView) mLeaveView.findViewById(R.id.live_tool_leave_text)).setText(R.string.live_zslk);
}else { } else {
((ImageView)mLeaveView.findViewById(R.id.live_tool_leave_img)).setImageResource(R.mipmap.icon_leave_p); ((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); ((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) { } else if (id == R.id.live_tool_camera) {
mFunctionClickListener.onClick(LIVE_FUNC_CAMERA); mFunctionClickListener.onClick(LIVE_FUNC_CAMERA);
} else if (id == R.id.live_tool_leave) { } else if (id == R.id.live_tool_leave) {
if (isPk) {
ToastUtil.show("PK中禁止离开");
return;
}
mFunctionClickListener.onClick(LIVE_FUNC_ZSLK); mFunctionClickListener.onClick(LIVE_FUNC_ZSLK);
} else if (id == R.id.live_tool_one_pk) { } else if (id == R.id.live_tool_one_pk) {
mFunctionClickListener.onClick(LIVE_FUNC_LINK_MIC); mFunctionClickListener.onClick(LIVE_FUNC_LINK_MIC);