diff --git a/.idea/modules.xml b/.idea/modules.xml index 5f6de159..9f4bd159 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -2,8 +2,8 @@ - + diff --git a/Aria/src/main/java/com/arialyy/aria/core/task/DownloadUtil.java b/Aria/src/main/java/com/arialyy/aria/core/task/DownloadUtil.java index 6f14d883..7bebb4f1 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/task/DownloadUtil.java +++ b/Aria/src/main/java/com/arialyy/aria/core/task/DownloadUtil.java @@ -40,18 +40,18 @@ public class DownloadUtil implements IDownloadUtil, Runnable { /** * 线程数 */ - private final int THREAD_NUM; + private final int THREAD_NUM; //下载监听 - private IDownloadListener mListener; - private int mConnectTimeOut = 5000 * 4; //连接超时时间 - private int mReadTimeOut = 5000 * 20; //流读取的超时时间 - private boolean isNewTask = true; + private IDownloadListener mListener; + private int mConnectTimeOut = 5000 * 4; //连接超时时间 + private int mReadTimeOut = 5000 * 20; //流读取的超时时间 + private boolean isNewTask = true; private boolean isSupportBreakpoint = true; - private Context mContext; - private DownloadEntity mDownloadEntity; + private Context mContext; + private DownloadEntity mDownloadEntity; private ExecutorService mFixedThreadPool; - private File mDownloadFile; //下载的文件 - private File mConfigFile;//下载信息配置文件 + private File mDownloadFile; //下载的文件 + private File mConfigFile;//下载信息配置文件 private SparseArray mTask = new SparseArray<>(); private DownloadStateConstance mConstance; @@ -223,8 +223,11 @@ public class DownloadUtil implements IDownloadUtil, Runnable { mListener.supportBreakpoint(false); Log.w(TAG, "该下载链接不支持断点下载"); handleBreakpoint(conn); + } else if (code == HttpURLConnection.HTTP_NOT_FOUND) { + Log.w(TAG, "任务【" + mDownloadEntity.getDownloadUrl() + "】下载失败,错误码:404"); + //mListener.onCancel(); } else { - failDownload("任务【" + mDownloadEntity.getDownloadUrl() + "】下载失败,返回码:" + code); + failDownload("任务【" + mDownloadEntity.getDownloadUrl() + "】下载失败,错误码:" + code); } } catch (IOException e) { failDownload("下载失败【downloadUrl:" @@ -263,7 +266,8 @@ public class DownloadUtil implements IDownloadUtil, Runnable { //RandomAccessFile file = new RandomAccessFile(mDownloadFile.getPath(), "rwd"); ////设置文件长度 //file.setLength(fileLength); - BufferedRandomAccessFile file = new BufferedRandomAccessFile(mDownloadFile.getPath(), "rwd", 8192); + BufferedRandomAccessFile file = + new BufferedRandomAccessFile(mDownloadFile.getPath(), "rwd", 8192); //设置文件长度 file.setLength(fileLength); mListener.onPostPre(fileLength); @@ -362,12 +366,12 @@ public class DownloadUtil implements IDownloadUtil, Runnable { */ final static class ConfigEntity { //文件大小 - long FILE_SIZE; + long FILE_SIZE; String DOWNLOAD_URL; - int THREAD_ID; - long START_LOCATION; - long END_LOCATION; - File TEMP_FILE; + int THREAD_ID; + long START_LOCATION; + long END_LOCATION; + File TEMP_FILE; boolean isSupportBreakpoint = true; String CONFIG_FILE_PATH; } diff --git a/README.md b/README.md index bc3b6642..987517ea 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Aria,让下载更简单。
## 下载 [![Download](https://api.bintray.com/packages/arialyy/maven/Aria/images/download.svg)](https://bintray.com/arialyy/maven/Aria/_latestVersion)
```java -compile 'com.arialyy.aria:Aria:2.4.2' +compile 'com.arialyy.aria:Aria:2.4.3' ``` ## 示例 @@ -133,16 +133,15 @@ Aria支持https下载,如果你希望使用自己的ca证书,那么你需要 ``` *** + ## 开发日志 + + v_2.4.3 修复404链接卡顿的问题 + v_2.4.2 修复失败重试无效的bug + v_2.4.1 修复下载慢的问题,修复application、service 不能使用的问题 + v_2.4.0 支持https链接下载 + v_2.3.8 修复数据错乱的bug、添加fragment支持 + v_2.3.6 添加dialog、popupWindow支持 - + v_2.3.3 - - 添加断点支持 - - 修改下载逻辑,让使用更加简单 - - 修复一个内存泄露的bug + + v_2.3.3 添加断点支持、修改下载逻辑,让使用更加简单、修复一个内存泄露的bug + v_2.3.1 重命名为Aria,下载流程简化 + v_2.1.1 增加,选择最大下载任务数接口 diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro deleted file mode 100644 index 80105608..00000000 --- a/app/proguard-rules.pro +++ /dev/null @@ -1,17 +0,0 @@ -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in D:\sdk/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the proguardFiles -# directive in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index dfa38c80..510df605 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -25,7 +25,7 @@ - http://g37.gdl.netease.com/onmyoji_netease.apk + http://g37.gdl.netease.com/onmyoji_netease_1.apk http://static.gaoshouyou.com/d/eb/f2/dfeba30541f209ab8a50d847fc1661ce.apk http://rs.0.gaoshouyou.com/d/51/46/58514d126c46b8a3f27fc8c7db3b09ec.apk http://rs.0.gaoshouyou.com/d/23/69/07238f952669727878d7a0e180534c8b.apk