update 多人PK也用新UI

This commit is contained in:
zlzw 2022-12-12 18:18:36 +08:00
parent 5356d91fef
commit ddc246e11c
4 changed files with 15 additions and 7 deletions

View File

@ -216,13 +216,12 @@ public class IMRTCManager {
return;
}
if (waitTime-- == 0) {
new Handler(Looper.getMainLooper()).post(() -> ToastUtil.show("超时清除"));
//callback.onFailed(JOIN_CHAT_ROOM_TIMEOUT);
cancelRequestJoinOtherRoom(liveUid, "extra", new IRCRTCResultCallback() {
@Override
public void onSuccess() {
requestUid.remove(liveUid);
if (RandomPkManager.getInstance().isRequestPk()) {
if (RandomPkManager.getInstance().isRandomModel()) {
RandomPkManager.getInstance().setPkStatus(RandomPkManager.PK_STATUS_REFUSE);
}
}
@ -230,7 +229,7 @@ public class IMRTCManager {
@Override
public void onFailed(RTCErrorCode errorCode) {
requestUid.remove(liveUid);
if (RandomPkManager.getInstance().isRequestPk()) {
if (RandomPkManager.getInstance().isRandomModel()) {
RandomPkManager.getInstance().setPkStatus(RandomPkManager.PK_STATUS_REFUSE);
}
}

View File

@ -88,6 +88,7 @@ public class RandomPkManager {
return;
}
task = new TimerTask() {
boolean isStartPk = false;
@Override
public void run() {
@ -100,7 +101,10 @@ public class RandomPkManager {
for (OnRandomPkTimer onRandomPkTimer : randomPkTimer) {
onRandomPkTimer.onTimer(String.format(Locale.CHINA, "%02d:%02d", min, sec));
}
if (!isStartPk) {
nextPk();
isStartPk = true;
}
});
}
};
@ -120,6 +124,10 @@ public class RandomPkManager {
if (status != PK_STATUS_DEFAULT && status != PK_STATUS_REFUSE) {
return;
}
new Handler(Looper.getMainLooper()).postDelayed(this::next, 5000);
}
private void next() {
status = PK_STATUS_REQUEST;
LiveNetManager.get(CommonAppContext.getTopActivity())
.randomPK(new HttpCallback<String>() {
@ -222,11 +230,11 @@ public class RandomPkManager {
* 通知所有监听者退出匹配成功
*/
private void callEndPkSuccess() {
status = PK_STATUS_DEFAULT;
rankPkInfoBean = null;
for (OnRandomPkTimer pkTimer : randomPkTimer) {
pkTimer.onPkEndSuccess();
}
status = PK_STATUS_DEFAULT;
rankPkInfoBean = null;
}
private int exitTimer;

View File

@ -1136,7 +1136,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
} else {
ToastUtil.show("主播正在PK稍後再試");
if (RandomPkManager.getInstance().isRequestPk()) {
if (RandomPkManager.getInstance().isRandomModel()) {
RandomPkManager.getInstance().setPkStatus(RandomPkManager.PK_STATUS_REFUSE);
}
}

View File

@ -134,6 +134,7 @@ public class RandomPkDialogFragment extends AbsDialogFragment implements View.On
mRandomPkSwitch.setTag(true);
mRandomPkSwitch.setOnClickListener(this);
mPkBtn.setOnClickListener(this);
mPkBtn.setTag(false);
mPkBtn.setOnLongClickListener(v -> {
DialogUitl.showSimpleInputDialog(mContext, "输入指定UID", new DialogUitl.SimpleCallback() {
@Override