From d935e20822501d545d4986ad9c51c866367e426e Mon Sep 17 00:00:00 2001 From: laoyuyu <511455842@qq.com> Date: Wed, 28 Feb 2018 21:14:21 +0800 Subject: [PATCH] fix bug --- .gitignore | 3 ++- .../main/java/com/arialyy/aria/core/AriaManager.java | 4 ++-- .../arialyy/aria/core/download/DownloadReceiver.java | 1 + .../arialyy/simple/download/SingleTaskActivity.java | 11 ++++++++--- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 6b0f8a6a..04f27198 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,5 @@ /.idea .idea /cache -*.log \ No newline at end of file +*.log +uml \ No newline at end of file diff --git a/Aria/src/main/java/com/arialyy/aria/core/AriaManager.java b/Aria/src/main/java/com/arialyy/aria/core/AriaManager.java index 9f7316c5..bddd61f9 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/AriaManager.java +++ b/Aria/src/main/java/com/arialyy/aria/core/AriaManager.java @@ -288,8 +288,8 @@ import org.xml.sax.SAXException; "onStop"); if (isDestroyed) { - ALog.w(TAG, - "请不要在Activity或Fragment的onDestroy、finish、onStop等方法中调用Aria,Aria的unRegister会在Activity页面销毁时自动执行"); + ALog.e(TAG, + "请不要在Activity或Fragment的onDestroy、finish、onStop等方法中注册Aria,Aria的unRegister会在Activity页面销毁时自动执行"); } if (obj instanceof Activity && isDestroyed) { diff --git a/Aria/src/main/java/com/arialyy/aria/core/download/DownloadReceiver.java b/Aria/src/main/java/com/arialyy/aria/core/download/DownloadReceiver.java index 21ca515b..844ee9dc 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/download/DownloadReceiver.java +++ b/Aria/src/main/java/com/arialyy/aria/core/download/DownloadReceiver.java @@ -207,6 +207,7 @@ public class DownloadReceiver extends AbsReceiver { /** * 取消注册,如果是Activity或fragment,Aria会界面销毁时自动调用该方法。 + * 如果在activity中一定要调用该方法,那么请在onDestroy()中调用 * 如果是Dialog或popupwindow,需要你在撤销界面时调用该方法 */ @Override public void unRegister() { diff --git a/app/src/main/java/com/arialyy/simple/download/SingleTaskActivity.java b/app/src/main/java/com/arialyy/simple/download/SingleTaskActivity.java index 18123af9..fd2d1acb 100644 --- a/app/src/main/java/com/arialyy/simple/download/SingleTaskActivity.java +++ b/app/src/main/java/com/arialyy/simple/download/SingleTaskActivity.java @@ -46,7 +46,7 @@ public class SingleTaskActivity extends BaseActivity { private static final String DOWNLOAD_URL = //"http://kotlinlang.org/docs/kotlin-docs.pdf"; //"https://atom-installer.github.com/v1.13.0/AtomSetup.exe?s=1484074138&ext=.exe"; - //"http://static.gaoshouyou.com/d/22/94/822260b849944492caadd2983f9bb624.apk"; + "http://static.gaoshouyou.com/d/22/94/822260b849944492caadd2983f9bb624.apk"; //"http://sitcac.daxincf.cn/wp-content/uploads/swift_vido/01/element.mp4_1"; //"http://120.25.196.56:8000/filereq?id=15692406294&ipncid=105635&client=android&filename=20170819185541.avi"; //"http://down2.xiaoshuofuwuqi.com/d/file/filetxt/20170608/14/%BA%DA%CE%D7%CA%A6%E1%C8%C6%F0.txt"; @@ -58,7 +58,7 @@ public class SingleTaskActivity extends BaseActivity { //"http://ox.konsung.net:5555/ksdc-web/download/downloadFile/?fileName=ksdc_1.0.2.apk&rRange=0-"; //"http://gdown.baidu.com/data/wisegame/0904344dee4a2d92/QQ_718.apk"; //"http://qudao.5535.cn/one/game.html?game=531&cpsuser=xiaoeryu2"; - "https://bogoe-res.mytbz.com/tbzengsong/If You're Happy.mp3"; + //"https://bogoe-res.mytbz.com/tbzengsong/If You're Happy.mp3"; //"http://ozr0ucjs5.bkt.clouddn.com/51_box-104_20180131202610.apk"; @Bind(R.id.start) Button mStart; @Bind(R.id.stop) Button mStop; @@ -67,7 +67,7 @@ public class SingleTaskActivity extends BaseActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - Aria.download(this).register(); + Aria.upload(this).register(); } /** @@ -240,4 +240,9 @@ public class SingleTaskActivity extends BaseActivity { super.onDestroy(); //Aria.download(this).unRegister(); } + + @Override protected void onStop() { + super.onStop(); + Aria.download(this).unRegister(); + } } \ No newline at end of file