AriaLyy 7 years ago
parent 2febe641a7
commit a8f183363e
  1. 4
      Aria/src/main/java/com/arialyy/aria/core/download/DownloadGroupTarget.java
  2. 4
      Aria/src/main/java/com/arialyy/aria/core/download/DownloadTarget.java
  3. 1
      Aria/src/main/java/com/arialyy/aria/core/download/DownloadTask.java
  4. 5
      Aria/src/main/java/com/arialyy/aria/core/upload/uploader/HttpThreadTask.java
  5. 2
      app/src/main/java/com/arialyy/simple/upload/HttpUploadActivity.java
  6. 1
      aria/src/main/java/com/arialyy/aria/core/upload/UploadTask.java
  7. 2
      build.gradle

@ -15,6 +15,7 @@
*/
package com.arialyy.aria.core.download;
import android.text.TextUtils;
import com.arialyy.aria.orm.DbEntity;
import com.arialyy.aria.util.CheckUtil;
import com.arialyy.aria.util.CommonUtil;
@ -51,8 +52,9 @@ public class DownloadGroupTarget
mTaskEntity.entity = getDownloadGroupEntity();
mTaskEntity.insert();
}
if (mTaskEntity.entity == null) {
if (mTaskEntity.entity == null || TextUtils.isEmpty(mTaskEntity.entity.getKey())) {
mTaskEntity.entity = getDownloadGroupEntity();
mTaskEntity.save();
}
mEntity = mTaskEntity.entity;
}

@ -54,9 +54,11 @@ public class DownloadTarget
mTaskEntity.entity = entity;
mTaskEntity.save();
}
if (mTaskEntity.entity == null) {
if (mTaskEntity.entity == null || TextUtils.isEmpty(mTaskEntity.entity.getUrl())) {
mTaskEntity.entity = entity;
mTaskEntity.save();
}
mEntity = mTaskEntity.entity;
}

@ -17,6 +17,7 @@
package com.arialyy.aria.core.download;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import com.arialyy.aria.core.AriaManager;
import com.arialyy.aria.core.common.IUtil;

@ -46,7 +46,6 @@ class HttpThreadTask extends AbsThreadTask<UploadEntity, UploadTaskEntity> {
private final String BOUNDARY = UUID.randomUUID().toString(); // 边界标识 随机生成
private final String PREFIX = "--", LINE_END = "\r\n";
private HttpURLConnection mHttpConn;
private long mCurrentLocation = 0;
private OutputStream mOutputStream;
HttpThreadTask(StateConstance constance, IUploadListener listener,
@ -152,12 +151,11 @@ class HttpThreadTask extends AbsThreadTask<UploadEntity, UploadTaskEntity> {
byte[] buffer = new byte[4096];
int bytesRead;
while ((bytesRead = inputStream.read(buffer)) != -1) {
mCurrentLocation += bytesRead;
STATE.CURRENT_LOCATION += bytesRead;
mOutputStream.write(buffer, 0, bytesRead);
if (STATE.isCancel) {
break;
}
mListener.onProgress(mCurrentLocation);
}
mOutputStream.flush();
@ -166,7 +164,6 @@ class HttpThreadTask extends AbsThreadTask<UploadEntity, UploadTaskEntity> {
writer.append(LINE_END);
writer.flush();
if (STATE.isCancel) {
mListener.onCancel();
STATE.isRunning = false;
return;
}

@ -50,7 +50,7 @@ public class HttpUploadActivity extends BaseActivity<ActivityUploadBinding> {
@OnClick(R.id.upload) void upload() {
Aria.upload(this)
.load(FILE_PATH)
.setUploadUrl("http://172.18.104.129:8080/upload/sign_file")
.setUploadUrl("http://172.18.104.66:8080/upload/sign_file")
.setAttachment("file")
.start();
}

@ -16,6 +16,7 @@
package com.arialyy.aria.core.upload;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import com.arialyy.aria.core.inf.AbsNormalTask;
import com.arialyy.aria.core.inf.IEntity;

@ -37,7 +37,7 @@ task clean(type: Delete) {
ext {
userOrg = 'arialyy'
groupId = 'com.arialyy.aria'
publishVersion = '3.2.15'
publishVersion = '3.2.16'
repoName='maven'
desc = 'android 下载框架'
website = 'https://github.com/AriaLyy/Aria'

Loading…
Cancel
Save