pull/330/head
AriaLyy 7 years ago
commit 8b322176d1
  1. 12
      Aria/src/main/java/com/arialyy/aria/core/download/DownloadTarget.java
  2. 1
      Aria/src/main/java/com/arialyy/aria/core/download/downloader/HttpFileInfoThread.java
  3. 3
      Aria/src/main/java/com/arialyy/aria/core/inf/AbsTarget.java
  4. 6
      Aria/src/main/java/com/arialyy/aria/core/inf/AbsTaskEntity.java
  5. 2
      DEV_LOG.md
  6. 19
      README.md
  7. 2
      app/src/main/java/com/arialyy/simple/download/SingleTaskActivity.java
  8. 2
      app/src/main/java/com/arialyy/simple/download/group/FTPDirDownloadActivity.java
  9. 2
      app/src/main/java/com/arialyy/simple/upload/FtpUploadActivity.java
  10. 2
      build.gradle

@ -62,6 +62,18 @@ public class DownloadTarget
mTaskEntity.refreshInfo = refreshInfo;
}
/**
* 是否使用服务器通过content-disposition传递的文件名内容格式{@code attachment;filename=***}
* 如果获取不到服务器文件名则使用用户设置的文件名
* 只适用于HTTP请求
*
* @param use {@code true} 使用
*/
@Deprecated public DownloadTarget useServerFileName(boolean use) {
mTaskEntity.useServerFileName = use;
return this;
}
/**
* 将任务设置为最高优先级任务最高优先级任务有以下特点
* 1在下载队列中有且只有一个最高优先级任务

@ -54,6 +54,7 @@ class HttpFileInfoThread implements Runnable {
conn = ConnectionHelp.setConnectParam(mTaskEntity, conn);
conn.setRequestProperty("Range", "bytes=" + 0 + "-");
conn.setConnectTimeout(mConnectTimeOut);
conn.setRequestMethod(mTaskEntity.requestEnum.name);
conn.connect();
handleConnect(conn);
} catch (IOException e) {

@ -168,7 +168,8 @@ public abstract class AbsTarget<TARGET extends AbsTarget, ENTITY extends AbsEnti
}
/**
* 设置请求类型
* 设置请求类型POST或GET默认为在GET
* 只试用于HTTP请求
*
* @param requestEnum {@link RequestEnum}
*/

@ -105,6 +105,12 @@ public abstract class AbsTaskEntity<ENTITY extends AbsEntity> extends DbEntity {
*/
public String md5Key = "Content-MD5";
/**
* 是否使用服务器通过content-disposition传递的文件名内容格式{@code attachment;filename=***}
* {@code true} 使用
*/
public boolean useServerFileName = false;
/**
* 从header中获取文件描述信息所需要的key
*/

@ -1,4 +1,6 @@
## 开发日志
+ v_3.3.8
- 添加POST支持
+ v_3.3.7
- 修复一个线程重启的问题 https://github.com/AriaLyy/Aria/issues/160
- 修复配置文件异常问题、格式化速度为0问题 https://github.com/AriaLyy/Aria/issues/161

@ -28,8 +28,8 @@ Aria有以下特点:
[![Download](https://api.bintray.com/packages/arialyy/maven/AriaApi/images/download.svg)](https://bintray.com/arialyy/maven/AriaApi/_latestVersion)
[![Download](https://api.bintray.com/packages/arialyy/maven/AriaCompiler/images/download.svg)](https://bintray.com/arialyy/maven/AriaCompiler/_latestVersion)
```java
compile 'com.arialyy.aria:aria-core:3.3.6'
annotationProcessor 'com.arialyy.aria:aria-compiler:3.3.6'
compile 'com.arialyy.aria:aria-core:3.3.7'
annotationProcessor 'com.arialyy.aria:aria-compiler:3.3.7'
```
如果你使用的是kotlin,请使用kotlin官方提供的方法配置apt,[kotlin kapt官方配置传送门](https://www.kotlincn.net/docs/reference/kapt.html)
@ -74,13 +74,17 @@ protected void onCreate(Bundle savedInstanceState) {
```java
//在这里处理任务执行中的状态,如进度进度条的刷新
@Download.onTaskRunning(DOWNLOAD_URL) protected void running(DownloadTask task) {
@Download.onTaskRunning protected void running(DownloadTask task) {
if(task.getUrl().eques(url)){
....
可以通过url判断是否是指定任务的回调
}
int p = task.getPercent(); //任务进度百分比
String speed = task.getConvertSpeed(); //转换单位后的下载速度,单位转换需要在配置文件中打开
String speed1 = task.getSpeed(); //原始byte长度速度
}
@Download.onTaskComplete(DOWNLOAD_URL) void taskComplete(DownloadTask task) {
@Download.onTaskComplete void taskComplete(DownloadTask task) {
//在这里处理任务完成的状态
}
```
@ -92,7 +96,12 @@ protected void onCreate(Bundle savedInstanceState) {
### [更多说明,见WIKI](https://github.com/AriaLyy/Aria/wiki)
### [历史版本说明](https://github.com/AriaLyy/Aria/blob/master/DEV_LOG.md)
### 升级日志
+ v_3.3.7
- 修复一个线程重启的问题 https://github.com/AriaLyy/Aria/issues/160
- 修复配置文件异常问题、格式化速度为0问题 https://github.com/AriaLyy/Aria/issues/161
[更多版本记录](https://github.com/AriaLyy/Aria/blob/master/DEV_LOG.md)
## 混淆配置
```

@ -29,6 +29,7 @@ import butterknife.Bind;
import com.arialyy.annotations.Download;
import com.arialyy.annotations.DownloadGroup;
import com.arialyy.aria.core.Aria;
import com.arialyy.aria.core.common.RequestEnum;
import com.arialyy.aria.core.download.DownloadEntity;
import com.arialyy.aria.core.download.DownloadGroupTask;
import com.arialyy.aria.core.download.DownloadTarget;
@ -216,6 +217,7 @@ public class SingleTaskActivity extends BaseActivity<ActivitySingleBinding> {
Aria.download(SingleTaskActivity.this)
.load(DOWNLOAD_URL)
.addHeader("groupName", "value")
.setRequestMode(RequestEnum.POST)
.setDownloadPath(Environment.getExternalStorageDirectory().getPath() + "/hhhhhhhh.apk")
.start();
}

@ -35,7 +35,7 @@ import com.arialyy.simple.widget.SubStateLinearLayout;
* Created by Aria.Lao on 2017/7/6.
*/
public class FTPDirDownloadActivity extends BaseActivity<ActivityDownloadGroupBinding> {
private static final String dir = "ftp://172.18.104.64:21/upload/测试";
private static final String dir = "ftp://192.168.1.2:21/upload/测试";
@Bind(R.id.child_list) SubStateLinearLayout mChildList;

@ -35,7 +35,7 @@ import com.arialyy.simple.databinding.ActivityFtpUploadBinding;
*/
public class FtpUploadActivity extends BaseActivity<ActivityFtpUploadBinding> {
private final String FILE_PATH = "/mnt/sdcard/Download/me.jpg";
private final String URL = "ftp://172.18.104.65:21/upload/测试";
private final String URL = "ftp://192.168.1.2:21/upload/测试";
@Override protected void init(Bundle savedInstanceState) {
setTile("D_FTP 文件上传");

@ -39,7 +39,7 @@ task clean(type: Delete) {
ext {
userOrg = 'arialyy'
groupId = 'com.arialyy.aria'
publishVersion = '3.3.6'
publishVersion = '3.3.7'
// publishVersion = '1.0.3' //FTP插件
repoName='maven'
desc = 'android 下载框架'

Loading…
Cancel
Save