diff --git a/Aria/src/main/java/com/arialyy/aria/core/common/ProxyHelper.java b/Aria/src/main/java/com/arialyy/aria/core/common/ProxyHelper.java index 18cca7bd..2a3f089e 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/common/ProxyHelper.java +++ b/Aria/src/main/java/com/arialyy/aria/core/common/ProxyHelper.java @@ -117,26 +117,26 @@ public class ProxyHelper { } private Set checkProxyTypeByInterface(Class clazz) { - if (clazz.isAssignableFrom(BaseListenerInterface.class)) { + if (!BaseListenerInterface.class.isAssignableFrom(clazz)) { return null; } Set result = new HashSet<>(); - if (clazz.isAssignableFrom(DownloadGroupTaskListener.class)) { + if (DownloadGroupTaskListener.class.isAssignableFrom(clazz)) { result.add(PROXY_TYPE_DOWNLOAD_GROUP); } - if (clazz.isAssignableFrom(DownloadTaskListener.class)) { + if (DownloadTaskListener.class.isAssignableFrom(clazz)) { result.add(PROXY_TYPE_DOWNLOAD); } - if (clazz.isAssignableFrom(UploadTaskListener.class)) { + if (UploadTaskListener.class.isAssignableFrom(clazz)) { result.add(PROXY_TYPE_UPLOAD); } - if (clazz.isAssignableFrom(M3U8PeerTaskListenerInterface.class)) { + if (M3U8PeerTaskListenerInterface.class.isAssignableFrom(clazz)) { result.add(PROXY_TYPE_M3U8_PEER); } - if (clazz.isAssignableFrom(SubTaskListenerInterface.class)) { + if (SubTaskListenerInterface.class.isAssignableFrom(clazz)) { result.add(PROXY_TYPE_DOWNLOAD_GROUP_SUB); } return result; diff --git a/Aria/src/main/java/com/arialyy/aria/core/scheduler/TaskSchedulers.java b/Aria/src/main/java/com/arialyy/aria/core/scheduler/TaskSchedulers.java index ef501638..0bf70ef0 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/scheduler/TaskSchedulers.java +++ b/Aria/src/main/java/com/arialyy/aria/core/scheduler/TaskSchedulers.java @@ -18,7 +18,6 @@ package com.arialyy.aria.core.scheduler; import android.content.Intent; import android.os.Bundle; import android.os.Message; -import android.util.Log; import com.arialyy.annotations.TaskEnum; import com.arialyy.aria.core.AriaConfig; import com.arialyy.aria.core.common.AbsEntity; @@ -107,8 +106,8 @@ public class TaskSchedulers implements ISchedulers { } if (!hasProxyListener(listeners, taskEnum)) { - if (obj instanceof BaseListenerInterface){ - listeners.put(taskEnum, (ISchedulerListener) obj); + if (obj instanceof BaseListenerInterface) { + listeners.put(taskEnum, obj); return; } String proxyClassName = targetName + taskEnum.proxySuffix; @@ -409,14 +408,14 @@ public class TaskSchedulers implements ISchedulers { if (listeners == null || listeners.isEmpty()) { continue; } - NormalTaskListener listener = null; + NormalTaskListenerInterface listener = null; if (mObservers.get(key) != null) { if (task instanceof DownloadTask) { - listener = (NormalTaskListener) listeners.get(TaskEnum.DOWNLOAD); + listener = (NormalTaskListenerInterface) listeners.get(TaskEnum.DOWNLOAD); } else if (task instanceof DownloadGroupTask) { - listener = (NormalTaskListener) listeners.get(TaskEnum.DOWNLOAD_GROUP); + listener = (NormalTaskListenerInterface) listeners.get(TaskEnum.DOWNLOAD_GROUP); } else if (task instanceof UploadTask) { - listener = (NormalTaskListener) listeners.get(TaskEnum.UPLOAD); + listener = (NormalTaskListenerInterface) listeners.get(TaskEnum.UPLOAD); } } if (listener != null) {