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

@ -1,18 +1,19 @@
# Project-wide Gradle settings. ## Project-wide Gradle settings.
#
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit # For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html # http://www.gradle.org/docs/current/userguide/build_environment.html
#
# Specifies the JVM arguments used for the daemon process. # Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings. # 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 # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
#
# When configured, Gradle will run in incubating parallel mode. # When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit # 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 # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true # 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