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

View File

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

View File

@ -1136,7 +1136,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
} else { } else {
ToastUtil.show("主播正在PK稍後再試"); ToastUtil.show("主播正在PK稍後再試");
if (RandomPkManager.getInstance().isRequestPk()) { if (RandomPkManager.getInstance().isRandomModel()) {
RandomPkManager.getInstance().setPkStatus(RandomPkManager.PK_STATUS_REFUSE); 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.setTag(true);
mRandomPkSwitch.setOnClickListener(this); mRandomPkSwitch.setOnClickListener(this);
mPkBtn.setOnClickListener(this); mPkBtn.setOnClickListener(this);
mPkBtn.setTag(false);
mPkBtn.setOnLongClickListener(v -> { mPkBtn.setOnLongClickListener(v -> {
DialogUitl.showSimpleInputDialog(mContext, "输入指定UID", new DialogUitl.SimpleCallback() { DialogUitl.showSimpleInputDialog(mContext, "输入指定UID", new DialogUitl.SimpleCallback() {
@Override @Override