fix bug https://github.com/AriaLyy/Aria/issues/423 https://github.com/AriaLyy/Aria/issues/426 https://github.com/AriaLyy/Aria/issues/427 https://github.com/AriaLyy/Aria/issues/428
parent
fdb607e10f
commit
062f124cae
@ -1,154 +1,154 @@ |
|||||||
/* |
/* |
||||||
* Copyright (C) 2016 AriaLyy(https://github.com/AriaLyy/Aria)
|
* Copyright (C) 2016 AriaLyy(https://github.com/AriaLyy/Aria)
|
||||||
* |
* |
||||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||||
* you may not use this file except in compliance with the License. |
* you may not use this file except in compliance with the License. |
||||||
* You may obtain a copy of the License at |
* You may obtain a copy of the License at |
||||||
* |
* |
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* |
* |
||||||
* Unless required by applicable law or agreed to in writing, software |
* Unless required by applicable law or agreed to in writing, software |
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
* See the License for the specific language governing permissions and |
* See the License for the specific language governing permissions and |
||||||
* limitations under the License. |
* limitations under the License. |
||||||
*/ |
*/ |
||||||
|
|
||||||
package com.arialyy.aria.core; |
package com.arialyy.aria.core; |
||||||
|
|
||||||
import android.annotation.TargetApi; |
import android.annotation.TargetApi; |
||||||
import android.app.Activity; |
import android.app.Activity; |
||||||
import android.app.Application; |
import android.app.Application; |
||||||
import android.app.Dialog; |
import android.app.Dialog; |
||||||
import android.app.Service; |
import android.app.Service; |
||||||
import android.content.Context; |
import android.content.Context; |
||||||
import android.os.Build; |
import android.os.Build; |
||||||
import android.support.v4.app.DialogFragment; |
import android.support.v4.app.DialogFragment; |
||||||
import android.support.v4.app.Fragment; |
import android.support.v4.app.Fragment; |
||||||
import android.widget.PopupWindow; |
import android.widget.PopupWindow; |
||||||
import com.arialyy.aria.core.download.DownloadReceiver; |
import com.arialyy.aria.core.download.DownloadReceiver; |
||||||
import com.arialyy.aria.core.upload.UploadReceiver; |
import com.arialyy.aria.core.upload.UploadReceiver; |
||||||
import com.arialyy.aria.util.ALog; |
import com.arialyy.aria.util.ALog; |
||||||
|
|
||||||
/** |
/** |
||||||
* Created by lyy on 2016/12/1. |
* Created by lyy on 2016/12/1. |
||||||
* |
* |
||||||
* @see <a href="https://github.com/AriaLyy/Aria">Aria</a> |
* @see <a href="https://github.com/AriaLyy/Aria">Aria</a> |
||||||
* @see <a href="https://aria.laoyuyu.me/aria_doc/">Aria doc</a> |
* @see <a href="https://aria.laoyuyu.me/aria_doc/">Aria doc</a> |
||||||
* Aria启动,管理全局任务 |
* Aria启动,管理全局任务 |
||||||
* <pre> |
* <pre> |
||||||
* <code> |
* <code> |
||||||
* //下载
|
* //下载
|
||||||
* Aria.download(this) |
* Aria.download(this) |
||||||
* .load(URL) //下载地址,必填
|
* .load(URL) //下载地址,必填
|
||||||
* //文件保存路径,必填
|
* //文件保存路径,必填
|
||||||
* .setDownloadPath(Environment.getExternalStorageDirectory().getPath() + "/test.apk") |
* .setDownloadPath(Environment.getExternalStorageDirectory().getPath() + "/test.apk") |
||||||
* .start(); |
* .start(); |
||||||
* </code> |
* </code> |
||||||
* <code> |
* <code> |
||||||
* //上传
|
* //上传
|
||||||
* Aria.upload(this) |
* Aria.upload(this) |
||||||
* .load(filePath) //文件路径,必填
|
* .load(filePath) //文件路径,必填
|
||||||
* .setTempUrl(uploadUrl) //上传路径,必填
|
* .setTempUrl(uploadUrl) //上传路径,必填
|
||||||
* .setAttachment(fileKey) //服务器读取文件的key,必填
|
* .setAttachment(fileKey) //服务器读取文件的key,必填
|
||||||
* .start(); |
* .start(); |
||||||
* </code> |
* </code> |
||||||
* </pre> |
* </pre> |
||||||
* |
* |
||||||
* 如果你需要在【Activity、Service、Application、DialogFragment、Fragment、PopupWindow、Dialog】 |
* 如果你需要在【Activity、Service、Application、DialogFragment、Fragment、PopupWindow、Dialog】 |
||||||
* 之外的java中使用Aria,那么你应该在Application或Activity初始化的时候调用{@link #init(Context)}对Aria进行初始化 |
* 之外的java中使用Aria,那么你应该在Application或Activity初始化的时候调用{@link #init(Context)}对Aria进行初始化 |
||||||
* 然后才能使用{@link #download(Object)}、{@link #upload(Object)} |
* 然后才能使用{@link #download(Object)}、{@link #upload(Object)} |
||||||
* |
* |
||||||
* <pre> |
* <pre> |
||||||
* <code> |
* <code> |
||||||
* Aria.init(this); |
* Aria.init(this); |
||||||
* |
* |
||||||
* Aria.download(this) |
* Aria.download(this) |
||||||
* .load(URL) //下载地址,必填
|
* .load(URL) //下载地址,必填
|
||||||
* //文件保存路径,必填
|
* //文件保存路径,必填
|
||||||
* .setDownloadPath(Environment.getExternalStorageDirectory().getPath() + "/test.apk") |
* .setDownloadPath(Environment.getExternalStorageDirectory().getPath() + "/test.apk") |
||||||
* .start(); |
* .start(); |
||||||
* |
* |
||||||
* </code> |
* </code> |
||||||
* |
* |
||||||
* </pre> |
* </pre> |
||||||
*/ |
*/ |
||||||
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) public class Aria { |
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) public class Aria { |
||||||
|
|
||||||
private Aria() { |
private Aria() { |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* 下载,在当前类中调用Aria方法,参数需要使用this,否则将 |
* 下载,在当前类中调用Aria方法,参数需要使用this,否则将 |
||||||
* 如果不是【Activity、Service、Application、DialogFragment、Fragment、PopupWindow、Dialog】对象,那么你 |
* 如果不是【Activity、Service、Application、DialogFragment、Fragment、PopupWindow、Dialog】对象,那么你 |
||||||
* 需要在对象中初始化下载前,在Application或Activity初始化的时候调用{@link #init(Context)}对Aria进行初始化 |
* 需要在对象中初始化下载前,在Application或Activity初始化的时候调用{@link #init(Context)}对Aria进行初始化 |
||||||
* |
* |
||||||
* @param obj 观察者对象,为本类对象,使用{@code this} |
* @param obj 观察者对象,为本类对象,使用{@code this} |
||||||
*/ |
*/ |
||||||
public static DownloadReceiver download(Object obj) { |
public static DownloadReceiver download(Object obj) { |
||||||
if (AriaManager.getInstance() != null){ |
if (AriaManager.getInstance() != null){ |
||||||
return AriaManager.getInstance().download(obj); |
return AriaManager.getInstance().download(obj); |
||||||
} |
} |
||||||
return get(convertContext(obj)).download(obj); |
return get(convertContext(obj)).download(obj); |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* 上传 |
* 上传 |
||||||
* 如果不是【Activity、Service、Application、DialogFragment、Fragment、PopupWindow、Dialog】对象,那么你 |
* 如果不是【Activity、Service、Application、DialogFragment、Fragment、PopupWindow、Dialog】对象,那么你 |
||||||
* 需要在对象中初始化下载前,在Application或Activity初始化的时候调用{@link #init(Context)}对Aria进行初始化 |
* 需要在对象中初始化下载前,在Application或Activity初始化的时候调用{@link #init(Context)}对Aria进行初始化 |
||||||
* |
* |
||||||
* @param obj 观察者对象,为本类对象,使用{@code this} |
* @param obj 观察者对象,为本类对象,使用{@code this} |
||||||
*/ |
*/ |
||||||
public static UploadReceiver upload(Object obj) { |
public static UploadReceiver upload(Object obj) { |
||||||
if (AriaManager.getInstance() != null){ |
if (AriaManager.getInstance() != null){ |
||||||
return AriaManager.getInstance().upload(obj); |
return AriaManager.getInstance().upload(obj); |
||||||
} |
} |
||||||
return get(convertContext(obj)).upload(obj); |
return get(convertContext(obj)).upload(obj); |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* 处理通用事件 |
* 处理通用事件 |
||||||
*/ |
*/ |
||||||
public static AriaManager get(Context context) { |
public static AriaManager get(Context context) { |
||||||
if (context == null) { |
if (context == null) { |
||||||
throw new NullPointerException("context 无效,在非【Activity、Service、Application、DialogFragment、Fragment、PopupWindow、Dialog】," |
throw new NullPointerException("context 无效,在非【Activity、Service、Application、DialogFragment、Fragment、PopupWindow、Dialog】," |
||||||
+ "请参考【https://aria.laoyuyu.me/aria_doc/start/any_java.html】,参数请使用 download(this) 或 upload(this);" |
+ "请参考【https://aria.laoyuyu.me/aria_doc/start/any_java.html】,参数请使用 download(this) 或 upload(this);" |
||||||
+ "不要使用 download(getContext()) 或 upload(getContext())"); |
+ "不要使用 download(getContext()) 或 upload(getContext())"); |
||||||
} |
} |
||||||
return AriaManager.getInstance(context); |
return AriaManager.getInstance(context); |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* 初始化Aria,如果你需要在【Activity、Service、Application、DialogFragment、Fragment、PopupWindow、Dialog】 |
* 初始化Aria,如果你需要在【Activity、Service、Application、DialogFragment、Fragment、PopupWindow、Dialog】 |
||||||
* 之外的java中使用Aria,那么你应该在Application或Activity初始化的时候调用本方法对Aria进行初始化 |
* 之外的java中使用Aria,那么你应该在Application或Activity初始化的时候调用本方法对Aria进行初始化 |
||||||
* 只需要初始化一次就可以 |
* 只需要初始化一次就可以 |
||||||
* {@link #download(Object)}、{@link #upload(Object)} |
* {@link #download(Object)}、{@link #upload(Object)} |
||||||
*/ |
*/ |
||||||
public static AriaManager init(Context context) { |
public static AriaManager init(Context context) { |
||||||
return AriaManager.getInstance(context); |
return AriaManager.getInstance(context); |
||||||
} |
} |
||||||
|
|
||||||
private static Context convertContext(Object obj) { |
private static Context convertContext(Object obj) { |
||||||
if (obj instanceof Application) { |
if (obj instanceof Application) { |
||||||
return (Application) obj; |
return (Application) obj; |
||||||
} else if (obj instanceof Service) { |
} else if (obj instanceof Service) { |
||||||
return (Service) obj; |
return (Service) obj; |
||||||
} else if (obj instanceof Activity) { |
} else if (obj instanceof Activity) { |
||||||
return (Activity) obj; |
return (Activity) obj; |
||||||
} else if (obj instanceof DialogFragment) { |
} else if (obj instanceof DialogFragment) { |
||||||
return ((DialogFragment) obj).getContext(); |
return ((DialogFragment) obj).getContext(); |
||||||
} else if (obj instanceof android.app.DialogFragment) { |
} else if (obj instanceof android.app.DialogFragment) { |
||||||
return ((android.app.DialogFragment) obj).getActivity(); |
return ((android.app.DialogFragment) obj).getActivity(); |
||||||
} else if (obj instanceof android.support.v4.app.Fragment) { |
} else if (obj instanceof android.support.v4.app.Fragment) { |
||||||
return ((Fragment) obj).getContext(); |
return ((Fragment) obj).getContext(); |
||||||
} else if (obj instanceof android.app.Fragment) { |
} else if (obj instanceof android.app.Fragment) { |
||||||
return ((android.app.Fragment) obj).getActivity(); |
return ((android.app.Fragment) obj).getActivity(); |
||||||
} else if (obj instanceof Dialog) { |
} else if (obj instanceof Dialog) { |
||||||
return ((Dialog) obj).getContext(); |
return ((Dialog) obj).getContext(); |
||||||
} else if (obj instanceof PopupWindow) { |
} else if (obj instanceof PopupWindow) { |
||||||
return ((PopupWindow) obj).getContentView().getContext(); |
return ((PopupWindow) obj).getContentView().getContext(); |
||||||
} |
} |
||||||
ALog.e("Aria", "请使用download(this)或upload(this)"); |
ALog.e("Aria", "请使用download(this)或upload(this)"); |
||||||
return null; |
return null; |
||||||
} |
} |
||||||
} |
} |
||||||
|
@ -1,27 +1,27 @@ |
|||||||
/* |
/* |
||||||
* Copyright (C) 2016 AriaLyy(https://github.com/AriaLyy/Aria)
|
* Copyright (C) 2016 AriaLyy(https://github.com/AriaLyy/Aria)
|
||||||
* |
* |
||||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||||
* you may not use this file except in compliance with the License. |
* you may not use this file except in compliance with the License. |
||||||
* You may obtain a copy of the License at |
* You may obtain a copy of the License at |
||||||
* |
* |
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* |
* |
||||||
* Unless required by applicable law or agreed to in writing, software |
* Unless required by applicable law or agreed to in writing, software |
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
* See the License for the specific language governing permissions and |
* See the License for the specific language governing permissions and |
||||||
* limitations under the License. |
* limitations under the License. |
||||||
*/ |
*/ |
||||||
package com.arialyy.aria.core.upload; |
package com.arialyy.aria.core.upload; |
||||||
|
|
||||||
import com.arialyy.aria.core.inf.AbsTarget; |
import com.arialyy.aria.core.inf.AbsTarget; |
||||||
|
|
||||||
/** |
/** |
||||||
* Created by AriaL on 2017/6/29. |
* Created by AriaL on 2017/6/29. |
||||||
* 普通上传任务接收器 |
* 普通上传任务接收器 |
||||||
*/ |
*/ |
||||||
abstract class AbsUploadTarget<TARGET extends AbsUploadTarget> extends AbsTarget<TARGET> { |
abstract class AbsUploadTarget<TARGET extends AbsUploadTarget> extends AbsTarget<TARGET> { |
||||||
|
|
||||||
|
|
||||||
} |
} |
||||||
|
@ -1,24 +1,24 @@ |
|||||||
/* |
/* |
||||||
* Copyright (C) 2016 AriaLyy(https://github.com/AriaLyy/Aria)
|
* Copyright (C) 2016 AriaLyy(https://github.com/AriaLyy/Aria)
|
||||||
* |
* |
||||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||||
* you may not use this file except in compliance with the License. |
* you may not use this file except in compliance with the License. |
||||||
* You may obtain a copy of the License at |
* You may obtain a copy of the License at |
||||||
* |
* |
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* |
* |
||||||
* Unless required by applicable law or agreed to in writing, software |
* Unless required by applicable law or agreed to in writing, software |
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
* See the License for the specific language governing permissions and |
* See the License for the specific language governing permissions and |
||||||
* limitations under the License. |
* limitations under the License. |
||||||
*/ |
*/ |
||||||
package com.arialyy.aria.exception; |
package com.arialyy.aria.exception; |
||||||
|
|
||||||
public class ParamException extends RuntimeException { |
public class ParamException extends RuntimeException { |
||||||
private static final String ARIA_NET_EXCEPTION = "Aria Params Exception:"; |
private static final String ARIA_NET_EXCEPTION = "Aria Params Exception:"; |
||||||
|
|
||||||
public ParamException(String message) { |
public ParamException(String message) { |
||||||
super(String.format("%s%s", ARIA_NET_EXCEPTION, message)); |
super(String.format("%s%s", ARIA_NET_EXCEPTION, message)); |
||||||
} |
} |
||||||
} |
} |
||||||
|
@ -1,244 +1,244 @@ |
|||||||
/* |
/* |
||||||
* Copyright (C) 2016 AriaLyy(https://github.com/AriaLyy/Aria)
|
* Copyright (C) 2016 AriaLyy(https://github.com/AriaLyy/Aria)
|
||||||
* |
* |
||||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||||
* you may not use this file except in compliance with the License. |
* you may not use this file except in compliance with the License. |
||||||
* You may obtain a copy of the License at |
* You may obtain a copy of the License at |
||||||
* |
* |
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* |
* |
||||||
* Unless required by applicable law or agreed to in writing, software |
* Unless required by applicable law or agreed to in writing, software |
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
* See the License for the specific language governing permissions and |
* See the License for the specific language governing permissions and |
||||||
* limitations under the License. |
* limitations under the License. |
||||||
*/ |
*/ |
||||||
package com.arialyy.simple.core.download; |
package com.arialyy.simple.core.download; |
||||||
|
|
||||||
import android.os.Bundle; |
import android.os.Bundle; |
||||||
import android.os.Environment; |
import android.os.Environment; |
||||||
import android.support.v7.widget.LinearLayoutManager; |
import android.support.v7.widget.LinearLayoutManager; |
||||||
import android.support.v7.widget.RecyclerView; |
import android.support.v7.widget.RecyclerView; |
||||||
import android.view.Menu; |
import android.view.Menu; |
||||||
import android.view.MenuItem; |
import android.view.MenuItem; |
||||||
import android.view.View; |
import android.view.View; |
||||||
import android.widget.Button; |
import android.widget.Button; |
||||||
import android.widget.TextView; |
import android.widget.TextView; |
||||||
import com.arialyy.annotations.Download; |
import com.arialyy.annotations.Download; |
||||||
import com.arialyy.aria.core.Aria; |
import com.arialyy.aria.core.Aria; |
||||||
import com.arialyy.aria.core.download.DownloadEntity; |
import com.arialyy.aria.core.download.DownloadEntity; |
||||||
import com.arialyy.aria.core.download.DownloadTarget; |
import com.arialyy.aria.core.download.DownloadTarget; |
||||||
import com.arialyy.aria.core.download.DownloadTask; |
import com.arialyy.aria.core.download.DownloadTask; |
||||||
import com.arialyy.aria.core.inf.AbsEntity; |
import com.arialyy.aria.core.inf.AbsEntity; |
||||||
import com.arialyy.aria.core.inf.IEntity; |
import com.arialyy.aria.core.inf.IEntity; |
||||||
import com.arialyy.frame.util.show.L; |
import com.arialyy.frame.util.show.L; |
||||||
import com.arialyy.simple.R; |
import com.arialyy.simple.R; |
||||||
import com.arialyy.simple.base.BaseActivity; |
import com.arialyy.simple.base.BaseActivity; |
||||||
import com.arialyy.simple.databinding.ActivityHighestPriorityBinding; |
import com.arialyy.simple.databinding.ActivityHighestPriorityBinding; |
||||||
import com.arialyy.simple.core.download.multi_download.DownloadAdapter; |
import com.arialyy.simple.core.download.multi_download.DownloadAdapter; |
||||||
import com.arialyy.simple.widget.HorizontalProgressBarWithNumber; |
import com.arialyy.simple.widget.HorizontalProgressBarWithNumber; |
||||||
import java.util.ArrayList; |
import java.util.ArrayList; |
||||||
import java.util.HashSet; |
import java.util.HashSet; |
||||||
import java.util.List; |
import java.util.List; |
||||||
import java.util.Set; |
import java.util.Set; |
||||||
|
|
||||||
/** |
/** |
||||||
* Created by lyy on 2017/6/2. |
* Created by lyy on 2017/6/2. |
||||||
* 最高优先级任务Demo |
* 最高优先级任务Demo |
||||||
*/ |
*/ |
||||||
public class HighestPriorityActivity extends BaseActivity<ActivityHighestPriorityBinding> { |
public class HighestPriorityActivity extends BaseActivity<ActivityHighestPriorityBinding> { |
||||||
private HorizontalProgressBarWithNumber mPb; |
private HorizontalProgressBarWithNumber mPb; |
||||||
private Button mStart; |
private Button mStart; |
||||||
private Button mStop; |
private Button mStop; |
||||||
private Button mCancel; |
private Button mCancel; |
||||||
private TextView mSize; |
private TextView mSize; |
||||||
private TextView mSpeed; |
private TextView mSpeed; |
||||||
private RecyclerView mList; |
private RecyclerView mList; |
||||||
|
|
||||||
private String mTaskName = "光明大陆"; |
private String mTaskName = "光明大陆"; |
||||||
private static final String DOWNLOAD_URL = |
private static final String DOWNLOAD_URL = |
||||||
"https://res5.d.cn/6f78ee3bcfdd033e64892a8553a95814cf5b4a62b12a76d9eb2a694905f0dc30fa5c7f728806a4ee0b3479e7b26a38707dac92b136add91191ac1219aadb4a3aa70bfa6d06d2d8db.apk"; |
"https://res5.d.cn/6f78ee3bcfdd033e64892a8553a95814cf5b4a62b12a76d9eb2a694905f0dc30fa5c7f728806a4ee0b3479e7b26a38707dac92b136add91191ac1219aadb4a3aa70bfa6d06d2d8db.apk"; |
||||||
private DownloadAdapter mAdapter; |
private DownloadAdapter mAdapter; |
||||||
private List<AbsEntity> mData = new ArrayList<>(); |
private List<AbsEntity> mData = new ArrayList<>(); |
||||||
private Set<String> mRecord = new HashSet<>(); |
private Set<String> mRecord = new HashSet<>(); |
||||||
|
|
||||||
@Override protected int setLayoutId() { |
@Override protected int setLayoutId() { |
||||||
return R.layout.activity_highest_priority; |
return R.layout.activity_highest_priority; |
||||||
} |
} |
||||||
|
|
||||||
@Override protected void init(Bundle savedInstanceState) { |
@Override protected void init(Bundle savedInstanceState) { |
||||||
super.init(savedInstanceState); |
super.init(savedInstanceState); |
||||||
mPb = findViewById(R.id.progressBar); |
mPb = findViewById(R.id.progressBar); |
||||||
mStart = findViewById(R.id.start); |
mStart = findViewById(R.id.start); |
||||||
mStop = findViewById(R.id.stop); |
mStop = findViewById(R.id.stop); |
||||||
mCancel = findViewById(R.id.cancel); |
mCancel = findViewById(R.id.cancel); |
||||||
mSize = findViewById(R.id.size); |
mSize = findViewById(R.id.size); |
||||||
mSpeed = findViewById(R.id.speed); |
mSpeed = findViewById(R.id.speed); |
||||||
mList = findViewById(R.id.list); |
mList = findViewById(R.id.list); |
||||||
|
|
||||||
setTitle("最高优先级任务"); |
setTitle("最高优先级任务"); |
||||||
getBinding().setTaskName("任务名:" + mTaskName + " (最高优先级任务)"); |
getBinding().setTaskName("任务名:" + mTaskName + " (最高优先级任务)"); |
||||||
initWidget(); |
initWidget(); |
||||||
Aria.download(this).register(); |
Aria.download(this).register(); |
||||||
} |
} |
||||||
|
|
||||||
private void initWidget() { |
private void initWidget() { |
||||||
DownloadTarget target = Aria.download(this).load(DOWNLOAD_URL); |
DownloadTarget target = Aria.download(this).load(DOWNLOAD_URL); |
||||||
mPb.setProgress(target.getPercent()); |
mPb.setProgress(target.getPercent()); |
||||||
if (target.getTaskState() == IEntity.STATE_STOP) { |
if (target.getTaskState() == IEntity.STATE_STOP) { |
||||||
mStart.setText("恢复"); |
mStart.setText("恢复"); |
||||||
mStart.setTextColor(getResources().getColor(android.R.color.holo_blue_light)); |
mStart.setTextColor(getResources().getColor(android.R.color.holo_blue_light)); |
||||||
setBtState(true); |
setBtState(true); |
||||||
} else if (target.isRunning()) { |
} else if (target.isRunning()) { |
||||||
setBtState(false); |
setBtState(false); |
||||||
} |
} |
||||||
mSize.setText(target.getConvertFileSize()); |
mSize.setText(target.getConvertFileSize()); |
||||||
List<DownloadEntity> temp = Aria.download(this).getTaskList(); |
List<DownloadEntity> temp = Aria.download(this).getTaskList(); |
||||||
if (temp != null && !temp.isEmpty()) { |
if (temp != null && !temp.isEmpty()) { |
||||||
for (DownloadEntity entity : temp) { |
for (DownloadEntity entity : temp) { |
||||||
if (entity.getUrl().equals(DOWNLOAD_URL)) continue; |
if (entity.getUrl().equals(DOWNLOAD_URL)) continue; |
||||||
mData.add(entity); |
mData.add(entity); |
||||||
mRecord.add(entity.getUrl()); |
mRecord.add(entity.getUrl()); |
||||||
} |
} |
||||||
} |
} |
||||||
mAdapter = new DownloadAdapter(this, mData); |
mAdapter = new DownloadAdapter(this, mData); |
||||||
mList.setLayoutManager(new LinearLayoutManager(this)); |
mList.setLayoutManager(new LinearLayoutManager(this)); |
||||||
mList.setAdapter(mAdapter); |
mList.setAdapter(mAdapter); |
||||||
} |
} |
||||||
|
|
||||||
@Override public boolean onCreateOptionsMenu(Menu menu) { |
@Override public boolean onCreateOptionsMenu(Menu menu) { |
||||||
getMenuInflater().inflate(R.menu.menu_highest_priority, menu); |
getMenuInflater().inflate(R.menu.menu_highest_priority, menu); |
||||||
return super.onCreateOptionsMenu(menu); |
return super.onCreateOptionsMenu(menu); |
||||||
} |
} |
||||||
|
|
||||||
@Override public boolean onMenuItemClick(MenuItem item) { |
@Override public boolean onMenuItemClick(MenuItem item) { |
||||||
switch (item.getItemId()) { |
switch (item.getItemId()) { |
||||||
case R.id.add_task: |
case R.id.add_task: |
||||||
List<DownloadEntity> temp = getModule(DownloadModule.class).getHighestTestList(); |
List<DownloadEntity> temp = getModule(DownloadModule.class).getHighestTestList(); |
||||||
for (DownloadEntity entity : temp) { |
for (DownloadEntity entity : temp) { |
||||||
String url = entity.getUrl(); |
String url = entity.getUrl(); |
||||||
if (mRecord.contains(url)) { |
if (mRecord.contains(url)) { |
||||||
continue; |
continue; |
||||||
} |
} |
||||||
mAdapter.addDownloadEntity(entity); |
mAdapter.addDownloadEntity(entity); |
||||||
mRecord.add(url); |
mRecord.add(url); |
||||||
} |
} |
||||||
mAdapter.notifyDataSetChanged(); |
mAdapter.notifyDataSetChanged(); |
||||||
break; |
break; |
||||||
case R.id.help: |
case R.id.help: |
||||||
String title = "最高优先级任务介绍"; |
String title = "最高优先级任务介绍"; |
||||||
String msg = " 将任务设置为最高优先级任务,最高优先级任务有以下特点:\n" |
String msg = " 将任务设置为最高优先级任务,最高优先级任务有以下特点:\n" |
||||||
+ " 1、在下载队列中,有且只有一个最高优先级任务\n" |
+ " 1、在下载队列中,有且只有一个最高优先级任务\n" |
||||||
+ " 2、最高优先级任务会一直存在,直到用户手动暂停或任务完成\n" |
+ " 2、最高优先级任务会一直存在,直到用户手动暂停或任务完成\n" |
||||||
+ " 3、任务调度器不会暂停最高优先级任务\n" |
+ " 3、任务调度器不会暂停最高优先级任务\n" |
||||||
+ " 4、用户手动暂停或任务完成后,第二次重新执行该任务,该命令将失效\n" |
+ " 4、用户手动暂停或任务完成后,第二次重新执行该任务,该命令将失效\n" |
||||||
+ " 5、如果下载队列中已经满了,则会停止队尾的任务,当高优先级任务完成后,该队尾任务将自动执行\n" |
+ " 5、如果下载队列中已经满了,则会停止队尾的任务,当高优先级任务完成后,该队尾任务将自动执行\n" |
||||||
+ " 6、把任务设置为最高优先级任务后,将自动执行任务,不需要重新调用start()启动任务"; |
+ " 6、把任务设置为最高优先级任务后,将自动执行任务,不需要重新调用start()启动任务"; |
||||||
showMsgDialog(title, msg); |
showMsgDialog(title, msg); |
||||||
break; |
break; |
||||||
} |
} |
||||||
return true; |
return true; |
||||||
} |
} |
||||||
|
|
||||||
public void onClick(View view) { |
public void onClick(View view) { |
||||||
switch (view.getId()) { |
switch (view.getId()) { |
||||||
case R.id.start: |
case R.id.start: |
||||||
String text = ((TextView) view).getText().toString(); |
String text = ((TextView) view).getText().toString(); |
||||||
if (text.equals("重新开始?") || text.equals("开始")) { |
if (text.equals("重新开始?") || text.equals("开始")) { |
||||||
Aria.download(this) |
Aria.download(this) |
||||||
.load(DOWNLOAD_URL) |
.load(DOWNLOAD_URL) |
||||||
.setFilePath(Environment.getExternalStorageDirectory().getPath() |
.setFilePath(Environment.getExternalStorageDirectory().getPath() |
||||||
+ "/Download/" |
+ "/Download/" |
||||||
+ mTaskName |
+ mTaskName |
||||||
+ ".apk") |
+ ".apk") |
||||||
.setHighestPriority(); |
.setHighestPriority(); |
||||||
} else if (text.equals("恢复")) { |
} else if (text.equals("恢复")) { |
||||||
Aria.download(this).load(DOWNLOAD_URL).resume(); |
Aria.download(this).load(DOWNLOAD_URL).resume(); |
||||||
} |
} |
||||||
break; |
break; |
||||||
case R.id.stop: |
case R.id.stop: |
||||||
Aria.download(this).load(DOWNLOAD_URL).pause(); |
Aria.download(this).load(DOWNLOAD_URL).pause(); |
||||||
break; |
break; |
||||||
case R.id.cancel: |
case R.id.cancel: |
||||||
Aria.download(this).load(DOWNLOAD_URL).cancel(); |
Aria.download(this).load(DOWNLOAD_URL).cancel(); |
||||||
break; |
break; |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* 设置start 和 stop 按钮状态 |
* 设置start 和 stop 按钮状态 |
||||||
*/ |
*/ |
||||||
private void setBtState(boolean state) { |
private void setBtState(boolean state) { |
||||||
mStart.setEnabled(state); |
mStart.setEnabled(state); |
||||||
mStop.setEnabled(!state); |
mStop.setEnabled(!state); |
||||||
} |
} |
||||||
|
|
||||||
@Download.onPre public void onPre(DownloadTask task) { |
@Download.onPre public void onPre(DownloadTask task) { |
||||||
mAdapter.updateState(task.getDownloadEntity()); |
mAdapter.updateState(task.getDownloadEntity()); |
||||||
} |
} |
||||||
|
|
||||||
@Download.onTaskPre public void onTaskPre(DownloadTask task) { |
@Download.onTaskPre public void onTaskPre(DownloadTask task) { |
||||||
if (task.getKey().equals(DOWNLOAD_URL)) { |
if (task.getKey().equals(DOWNLOAD_URL)) { |
||||||
mSize.setText(task.getConvertFileSize()); |
mSize.setText(task.getConvertFileSize()); |
||||||
} |
} |
||||||
mAdapter.updateState(task.getDownloadEntity()); |
mAdapter.updateState(task.getDownloadEntity()); |
||||||
} |
} |
||||||
|
|
||||||
@Download.onTaskStart public void onTaskStart(DownloadTask task) { |
@Download.onTaskStart public void onTaskStart(DownloadTask task) { |
||||||
if (task.getKey().equals(DOWNLOAD_URL)) { |
if (task.getKey().equals(DOWNLOAD_URL)) { |
||||||
setBtState(false); |
setBtState(false); |
||||||
} |
} |
||||||
mAdapter.updateState(task.getDownloadEntity()); |
mAdapter.updateState(task.getDownloadEntity()); |
||||||
} |
} |
||||||
|
|
||||||
@Download.onTaskResume public void onTaskResume(DownloadTask task) { |
@Download.onTaskResume public void onTaskResume(DownloadTask task) { |
||||||
if (task.getKey().equals(DOWNLOAD_URL)) { |
if (task.getKey().equals(DOWNLOAD_URL)) { |
||||||
setBtState(false); |
setBtState(false); |
||||||
} |
} |
||||||
mAdapter.updateState(task.getDownloadEntity()); |
mAdapter.updateState(task.getDownloadEntity()); |
||||||
} |
} |
||||||
|
|
||||||
@Download.onTaskStop public void onTaskStop(DownloadTask task) { |
@Download.onTaskStop public void onTaskStop(DownloadTask task) { |
||||||
if (task.getKey().equals(DOWNLOAD_URL)) { |
if (task.getKey().equals(DOWNLOAD_URL)) { |
||||||
setBtState(true); |
setBtState(true); |
||||||
mStart.setText("恢复"); |
mStart.setText("恢复"); |
||||||
mStart.setTextColor(getResources().getColor(android.R.color.holo_blue_light)); |
mStart.setTextColor(getResources().getColor(android.R.color.holo_blue_light)); |
||||||
} |
} |
||||||
mAdapter.updateState(task.getDownloadEntity()); |
mAdapter.updateState(task.getDownloadEntity()); |
||||||
} |
} |
||||||
|
|
||||||
@Download.onTaskCancel public void onTaskCancel(DownloadTask task) { |
@Download.onTaskCancel public void onTaskCancel(DownloadTask task) { |
||||||
if (task.getKey().equals(DOWNLOAD_URL)) { |
if (task.getKey().equals(DOWNLOAD_URL)) { |
||||||
setBtState(true); |
setBtState(true); |
||||||
mStart.setText("开始"); |
mStart.setText("开始"); |
||||||
mPb.setProgress(0); |
mPb.setProgress(0); |
||||||
} |
} |
||||||
mAdapter.updateState(task.getDownloadEntity()); |
mAdapter.updateState(task.getDownloadEntity()); |
||||||
} |
} |
||||||
|
|
||||||
@Download.onTaskFail public void onTaskFail(DownloadTask task) { |
@Download.onTaskFail public void onTaskFail(DownloadTask task) { |
||||||
if (task.getKey().equals(DOWNLOAD_URL)) { |
if (task.getKey().equals(DOWNLOAD_URL)) { |
||||||
setBtState(true); |
setBtState(true); |
||||||
} else { |
} else { |
||||||
L.d(TAG, "download fail【" + task.getKey() + "】"); |
L.d(TAG, "download fail【" + task.getKey() + "】"); |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
@Download.onTaskComplete public void onTaskComplete(DownloadTask task) { |
@Download.onTaskComplete public void onTaskComplete(DownloadTask task) { |
||||||
if (task.getKey().equals(DOWNLOAD_URL)) { |
if (task.getKey().equals(DOWNLOAD_URL)) { |
||||||
setBtState(true); |
setBtState(true); |
||||||
mStart.setText("重新开始"); |
mStart.setText("重新开始"); |
||||||
mStart.setTextColor(getResources().getColor(android.R.color.holo_green_light)); |
mStart.setTextColor(getResources().getColor(android.R.color.holo_green_light)); |
||||||
mPb.setProgress(100); |
mPb.setProgress(100); |
||||||
} |
} |
||||||
mAdapter.updateState(task.getDownloadEntity()); |
mAdapter.updateState(task.getDownloadEntity()); |
||||||
} |
} |
||||||
|
|
||||||
@Download.onTaskRunning public void onTaskRunning(DownloadTask task) { |
@Download.onTaskRunning public void onTaskRunning(DownloadTask task) { |
||||||
if (task.getKey().equals(DOWNLOAD_URL)) { |
if (task.getKey().equals(DOWNLOAD_URL)) { |
||||||
mPb.setProgress(task.getPercent()); |
mPb.setProgress(task.getPercent()); |
||||||
mSpeed.setText(task.getConvertSpeed()); |
mSpeed.setText(task.getConvertSpeed()); |
||||||
} |
} |
||||||
mAdapter.setProgress(task.getDownloadEntity()); |
mAdapter.setProgress(task.getDownloadEntity()); |
||||||
} |
} |
||||||
} |
} |
||||||
|
@ -1,80 +1,80 @@ |
|||||||
package com.arialyy.simple.core.test; |
package com.arialyy.simple.core.test; |
||||||
|
|
||||||
import android.os.Environment; |
import android.os.Environment; |
||||||
import android.view.View; |
import android.view.View; |
||||||
import com.arialyy.aria.core.Aria; |
import com.arialyy.aria.core.Aria; |
||||||
import com.arialyy.aria.core.common.QueueMod; |
import com.arialyy.aria.core.common.QueueMod; |
||||||
import com.arialyy.simple.R; |
import com.arialyy.simple.R; |
||||||
import com.arialyy.simple.base.BaseActivity; |
import com.arialyy.simple.base.BaseActivity; |
||||||
import com.arialyy.simple.databinding.TestActivityMultiBinding; |
import com.arialyy.simple.databinding.TestActivityMultiBinding; |
||||||
|
|
||||||
/** |
/** |
||||||
* Created by AriaL on 2017/6/15. |
* Created by AriaL on 2017/6/15. |
||||||
*/ |
*/ |
||||||
|
|
||||||
public class TestMutilTaskSysDownload extends BaseActivity<TestActivityMultiBinding> { |
public class TestMutilTaskSysDownload extends BaseActivity<TestActivityMultiBinding> { |
||||||
|
|
||||||
@Override protected int setLayoutId() { |
@Override protected int setLayoutId() { |
||||||
return R.layout.test_activity_multi; |
return R.layout.test_activity_multi; |
||||||
} |
} |
||||||
|
|
||||||
public void onClick(View view) { |
public void onClick(View view) { |
||||||
String baseUrl = "http://file.bmob.cn/"; |
String baseUrl = "http://file.bmob.cn/"; |
||||||
String[] urlArray = { |
String[] urlArray = { |
||||||
"M02/3B/A4/oYYBAFaOeUSAc1QiAAFTbmA7AHs052.jpg", |
"M02/3B/A4/oYYBAFaOeUSAc1QiAAFTbmA7AHs052.jpg", |
||||||
"M02/3B/A4/oYYBAFaOeUaAfYC-AAFD8zf9NXc879.jpg", |
"M02/3B/A4/oYYBAFaOeUaAfYC-AAFD8zf9NXc879.jpg", |
||||||
"M02/3B/A4/oYYBAFaOeUuAOxhnAACSdmbqSac702.jpg", |
"M02/3B/A4/oYYBAFaOeUuAOxhnAACSdmbqSac702.jpg", |
||||||
"M02/3B/A4/oYYBAFaOeU2AFAIGAAFICximvXc924.jpg", |
"M02/3B/A4/oYYBAFaOeU2AFAIGAAFICximvXc924.jpg", |
||||||
"M02/3B/A4/oYYBAFaOeVCAPWMQAAFm2KWCq_E721.jpg", |
"M02/3B/A4/oYYBAFaOeVCAPWMQAAFm2KWCq_E721.jpg", |
||||||
"M02/3B/A4/oYYBAFaOeVOAbiv9AAFfCTTgr94948.jpg", |
"M02/3B/A4/oYYBAFaOeVOAbiv9AAFfCTTgr94948.jpg", |
||||||
"M02/3B/A4/oYYBAFaOeVaAMR3tAAFf3yTuuCM577.jpg", |
"M02/3B/A4/oYYBAFaOeVaAMR3tAAFf3yTuuCM577.jpg", |
||||||
"M02/3B/A4/oYYBAFaOeVmACEWhAAEt72ecbpg468.jpg", |
"M02/3B/A4/oYYBAFaOeVmACEWhAAEt72ecbpg468.jpg", |
||||||
"M02/3B/A4/oYYBAFaOeVyAHHt4AAFg9e9bRio507.jpg", |
"M02/3B/A4/oYYBAFaOeVyAHHt4AAFg9e9bRio507.jpg", |
||||||
"M02/3B/A4/oYYBAFaOeV-AClYXAAESLGY0gag424.jpg", |
"M02/3B/A4/oYYBAFaOeV-AClYXAAESLGY0gag424.jpg", |
||||||
"M02/3B/A4/oYYBAFaOeWKAA7N0AAF3omYOJUI703.jpg", |
"M02/3B/A4/oYYBAFaOeWKAA7N0AAF3omYOJUI703.jpg", |
||||||
"M02/3B/A4/oYYBAFaOeWWAD2lrAAFN7eRFxBs575.jpg", |
"M02/3B/A4/oYYBAFaOeWWAD2lrAAFN7eRFxBs575.jpg", |
||||||
"M02/3B/A4/oYYBAFaOeWiAdCVEAAFg4273Dus313.jpg", |
"M02/3B/A4/oYYBAFaOeWiAdCVEAAFg4273Dus313.jpg", |
||||||
"M02/3B/A4/oYYBAFaOeWyAJDm5AAF8JVoGVb0705.jpg", |
"M02/3B/A4/oYYBAFaOeWyAJDm5AAF8JVoGVb0705.jpg", |
||||||
"M02/3B/A4/oYYBAFaOeW-AUoA8AAGjKiHkXUo181.jpg", |
"M02/3B/A4/oYYBAFaOeW-AUoA8AAGjKiHkXUo181.jpg", |
||||||
"M02/3B/A4/oYYBAFaOeXKABIamAAFU7J7vraE265.jpg", |
"M02/3B/A4/oYYBAFaOeXKABIamAAFU7J7vraE265.jpg", |
||||||
"M02/3B/A5/oYYBAFaOeXaAW09jAAFf37qdwDA457.jpg", |
"M02/3B/A5/oYYBAFaOeXaAW09jAAFf37qdwDA457.jpg", |
||||||
"M02/3B/A5/oYYBAFaOeXmAWmS7AAFtLNpWjgo967.jpg", |
"M02/3B/A5/oYYBAFaOeXmAWmS7AAFtLNpWjgo967.jpg", |
||||||
"M02/3B/A5/oYYBAFaOeX2AQf9cAAF2fhwS2UE145.jpg", |
"M02/3B/A5/oYYBAFaOeX2AQf9cAAF2fhwS2UE145.jpg", |
||||||
"M02/3B/A5/oYYBAFaOeYCAKGnLAAFVAzks-qU937.jpg", |
"M02/3B/A5/oYYBAFaOeYCAKGnLAAFVAzks-qU937.jpg", |
||||||
"M02/3B/A5/oYYBAFaOeYOAMODNAAF6HjTTMq4819.jpg", |
"M02/3B/A5/oYYBAFaOeYOAMODNAAF6HjTTMq4819.jpg", |
||||||
"M02/3B/A5/oYYBAFaOeYeAbn8uAAFLSQLw48Q042.jpg", |
"M02/3B/A5/oYYBAFaOeYeAbn8uAAFLSQLw48Q042.jpg", |
||||||
"M02/3B/A5/oYYBAFaOeYqAMJThAAFtrNe4UNM047.jpg", |
"M02/3B/A5/oYYBAFaOeYqAMJThAAFtrNe4UNM047.jpg", |
||||||
"M02/3B/A5/oYYBAFaOeY2AbnQvAAFNSXWn0Dc026.jpg", |
"M02/3B/A5/oYYBAFaOeY2AbnQvAAFNSXWn0Dc026.jpg", |
||||||
"M02/3B/A5/oYYBAFaOeZCAIsr0AAFHZFEVhPc682.jpg", |
"M02/3B/A5/oYYBAFaOeZCAIsr0AAFHZFEVhPc682.jpg", |
||||||
"M02/3B/A5/oYYBAFaOeZOAGvITAAFqPmfcc9c471.jpg", |
"M02/3B/A5/oYYBAFaOeZOAGvITAAFqPmfcc9c471.jpg", |
||||||
"M02/3B/A5/oYYBAFaOeZaATvjbAAFHDmALnhE003.jpg", |
"M02/3B/A5/oYYBAFaOeZaATvjbAAFHDmALnhE003.jpg", |
||||||
"M02/3B/A5/oYYBAFaOeZmAJPuVAAFfPJC2wsE319.jpg", |
"M02/3B/A5/oYYBAFaOeZmAJPuVAAFfPJC2wsE319.jpg", |
||||||
"M02/3B/A5/oYYBAFaOeZyAXtAmAAFfArJNwtM371.jpg", |
"M02/3B/A5/oYYBAFaOeZyAXtAmAAFfArJNwtM371.jpg", |
||||||
"M02/3B/A5/oYYBAFaOeZ-AGZN0AAFgqwYYCS8004.jpg", |
"M02/3B/A5/oYYBAFaOeZ-AGZN0AAFgqwYYCS8004.jpg", |
||||||
"M02/3B/A5/oYYBAFaOeaOAbbrGAAFcq59JjUo205.jpg", |
"M02/3B/A5/oYYBAFaOeaOAbbrGAAFcq59JjUo205.jpg", |
||||||
"M02/3B/A5/oYYBAFaOeaSAdFyoAACaxVxgUJA092.jpg" |
"M02/3B/A5/oYYBAFaOeaSAdFyoAACaxVxgUJA092.jpg" |
||||||
}; |
}; |
||||||
int maxNum = Aria.get(this).getDownloadConfig().getMaxTaskNum(); |
int maxNum = Aria.get(this).getDownloadConfig().getMaxTaskNum(); |
||||||
Aria.get(this).setDownloadQueueMod(QueueMod.NOW); |
Aria.get(this).setDownloadQueueMod(QueueMod.NOW); |
||||||
for (int i = 0; i < urlArray.length; i++) { |
for (int i = 0; i < urlArray.length; i++) { |
||||||
Aria.download(this) |
Aria.download(this) |
||||||
.load(baseUrl + urlArray[i]) |
.load(baseUrl + urlArray[i]) |
||||||
.setFilePath(Environment.getExternalStorageDirectory() + "/test/" + i + ".jpg") |
.setFilePath(Environment.getExternalStorageDirectory() + "/test/" + i + ".jpg") |
||||||
//.addHeader("Accept-Encoding", "gzip,deflate,sdcn")
|
//.addHeader("Accept-Encoding", "gzip,deflate,sdcn")
|
||||||
.start(); |
.start(); |
||||||
//if (i < maxNum) {
|
//if (i < maxNum) {
|
||||||
// Aria.download(this)
|
// Aria.download(this)
|
||||||
// .load(baseUrl + urlArray[i])
|
// .load(baseUrl + urlArray[i])
|
||||||
// .setDownloadPath(Environment.getExternalStorageDirectory() + "/test/" + i + ".jpg")
|
// .setDownloadPath(Environment.getExternalStorageDirectory() + "/test/" + i + ".jpg")
|
||||||
// //.addHeader("Accept-Encoding", "gzip,deflate,sdcn")
|
// //.addHeader("Accept-Encoding", "gzip,deflate,sdcn")
|
||||||
// .start();
|
// .start();
|
||||||
//} else {
|
//} else {
|
||||||
// Aria.download(this)
|
// Aria.download(this)
|
||||||
// .load(baseUrl + urlArray[i])
|
// .load(baseUrl + urlArray[i])
|
||||||
// .setDownloadPath(Environment.getExternalStorageDirectory() + "/test/" + i + ".jpg")
|
// .setDownloadPath(Environment.getExternalStorageDirectory() + "/test/" + i + ".jpg")
|
||||||
// //.addHeader("Accept-Encoding", "gzip,deflate,sdcn")
|
// //.addHeader("Accept-Encoding", "gzip,deflate,sdcn")
|
||||||
// .add();
|
// .add();
|
||||||
//}
|
//}
|
||||||
} |
} |
||||||
} |
} |
||||||
} |
} |
||||||
|
@ -1,27 +1,27 @@ |
|||||||
## Project-wide Gradle settings. |
## Project-wide Gradle settings. |
||||||
# |
# |
||||||
# 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: -Xmx1024m -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 |
#Wed Dec 07 20:19:22 CST 2016 |
||||||
#org.gradle.daemon=true |
#org.gradle.daemon=true |
||||||
#org.gradle.jvmargs=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 |
#org.gradle.jvmargs=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 |
||||||
# gradle proxy https://chaosleong.github.io/2017/02/10/Configuring-Gradle-Proxy/ |
# gradle proxy https://chaosleong.github.io/2017/02/10/Configuring-Gradle-Proxy/ |
||||||
#systemProp.socksProxyHost=127.0.0.1 |
#systemProp.socksProxyHost=127.0.0.1 |
||||||
#systemProp.socksProxyPort=1080 |
#systemProp.socksProxyPort=1080 |
||||||
#systemprop.socksProxyVersion=5 |
#systemprop.socksProxyVersion=5 |
||||||
|
|
||||||
#Pandroid.debug.obsoleteApi=true |
#Pandroid.debug.obsoleteApi=true |
||||||
|
|
||||||
# androidx https://developer.android.com/studio/preview/features/?hl=zh-cn#androidx_migration |
# androidx https://developer.android.com/studio/preview/features/?hl=zh-cn#androidx_migration |
||||||
#android.useAndroidX=true |
#android.useAndroidX=true |
||||||
#android.enableJetifier=true |
#android.enableJetifier=true |
Loading…
Reference in new issue