修复fragment bug

pull/2/head
AriaLyy 8 years ago
parent 02420fe1f5
commit 815d549c3b
  1. 13
      Aria/src/main/java/com/arialyy/aria/core/AriaManager.java
  2. 19
      gradle.properties

@ -7,6 +7,7 @@ import android.app.Service;
import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import com.arialyy.aria.core.command.CmdFactory;
import com.arialyy.aria.util.CommonUtil;
import com.arialyy.aria.core.command.IDownloadCmd;
@ -48,8 +49,8 @@ import java.util.Set;
/**
* 设置同时下载的任务数
*/
public void setDownloadNum(int num){
if (num <= 0){
public void setDownloadNum(int num) {
if (num <= 0) {
throw new IllegalArgumentException("下载任务数不能小于1");
}
mManager.getTaskQueue().setDownloadNum(num);
@ -93,6 +94,11 @@ import java.util.Set;
if (target == null) {
target = new AMReceiver();
target.obj = obj;
if (obj instanceof android.support.v4.app.Fragment) {
clsName += "_" + ((Fragment) obj).getActivity().getClass().getName();
} else if (obj instanceof android.app.Fragment) {
clsName += "_" + ((android.app.Fragment) obj).getActivity().getClass().getName();
}
mTargets.put(clsName, target);
}
return target;
@ -149,7 +155,8 @@ import java.util.Set;
@Override public void onActivityDestroyed(Activity activity) {
Set<String> keys = mTargets.keySet();
for (String key : keys) {
if (key.equals(activity.getClass().getName())) {
String clsName = activity.getClass().getName();
if (key.equals(clsName) || key.contains(clsName)) {
AMReceiver target = mTargets.get(key);
if (target.obj != null) {
if (target.obj instanceof Application || target.obj instanceof Service) break;

@ -1,18 +1,19 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
## Project-wide Gradle settings.
#
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
#
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# Default value: -Xmx1024m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
#
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
#Wed Dec 07 20:19:22 CST 2016
systemProp.http.proxyPassword=7RbgsDfOoBn
systemProp.http.proxyHost=hilton.h.xduotai.com
systemProp.http.proxyUser=duotai
systemProp.http.proxyPort=10969

Loading…
Cancel
Save