修复类型转换错误

pull/709/head
陈斐 4 years ago
parent 1241bc5991
commit b5cbbd9d3d
  1. 12
      Aria/src/main/java/com/arialyy/aria/core/common/ProxyHelper.java
  2. 11
      Aria/src/main/java/com/arialyy/aria/core/scheduler/TaskSchedulers.java

@ -117,26 +117,26 @@ public class ProxyHelper {
}
private Set<Integer> checkProxyTypeByInterface(Class clazz) {
if (clazz.isAssignableFrom(BaseListenerInterface.class)) {
if (!BaseListenerInterface.class.isAssignableFrom(clazz)) {
return null;
}
Set<Integer> 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;

@ -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;
@ -108,7 +107,7 @@ public class TaskSchedulers<TASK extends ITask> implements ISchedulers {
if (!hasProxyListener(listeners, taskEnum)) {
if (obj instanceof BaseListenerInterface) {
listeners.put(taskEnum, (ISchedulerListener) obj);
listeners.put(taskEnum, obj);
return;
}
String proxyClassName = targetName + taskEnum.proxySuffix;
@ -409,14 +408,14 @@ public class TaskSchedulers<TASK extends ITask> implements ISchedulers {
if (listeners == null || listeners.isEmpty()) {
continue;
}
NormalTaskListener<TASK> listener = null;
NormalTaskListenerInterface<TASK> listener = null;
if (mObservers.get(key) != null) {
if (task instanceof DownloadTask) {
listener = (NormalTaskListener<TASK>) listeners.get(TaskEnum.DOWNLOAD);
listener = (NormalTaskListenerInterface<TASK>) listeners.get(TaskEnum.DOWNLOAD);
} else if (task instanceof DownloadGroupTask) {
listener = (NormalTaskListener<TASK>) listeners.get(TaskEnum.DOWNLOAD_GROUP);
listener = (NormalTaskListenerInterface<TASK>) listeners.get(TaskEnum.DOWNLOAD_GROUP);
} else if (task instanceof UploadTask) {
listener = (NormalTaskListener<TASK>) listeners.get(TaskEnum.UPLOAD);
listener = (NormalTaskListenerInterface<TASK>) listeners.get(TaskEnum.UPLOAD);
}
}
if (listener != null) {

Loading…
Cancel
Save