Merge branch 'v_3.0' of https://github.com/AriaLyy/Aria into v_3.0
This commit is contained in:
2
.idea/modules.xml
generated
2
.idea/modules.xml
generated
@ -2,8 +2,8 @@
|
|||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectModuleManager">
|
<component name="ProjectModuleManager">
|
||||||
<modules>
|
<modules>
|
||||||
<module fileurl="file://$PROJECT_DIR$/Aria.iml" filepath="$PROJECT_DIR$/Aria.iml" />
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/Aria/Aria.iml" filepath="$PROJECT_DIR$/Aria/Aria.iml" />
|
<module fileurl="file://$PROJECT_DIR$/Aria/Aria.iml" filepath="$PROJECT_DIR$/Aria/Aria.iml" />
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/Aria.iml" filepath="$PROJECT_DIR$/Aria.iml" />
|
||||||
<module fileurl="file://$PROJECT_DIR$/Aria/Aria-Aria.iml" filepath="$PROJECT_DIR$/Aria/Aria-Aria.iml" />
|
<module fileurl="file://$PROJECT_DIR$/Aria/Aria-Aria.iml" filepath="$PROJECT_DIR$/Aria/Aria-Aria.iml" />
|
||||||
<module fileurl="file://$PROJECT_DIR$/AriaPrj.iml" filepath="$PROJECT_DIR$/AriaPrj.iml" />
|
<module fileurl="file://$PROJECT_DIR$/AriaPrj.iml" filepath="$PROJECT_DIR$/AriaPrj.iml" />
|
||||||
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
|
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
|
||||||
|
@ -7,8 +7,8 @@ android {
|
|||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 9
|
minSdkVersion 9
|
||||||
targetSdkVersion 23
|
targetSdkVersion 23
|
||||||
versionCode 102
|
versionCode 311
|
||||||
versionName "3.0.3"
|
versionName "3.1.1"
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
|
@ -93,16 +93,18 @@ import org.xml.sax.SAXException;
|
|||||||
SAXParser parser = factory.newSAXParser();
|
SAXParser parser = factory.newSAXParser();
|
||||||
parser.parse(APP.getAssets().open("aria_config.xml"), helper);
|
parser.parse(APP.getAssets().open("aria_config.xml"), helper);
|
||||||
} catch (ParserConfigurationException | IOException | SAXException e) {
|
} catch (ParserConfigurationException | IOException | SAXException e) {
|
||||||
Log.d(TAG, e.toString());
|
Log.e(TAG, e.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 如果需要在代码中修改下载配置,请使用以下方法
|
* 如果需要在代码中修改下载配置,请使用以下方法
|
||||||
*
|
* <pre>
|
||||||
* @<code> //修改最大任务队列数
|
* <code>
|
||||||
|
* //修改最大任务队列数
|
||||||
* Aria.get(this).getDownloadConfig().setMaxTaskNum(3);
|
* Aria.get(this).getDownloadConfig().setMaxTaskNum(3);
|
||||||
* </code>
|
* </code>
|
||||||
|
* </pre>
|
||||||
*/
|
*/
|
||||||
public Configuration.DownloadConfig getDownloadConfig() {
|
public Configuration.DownloadConfig getDownloadConfig() {
|
||||||
return mDConfig;
|
return mDConfig;
|
||||||
@ -110,10 +112,12 @@ import org.xml.sax.SAXException;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 如果需要在代码中修改下载配置,请使用以下方法
|
* 如果需要在代码中修改下载配置,请使用以下方法
|
||||||
*
|
* <pre>
|
||||||
* @<code> //修改最大任务队列数
|
* <code>
|
||||||
|
* //修改最大任务队列数
|
||||||
* Aria.get(this).getUploadConfig().setMaxTaskNum(3);
|
* Aria.get(this).getUploadConfig().setMaxTaskNum(3);
|
||||||
* </code>
|
* </code>
|
||||||
|
* </pre>
|
||||||
*/
|
*/
|
||||||
public Configuration.UploadConfig getUploadConfig() {
|
public Configuration.UploadConfig getUploadConfig() {
|
||||||
return mUConfig;
|
return mUConfig;
|
||||||
@ -242,8 +246,6 @@ import org.xml.sax.SAXException;
|
|||||||
* 初始化配置文件
|
* 初始化配置文件
|
||||||
*/
|
*/
|
||||||
private void initConfig() {
|
private void initConfig() {
|
||||||
//File dFile = new File(APP.getFilesDir().getPath() + Configuration.DOWNLOAD_CONFIG_FILE);
|
|
||||||
//File uFile = new File(APP.getFilesDir().getPath() + Configuration.UPLOAD_CONFIG_FILE);
|
|
||||||
File xmlFile = new File(APP.getFilesDir().getPath() + Configuration.XML_FILE);
|
File xmlFile = new File(APP.getFilesDir().getPath() + Configuration.XML_FILE);
|
||||||
if (!xmlFile.exists()) {
|
if (!xmlFile.exists()) {
|
||||||
loadConfig();
|
loadConfig();
|
||||||
|
@ -56,6 +56,8 @@ public class DownloadTask implements ITask {
|
|||||||
/**
|
/**
|
||||||
* @return 返回原始byte速度,需要你在配置文件中配置
|
* @return 返回原始byte速度,需要你在配置文件中配置
|
||||||
* <pre>
|
* <pre>
|
||||||
|
* {@code
|
||||||
|
* <xml>
|
||||||
* <download>
|
* <download>
|
||||||
* ...
|
* ...
|
||||||
* <convertSpeed value="false"/>
|
* <convertSpeed value="false"/>
|
||||||
@ -63,6 +65,8 @@ public class DownloadTask implements ITask {
|
|||||||
*
|
*
|
||||||
* 或在代码中设置
|
* 或在代码中设置
|
||||||
* Aria.get(this).getDownloadConfig().setConvertSpeed(false);
|
* Aria.get(this).getDownloadConfig().setConvertSpeed(false);
|
||||||
|
* </xml>
|
||||||
|
* }
|
||||||
* </pre>
|
* </pre>
|
||||||
* 才能生效
|
* 才能生效
|
||||||
*/
|
*/
|
||||||
@ -73,6 +77,8 @@ public class DownloadTask implements ITask {
|
|||||||
/**
|
/**
|
||||||
* @return 返回转换单位后的速度,需要你在配置文件中配置,转换完成后为:1b/s、1k/s、1m/s、1g/s、1t/s
|
* @return 返回转换单位后的速度,需要你在配置文件中配置,转换完成后为:1b/s、1k/s、1m/s、1g/s、1t/s
|
||||||
* <pre>
|
* <pre>
|
||||||
|
* {@code
|
||||||
|
* <xml>
|
||||||
* <download>
|
* <download>
|
||||||
* ...
|
* ...
|
||||||
* <convertSpeed value="true"/>
|
* <convertSpeed value="true"/>
|
||||||
@ -80,6 +86,8 @@ public class DownloadTask implements ITask {
|
|||||||
*
|
*
|
||||||
* 或在代码中设置
|
* 或在代码中设置
|
||||||
* Aria.get(this).getDownloadConfig().setConvertSpeed(true);
|
* Aria.get(this).getDownloadConfig().setConvertSpeed(true);
|
||||||
|
* </xml>
|
||||||
|
* }
|
||||||
* </pre>
|
* </pre>
|
||||||
* 才能生效
|
* 才能生效
|
||||||
*/
|
*/
|
||||||
@ -87,6 +95,18 @@ public class DownloadTask implements ITask {
|
|||||||
return mEntity.getConvertSpeed();
|
return mEntity.getConvertSpeed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取百分比进度
|
||||||
|
*
|
||||||
|
* @return 返回百分比进度,如果文件长度为0,返回0
|
||||||
|
*/
|
||||||
|
@Override public int getPercent() {
|
||||||
|
if (mEntity.getFileSize() == 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return (int) (mEntity.getCurrentProgress() * 100 / mEntity.getFileSize());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取文件大小
|
* 获取文件大小
|
||||||
*/
|
*/
|
||||||
@ -94,6 +114,18 @@ public class DownloadTask implements ITask {
|
|||||||
return mEntity.getFileSize();
|
return mEntity.getFileSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换单位后的文件长度
|
||||||
|
*
|
||||||
|
* @return 如果文件长度为0,则返回0m,否则返回转换后的长度1b、1k、1m、1g、1t
|
||||||
|
*/
|
||||||
|
@Override public String getConvertFileSize() {
|
||||||
|
if (mEntity.getFileSize() == 0) {
|
||||||
|
return "0m";
|
||||||
|
}
|
||||||
|
return CommonUtil.formatFileSize(mEntity.getFileSize());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取当前下载进度
|
* 获取当前下载进度
|
||||||
*/
|
*/
|
||||||
|
@ -54,8 +54,21 @@ public interface ITask {
|
|||||||
*/
|
*/
|
||||||
public String getConvertSpeed();
|
public String getConvertSpeed();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取百分比进度
|
||||||
|
*/
|
||||||
|
public int getPercent();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 原始文件byte长度
|
||||||
|
*/
|
||||||
public long getFileSize();
|
public long getFileSize();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换单位后的文件长度
|
||||||
|
*/
|
||||||
|
public String getConvertFileSize();
|
||||||
|
|
||||||
public long getCurrentProgress();
|
public long getCurrentProgress();
|
||||||
|
|
||||||
public void setTargetName(String targetName);
|
public void setTargetName(String targetName);
|
||||||
|
@ -111,6 +111,8 @@ public class UploadTask implements ITask {
|
|||||||
/**
|
/**
|
||||||
* @return 返回原始byte速度,需要你在配置文件中配置
|
* @return 返回原始byte速度,需要你在配置文件中配置
|
||||||
* <pre>
|
* <pre>
|
||||||
|
* {@code
|
||||||
|
* <xml>
|
||||||
* <upload>
|
* <upload>
|
||||||
* ...
|
* ...
|
||||||
* <convertSpeed value="false"/>
|
* <convertSpeed value="false"/>
|
||||||
@ -118,6 +120,8 @@ public class UploadTask implements ITask {
|
|||||||
*
|
*
|
||||||
* 或在代码中设置
|
* 或在代码中设置
|
||||||
* Aria.get(this).getUploadConfig().setConvertSpeed(false);
|
* Aria.get(this).getUploadConfig().setConvertSpeed(false);
|
||||||
|
* </xml>
|
||||||
|
* }
|
||||||
* </pre>
|
* </pre>
|
||||||
* 才能生效
|
* 才能生效
|
||||||
*/
|
*/
|
||||||
@ -128,6 +132,8 @@ public class UploadTask implements ITask {
|
|||||||
/**
|
/**
|
||||||
* @return 返回转换单位后的速度,需要你在配置文件中配置,转换完成后为:1b/s、1k/s、1m/s、1g/s、1t/s
|
* @return 返回转换单位后的速度,需要你在配置文件中配置,转换完成后为:1b/s、1k/s、1m/s、1g/s、1t/s
|
||||||
* <pre>
|
* <pre>
|
||||||
|
* {@code
|
||||||
|
* <xml>
|
||||||
* <upload>
|
* <upload>
|
||||||
* ...
|
* ...
|
||||||
* <convertSpeed value="true"/>
|
* <convertSpeed value="true"/>
|
||||||
@ -135,6 +141,8 @@ public class UploadTask implements ITask {
|
|||||||
*
|
*
|
||||||
* 或在代码中设置
|
* 或在代码中设置
|
||||||
* Aria.get(this).getUploadConfig().setConvertSpeed(true);
|
* Aria.get(this).getUploadConfig().setConvertSpeed(true);
|
||||||
|
* </xml>
|
||||||
|
* }
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* 才能生效
|
* 才能生效
|
||||||
@ -143,6 +151,30 @@ public class UploadTask implements ITask {
|
|||||||
return mUploadEntity.getConvertSpeed();
|
return mUploadEntity.getConvertSpeed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取百分比进度
|
||||||
|
*
|
||||||
|
* @return 返回百分比进度,如果文件长度为0,返回0
|
||||||
|
*/
|
||||||
|
@Override public int getPercent() {
|
||||||
|
if (mUploadEntity.getFileSize() == 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return (int) (mUploadEntity.getCurrentProgress() * 100 / mUploadEntity.getFileSize());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换单位后的文件长度
|
||||||
|
*
|
||||||
|
* @return 如果文件长度为0,则返回0m,否则返回转换后的长度1b、1k、1m、1g、1t
|
||||||
|
*/
|
||||||
|
@Override public String getConvertFileSize() {
|
||||||
|
if (mUploadEntity.getFileSize() == 0) {
|
||||||
|
return "0m";
|
||||||
|
}
|
||||||
|
return CommonUtil.formatFileSize(mUploadEntity.getFileSize());
|
||||||
|
}
|
||||||
|
|
||||||
@Override public long getFileSize() {
|
@Override public long getFileSize() {
|
||||||
return mUploadEntity.getFileSize();
|
return mUploadEntity.getFileSize();
|
||||||
}
|
}
|
||||||
|
36
README.md
36
README.md
@ -6,10 +6,10 @@ Aria有以下特点:
|
|||||||
+ 简单、方便
|
+ 简单、方便
|
||||||
- 可以在Activity、Service、Fragment、Dialog、popupWindow、Notification等组件中使用
|
- 可以在Activity、Service、Fragment、Dialog、popupWindow、Notification等组件中使用
|
||||||
- 支持任务自动调度,使用者不需要关心任务状态切换的逻辑
|
- 支持任务自动调度,使用者不需要关心任务状态切换的逻辑
|
||||||
- [通过Aria的事件,能很容易获取当前下载任务的下载状态](#二、下载状态获取)
|
- [通过Aria的事件,能很容易获取当前下载任务的下载状态](#下载状态获取)
|
||||||
- [一句代码就可以动态设置最大下载数](#通过代码修改Aria参数)
|
- [一句代码加可以获取当前的下载速度](#常用接口)
|
||||||
- [一句代码加可以获取当前的下载速度](#其它好用的API)
|
- [一句代码就可以动态设置最大下载数](#代码中设置参数)
|
||||||
- [通过修改配置文件很容易就能修改下载线程数](#通过文件修改Aria配置参数)
|
- [通过修改配置文件很容易就能修改下载线程数](#配置文件设置参数)
|
||||||
+ 支持https地址下载
|
+ 支持https地址下载
|
||||||
- 在配置文件中很容易就可以设置CA证书的信息
|
- 在配置文件中很容易就可以设置CA证书的信息
|
||||||
+ 支持300、301、302重定向下载链接下载
|
+ 支持300、301、302重定向下载链接下载
|
||||||
@ -25,7 +25,7 @@ Aria怎样使用?
|
|||||||
## 下载
|
## 下载
|
||||||
[](https://bintray.com/arialyy/maven/Aria/_latestVersion)</br>
|
[](https://bintray.com/arialyy/maven/Aria/_latestVersion)</br>
|
||||||
```java
|
```java
|
||||||
compile 'com.arialyy.aria:Aria:3.1.0'
|
compile 'com.arialyy.aria:Aria:3.1.1'
|
||||||
```
|
```
|
||||||
|
|
||||||
## 示例
|
## 示例
|
||||||
@ -77,7 +77,7 @@ compile 'com.arialyy.aria:Aria:3.1.0'
|
|||||||
Aria.download(this).load(DOWNLOAD_URL).cancel();
|
Aria.download(this).load(DOWNLOAD_URL).cancel();
|
||||||
```
|
```
|
||||||
|
|
||||||
### 二、下载状态获取
|
### 下载状态获取
|
||||||
如果你希望读取下载进度或下载信息,那么你需要创建事件类,并在onResume(Activity、Fragment)或构造函数(Dialog、PopupWindow),将该事件类注册到Aria管理器。
|
如果你希望读取下载进度或下载信息,那么你需要创建事件类,并在onResume(Activity、Fragment)或构造函数(Dialog、PopupWindow),将该事件类注册到Aria管理器。
|
||||||
* 创建事件类
|
* 创建事件类
|
||||||
|
|
||||||
@ -110,8 +110,8 @@ compile 'com.arialyy.aria:Aria:3.1.0'
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### 三、Aria参数配置
|
### Aria参数配置
|
||||||
#### 通过文件修改Aria配置参数
|
#### 配置文件设置参数
|
||||||
创建`aria_config.xml`文件,将其放在`assets`目录下,添加以下内容
|
创建`aria_config.xml`文件,将其放在`assets`目录下,添加以下内容
|
||||||
```xml
|
```xml
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
@ -172,7 +172,7 @@ compile 'com.arialyy.aria:Aria:3.1.0'
|
|||||||
</aria>
|
</aria>
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 通过代码修改Aria参数
|
#### 代码中设置参数
|
||||||
除了文件方式外修改Aria参数外,同样的,你也可以在代码中动态修改Aria参数</br>
|
除了文件方式外修改Aria参数外,同样的,你也可以在代码中动态修改Aria参数</br>
|
||||||
通过`Aria.get(this).getDownloadConfig()`或`Aria.get(this).getUploadConfig()`直接获取配置文件,然后修改参数</br>
|
通过`Aria.get(this).getDownloadConfig()`或`Aria.get(this).getUploadConfig()`直接获取配置文件,然后修改参数</br>
|
||||||
如以下所示:
|
如以下所示:
|
||||||
@ -182,7 +182,7 @@ compile 'com.arialyy.aria:Aria:3.1.0'
|
|||||||
Aria.get(this).getDownloadConfig().setMaxTaskNum(3);
|
Aria.get(this).getDownloadConfig().setMaxTaskNum(3);
|
||||||
```
|
```
|
||||||
|
|
||||||
### 其它好用的API
|
### 常用接口
|
||||||
* 停止所有任务
|
* 停止所有任务
|
||||||
|
|
||||||
```java
|
```java
|
||||||
@ -194,7 +194,7 @@ Aria.download(this).stopAllTask();
|
|||||||
Aria.download(this).removeAllTask();
|
Aria.download(this).removeAllTask();
|
||||||
```
|
```
|
||||||
* 获取当前任务的下载速度
|
* 获取当前任务的下载速度
|
||||||
速度参数有点特殊,需要[下载事件支持](#下载事件监听)
|
速度参数有点特殊,需要[下载事件支持](#下载状态获取)
|
||||||
``` java
|
``` java
|
||||||
@Override public void onTaskRunning(DownloadTask task) {
|
@Override public void onTaskRunning(DownloadTask task) {
|
||||||
//如果你打开了速度单位转换配置,将可以通过以下方法获取带单位的下载速度,如:1 m/s
|
//如果你打开了速度单位转换配置,将可以通过以下方法获取带单位的下载速度,如:1 m/s
|
||||||
@ -203,6 +203,18 @@ Aria.download(this).removeAllTask();
|
|||||||
long speed = task.getSpeed();
|
long speed = task.getSpeed();
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
* 获取下载的文件大小、当前进度百分比
|
||||||
|
同样的,你也可以在DownloadTask对象中获取下载的文件大小
|
||||||
|
```
|
||||||
|
@Override public void onTaskRunning(DownloadTask task) {
|
||||||
|
//获取文件大小
|
||||||
|
long fileSize = task.getFileSize();
|
||||||
|
//获取单位转换后的文件大小
|
||||||
|
String fileSize1 = task.getConvertFileSize();
|
||||||
|
//当前进度百分比
|
||||||
|
int percent = task.getPercent();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
**tips:为了防止内存泄露的情况,事件类需要使用staic进行修饰**
|
**tips:为了防止内存泄露的情况,事件类需要使用staic进行修饰**
|
||||||
|
|
||||||
@ -238,7 +250,7 @@ Aria.download(this).removeAllTask();
|
|||||||
***
|
***
|
||||||
|
|
||||||
## 后续版本开发规划
|
## 后续版本开发规划
|
||||||
* 实现上传队列调度功能
|
* ~~实现上传队列调度功能~~
|
||||||
|
|
||||||
## 开发日志
|
## 开发日志
|
||||||
+ v_3.1.0 添加Aria配置文件,优化代码
|
+ v_3.1.0 添加Aria配置文件,优化代码
|
||||||
|
@ -44,7 +44,7 @@ public class DownloadDialog extends AbsDialog {
|
|||||||
@Bind(R.id.speed) TextView mSpeed;
|
@Bind(R.id.speed) TextView mSpeed;
|
||||||
|
|
||||||
private static final String DOWNLOAD_URL =
|
private static final String DOWNLOAD_URL =
|
||||||
"http://static.gaoshouyou.com/d/3a/93/573ae1db9493a801c24bf66128b11e39.apk";
|
"http://clashroyalecdn.static.kunlun.com/Clash_Royale-1.2.6-kunlun_landing_page-release.apk.apk";
|
||||||
|
|
||||||
public DownloadDialog(Context context) {
|
public DownloadDialog(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
|
@ -131,7 +131,7 @@ public class DownloadPopupWindow extends AbsPopupWindow {
|
|||||||
} else {
|
} else {
|
||||||
mPb.setProgress((int) ((current * 100) / len));
|
mPb.setProgress((int) ((current * 100) / len));
|
||||||
}
|
}
|
||||||
mSpeed.setText(CommonUtil.formatFileSize(task.getSpeed()) + "/s");
|
mSpeed.setText(task.getConvertSpeed());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ public class DownloadFragment extends AbsFragment<FragmentDownloadBinding> {
|
|||||||
@Bind(R.id.speed) TextView mSpeed;
|
@Bind(R.id.speed) TextView mSpeed;
|
||||||
|
|
||||||
private static final String DOWNLOAD_URL =
|
private static final String DOWNLOAD_URL =
|
||||||
"http://static.gaoshouyou.com/d/3a/93/573ae1db9493a801c24bf66128b11e39.apk";
|
"http://rs.0.gaoshouyou.com/d/90/d7/7490c6fd6cd733bef336e766778507c5.apk";
|
||||||
|
|
||||||
@Override protected void init(Bundle savedInstanceState) {
|
@Override protected void init(Bundle savedInstanceState) {
|
||||||
if (Aria.download(this).taskExists(DOWNLOAD_URL)) {
|
if (Aria.download(this).taskExists(DOWNLOAD_URL)) {
|
||||||
@ -74,7 +74,6 @@ public class DownloadFragment extends AbsFragment<FragmentDownloadBinding> {
|
|||||||
Aria.download(this)
|
Aria.download(this)
|
||||||
.load(DOWNLOAD_URL)
|
.load(DOWNLOAD_URL)
|
||||||
.setDownloadPath(Environment.getExternalStorageDirectory().getPath() + "/daialog.apk")
|
.setDownloadPath(Environment.getExternalStorageDirectory().getPath() + "/daialog.apk")
|
||||||
.setDownloadName("daialog.apk")
|
|
||||||
.start();
|
.start();
|
||||||
break;
|
break;
|
||||||
case R.id.stop:
|
case R.id.stop:
|
||||||
|
@ -31,11 +31,7 @@ import com.arialyy.frame.util.show.T;
|
|||||||
public class DownloadService extends Service {
|
public class DownloadService extends Service {
|
||||||
|
|
||||||
private static final String DOWNLOAD_URL =
|
private static final String DOWNLOAD_URL =
|
||||||
//"http://kotlinlang.org/docs/kotlin-docs.pdf";
|
"http://rs.0.gaoshouyou.com/d/df/db/03df9eab61dbc48a5939f671f05f1cdf.apk";
|
||||||
//"https://atom-installer.github.com/v1.13.0/AtomSetup.exe?s=1484074138&ext=.exe";
|
|
||||||
//"http://static.gaoshouyou.com/d/21/e8/61218d78d0e8b79df68dbc18dd484c97.apk";
|
|
||||||
//不支持断点的链接
|
|
||||||
"http://ox.konsung.net:5555/ksdc-web/download/downloadFile/?fileName=ksdc_1.0.2.apk&rRange=0-";
|
|
||||||
private DownloadNotification mNotify;
|
private DownloadNotification mNotify;
|
||||||
|
|
||||||
@Nullable @Override public IBinder onBind(Intent intent) {
|
@Nullable @Override public IBinder onBind(Intent intent) {
|
||||||
|
Reference in New Issue
Block a user