pull/330/head
laoyuyu 7 years ago
parent 39ac574d0c
commit d935e20822
  1. 3
      .gitignore
  2. 4
      Aria/src/main/java/com/arialyy/aria/core/AriaManager.java
  3. 1
      Aria/src/main/java/com/arialyy/aria/core/download/DownloadReceiver.java
  4. 11
      app/src/main/java/com/arialyy/simple/download/SingleTaskActivity.java

3
.gitignore vendored

@ -13,4 +13,5 @@
/.idea /.idea
.idea .idea
/cache /cache
*.log *.log
uml

@ -288,8 +288,8 @@ import org.xml.sax.SAXException;
"onStop"); "onStop");
if (isDestroyed) { if (isDestroyed) {
ALog.w(TAG, ALog.e(TAG,
"请不要在Activity或Fragment的onDestroy、finish、onStop等方法中调用Aria,Aria的unRegister会在Activity页面销毁时自动执行"); "请不要在Activity或Fragment的onDestroy、finish、onStop等方法中注册Aria,Aria的unRegister会在Activity页面销毁时自动执行");
} }
if (obj instanceof Activity && isDestroyed) { if (obj instanceof Activity && isDestroyed) {

@ -207,6 +207,7 @@ public class DownloadReceiver extends AbsReceiver {
/** /**
* 取消注册如果是Activity或fragmentAria会界面销毁时自动调用该方法 * 取消注册如果是Activity或fragmentAria会界面销毁时自动调用该方法
* 如果在activity中一定要调用该方法那么请在onDestroy()中调用
* 如果是Dialog或popupwindow需要你在撤销界面时调用该方法 * 如果是Dialog或popupwindow需要你在撤销界面时调用该方法
*/ */
@Override public void unRegister() { @Override public void unRegister() {

@ -46,7 +46,7 @@ public class SingleTaskActivity extends BaseActivity<ActivitySingleBinding> {
private static final String DOWNLOAD_URL = private static final String DOWNLOAD_URL =
//"http://kotlinlang.org/docs/kotlin-docs.pdf"; //"http://kotlinlang.org/docs/kotlin-docs.pdf";
//"https://atom-installer.github.com/v1.13.0/AtomSetup.exe?s=1484074138&ext=.exe"; //"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://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://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"; //"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<ActivitySingleBinding> {
//"http://ox.konsung.net:5555/ksdc-web/download/downloadFile/?fileName=ksdc_1.0.2.apk&rRange=0-"; //"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://gdown.baidu.com/data/wisegame/0904344dee4a2d92/QQ_718.apk";
//"http://qudao.5535.cn/one/game.html?game=531&cpsuser=xiaoeryu2"; //"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"; //"http://ozr0ucjs5.bkt.clouddn.com/51_box-104_20180131202610.apk";
@Bind(R.id.start) Button mStart; @Bind(R.id.start) Button mStart;
@Bind(R.id.stop) Button mStop; @Bind(R.id.stop) Button mStop;
@ -67,7 +67,7 @@ public class SingleTaskActivity extends BaseActivity<ActivitySingleBinding> {
@Override protected void onCreate(Bundle savedInstanceState) { @Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
Aria.download(this).register(); Aria.upload(this).register();
} }
/** /**
@ -240,4 +240,9 @@ public class SingleTaskActivity extends BaseActivity<ActivitySingleBinding> {
super.onDestroy(); super.onDestroy();
//Aria.download(this).unRegister(); //Aria.download(this).unRegister();
} }
@Override protected void onStop() {
super.onStop();
Aria.download(this).unRegister();
}
} }
Loading…
Cancel
Save