Permalink
Browse files

compiler 重构

  • Loading branch information...
AriaLyy committed Sep 7, 2017
1 parent ac99cc5 commit 3574531d8def82786f5f4412397d3eb20a9f1b43
Showing with 1,100 additions and 909 deletions.
  1. +0 −106 Aria/src/main/java/com/arialyy/aria/core/Aria.java
  2. +0 −1 Aria/src/main/java/com/arialyy/aria/core/AriaManager.java
  3. +2 −1 Aria/src/main/java/com/arialyy/aria/core/download/BaseDListener.java
  4. +25 −1 Aria/src/main/java/com/arialyy/aria/core/download/DownloadGroupListener.java
  5. +0 −23 Aria/src/main/java/com/arialyy/aria/core/download/DownloadReceiver.java
  6. +2 −0 Aria/src/main/java/com/arialyy/aria/core/download/downloader/AbsGroupUtil.java
  7. +0 −118 Aria/src/main/java/com/arialyy/aria/core/download/downloader/FtpClientHelp.java
  8. +10 −1 Aria/src/main/java/com/arialyy/aria/core/download/downloader/IDownloadGroupListener.java
  9. +15 −0 Aria/src/main/java/com/arialyy/aria/core/inf/AbsEntity.java
  10. +0 −4 Aria/src/main/java/com/arialyy/aria/core/inf/IReceiver.java
  11. +31 −1 Aria/src/main/java/com/arialyy/aria/core/scheduler/AbsSchedulerListener.java
  12. +57 −46 Aria/src/main/java/com/arialyy/aria/core/scheduler/AbsSchedulers.java
  13. +4 −0 Aria/src/main/java/com/arialyy/aria/core/scheduler/ISchedulerListener.java
  14. +34 −8 Aria/src/main/java/com/arialyy/aria/core/scheduler/ISchedulers.java
  15. +1 −0 Aria/src/main/java/com/arialyy/aria/core/upload/BaseUListener.java
  16. +0 −22 Aria/src/main/java/com/arialyy/aria/core/upload/UploadReceiver.java
  17. +7 −7 AriaAnnotations/src/main/java/com/arialyy/annotations/DownloadGroup.java
  18. +20 −11 AriaCompiler/src/main/java/com/arialyy/compiler/AriaProcessor.java
  19. +123 −0 AriaCompiler/src/main/java/com/arialyy/compiler/CountFiler.java
  20. +65 −515 AriaCompiler/src/main/java/com/arialyy/compiler/ElementHandler.java
  21. +244 −0 AriaCompiler/src/main/java/com/arialyy/compiler/EventProxyFiler.java
  22. +221 −0 AriaCompiler/src/main/java/com/arialyy/compiler/ParamObtainUtil.java
  23. +1 −1 AriaCompiler/src/main/java/com/arialyy/compiler/PrintLog.java
  24. +21 −2 AriaCompiler/src/main/java/com/arialyy/compiler/{ProxyMethodParam.java → ProxyClassParam.java}
  25. +2 −0 AriaCompiler/src/main/java/com/arialyy/compiler/ProxyConstance.java
  26. +5 −3 AriaCompiler/src/main/java/com/arialyy/compiler/TaskEnum.java
  27. +175 −0 AriaCompiler/src/main/java/com/arialyy/compiler/ValuesUtil.java
  28. +1 −0 CHINESE_README.md
  29. +22 −38 app/src/main/java/com/arialyy/simple/download/SimpleNotification.java
  30. +10 −0 app/src/main/java/com/arialyy/simple/download/SingleTaskActivity.java
  31. +2 −0 gradle.properties
@@ -114,110 +114,4 @@ public static AriaManager get(Object obj) {
throw new IllegalArgumentException("不支持的类型");
}
}
/**
* 上传任务状态监听
*
* @see Upload
* @deprecated 请使用注解函数的方式来实现事件的获取
*/
@Deprecated public static class UploadSchedulerListener
implements ISchedulerListener<UploadTask> {
/**
* 预处理,有时有些地址链接比较慢,这时可以先在这个地方出来一些界面上的UI,如按钮的状态。
*
* @param task 上传文物实体
*/
@Override public void onPre(UploadTask task) {
}
@Override public void onTaskPre(UploadTask task) {
}
@Override public void onTaskResume(UploadTask task) {
}
@Override public void onTaskStart(UploadTask task) {
}
@Override public void onTaskStop(UploadTask task) {
}
@Override public void onTaskCancel(UploadTask task) {
}
@Override public void onTaskFail(UploadTask task) {
}
@Override public void onTaskComplete(UploadTask task) {
}
@Override public void onTaskRunning(UploadTask task) {
}
}
/**
* 下载任务状态监听
*
* @see Download
* @deprecated 请使用注解函数的方式来实现事件的获取
*/
@Deprecated public static class DownloadSchedulerListener
implements IDownloadSchedulerListener<DownloadTask> {
/**
* 预处理,有时有些地址链接比较慢,这时可以先在这个地方出来一些界面上的UI,如按钮的状态。
* 需要注意的是,在该回调中,是得不到文件长度的,如果需要获取文件长度,需要在onTaskPre中获取
*
* @param task 下载任务
*/
@Override public void onPre(DownloadTask task) {
}
@Override public void onTaskPre(DownloadTask task) {
}
@Override public void onTaskResume(DownloadTask task) {
}
@Override public void onTaskStart(DownloadTask task) {
}
@Override public void onTaskStop(DownloadTask task) {
}
@Override public void onTaskCancel(DownloadTask task) {
}
@Override public void onTaskFail(DownloadTask task) {
}
@Override public void onTaskComplete(DownloadTask task) {
}
@Override public void onTaskRunning(DownloadTask task) {
}
@Override public void onNoSupportBreakPoint(DownloadTask task) {
}
}
}
@@ -398,7 +398,6 @@ void destroySchedulerListener(Object obj) {
if (key.contains(clsName)) {
IReceiver receiver = mReceivers.get(key);
if (receiver != null) {
receiver.removeSchedulerListener();
receiver.unRegister();
receiver.destroy();
}
@@ -30,7 +30,7 @@
*/
class BaseDListener<ENTITY extends AbsEntity, TASK extends AbsTask<ENTITY>>
implements IDownloadListener {
private WeakReference<Handler> outHandler;
protected WeakReference<Handler> outHandler;
private long mLastLen = 0; //上一次发送长度
private boolean isFirst = true;
protected ENTITY mEntity;
@@ -117,6 +117,7 @@ private void handleSpeed(long speed) {
} else {
mEntity.setSpeed(speed < 0 ? 0 : speed);
}
mEntity.setPercent((int) (mEntity.getCurrentProgress() * 100 / mEntity.getFileSize()));
}
/**
@@ -17,6 +17,7 @@
import android.os.Handler;
import com.arialyy.aria.core.download.downloader.IDownloadGroupListener;
import com.arialyy.aria.core.scheduler.ISchedulers;
/**
* Created by Aria.Lao on 2017/7/20.
@@ -30,28 +31,51 @@
super(task, outHandler);
}
@Override public void onSubPre(DownloadEntity subEntity) {
sendInState2Target(ISchedulers.SUB_PRE);
}
@Override public void supportBreakpoint(boolean support, DownloadEntity subEntity) {
}
@Override public void onSubStart(DownloadEntity subEntity) {
sendInState2Target(ISchedulers.SUB_START);
}
@Override public void onSubStop(DownloadEntity subEntity) {
saveCurrentLocation();
sendInState2Target(ISchedulers.SUB_STOP);
}
@Override public void onSubComplete(DownloadEntity subEntity) {
saveCurrentLocation();
sendInState2Target(ISchedulers.SUB_COMPLETE);
}
@Override public void onSubFail(DownloadEntity subEntity) {
saveCurrentLocation();
sendInState2Target(ISchedulers.SUB_FAIL);
}
@Override public void onSubCancel(DownloadEntity entity) {
saveCurrentLocation();
sendInState2Target(ISchedulers.SUB_CANCEL);
}
@Override public void onSubRunning(DownloadEntity subEntity) {
sendInState2Target(ISchedulers.SUB_RUNNING);
}
/**
* 将任务状态发送给下载器
*
* @param state {@link ISchedulers#START}
*/
private void sendInState2Target(int state) {
if (outHandler.get() != null) {
outHandler.get().obtainMessage(state, ISchedulers.IS_SUB_TASK, 0, mTask).sendToTarget();
}
}
private void saveCurrentLocation() {
@@ -166,29 +166,6 @@ public DownloadReceiver register() {
}
}
/**
* 添加调度器回调
*
* @see #register()
*/
@Deprecated public DownloadReceiver addSchedulerListener(
ISchedulerListener<DownloadTask> listener) {
this.listener = listener;
DownloadSchedulers.getInstance().addSchedulerListener(targetName, listener);
return this;
}
/**
* 移除回调
*
* @see #unRegister()
*/
@Deprecated @Override public void removeSchedulerListener() {
if (listener != null) {
DownloadSchedulers.getInstance().removeSchedulerListener(targetName, listener);
}
}
@Override public void destroy() {
targetName = null;
listener = null;
@@ -127,6 +127,7 @@ void updateFileSize() {
mTaskEntity.getEntity().update();
}
}
/**
* 启动子任务下载
*
@@ -457,6 +458,7 @@ private void reStartTask() {
private void handleSpeed(long speed) {
entity.setSpeed(speed);
entity.setConvertSpeed(speed <= 0 ? "" : CommonUtil.formatFileSize(speed) + "/s");
entity.setPercent((int) (entity.getCurrentProgress() * 100 / entity.getFileSize()));
}
private void saveData(int state, long location) {

This file was deleted.

Oops, something went wrong.
@@ -17,14 +17,18 @@
import com.arialyy.aria.core.download.DownloadEntity;
import com.arialyy.aria.core.inf.IDownloadListener;
import com.arialyy.aria.core.inf.IEventListener;
/**
* Created by Aria.Lao on 2017/7/20.
* 下载任务组事件
*/
public interface IDownloadGroupListener extends IDownloadListener {
/**
* 子任务预处理
*/
void onSubPre(DownloadEntity subEntity);
/**
* 子任务支持断点回调
*
@@ -56,4 +60,9 @@
* 子任务取消下载
*/
void onSubCancel(DownloadEntity subEntity);
/**
* 子任务执行中
*/
void onSubRunning(DownloadEntity subEntity);
}
Oops, something went wrong.

0 comments on commit 3574531

Please sign in to comment.