Browse Source

fix: ci

dejiAi
高志龙 3 months ago
parent
commit
da06587620
  1. 4
      app/src/main/java/qianmu/container/activity/H5/WebViewActivity.java
  2. 46
      app/src/main/java/qianmu/container/util/FileUtil.java

4
app/src/main/java/qianmu/container/activity/H5/WebViewActivity.java

@ -108,8 +108,8 @@ public class WebViewActivity extends BaseActivity {
static final int TYPE_GO_SAVESCREEN = 300;//导视通知跳转屏保
static final int TYPE_HINT_PASSWORD = 3;//隐藏密码输入框
static final int TYPE_START_SERVER = 4;//重新启动web服务
//static String HtmlUrl = "http://127.0.0.1:8080/index.html";//webServer服务地址 http://192.168.1.218:5173/
static String HtmlUrl = "http://192.168.1.196:5500/index.html";
static String HtmlUrl = "http://127.0.0.1:8080/index.html";//webServer服务地址 http://192.168.1.218:5173/
// static String HtmlUrl = "http://192.168.1.196:5500/index.html";
int time = 0;
private VideoView currentVideo;
private VideoView proVideo; // 当前正在切换的目标视频

46
app/src/main/java/qianmu/container/util/FileUtil.java

@ -168,24 +168,38 @@ public class FileUtil {
try {
String fileTotalLength = response.headers().get("Content-Range");
//获取请求数据的总大小
fileTotalLength = fileTotalLength.substring(fileTotalLength.lastIndexOf("/") + 1);
File tempFile = new File(localPath);
//读取本地保存文件大小
String tempFileLength = String.valueOf(tempFile.length());
//二者大小一致时 修改文件后缀名
if (tempFile.length()!=0 &&fileTotalLength.equals(tempFileLength)) {
String targetPath = localPath.substring(0, localPath.lastIndexOf("."));
if(targetPath.contains("?")){
String[] split = targetPath.split("[?]");
targetPath=split[0];
if( StringUtil.isEmpty(fileTotalLength)){
if(tempFile.length() > 10){
String targetPath = localPath.substring(0, localPath.lastIndexOf("."));
if(targetPath.contains("?")){
String[] split = targetPath.split("[?]");
targetPath=split[0];
}
File targetFile = new File(targetPath);
tempFile.renameTo(targetFile);
}else{
tempFile.delete();
}
}else{
//获取请求数据的总大小
fileTotalLength = fileTotalLength.substring(fileTotalLength.lastIndexOf("/") + 1);
//读取本地保存文件大小
String tempFileLength = String.valueOf(tempFile.length());
//二者大小一致时 修改文件后缀名
if (tempFile.length()!=0 &&fileTotalLength.equals(tempFileLength)) {
String targetPath = localPath.substring(0, localPath.lastIndexOf("."));
if(targetPath.contains("?")){
String[] split = targetPath.split("[?]");
targetPath=split[0];
}
File targetFile = new File(targetPath);
tempFile.renameTo(targetFile);
} else{
Log.e("下载失败", localPath);
//本地文件大于待下载文件时 表示断点下载异常 删除已下载文件
tempFile.delete();
}
File targetFile = new File(targetPath);
tempFile.renameTo(targetFile);
} else if (Integer.valueOf(tempFileLength) > Integer.valueOf(fileTotalLength) || tempFile.length()==0) {
Log.e("下载失败", localPath);
//本地文件大于待下载文件时 表示断点下载异常 删除已下载文件
tempFile.delete();
}
} catch (Throwable t) {
LoggerUtil.e("downloadSuccess", StringUtil.getThrowableStr(t));

Loading…
Cancel
Save