增加非静态的成员类警告提示
This commit is contained in:
@@ -31,11 +31,11 @@ import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModelProviders;
|
||||
import com.arialyy.annotations.Download;
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.arialyy.aria.core.processor.IHttpFileLenAdapter;
|
||||
import com.arialyy.aria.core.common.controller.ControllerType;
|
||||
import com.arialyy.aria.core.download.DownloadEntity;
|
||||
import com.arialyy.aria.core.inf.IEntity;
|
||||
import com.arialyy.aria.core.listener.ISchedulers;
|
||||
import com.arialyy.aria.core.processor.IHttpFileLenAdapter;
|
||||
import com.arialyy.aria.core.task.DownloadTask;
|
||||
import com.arialyy.aria.util.ALog;
|
||||
import com.arialyy.aria.util.CommonUtil;
|
||||
@@ -291,18 +291,7 @@ public class SingleTaskActivity extends BaseActivity<ActivitySingleBinding> {
|
||||
.load(mUrl)
|
||||
.useServerFileName(true)
|
||||
.setFilePath(mFilePath, true)
|
||||
.setFileLenAdapter(new IHttpFileLenAdapter() {
|
||||
@Override public long handleFileLen(Map<String, List<String>> headers) {
|
||||
|
||||
List<String> sLength = headers.get("Content-Length");
|
||||
if (sLength == null || sLength.isEmpty()) {
|
||||
return -1;
|
||||
}
|
||||
String temp = sLength.get(0);
|
||||
|
||||
return Long.parseLong(temp);
|
||||
}
|
||||
})
|
||||
.setFileLenAdapter(new FileLenAdapter())
|
||||
.option()
|
||||
.addHeader("1", "@")
|
||||
.controller(ControllerType.CREATE_CONTROLLER)
|
||||
@@ -327,4 +316,17 @@ public class SingleTaskActivity extends BaseActivity<ActivitySingleBinding> {
|
||||
mModule.updateFilePath(this, String.valueOf(data));
|
||||
}
|
||||
}
|
||||
|
||||
static class FileLenAdapter implements IHttpFileLenAdapter {
|
||||
@Override public long handleFileLen(Map<String, List<String>> headers) {
|
||||
|
||||
List<String> sLength = headers.get("Content-Length");
|
||||
if (sLength == null || sLength.isEmpty()) {
|
||||
return -1;
|
||||
}
|
||||
String temp = sLength.get(0);
|
||||
|
||||
return Long.parseLong(temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -212,27 +212,28 @@ public class M3U8LiveDLoadActivity extends BaseActivity<ActivityM3u8LiveBinding>
|
||||
public void onClick(View view) {
|
||||
switch (view.getId()) {
|
||||
case R.id.start:
|
||||
if (!AppUtil.chekEntityValid(mEntity)) {
|
||||
startD();
|
||||
break;
|
||||
}
|
||||
if (Aria.download(this).load(mEntity.getId()).isRunning()) {
|
||||
Aria.download(this).load(mEntity.getId()).stop();
|
||||
} else {
|
||||
Aria.download(this).load(mEntity.getId())
|
||||
.asM3U8()
|
||||
.asLive()
|
||||
.setLiveTsUrlConvert(new ILiveTsUrlConverter() {
|
||||
@Override public String convert(String m3u8Url, String tsUrl) {
|
||||
int index = m3u8Url.lastIndexOf("/");
|
||||
String parentUrl = m3u8Url.substring(0, index + 1);
|
||||
return parentUrl + tsUrl;
|
||||
}
|
||||
})
|
||||
.controller(ControllerType.TASK_CONTROLLER)
|
||||
.resume();
|
||||
}
|
||||
break;
|
||||
startD();
|
||||
//if (!AppUtil.chekEntityValid(mEntity)) {
|
||||
// startD();
|
||||
// break;
|
||||
//}
|
||||
//if (Aria.download(this).load(mEntity.getId()).isRunning()) {
|
||||
// Aria.download(this).load(mEntity.getId()).stop();
|
||||
//} else {
|
||||
// Aria.download(this).load(mEntity.getId())
|
||||
// .asM3U8()
|
||||
// .asLive()
|
||||
// .setLiveTsUrlConvert(new ILiveTsUrlConverter() {
|
||||
// @Override public String convert(String m3u8Url, String tsUrl) {
|
||||
// int index = m3u8Url.lastIndexOf("/");
|
||||
// String parentUrl = m3u8Url.substring(0, index + 1);
|
||||
// return parentUrl + tsUrl;
|
||||
// }
|
||||
// })
|
||||
// .controller(ControllerType.TASK_CONTROLLER)
|
||||
// .resume();
|
||||
//}
|
||||
//break;
|
||||
case R.id.cancel:
|
||||
if (AppUtil.chekEntityValid(mEntity)) {
|
||||
Aria.download(this).load(mEntity.getId()).cancel(true);
|
||||
@@ -254,13 +255,7 @@ public class M3U8LiveDLoadActivity extends BaseActivity<ActivityM3u8LiveBinding>
|
||||
// }
|
||||
//})
|
||||
.asLive()
|
||||
.setLiveTsUrlConvert(new ILiveTsUrlConverter() {
|
||||
@Override public String convert(String m3u8Url, String tsUrl) {
|
||||
int index = m3u8Url.lastIndexOf("/");
|
||||
String parentUrl = m3u8Url.substring(0, index + 1);
|
||||
return parentUrl + tsUrl;
|
||||
}
|
||||
})
|
||||
.setLiveTsUrlConvert(new LiveTsUrlConverter())
|
||||
.controller(ControllerType.CREATE_CONTROLLER)
|
||||
//.setLiveTsUrlConvert(new IVodTsUrlConverter() {
|
||||
// @Override public List<String> convert(String m3u8Url, List<String> tsUrls) {
|
||||
@@ -285,4 +280,12 @@ public class M3U8LiveDLoadActivity extends BaseActivity<ActivityM3u8LiveBinding>
|
||||
mModule.updateFilePath(this, String.valueOf(data));
|
||||
}
|
||||
}
|
||||
|
||||
static class LiveTsUrlConverter implements ILiveTsUrlConverter {
|
||||
@Override public String convert(String m3u8Url, String tsUrl) {
|
||||
int index = m3u8Url.lastIndexOf("/");
|
||||
String parentUrl = m3u8Url.substring(0, index + 1);
|
||||
return parentUrl + tsUrl;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,13 +17,14 @@
|
||||
package com.arialyy.simple.core.upload;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.view.View;
|
||||
import com.arialyy.annotations.Upload;
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.arialyy.aria.core.common.RequestEnum;
|
||||
import com.arialyy.aria.core.common.controller.ControllerType;
|
||||
import com.arialyy.aria.core.upload.UploadEntity;
|
||||
import com.arialyy.aria.core.task.UploadTask;
|
||||
import com.arialyy.aria.core.upload.UploadEntity;
|
||||
import com.arialyy.frame.util.FileUtil;
|
||||
import com.arialyy.frame.util.show.L;
|
||||
import com.arialyy.simple.R;
|
||||
@@ -40,7 +41,9 @@ public class HttpUploadActivity extends BaseActivity<ActivityUploadBinding> {
|
||||
private static final String TAG = "HttpUploadActivity";
|
||||
HorizontalProgressBarWithNumber mPb;
|
||||
|
||||
private final String FILE_PATH = "/mnt/sdcard/ggsg14.apk";
|
||||
//private final String FILE_PATH = "/mnt/sdcard/ggsg14.apk";
|
||||
private final String FILE_PATH =
|
||||
Environment.getExternalStorageDirectory().getPath() + "/Download/PaNTFS15562.zip";
|
||||
private UploadEntity mEntity;
|
||||
|
||||
@Override protected int setLayoutId() {
|
||||
|
||||
Reference in New Issue
Block a user