Aria project is from the moment taht the work encountered in a file download management needs adn i was tortured at the time of the pain.</br>
Since then i have a idea which is to program a simple and easy to use,stable and efficient download framework.
Aria experienced 1.0 to 3.0 development, be more and more close to the original set by the target.
Aria has the following characteristics:
+ simple and convenient
- can be used in Activity, Service, Fragment, Dialog, popupWindow, Notification and other components
- support the task of automatic scheduling, the user does not need to care about the state of the task switch logic
- [Through the Aria event, it is easy to get the download status of the current download task](#status)
- [a code plus can get the current download speed](#interface)
- [a code can be dynamically set the maximum number of downloads](#parameters)
- [code to achieve speed limit](#interface)
- [It is easy to modify the number of download threads by modifying the configuration file](https://github.com/AriaLyy/Aria/blob/master/app/src/main/assets/aria_config.xml)
- [priority to download a task](#interface)
+ Support https address download
- It is easy to set the CA certificate information in the configuration file
+ Support 300,301,302 redirect download link download
+ Support upload operation
How do we to use Aria?
* [download](#Using)
* [upload](#Upload)
If you feel that Aria is helpful to you, your star and issues will be the greatest support for me.`^_^`
* Add a task (do not download), when other download tasks are completed, will automatically download the waiting task
```java
Aria.download(this)
.load(DOWNLOAD_URL)
.setDownloadPath(DOWNLOAD_PATH) //file save path
.add();
```
* download
```java
Aria.download(this)
.load(DOWNLOAD_URL) //load download url
.setDownloadPath(DOWNLOAD_PATH) //file save path
.start(); //start download
```
* Pause
```java
Aria.download(this).load(DOWNLOAD_URL).pause();
```
* Resume download
```java
Aria.download(this).load(DOWNLOAD_URL).resume();
```
* Cancel download
```java
Aria.download(this).load(DOWNLOAD_URL).cancel();
```
### status
If you want to read the download progress or download the information, then you need to create an event class and register the event class into the Aria manager in the onResume (Activity, Fragment) or constructor (Dialog, PopupWindow).
1. Register the object to Aria
`Aria.download(this).register();` or `Aria.upload(this).register();`
2. Use`@Download` or `@Upload` to annotate your function<br>
**note:**
- Annotation is done by using `Apt`, so you do not need to worry that this will affect your machine's performance
- The annotated method**can not be modified by private**
- The annotated method**can have only one argument, and the parameter type must be either`DownloadTask` or `UploadTask`**
- Method name can be any string
3. In addition to using annotation methods in widget (Activity, Fragment, Dialog, Popupwindow), you can also use annotation functions in components such as Service, Notification, and so on.
```java
@Download.onPre(DOWNLOAD_URL)
protected void onPre(DownloadTask task) {}
@Download.onTaskStart
void taskStart(DownloadTask task) {}
@Download.onTaskRunning
protected void running(DownloadTask task) {}
@Download.onTaskResume
void taskResume(DownloadTask task) {}
@Download.onTaskStop
void taskStop(DownloadTask task) {}
@Download.onTaskCancel
void taskCancel(DownloadTask task) {}
@Download.onTaskFail
void taskFail(DownloadTask task) {}
@Download.onTaskComplete
void taskComplete(DownloadTask task) {}
@Download.onNoSupportBreakPoint
public void onNoSupportBreakPoint(DownloadTask task) {}
```
4. If you want to set up a listener for a single task, or for some specific task.<br>
**Adding a download address for a task in an annotation means that only the task triggers the annotated method.**
```java
@Download.onTaskRunning({
"https://test.xx.apk",
"http://test.xx2.apk"
}) void taskRunning(DownloadTask task) {
mAdapter.setProgress(task.getDownloadEntity());
}
```
In the above example,only the download address is`https://test.xx.apk` and `http://test.xx2.apk`will trigger the`taskRunning(DownloadTask task)`method。
.setAttachment(fileKey) //The server reads the file's key
.add();
```
* Upload
```java
Aria.upload(this)
.load(filePath) //file path
.setUploadUrl(uploadUrl) //upload the path
.setAttachment(fileKey) //The server reads the file's key
.start();
```
* cancel upload
```java
Aria.upload(this).load(filePath).cancel();
```
## Confused configuration
```
-dontwarn com.arialyy.aria.**
-keep class com.arialyy.aria.**{*;}
-keep class **$$DownloadListenerProxy{ *; }
-keep class **$$UploadListenerProxy{ *; }
-keepclasseswithmembernames class * {
@Download.* <methods>;
@Upload.* <methods>;
}
```
## others
Have any questions that can give me a message in the[issues](https://github.com/AriaLyy/Aria/issues)。
***
## 后续版本开发规划
* ~~http、scoket断点上传~~
* ~~实现上传队列调度功能~~
## Development log
+ v_3.1.9 Repair the stopAll queue without task when the problem of collapse, increase the function for a single task monitor
+ v_3.1.7 repair some files can not download the bug, increase the apt annotation method, the incident is more simple
+ v_3.1.6 When the task is canceled ontaskCancel callback twice
+ v_3.1.5 Optimize the code structure, increase the priority download task function.
+ v_3.1.4 Repair the fast switching, pause, and restore functions, the probability of re-download problems, add onPre () callback, onPre () used to request the interface before the implementation of interface UI update operation.
+ v_3.1.0 Add the Aria configuration file to optimize the code
+ v_3.0.3 Repair the pause after deleting the task, flashing the problem, add the api to delete the record
+ v_3.0.2 supports 30x redirect link download
+ v_3.0.0 add upload task support to fix some bugs that have been discovered
Aria project is from the moment taht the work encountered in a file download management needs adn i was tortured at the time of the pain.</br>
Since then i have a idea which is to program a simple and easy to use,stable and efficient download framework.
Aria experienced 1.0 to 3.0 development, be more and more close to the original set by the target.
Aria has the following characteristics:
+ simple and convenient
- can be used in Activity, Service, Fragment, Dialog, popupWindow, Notification and other components
- support the task of automatic scheduling, the user does not need to care about the state of the task switch logic
- [Through the Aria event, it is easy to get the download status of the current download task](#status)
- [a code plus can get the current download speed](#interface)
- [a code can be dynamically set the maximum number of downloads](#parameters)
- [code to achieve speed limit](#interface)
- [It is easy to modify the number of download threads by modifying the configuration file](https://github.com/AriaLyy/Aria/blob/master/app/src/main/assets/aria_config.xml)
- [priority to download a task](#interface)
+ Support https address download
- It is easy to set the CA certificate information in the configuration file
+ Support 300,301,302 redirect download link download
+ Support upload operation
How do we to use Aria?
* [download](#Using)
* [upload](#Upload)
If you feel that Aria is helpful to you, your star and issues will be the greatest support for me.`^_^`
* Add a task (do not download), when other download tasks are completed, will automatically download the waiting task
## 使用Aria进行下载
* 添加任务(不进行下载),当其他下载任务完成时,将自动下载等待中的任务
```java
Aria.download(this)
.load(DOWNLOAD_URL)
.setDownloadPath(DOWNLOAD_PATH) //file save path
.setDownloadPath(DOWNLOAD_PATH) //文件保存路径
.add();
```
* download
* 下载
```java
Aria.download(this)
.load(DOWNLOAD_URL) //load download url
.setDownloadPath(DOWNLOAD_PATH) //file save path
.start(); //start download
.load(DOWNLOAD_URL) //读取下载地址
.setDownloadPath(DOWNLOAD_PATH) //设置文件保存的完整路径
.start(); //启动下载
```
* Pause
* 暂停
```java
Aria.download(this).load(DOWNLOAD_URL).pause();
```
* Resume download
* 恢复下载
```java
Aria.download(this).load(DOWNLOAD_URL).resume();
```
* Cancel download
* 取消下载
```java
Aria.download(this).load(DOWNLOAD_URL).cancel();
```
### status
If you want to read the download progress or download the information, then you need to create an event class and register the event class into the Aria manager in the onResume (Activity, Fragment) or constructor (Dialog, PopupWindow).
3. In addition to using annotation methods in widget (Activity, Fragment, Dialog, Popupwindow), you can also use annotation functions in components such as Service, Notification, and so on.
@ -138,8 +135,8 @@ If you want to read the download progress or download the information, then you
public void onNoSupportBreakPoint(DownloadTask task) {}
```
4. If you want to set up a listener for a single task, or for some specific task.<br>
**Adding a download address for a task in an annotation means that only the task triggers the annotated method.**
4. 如果你希望对单个任务,或某一些特定任务设置监听器。<br>
**在注解中添加任务的下载地址,则表示只有该任务才会触发被注解的方法**。
```java
@Download.onTaskRunning({
@ -149,110 +146,173 @@ If you want to read the download progress or download the information, then you
mAdapter.setProgress(task.getDownloadEntity());
}
```
In the above example,only the download address is`https://test.xx.apk` and `http://test.xx2.apk`will trigger the`taskRunning(DownloadTask task)`method。
+ v_3.1.9 Repair the stopAll queue without task when the problem of collapse, increase the function for a single task monitor
+ v_3.1.7 repair some files can not download the bug, increase the apt annotation method, the incident is more simple
+ v_3.1.6 When the task is canceled ontaskCancel callback twice
+ v_3.1.5 Optimize the code structure, increase the priority download task function.
+ v_3.1.4 Repair the fast switching, pause, and restore functions, the probability of re-download problems, add onPre () callback, onPre () used to request the interface before the implementation of interface UI update operation.
+ v_3.1.0 Add the Aria configuration file to optimize the code
+ v_3.0.3 Repair the pause after deleting the task, flashing the problem, add the api to delete the record
+ v_3.0.2 supports 30x redirect link download
+ v_3.0.0 add upload task support to fix some bugs that have been discovered