AriaLyy 7 years ago
parent 44ca80044d
commit f4e2202033
  1. 6
      Aria/src/main/java/com/arialyy/aria/core/inf/AbsTarget.java
  2. 4
      app/src/main/java/com/arialyy/simple/download/SingleTaskActivity.java

@ -81,7 +81,11 @@ public abstract class AbsTarget<TARGET extends AbsTarget, ENTITY extends AbsEnti
* @param str 扩展数据 * @param str 扩展数据
*/ */
public TARGET setExtendField(String str) { public TARGET setExtendField(String str) {
mEntity.setStr(str); if (TextUtils.isEmpty(str)) return (TARGET) this;
if (TextUtils.isEmpty(mEntity.getStr()) || !mEntity.getStr().equals(str)) {
mEntity.setStr(str);
mEntity.save();
}
return (TARGET) this; return (TARGET) this;
} }

@ -18,6 +18,7 @@ package com.arialyy.simple.download;
import android.os.Bundle; import android.os.Bundle;
import android.os.Environment; import android.os.Environment;
import android.os.Handler;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
@ -31,6 +32,7 @@ import com.arialyy.aria.core.download.DownloadTarget;
import com.arialyy.aria.core.Aria; import com.arialyy.aria.core.Aria;
import com.arialyy.aria.core.download.DownloadTask; import com.arialyy.aria.core.download.DownloadTask;
import com.arialyy.aria.core.inf.IEntity; import com.arialyy.aria.core.inf.IEntity;
import com.arialyy.frame.util.show.L;
import com.arialyy.frame.util.show.T; import com.arialyy.frame.util.show.T;
import com.arialyy.simple.R; import com.arialyy.simple.R;
import com.arialyy.simple.base.BaseActivity; import com.arialyy.simple.base.BaseActivity;
@ -200,8 +202,10 @@ public class SingleTaskActivity extends BaseActivity<ActivitySingleBinding> {
Aria.download(this) Aria.download(this)
.load(DOWNLOAD_URL) .load(DOWNLOAD_URL)
.addHeader("groupName", "value") .addHeader("groupName", "value")
.setExtendField("str___ggggggg")
.setDownloadPath(Environment.getExternalStorageDirectory().getPath() + "/gggg.apk") .setDownloadPath(Environment.getExternalStorageDirectory().getPath() + "/gggg.apk")
.start(); .start();
break; break;
case R.id.stop: case R.id.stop:
Aria.download(this).load(DOWNLOAD_URL).stop(); Aria.download(this).load(DOWNLOAD_URL).stop();

Loading…
Cancel
Save