优化随机PK前先检测是否开启了连麦功能

This commit is contained in:
zlzw 2022-12-09 10:15:20 +08:00
parent 1bbc78fb32
commit 5e9f23286e

View File

@ -15,12 +15,18 @@ import androidx.annotation.Nullable;
import com.yunbao.common.bean.HttpCallbackModel;
import com.yunbao.common.dialog.AbsDialogFragment;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.MicStatusManager;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R;
import com.yunbao.common.manager.RandomPkManager;
import com.yunbao.live.activity.LiveRyAnchorActivity;
import com.yunbao.live.http.LiveHttpUtil;
import java.util.Arrays;
/**
* 随机PK
@ -237,12 +243,23 @@ public class RandomPkDialogFragment extends AbsDialogFragment implements View.On
RandomPkManager.getInstance().exitPk();
return;
}
LiveHttpUtil.getMicList(LiveRyAnchorActivity.mLiveUid, 0, new 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 (RandomPkManager.getInstance().start()) {
mPkBtnDesc.setVisibility(View.VISIBLE);
mPkBtnDesc.setText(R.string.random_pk_info_btn_ing_desc);
mPkBtn.setTag(true);
}
} else {
ToastUtil.show("請先關閉語言連麥");
}
}
});
if (RandomPkManager.getInstance().start()) {
mPkBtnDesc.setVisibility(View.VISIBLE);
mPkBtnDesc.setText(R.string.random_pk_info_btn_ing_desc);
mPkBtn.setTag(true);
}
}
private void resetPkBtn() {