From b5cbbd9d3da18fde4626f6c82eb2529cbdb22664 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=96=90?= Date: Tue, 7 Jul 2020 17:10:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=B1=BB=E5=9E=8B=E8=BD=AC?= =?UTF-8?q?=E6=8D=A2=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/arialyy/aria/core/common/ProxyHelper.java | 12 ++++++------ .../arialyy/aria/core/scheduler/TaskSchedulers.java | 13 ++++++------- 2 files changed, 12 insertions(+), 13 deletions(-) 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) {