diff --git a/DEV_LOG.md b/DEV_LOG.md index 33259882..21fe4ff5 100644 --- a/DEV_LOG.md +++ b/DEV_LOG.md @@ -1,6 +1,9 @@ ## 开发日志 - + v_3.8.6 + + v_3.8.6 (2020/2/17) - fix bug https://github.com/AriaLyy/Aria/issues/608 + - fix bug https://github.com/AriaLyy/Aria/issues/579#issuecomment-586665035 + - fix bug https://github.com/AriaLyy/Aria/issues/610 + - fix bug https://github.com/AriaLyy/Aria/issues/614 - 优化异常提示 + v_3.8.5 (2020/1/18) - fix bug https://github.com/AriaLyy/Aria/issues/599 diff --git a/HttpComponent/src/main/java/com/arialyy/aria/http/download/HttpDLoaderUtil.java b/HttpComponent/src/main/java/com/arialyy/aria/http/download/HttpDLoaderUtil.java index 763f20bf..4cb2a09c 100644 --- a/HttpComponent/src/main/java/com/arialyy/aria/http/download/HttpDLoaderUtil.java +++ b/HttpComponent/src/main/java/com/arialyy/aria/http/download/HttpDLoaderUtil.java @@ -15,27 +15,17 @@ */ package com.arialyy.aria.http.download; -import com.arialyy.aria.core.TaskRecord; -import com.arialyy.aria.core.common.SubThreadConfig; import com.arialyy.aria.core.download.DTaskWrapper; import com.arialyy.aria.core.listener.IEventListener; import com.arialyy.aria.core.loader.AbsNormalLoader; import com.arialyy.aria.core.loader.AbsNormalLoaderUtil; -import com.arialyy.aria.core.loader.AbsNormalTTBuilderAdapter; -import com.arialyy.aria.core.loader.IRecordHandler; import com.arialyy.aria.core.loader.LoaderStructure; import com.arialyy.aria.core.loader.NormalLoader; import com.arialyy.aria.core.loader.NormalTTBuilder; import com.arialyy.aria.core.loader.NormalThreadStateManager; -import com.arialyy.aria.core.task.IThreadTaskAdapter; import com.arialyy.aria.core.wrapper.AbsTaskWrapper; import com.arialyy.aria.http.HttpRecordHandler; import com.arialyy.aria.http.HttpTaskOption; -import com.arialyy.aria.util.ALog; -import com.arialyy.aria.util.BufferedRandomAccessFile; -import com.arialyy.aria.util.FileUtil; -import java.io.File; -import java.io.IOException; /** * @Author lyy @@ -60,6 +50,4 @@ public final class HttpDLoaderUtil extends AbsNormalLoaderUtil { structure.accept(getLoader()); return structure; } - - } diff --git a/PublicComponent/src/main/java/com/arialyy/aria/core/AriaConfig.java b/PublicComponent/src/main/java/com/arialyy/aria/core/AriaConfig.java index 7b4c3c04..ec0b0349 100644 --- a/PublicComponent/src/main/java/com/arialyy/aria/core/AriaConfig.java +++ b/PublicComponent/src/main/java/com/arialyy/aria/core/AriaConfig.java @@ -21,6 +21,7 @@ import android.content.Context; import android.net.ConnectivityManager; import android.net.Network; import android.net.NetworkCapabilities; +import android.net.NetworkInfo; import android.net.NetworkRequest; import android.os.Build; import android.os.Handler; @@ -120,6 +121,7 @@ public class AriaConfig { * 注册网络监听,只有配置了检查网络{@link AppConfig#isNetCheck()}才会注册事件 */ private void regNetCallBack(Context context) { + isConnectedNet = isNetworkAvailable(); if (!getAConfig().isNetCheck()) { return; } @@ -155,6 +157,31 @@ public class AriaConfig { } } + public boolean isNetworkAvailable() { + // 获取手机所有连接管理对象(包括对wi-fi,net等连接的管理) + ConnectivityManager connectivityManager = + (ConnectivityManager) getAPP().getSystemService(Context.CONNECTIVITY_SERVICE); + + if (connectivityManager == null) { + + return false; + } else { + // 获取NetworkInfo对象 + NetworkInfo[] networkInfo = connectivityManager.getAllNetworkInfo(); + + if (networkInfo != null && networkInfo.length > 0) { + for (NetworkInfo info : networkInfo) { + // 判断当前网络状态是否为连接状态 + if (info.getState() == NetworkInfo.State.CONNECTED) { + return true; + } + } + } + } + return false; + } + + public boolean isConnectedNet() { return isConnectedNet; } diff --git a/PublicComponent/src/main/java/com/arialyy/aria/core/download/DownloadEntity.java b/PublicComponent/src/main/java/com/arialyy/aria/core/download/DownloadEntity.java index 5b6a1d76..5cfa93b1 100644 --- a/PublicComponent/src/main/java/com/arialyy/aria/core/download/DownloadEntity.java +++ b/PublicComponent/src/main/java/com/arialyy/aria/core/download/DownloadEntity.java @@ -80,21 +80,21 @@ public class DownloadEntity extends AbsNormalEntity implements Parcelable { @Override public int getTaskType() { int type; - if (TextUtils.isEmpty(getUrl())) { + if (getUrl() == null){ type = ITaskWrapper.ERROR; } else if (getUrl().startsWith("http")) { - type = ITaskWrapper.D_HTTP; - } else if (getUrl().startsWith("ftp")) { - type = ITaskWrapper.D_FTP; - } else if (getUrl().startsWith("sftp")) { - type = ITaskWrapper.D_SFTP; - } else { M3U8Entity temp = getM3U8Entity(); if (temp == null) { type = ITaskWrapper.D_HTTP; } else { type = temp.isLive() ? ITaskWrapper.M3U8_LIVE : ITaskWrapper.M3U8_VOD; } + } else if (getUrl().startsWith("ftp")) { + type = ITaskWrapper.D_FTP; + } else if (getUrl().startsWith("sftp")) { + type = ITaskWrapper.D_SFTP; + } else { + type = ITaskWrapper.ERROR; } return type; } diff --git a/app/src/main/assets/aria_config.xml b/app/src/main/assets/aria_config.xml index dca2c50b..56a3067d 100644 --- a/app/src/main/assets/aria_config.xml +++ b/app/src/main/assets/aria_config.xml @@ -9,7 +9,7 @@ - + diff --git a/app/src/main/java/com/arialyy/simple/core/download/HttpDownloadModule.java b/app/src/main/java/com/arialyy/simple/core/download/HttpDownloadModule.java index a5c311a1..4b0cbe0d 100644 --- a/app/src/main/java/com/arialyy/simple/core/download/HttpDownloadModule.java +++ b/app/src/main/java/com/arialyy/simple/core/download/HttpDownloadModule.java @@ -59,6 +59,7 @@ public class HttpDownloadModule extends BaseViewModule { //String url = "https://ss1.baidu.com/-4o3dSag_xI4khGko9WTAnF6hhy/image/h%3D300/sign=a9e671b9a551f3dedcb2bf64a4eff0ec/4610b912c8fcc3cef70d70409845d688d53f20f7.jpg"; //String filePath = AppUtil.getConfigValue(context, HTTP_PATH_KEY, defFilePath); String url = "https://y.qq.com/download/import/QQMusic-import-1.2.1.zip"; + //String url = "http://donuts.aigauss.com/doc_fPhW2DBGj3_1578932414.png"; String filePath = "/mnt/sdcard/update.zip"; //String url = "https://dhfspace.360drm.com/1_12809_1543904946_VID_20180808_212829.vep?e=1578554567&token=gUBmfZgZS5wy4wdQIDZG8UVxlNCyVSjvksIb13K5:WYSZRgmLbH1_9hjgqOAGmqR27JM="; //String filePath = "/mnt/sdcard/sssss.zip"; @@ -67,7 +68,7 @@ public class HttpDownloadModule extends BaseViewModule { if (singDownloadInfo == null) { singDownloadInfo = new DownloadEntity(); singDownloadInfo.setUrl(url); - File file = new File(defFilePath); + File file = new File(filePath); singDownloadInfo.setFilePath(filePath); singDownloadInfo.setFileName(file.getName()); } else { diff --git a/app/src/main/java/com/arialyy/simple/core/download/m3u8/M3U8VodDLoadActivity.java b/app/src/main/java/com/arialyy/simple/core/download/m3u8/M3U8VodDLoadActivity.java index a8f6e80e..0c44a547 100644 --- a/app/src/main/java/com/arialyy/simple/core/download/m3u8/M3U8VodDLoadActivity.java +++ b/app/src/main/java/com/arialyy/simple/core/download/m3u8/M3U8VodDLoadActivity.java @@ -269,7 +269,7 @@ public class M3U8VodDLoadActivity extends BaseActivity { @Download.onTaskFail void taskFail(DownloadTask task, Exception e) { - if (task.getKey().equals(mUrl)) { + if (task != null && task.getKey().equals(mUrl)) { Toast.makeText(M3U8VodDLoadActivity.this, getString(R.string.download_fail), Toast.LENGTH_SHORT) .show(); @@ -330,7 +330,7 @@ public class M3U8VodDLoadActivity extends BaseActivity { //String parentUrl = "http://" + uri.getHost() + "/gear1/"; int index = m3u8Url.lastIndexOf("/"); //String parentUrl = m3u8Url.substring(0, index + 1); - String parentUrl = "https://cn7.kankia.com/"; + String parentUrl = "https://135zyv5.xw0371.com/2018/10/29/X05c7CG3VB91gi1M/"; //String parentUrl = "http://" + uri.getHost() + "/"; List newUrls = new ArrayList<>(); for (String url : tsUrls) { diff --git a/app/src/main/java/com/arialyy/simple/core/download/m3u8/M3U8VodModule.java b/app/src/main/java/com/arialyy/simple/core/download/m3u8/M3U8VodModule.java index 451a1681..cf1859b9 100644 --- a/app/src/main/java/com/arialyy/simple/core/download/m3u8/M3U8VodModule.java +++ b/app/src/main/java/com/arialyy/simple/core/download/m3u8/M3U8VodModule.java @@ -35,9 +35,10 @@ public class M3U8VodModule extends BaseViewModule { //private final String defUrl = "https://www.gaoya123.cn/2019/1557993797897.m3u8"; // 多码率地址: //private final String defUrl = "http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8"; - private final String defUrl = "https://cn7.kankia.com/hls/20200108/e1eaec074274c64fe46a3bdb5d2ba487/1578488360/index.m3u8"; + //private final String defUrl = "https://cn7.kankia.com/hls/20200108/e1eaec074274c64fe46a3bdb5d2ba487/1578488360/index.m3u8"; //private final String defUrl = "https://youku.cdn7-okzy.com/20191213/16167_c3592a02/index.m3u8"; //private final String defUrl = "http://qn.shytong.cn/b83137769ff6b555/11b0c9970f9a3fa0.mp4.m3u8"; + private final String defUrl = "https://135zyv5.xw0371.com/2018/10/29/X05c7CG3VB91gi1M/playlist.m3u8"; private final String filePath = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getPath() //+ "/道士下山.ts";