diff --git a/README.md b/README.md index 35b7f5b..f42998b 100644 --- a/README.md +++ b/README.md @@ -16,14 +16,14 @@ allprojects { ``` dependencies { //如果项目中已有com.android.support.*包,则从Downloader中剔除; - compile('com.github.CodyyAndroid:Downloader:1.1.7') { + compile('com.github.CodyyAndroid:Downloader:1.1.8') { exclude group: 'com.android.support' } //如果项目中无com.android.support.*包,则保留; - compile('com.github.CodyyAndroid:Downloader:1.1.7') + compile('com.github.CodyyAndroid:Downloader:1.1.8') } ``` -## [API](https://jitpack.io/com/github/CodyyAndroid/Downloader/1.1.7/javadoc/) +## [API](https://jitpack.io/com/github/CodyyAndroid/Downloader/1.1.8/javadoc/) diff --git a/downloadlibrary/build.gradle b/downloadlibrary/build.gradle index f95bf34..633da8d 100644 --- a/downloadlibrary/build.gradle +++ b/downloadlibrary/build.gradle @@ -9,8 +9,8 @@ android { defaultConfig { minSdkVersion 14 targetSdkVersion 26 - versionCode 50 - versionName "1.1.7" + versionCode 51 + versionName "1.1.8" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" @@ -56,7 +56,7 @@ javadoc { author true version true links "http://docs.oracle.com/javase/7/docs/api" - title "下载库1.1.7" + title "下载库1.1.8" } } // 制作文档(Javadoc) diff --git a/downloadlibrary/src/main/java/com/codyy/download/Downloader.java b/downloadlibrary/src/main/java/com/codyy/download/Downloader.java index db24431..e854911 100644 --- a/downloadlibrary/src/main/java/com/codyy/download/Downloader.java +++ b/downloadlibrary/src/main/java/com/codyy/download/Downloader.java @@ -25,7 +25,7 @@ * 文件下载器 * Created by lijian on 2017/6/7. * - * @version 1.1.7 + * @version 1.1.8 */ public class Downloader { diff --git a/downloadlibrary/src/main/java/com/codyy/download/service/DownloadFlag.java b/downloadlibrary/src/main/java/com/codyy/download/service/DownloadFlag.java index 86fc48a..1106c66 100644 --- a/downloadlibrary/src/main/java/com/codyy/download/service/DownloadFlag.java +++ b/downloadlibrary/src/main/java/com/codyy/download/service/DownloadFlag.java @@ -10,7 +10,7 @@ /** * 文件下载状态 * Created by lijian on 2017/6/7. - * @version 0.2.9 + * @version 1.1.8 */ @IntDef({DownloadFlag.NORMAL, DownloadFlag.WAITING, @@ -20,7 +20,7 @@ DownloadFlag.FAILED, DownloadFlag.ERROR, DownloadFlag.DELETED, - DownloadFlag.RATING}) + DownloadFlag.RATE}) @Documented @Retention(RetentionPolicy.SOURCE) public @interface DownloadFlag { @@ -32,5 +32,5 @@ int FAILED = 9995; int ERROR = 9996; int DELETED = 9999; - int RATING = -1; + int RATE = -1; } diff --git a/downloadlibrary/src/main/java/com/codyy/download/service/DownloadService.java b/downloadlibrary/src/main/java/com/codyy/download/service/DownloadService.java index 966966e..b9b1bc6 100644 --- a/downloadlibrary/src/main/java/com/codyy/download/service/DownloadService.java +++ b/downloadlibrary/src/main/java/com/codyy/download/service/DownloadService.java @@ -273,7 +273,7 @@ public void run() { */ private void sendRatingMessage(List downloadEntities) { Message message = new Message(); - message.what = DownloadFlag.RATING; + message.what = DownloadFlag.RATE; Bundle bundle = new Bundle(); bundle.putString(DownloadExtra.EXTRA_RATE, DownloadStatus.formatRate(sRates)); bundle.putInt(DownloadExtra.EXTRA_COUNT, downloadEntities.size()); @@ -683,7 +683,7 @@ public boolean handleMessage(Message msg) { downLoadListener.onDelete(); } break; - case DownloadFlag.RATING: + case DownloadFlag.RATE: if (mRateListener != null) { // Cog.d(TAG, "Download Rating" + msg.getData().getString(DownloadExtra.EXTRA_ID) + msg.getData().getString(DownloadExtra.EXTRA_RATE) + msg.getData().getInt(DownloadExtra.EXTRA_COUNT, 0)); mRateListener.onRate(msg.getData().getString(DownloadExtra.EXTRA_RATE), msg.getData().getInt(DownloadExtra.EXTRA_COUNT, 0)); @@ -693,6 +693,9 @@ public boolean handleMessage(Message msg) { return true; } + /** + * 网络状态变换时,切换下载状态 + */ private class NetReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { @@ -708,7 +711,7 @@ public void onReceive(Context context, Intent intent) { startToDownload(context, Downloader.getInstance(context).isHoneyCombDownload()); break; case NETWORK_WIFI: - startToDownload(context, true); + startToDownload(context, Downloader.getInstance(context).isWifiDownload()); break; default: startToDownload(context, false);