多人PK人数和窗口不对应问题 处理中
This commit is contained in:
parent
d05c975068
commit
ee431d0ee2
@ -356,6 +356,10 @@ public class LivePushSwViewHolder extends AbsRyLivePushViewHolder {
|
|||||||
} else {
|
} else {
|
||||||
temp = position;
|
temp = position;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
L.eSw("PK 人数:" + temp );
|
||||||
|
|
||||||
|
|
||||||
switch (temp) {
|
switch (temp) {
|
||||||
case 2:
|
case 2:
|
||||||
swManager.joinChannelDrEx(dr2_preview, CommonAppConfig.getInstance().getUid(), CommonAppConfig.SWToken, uid, SWAuManager.getChannelName(uid), temp);
|
swManager.joinChannelDrEx(dr2_preview, CommonAppConfig.getInstance().getUid(), CommonAppConfig.SWToken, uid, SWAuManager.getChannelName(uid), temp);
|
||||||
@ -373,6 +377,7 @@ public class LivePushSwViewHolder extends AbsRyLivePushViewHolder {
|
|||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
dr3_preview.setVisibility(View.VISIBLE);
|
dr3_preview.setVisibility(View.VISIBLE);
|
||||||
|
dr4_preview.setVisibility(View.VISIBLE);
|
||||||
//先退出这个主播的直播间,在进入该直播间,(视图问题暂时這樣處理)
|
//先退出这个主播的直播间,在进入该直播间,(视图问题暂时這樣處理)
|
||||||
swManager.exitChannelToUid(Integer.parseInt(CommonAppConfig.getInstance().getUid()), drpkUid3);
|
swManager.exitChannelToUid(Integer.parseInt(CommonAppConfig.getInstance().getUid()), drpkUid3);
|
||||||
swManager.joinChannelDrEx(dr3_preview, CommonAppConfig.getInstance().getUid(), CommonAppConfig.SWToken, drpkUid3, SWAuManager.getChannelName(drpkUid3), temp);
|
swManager.joinChannelDrEx(dr3_preview, CommonAppConfig.getInstance().getUid(), CommonAppConfig.SWToken, drpkUid3, SWAuManager.getChannelName(drpkUid3), temp);
|
||||||
|
@ -177,7 +177,7 @@ public class LiveRyAnchorViewHolder extends AbsLiveViewHolder {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//结束多人PK
|
//发起人 多人PK 强制退出
|
||||||
btn_end_pk.setOnClickListener(new View.OnClickListener() {
|
btn_end_pk.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
@ -186,28 +186,40 @@ public class LiveRyAnchorViewHolder extends AbsLiveViewHolder {
|
|||||||
.execute(new HttpCallback() {
|
.execute(new HttpCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(int code, String msg, String[] info) {
|
public void onSuccess(int code, String msg, String[] info) {
|
||||||
|
|
||||||
Bus.get().post(new LiveAudienceEvent()
|
Bus.get().post(new LiveAudienceEvent()
|
||||||
.setType(LiveAudienceEvent.LiveAudienceType.LEAVE_DR_ROOM));
|
.setType(LiveAudienceEvent.LiveAudienceType.LEAVE_DR_ROOM));
|
||||||
PKing = false;
|
PKing = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError() {
|
||||||
|
super.onError();
|
||||||
|
|
||||||
|
}
|
||||||
});
|
});
|
||||||
btn_start_dr_pk_view.setVisibility(View.GONE);
|
btn_start_dr_pk_view.setVisibility(View.GONE);
|
||||||
yaoqing.clear();
|
yaoqing.clear();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 被邀请人退出多人PK
|
||||||
btn_end_pk_dr.setOnClickListener(new View.OnClickListener() {
|
btn_end_pk_dr.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
closeEndPkBt();
|
|
||||||
HttpClient.getInstance().post("tuichuduorenpkfangjian", "tuichuduorenpkfangjian")
|
HttpClient.getInstance().post("tuichuduorenpkfangjian", "tuichuduorenpkfangjian")
|
||||||
.params("roomid", drpkRoomId)
|
.params("roomid", drpkRoomId)
|
||||||
.params("uid", CommonAppConfig.getInstance().getUid())
|
.params("uid", CommonAppConfig.getInstance().getUid())
|
||||||
.execute(new HttpCallback() {
|
.execute(new HttpCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(int code, String msg, String[] info) {
|
public void onSuccess(int code, String msg, String[] info) {
|
||||||
|
if (code == 0) {
|
||||||
|
closeEndPkBt();
|
||||||
|
}else {
|
||||||
|
ToastUtil.show(msg);
|
||||||
|
}
|
||||||
L.eSw("tuichuduorenpkfangjian" + code + " info" + new Gson().toJson(info));
|
L.eSw("tuichuduorenpkfangjian" + code + " info" + new Gson().toJson(info));
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
66
main/src/main/java/com/yunbao/main/FileCopier.java
Normal file
66
main/src/main/java/com/yunbao/main/FileCopier.java
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
package com.yunbao.main;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Author: plx
|
||||||
|
* Date: 2024/11/1
|
||||||
|
* Description:
|
||||||
|
*/
|
||||||
|
import android.Manifest;
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.Environment;
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.core.app.ActivityCompat;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
|
||||||
|
public class FileCopier {
|
||||||
|
|
||||||
|
private static final int REQUEST_WRITE_STORAGE = 112;
|
||||||
|
|
||||||
|
public void copyLogsToExternalStorage(Context context) {
|
||||||
|
// 检查并请求写入外部存储的权限
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
|
if (ContextCompat.checkSelfPermission(context, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
ActivityCompat.requestPermissions((Activity) context, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, REQUEST_WRITE_STORAGE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 定义源目录和目标目录
|
||||||
|
File sourceDir = new File(context.getFilesDir(), "log");
|
||||||
|
File targetDir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS), "app_logs");
|
||||||
|
|
||||||
|
// 确保目标目录存在
|
||||||
|
if (!targetDir.exists()) {
|
||||||
|
targetDir.mkdirs();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 复制文件
|
||||||
|
File[] logFiles = sourceDir.listFiles((dir, name) -> name.endsWith(".log"));
|
||||||
|
if (logFiles != null) {
|
||||||
|
for (File logFile : logFiles) {
|
||||||
|
File targetFile = new File(targetDir, logFile.getName());
|
||||||
|
try (InputStream in = new FileInputStream(logFile);
|
||||||
|
OutputStream out = new FileOutputStream(targetFile)) {
|
||||||
|
|
||||||
|
byte[] buffer = new byte[1024];
|
||||||
|
int read;
|
||||||
|
while ((read = in.read(buffer)) != -1) {
|
||||||
|
out.write(buffer, 0, read);
|
||||||
|
}
|
||||||
|
out.flush();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user