|
|
@ -29,6 +29,7 @@ import android.support.v4.app.Fragment; |
|
|
|
import android.text.TextUtils; |
|
|
|
import android.text.TextUtils; |
|
|
|
import android.util.Log; |
|
|
|
import android.util.Log; |
|
|
|
import com.arialyy.aria.core.command.CmdFactory; |
|
|
|
import com.arialyy.aria.core.command.CmdFactory; |
|
|
|
|
|
|
|
import com.arialyy.aria.core.scheduler.OnSchedulerListener; |
|
|
|
import com.arialyy.aria.util.CheckUtil; |
|
|
|
import com.arialyy.aria.util.CheckUtil; |
|
|
|
import com.arialyy.aria.util.CommonUtil; |
|
|
|
import com.arialyy.aria.util.CommonUtil; |
|
|
|
import com.arialyy.aria.core.command.IDownloadCmd; |
|
|
|
import com.arialyy.aria.core.command.IDownloadCmd; |
|
|
@ -37,6 +38,7 @@ import java.io.File; |
|
|
|
import java.lang.reflect.Field; |
|
|
|
import java.lang.reflect.Field; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.HashMap; |
|
|
|
|
|
|
|
import java.util.Iterator; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Set; |
|
|
|
import java.util.Set; |
|
|
@ -284,18 +286,33 @@ import java.util.Set; |
|
|
|
private void destroySchedulerListener(Object obj) { |
|
|
|
private void destroySchedulerListener(Object obj) { |
|
|
|
Set<String> keys = mTargets.keySet(); |
|
|
|
Set<String> keys = mTargets.keySet(); |
|
|
|
String clsName = obj.getClass().getName(); |
|
|
|
String clsName = obj.getClass().getName(); |
|
|
|
for (String key : keys) { |
|
|
|
for (Iterator<Map.Entry<String, AMReceiver>> iter = mTargets.entrySet().iterator(); |
|
|
|
|
|
|
|
iter.hasNext(); ) { |
|
|
|
|
|
|
|
Map.Entry<String, AMReceiver> entry = iter.next(); |
|
|
|
|
|
|
|
String key = entry.getKey(); |
|
|
|
if (key.equals(clsName) || key.contains(clsName)) { |
|
|
|
if (key.equals(clsName) || key.contains(clsName)) { |
|
|
|
AMReceiver receiver = mTargets.get(key); |
|
|
|
AMReceiver receiver = mTargets.get(key); |
|
|
|
if (receiver.obj != null) { |
|
|
|
if (receiver.obj != null) { |
|
|
|
if (receiver.obj instanceof Application || receiver.obj instanceof Service) break; |
|
|
|
if (receiver.obj instanceof Application || receiver.obj instanceof Service) break; |
|
|
|
receiver.removeSchedulerListener(); |
|
|
|
receiver.removeSchedulerListener(); |
|
|
|
receiver.destroy(); |
|
|
|
receiver.destroy(); |
|
|
|
mTargets.remove(key); |
|
|
|
iter.remove(); |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//for (String key : keys) {
|
|
|
|
|
|
|
|
// if (key.equals(clsName) || key.contains(clsName)) {
|
|
|
|
|
|
|
|
// AMReceiver receiver = mTargets.get(key);
|
|
|
|
|
|
|
|
// if (receiver.obj != null) {
|
|
|
|
|
|
|
|
// if (receiver.obj instanceof Application || receiver.obj instanceof Service) break;
|
|
|
|
|
|
|
|
// receiver.removeSchedulerListener();
|
|
|
|
|
|
|
|
// receiver.destroy();
|
|
|
|
|
|
|
|
// mTargets.remove(key);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// break;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//}
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|