fix:修复主播开播返回不会弹出确认框

fix:修复主播点离开后,主播端没有离开遮罩图
This commit is contained in:
zlzw 2022-12-13 10:28:11 +08:00
parent af91783b9f
commit 6c33ac15f8
3 changed files with 16 additions and 7 deletions

View File

@ -38,7 +38,6 @@ public class RandomPkManager {
public static String debugUid; public static String debugUid;
private RankPkInfoBean rankPkInfoBean;//排位赛信息 private RankPkInfoBean rankPkInfoBean;//排位赛信息
Handler handler = new Handler(Looper.getMainLooper()); Handler handler = new Handler(Looper.getMainLooper());
private boolean exitSuccess = false;
private RandomPkManager() { private RandomPkManager() {
getRankInfo(); getRankInfo();
@ -130,8 +129,7 @@ public class RandomPkManager {
} }
private void next() { private void next() {
if (exitSuccess) { if (task==null) {
exitSuccess = false;
return; return;
} }
status = PK_STATUS_REQUEST; status = PK_STATUS_REQUEST;
@ -239,7 +237,6 @@ public class RandomPkManager {
*/ */
private void callEndPkSuccess() { private void callEndPkSuccess() {
status = PK_STATUS_DEFAULT; status = PK_STATUS_DEFAULT;
exitSuccess = true;
rankPkInfoBean = null; rankPkInfoBean = null;
for (OnRandomPkTimer pkTimer : randomPkTimer) { for (OnRandomPkTimer pkTimer : randomPkTimer) {
pkTimer.onPkEndSuccess(); pkTimer.onPkEndSuccess();

View File

@ -22,6 +22,7 @@ import android.util.Log;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
@ -152,6 +153,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
public static int pk_nub; public static int pk_nub;
public static int backIndex = 0;//0=未判断1=已判断 public static int backIndex = 0;//0=未判断1=已判断
private FaceManager manager; private FaceManager manager;
private ImageView leave_img;
private final RandomPkManager.OnRandomPkTimer onRandomPkTimer = new RandomPkManager.OnRandomPkTimer() { private final RandomPkManager.OnRandomPkTimer onRandomPkTimer = new RandomPkManager.OnRandomPkTimer() {
@Override @Override
public void onTimer(String time) { public void onTimer(String time) {
@ -197,6 +199,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
Bus.getOn(this); Bus.getOn(this);
Intent intent = getIntent(); Intent intent = getIntent();
initFaceManager(); initFaceManager();
leave_img = findViewById(R.id.leave_img);
mLiveSDK = intent.getIntExtra(Constants.LIVE_SDK, Constants.LIVE_SDK_KSY); mLiveSDK = intent.getIntExtra(Constants.LIVE_SDK, Constants.LIVE_SDK_KSY);
mLiveKsyConfigBean = intent.getParcelableExtra(Constants.LIVE_KSY_CONFIG); mLiveKsyConfigBean = intent.getParcelableExtra(Constants.LIVE_KSY_CONFIG);
L.e(TAG, "直播sdk----->" + (mLiveSDK == Constants.LIVE_SDK_KSY ? "金山云" : "腾讯云")); L.e(TAG, "直播sdk----->" + (mLiveSDK == Constants.LIVE_SDK_KSY ? "金山云" : "腾讯云"));
@ -446,6 +449,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
RCRTCRect rect = new RCRTCRect(0f, 0f, 1.0f); RCRTCRect rect = new RCRTCRect(0f, 0f, 1.0f);
if (leave == 0) { if (leave == 0) {
leave = 1; leave = 1;
leave_img.setVisibility(View.VISIBLE);
Glide.with(mContext).asBitmap().load(R.mipmap.zslk).into(new CustomTarget<Bitmap>() { Glide.with(mContext).asBitmap().load(R.mipmap.zslk).into(new CustomTarget<Bitmap>() {
@Override @Override
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) { public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
@ -461,6 +465,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
}); });
} else if (leave == 1) { } else if (leave == 1) {
leave = 0; leave = 0;
leave_img.setVisibility(View.GONE);
// 清除水印 // 清除水印
boolean ret = RCRTCEngine.getInstance().getDefaultVideoStream().setWatermark(null, rect); boolean ret = RCRTCEngine.getInstance().getDefaultVideoStream().setWatermark(null, rect);
sendSystemMessage(WordUtil.getString(R.string.live_anchor_come_back)); sendSystemMessage(WordUtil.getString(R.string.live_anchor_come_back));
@ -938,7 +943,6 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
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();
} }
return super.onKeyUp(keyCode, event); return super.onKeyUp(keyCode, event);
} }

View File

@ -47,4 +47,12 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent" />
<ImageView
android:id="@+id/leave_img"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="45dp"
android:scaleType="fitXY"
android:src="@mipmap/zslk"
android:visibility="gone" />
</FrameLayout> </FrameLayout>