pull/330/head
AriaLyy 8 years ago
parent 42c374e275
commit 946aade387
  1. 5
      Aria/src/main/java/com/arialyy/aria/core/upload/UploadUtil.java
  2. 4
      app/src/main/java/com/arialyy/simple/upload/UploadActivity.java

@ -122,8 +122,8 @@ final class UploadUtil implements Runnable {
} }
private void fail() { private void fail() {
mWriter.flush(); //mWriter.flush();
mWriter.close(); //mWriter.close();
mListener.onFail(); mListener.onFail();
} }
@ -180,6 +180,7 @@ final class UploadUtil implements Runnable {
} }
mOutputStream.flush(); mOutputStream.flush();
mOutputStream.close();
inputStream.close(); inputStream.close();
mWriter.append(LINE_END); mWriter.append(LINE_END);
mWriter.flush(); mWriter.flush();

@ -45,11 +45,11 @@ public class UploadActivity extends BaseActivity<ActivityUploadMeanBinding> {
break; break;
case RUNNING: case RUNNING:
int p = (int) (task.getCurrentProgress() * 100 / task.getFileSize()); int p = (int) (task.getCurrentProgress() * 100 / task.getFileSize());
L.d(TAG, "p ==> " + p);
mPb.setProgress(p); mPb.setProgress(p);
break; break;
case COMPLETE: case COMPLETE:
T.showShort(UploadActivity.this, "上传完成"); T.showShort(UploadActivity.this, "上传完成");
mPb.setProgress(100);
break; break;
} }
} }
@ -62,7 +62,7 @@ public class UploadActivity extends BaseActivity<ActivityUploadMeanBinding> {
@OnClick(R.id.upload) void upload() { @OnClick(R.id.upload) void upload() {
Aria.upload(this) Aria.upload(this)
.load(FILE_PATH) .load(FILE_PATH)
.setUploadUrl("http://172.18.104.50:8080/UploadActivity/sign_file") .setUploadUrl("http://172.18.104.50:8080/upload/sign_file")
.setAttachment("file") .setAttachment("file")
.start(); .start();
} }

Loading…
Cancel
Save