3.0 版本编写、添加header支持、代码逻辑修改

This commit is contained in:
AriaLyy
2017-02-06 18:25:21 +08:00
parent 41154d47fb
commit 62d6434914
37 changed files with 397 additions and 357 deletions

View File

@ -43,11 +43,11 @@ public class DownloadPopupWindow extends AbsPopupWindow {
private void initWidget() {
if (Aria.get(this).taskExists(DOWNLOAD_URL)) {
AMTarget target = Aria.whit(this).load(DOWNLOAD_URL);
AMTarget target = Aria.download(this).load(DOWNLOAD_URL);
int p = (int) (target.getCurrentProgress() * 100 / target.getFileSize());
mPb.setProgress(p);
}
Aria.whit(this).addSchedulerListener(new MyDialogDownloadCallback());
Aria.download(this).addSchedulerListener(new MyDialogDownloadCallback());
DownloadEntity entity = Aria.get(this).getDownloadEntity(DOWNLOAD_URL);
if (entity != null) {
mSize.setText(CommonUtil.formatFileSize(entity.getFileSize()));
@ -61,17 +61,17 @@ public class DownloadPopupWindow extends AbsPopupWindow {
@OnClick({ R.id.start, R.id.stop, R.id.cancel }) public void onClick(View view) {
switch (view.getId()) {
case R.id.start:
Aria.whit(this)
Aria.download(this)
.load(DOWNLOAD_URL)
.setDownloadPath(Environment.getExternalStorageDirectory().getPath() + "/daialog.apk")
.setDownloadName("daialog.apk")
.start();
break;
case R.id.stop:
Aria.whit(this).load(DOWNLOAD_URL).stop();
Aria.download(this).load(DOWNLOAD_URL).stop();
break;
case R.id.cancel:
Aria.whit(this).load(DOWNLOAD_URL).cancel();
Aria.download(this).load(DOWNLOAD_URL).cancel();
break;
}
}