修复kotlin设置配置文件ide报错的问题 https://github.com/AriaLyy/Aria/issues/286

pull/330/head
laoyuyu 6 years ago
parent 6d5398de40
commit 7f975b2e91
  1. 15
      Aria/src/main/java/com/arialyy/aria/core/common/AbsFileer.java
  2. 27
      Aria/src/main/java/com/arialyy/aria/core/common/AbsThreadTask.java
  3. 2
      Aria/src/main/java/com/arialyy/aria/core/common/BandwidthLimiter.java
  4. 4
      Aria/src/main/java/com/arialyy/aria/core/download/DownloadGroupTarget.java
  5. 14
      Aria/src/main/java/com/arialyy/aria/core/download/downloader/AbsGroupUtil.java
  6. 3
      Aria/src/main/java/com/arialyy/aria/core/download/downloader/HttpThreadTask.java
  7. 20
      Aria/src/main/java/com/arialyy/aria/core/manager/ThreadTaskManager.java
  8. 2
      AriaFtpPlug/src/main/java/org/apache/commons/net/io/Util.java
  9. 3
      DEV_LOG.md
  10. 10
      README.md
  11. 6
      app/build.gradle
  12. 5
      app/src/main/AndroidManifest.xml
  13. 2
      app/src/main/assets/aria_config.xml
  14. 2
      app/src/main/java/com/arialyy/simple/MainActivity.java
  15. 8
      app/src/main/java/com/arialyy/simple/download/KotlinDownloadActivity.kt
  16. 2
      app/src/main/java/com/arialyy/simple/download/SingleTaskActivity.java
  17. 4
      app/src/main/java/com/arialyy/simple/download/group/DownloadGroupActivity.java
  18. 2
      app/src/main/java/com/arialyy/simple/download/group/GroupModule.java
  19. 6
      app/src/main/java/com/arialyy/simple/test/TestFTPActivity.java
  20. 2
      app/src/main/res/values/strings.xml
  21. 2
      aria/src/main/java/com/arialyy/aria/core/Configuration.java
  22. 6
      build.gradle

@ -42,8 +42,7 @@ import java.util.TimerTask;
* Created by AriaL on 2017/7/1. * Created by AriaL on 2017/7/1.
* 任务处理器 * 任务处理器
*/ */
public abstract class AbsFileer<ENTITY extends AbsNormalEntity, TASK_ENTITY extends AbsTaskEntity<ENTITY>> public abstract class AbsFileer<ENTITY extends AbsNormalEntity, TASK_ENTITY extends AbsTaskEntity<ENTITY>> {
implements Runnable {
private static final String STATE = "_state_"; private static final String STATE = "_state_";
private static final String RECORD = "_record_"; private static final String RECORD = "_record_";
/** /**
@ -104,13 +103,6 @@ public abstract class AbsFileer<ENTITY extends AbsNormalEntity, TASK_ENTITY exte
} }
} }
@Override public void run() {
if (mConstance.isRunning) {
return;
}
startFlow();
}
/** /**
* 重置任务状态 * 重置任务状态
*/ */
@ -280,7 +272,10 @@ public abstract class AbsFileer<ENTITY extends AbsNormalEntity, TASK_ENTITY exte
* 直接调用的时候会自动启动线程执行 * 直接调用的时候会自动启动线程执行
*/ */
public void start() { public void start() {
new Thread(this).start(); if (mConstance.isRunning) {
return;
}
startFlow();
} }
public void resume() { public void resume() {

@ -15,7 +15,6 @@
*/ */
package com.arialyy.aria.core.common; package com.arialyy.aria.core.common;
import android.os.Build;
import com.arialyy.aria.core.AriaManager; import com.arialyy.aria.core.AriaManager;
import com.arialyy.aria.core.inf.AbsNormalEntity; import com.arialyy.aria.core.inf.AbsNormalEntity;
import com.arialyy.aria.core.inf.AbsTaskEntity; import com.arialyy.aria.core.inf.AbsTaskEntity;
@ -29,8 +28,6 @@ import com.arialyy.aria.util.NetUtils;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
@ -58,7 +55,6 @@ public abstract class AbsThreadTask<ENTITY extends AbsNormalEntity, TASK_ENTITY
protected ENTITY mEntity; protected ENTITY mEntity;
protected TASK_ENTITY mTaskEntity; protected TASK_ENTITY mTaskEntity;
private int mFailTimes = 0; private int mFailTimes = 0;
private Timer mFailTimer;
private long mLastSaveTime; private long mLastSaveTime;
private ExecutorService mConfigThreadPool; private ExecutorService mConfigThreadPool;
protected int mConnectTimeOut; //连接超时时间 protected int mConnectTimeOut; //连接超时时间
@ -126,6 +122,7 @@ public abstract class AbsThreadTask<ENTITY extends AbsNormalEntity, TASK_ENTITY
/** /**
* 设置最大下载速度 * 设置最大下载速度
*
* @param speed 单位为kb * @param speed 单位为kb
*/ */
public void setMaxSpeed(int speed) { public void setMaxSpeed(int speed) {
@ -166,6 +163,10 @@ public abstract class AbsThreadTask<ENTITY extends AbsNormalEntity, TASK_ENTITY
return STATE.isRunning; return STATE.isRunning;
} }
public boolean isInterrupted() {
return Thread.currentThread().isInterrupted();
}
/** /**
* 获取线程配置信息 * 获取线程配置信息
*/ */
@ -173,10 +174,6 @@ public abstract class AbsThreadTask<ENTITY extends AbsNormalEntity, TASK_ENTITY
return mConfig; return mConfig;
} }
private boolean filterVersion() {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP;
}
@Override protected void finalize() throws Throwable { @Override protected void finalize() throws Throwable {
super.finalize(); super.finalize();
if (mConfigThreadPool != null) { if (mConfigThreadPool != null) {
@ -333,10 +330,6 @@ public abstract class AbsThreadTask<ENTITY extends AbsNormalEntity, TASK_ENTITY
* @param needRetry 是否可以重试 * @param needRetry 是否可以重试
*/ */
private void retryThis(boolean needRetry) { private void retryThis(boolean needRetry) {
if (mFailTimer != null) {
mFailTimer.purge();
mFailTimer.cancel();
}
if (!NetUtils.isConnected(AriaManager.APP) && !isNotNetRetry) { if (!NetUtils.isConnected(AriaManager.APP) && !isNotNetRetry) {
ALog.w(TAG, String.format("任务【%s】thread__%s__重试失败,网络未连接", mConfig.TEMP_FILE.getName(), ALog.w(TAG, String.format("任务【%s】thread__%s__重试失败,网络未连接", mConfig.TEMP_FILE.getName(),
mConfig.THREAD_ID)); mConfig.THREAD_ID));
@ -345,19 +338,9 @@ public abstract class AbsThreadTask<ENTITY extends AbsNormalEntity, TASK_ENTITY
|| isNotNetRetry) && !isBreak()) { || isNotNetRetry) && !isBreak()) {
ALog.w(TAG, ALog.w(TAG,
String.format("任务【%s】thread__%s__正在重试", mConfig.TEMP_FILE.getName(), mConfig.THREAD_ID)); String.format("任务【%s】thread__%s__正在重试", mConfig.TEMP_FILE.getName(), mConfig.THREAD_ID));
mFailTimer = new Timer(true);
mFailTimer.schedule(new TimerTask() {
@Override public void run() {
if (isBreak()) {
handleFailState(false);
return;
}
mFailTimes++; mFailTimes++;
handleRetryRecord(); handleRetryRecord();
ThreadTaskManager.getInstance().retryThread(AbsThreadTask.this); ThreadTaskManager.getInstance().retryThread(AbsThreadTask.this);
//AbsThreadTask.this.run();
}
}, 3000);
} else { } else {
handleFailState(!isBreak()); handleFailState(!isBreak());
} }

@ -84,7 +84,7 @@ public class BandwidthLimiter {
this.bytesWillBeSentOrReceive += len; this.bytesWillBeSentOrReceive += len;
/* We have sent CHUNK_LENGTH bytes */ /* We have sent CHUNK_LENGTH bytes */
while (this.bytesWillBeSentOrReceive > CHUNK_LENGTH) { while (!Thread.currentThread().isInterrupted() && this.bytesWillBeSentOrReceive > CHUNK_LENGTH) {
long nowTick = System.nanoTime(); long nowTick = System.nanoTime();
long missedTime = this.timeCostPerChunk long missedTime = this.timeCostPerChunk
- (nowTick - this.lastPieceSentOrReceiveTick); - (nowTick - this.lastPieceSentOrReceiveTick);

@ -266,8 +266,8 @@ public class DownloadGroupTarget extends BaseGroupTarget<DownloadGroupTarget> im
if (oldFile.exists()) { if (oldFile.exists()) {
oldFile.renameTo(new File(newPath)); oldFile.renameTo(new File(newPath));
} }
if (DbEntity.checkDataExist(DownloadEntity.class, "downloadPath=?", newPath)) { if (DbEntity.checkDataExist(DownloadEntity.class, "downloadPath=? or isComplete='true'", newPath)) {
ALog.w(TAG, String.format("更新文件名失败,路径【%s】已存在", newPath)); ALog.w(TAG, String.format("更新文件名失败,路径【%s】已存在或文件已下载", newPath));
return; return;
} }

@ -26,13 +26,11 @@ import com.arialyy.aria.util.ALog;
import com.arialyy.aria.util.CommonUtil; import com.arialyy.aria.util.CommonUtil;
import com.arialyy.aria.util.NetUtils; import com.arialyy.aria.util.NetUtils;
import java.io.File; import java.io.File;
import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.Timer; import java.util.Timer;
import java.util.TimerTask; import java.util.TimerTask;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
/** /**
@ -56,7 +54,6 @@ public abstract class AbsGroupUtil implements IUtil {
*/ */
long mTotalLen = 0; long mTotalLen = 0;
long mCurrentLocation = 0; long mCurrentLocation = 0;
private ExecutorService mExePool;
protected IDownloadGroupListener mListener; protected IDownloadGroupListener mListener;
DownloadGroupTaskEntity mGTEntity; DownloadGroupTaskEntity mGTEntity;
private boolean isRunning = false; private boolean isRunning = false;
@ -97,7 +94,6 @@ public abstract class AbsGroupUtil implements IUtil {
AbsGroupUtil(IDownloadGroupListener listener, DownloadGroupTaskEntity groupEntity) { AbsGroupUtil(IDownloadGroupListener listener, DownloadGroupTaskEntity groupEntity) {
mListener = listener; mListener = listener;
mGTEntity = groupEntity; mGTEntity = groupEntity;
mExePool = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
mUpdateInterval = mUpdateInterval =
AriaManager.getInstance(AriaManager.APP).getDownloadConfig().getUpdateInterval(); AriaManager.getInstance(AriaManager.APP).getDownloadConfig().getUpdateInterval();
} }
@ -228,10 +224,6 @@ public abstract class AbsGroupUtil implements IUtil {
isCancel = true; isCancel = true;
closeTimer(); closeTimer();
onCancel(); onCancel();
if (!mExePool.isShutdown()) {
mExePool.shutdown();
}
Set<String> keys = mDownloaderMap.keySet(); Set<String> keys = mDownloaderMap.keySet();
for (String key : keys) { for (String key : keys) {
Downloader dt = mDownloaderMap.get(key); Downloader dt = mDownloaderMap.get(key);
@ -251,9 +243,6 @@ public abstract class AbsGroupUtil implements IUtil {
isStop = true; isStop = true;
closeTimer(); closeTimer();
onStop(); onStop();
if (!mExePool.isShutdown()) {
mExePool.shutdown();
}
Set<String> keys = mDownloaderMap.keySet(); Set<String> keys = mDownloaderMap.keySet();
for (String key : keys) { for (String key : keys) {
@ -392,9 +381,8 @@ public abstract class AbsGroupUtil implements IUtil {
ChildDownloadListener listener = new ChildDownloadListener(taskEntity); ChildDownloadListener listener = new ChildDownloadListener(taskEntity);
Downloader dt = new Downloader(listener, taskEntity); Downloader dt = new Downloader(listener, taskEntity);
mDownloaderMap.put(taskEntity.getEntity().getUrl(), dt); mDownloaderMap.put(taskEntity.getEntity().getUrl(), dt);
if (mExePool.isShutdown()) return dt;
if (start) { if (start) {
mExePool.execute(dt); dt.start();
} }
return dt; return dt;
} }

@ -33,7 +33,6 @@ import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.channels.Channels; import java.nio.channels.Channels;
import java.nio.channels.ClosedByInterruptException;
import java.nio.channels.FileChannel; import java.nio.channels.FileChannel;
import java.nio.channels.ReadableByteChannel; import java.nio.channels.ReadableByteChannel;
@ -68,7 +67,7 @@ final class HttpThreadTask extends AbsThreadTask<DownloadEntity, DownloadTaskEnt
//当前子线程的下载位置 //当前子线程的下载位置
mChildCurrentLocation = mConfig.START_LOCATION; mChildCurrentLocation = mConfig.START_LOCATION;
try { try {
URL url = new URL(CommonUtil.convertUrl(mConfig.URL)); URL url = new URL(CommonUtil.convertUrl(mConfig.URL + 1));
conn = ConnectionHelp.handleConnection(url, mTaskEntity); conn = ConnectionHelp.handleConnection(url, mTaskEntity);
if (mConfig.SUPPORT_BP) { if (mConfig.SUPPORT_BP) {
ALog.d(TAG, ALog.d(TAG,

@ -57,7 +57,7 @@ public class ThreadTaskManager {
* @param key 任务对应的key{@link AbsTaskEntity#getKey()} * @param key 任务对应的key{@link AbsTaskEntity#getKey()}
* @param threadTask 线程任务{@link AbsThreadTask} * @param threadTask 线程任务{@link AbsThreadTask}
*/ */
public void startThread(String key, AbsThreadTask threadTask) { public synchronized void startThread(String key, AbsThreadTask threadTask) {
if (mExePool.isShutdown()) { if (mExePool.isShutdown()) {
ALog.e(TAG, "线程池已经关闭"); ALog.e(TAG, "线程池已经关闭");
return; return;
@ -76,18 +76,23 @@ public class ThreadTaskManager {
* *
* @param key 任务对应的key{@link AbsTaskEntity#getKey()} * @param key 任务对应的key{@link AbsTaskEntity#getKey()}
*/ */
public void stopTaskThread(String key) { public synchronized void stopTaskThread(String key) {
if (mExePool.isShutdown()) { if (mExePool.isShutdown()) {
ALog.e(TAG, "线程池已经关闭"); ALog.e(TAG, "线程池已经关闭");
return; return;
} }
Set<Future> temp = mThreadTasks.get(getKey(key)); Set<Future> temp = mThreadTasks.get(getKey(key));
try {
for (Future future : temp) { for (Future future : temp) {
if (future.isDone() || future.isCancelled()) { if (future.isDone() || future.isCancelled()) {
continue; continue;
} }
future.cancel(true); future.cancel(true);
} }
} catch (Exception e) {
ALog.e(TAG, e);
}
temp.clear();
mThreadTasks.remove(key); mThreadTasks.remove(key);
} }
@ -96,11 +101,20 @@ public class ThreadTaskManager {
* *
* @param task 线程任务 * @param task 线程任务
*/ */
public void retryThread(AbsThreadTask task) { public synchronized void retryThread(AbsThreadTask task) {
if (mExePool.isShutdown()) { if (mExePool.isShutdown()) {
ALog.e(TAG, "线程池已经关闭"); ALog.e(TAG, "线程池已经关闭");
return; return;
} }
try {
if (task == null || task.isInterrupted()) {
ALog.e(TAG, "线程为空或线程已经中断");
return;
}
} catch (Exception e) {
ALog.e(TAG, e);
return;
}
mExePool.submit(task); mExePool.submit(task);
} }

@ -92,7 +92,7 @@ public final class Util {
byte[] buffer = new byte[bufferSize > 0 ? bufferSize : DEFAULT_COPY_BUFFER_SIZE]; byte[] buffer = new byte[bufferSize > 0 ? bufferSize : DEFAULT_COPY_BUFFER_SIZE];
try { try {
while ((numBytes = source.read(buffer)) != -1) { while (!Thread.currentThread().isInterrupted() && (numBytes = source.read(buffer)) != -1) {
// Technically, some read(byte[]) methods may return 0 and we cannot // Technically, some read(byte[]) methods may return 0 and we cannot
// accept that as an indication of EOF. // accept that as an indication of EOF.

@ -1,4 +1,7 @@
## 开发日志 ## 开发日志
+ v_3.4.12
- fix bug https://github.com/AriaLyy/Aria/issues/286
- 优化线程池任务
+ v_3.4.11 + v_3.4.11
- fix bug https://github.com/AriaLyy/Aria/issues/288 - fix bug https://github.com/AriaLyy/Aria/issues/288
- fix bug https://github.com/AriaLyy/Aria/issues/282 - fix bug https://github.com/AriaLyy/Aria/issues/282

@ -32,8 +32,8 @@ Aria有以下特点:
[![Download](https://api.bintray.com/packages/arialyy/maven/AriaApi/images/download.svg)](https://bintray.com/arialyy/maven/AriaApi/_latestVersion) [![Download](https://api.bintray.com/packages/arialyy/maven/AriaApi/images/download.svg)](https://bintray.com/arialyy/maven/AriaApi/_latestVersion)
[![Download](https://api.bintray.com/packages/arialyy/maven/AriaCompiler/images/download.svg)](https://bintray.com/arialyy/maven/AriaCompiler/_latestVersion) [![Download](https://api.bintray.com/packages/arialyy/maven/AriaCompiler/images/download.svg)](https://bintray.com/arialyy/maven/AriaCompiler/_latestVersion)
```java ```java
compile 'com.arialyy.aria:aria-core:3.4.11' compile 'com.arialyy.aria:aria-core:3.4.12'
annotationProcessor 'com.arialyy.aria:aria-compiler:3.4.11' annotationProcessor 'com.arialyy.aria:aria-compiler:3.4.12'
``` ```
如果出现android support,请将 `compile 'com.arialyy.aria:aria-core:<last-version>'`替换为 如果出现android support,请将 `compile 'com.arialyy.aria:aria-core:<last-version>'`替换为
``` ```
@ -101,9 +101,9 @@ protected void onCreate(Bundle savedInstanceState) {
### 版本日志 ### 版本日志
+ v_3.4.11 + v_3.4.12
- fix bug https://github.com/AriaLyy/Aria/issues/288 - fix bug https://github.com/AriaLyy/Aria/issues/286
- fix bug https://github.com/AriaLyy/Aria/issues/282 - 优化线程池任务
[更多版本记录](https://github.com/AriaLyy/Aria/blob/master/DEV_LOG.md) [更多版本记录](https://github.com/AriaLyy/Aria/blob/master/DEV_LOG.md)

@ -1,6 +1,6 @@
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
//apply plugin: 'kotlin-android' apply plugin: 'kotlin-android'
//apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-android-extensions'
//apply plugin: 'kotlin-kapt' //apply plugin: 'kotlin-kapt'
android { android {
@ -51,7 +51,7 @@ dependencies {
compile 'com.arialyy.frame:MVVM2:2.2.0' compile 'com.arialyy.frame:MVVM2:2.2.0'
compile project(':Aria') compile project(':Aria')
compile project(':AriaCompiler') compile project(':AriaCompiler')
// compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
// compile 'com.arialyy.aria:aria-core:3.3.16' // compile 'com.arialyy.aria:aria-core:3.3.16'
// annotationProcessor 'com.arialyy.aria:aria-compiler:3.3.16' // annotationProcessor 'com.arialyy.aria:aria-compiler:3.3.16'
debugCompile 'com.amitshekhar.android:debug-db:1.0.0' debugCompile 'com.amitshekhar.android:debug-db:1.0.0'

@ -14,10 +14,11 @@
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme.NoActionBar"> android:theme="@style/AppTheme.NoActionBar">
<!--android:name=".MainActivity"--> <!--android:name=".MainActivity"-->
<!--android:name=".download.group.DownloadGroupActivity"-->
<!--android:name=".test.TestFTPDirActivity"--> <!--android:name=".test.TestFTPDirActivity"-->
<!--android:name=".test.TestFTPActivity"-->
<!--android:name=".test.AnyRunActivity"--> <!--android:name=".test.AnyRunActivity"-->
<!--android:name=".download.SingleTaskActivity"-->
<!--android:name=".test.TestFTPActivity"-->
<!--android:name=".download.group.DownloadGroupActivity"-->
<activity <activity
android:name=".download.SingleTaskActivity" android:name=".download.SingleTaskActivity"
android:label="@string/app_name"> android:label="@string/app_name">

@ -35,7 +35,7 @@
3、从3.4.1开始,如果线程数为1,文件初始化时将不再预占用对应长度的空间,下载多少byte,则占多大的空间; 3、从3.4.1开始,如果线程数为1,文件初始化时将不再预占用对应长度的空间,下载多少byte,则占多大的空间;
对于采用多线程的任务或旧任务,依然采用原来的文件空间占用方式; 对于采用多线程的任务或旧任务,依然采用原来的文件空间占用方式;
--> -->
<threadNum value="3"/> <threadNum value="1"/>
<!--设置下载队列最大任务数, 默认为2--> <!--设置下载队列最大任务数, 默认为2-->
<maxTaskNum value="1"/> <maxTaskNum value="1"/>

@ -20,6 +20,7 @@ import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
import butterknife.OnClick; import butterknife.OnClick;
import com.arialyy.aria.core.Aria;
import com.arialyy.simple.base.BaseActivity; import com.arialyy.simple.base.BaseActivity;
import com.arialyy.simple.databinding.ActivityMainBinding; import com.arialyy.simple.databinding.ActivityMainBinding;
import com.arialyy.simple.download.DownloadActivity; import com.arialyy.simple.download.DownloadActivity;
@ -39,6 +40,7 @@ public class MainActivity extends BaseActivity<ActivityMainBinding> {
setSupportActionBar(mBar); setSupportActionBar(mBar);
mBar.setTitle("Aria Demo"); mBar.setTitle("Aria Demo");
getSupportActionBar().setDisplayHomeAsUpEnabled(false); getSupportActionBar().setDisplayHomeAsUpEnabled(false);
} }
@Override protected int setLayoutId() { @Override protected int setLayoutId() {

@ -41,12 +41,14 @@ class KotlinDownloadActivity : AppCompatActivity() {
// setBtState(false) // setBtState(false)
// } // }
// binding.fileSize = target.getConvertFileSize() // binding.fileSize = target.getConvertFileSize()
Aria.get(this).downloadConfig.maxTaskNum = 2
Aria.download(this).register() Aria.download(this).register()
} }
@Download.onTaskRunning protected fun running(task: DownloadTask) { @Download.onTaskRunning
protected fun running(task: DownloadTask) {
Log.d(TAG, task.percent.toString() + "") Log.d(TAG, task.percent.toString() + "")
val len = task.fileSize // val len = task.fileSize
// if (len == 0L) { // if (len == 0L) {
// binding.progress = 0 // binding.progress = 0
// } else { // } else {
@ -65,7 +67,7 @@ class KotlinDownloadActivity : AppCompatActivity() {
private fun startD() { private fun startD() {
Aria.download(this) Aria.download(this)
.load(DOWNLOAD_URL, true) .load(DOWNLOAD_URL)
.addHeader("groupName", "value") .addHeader("groupName", "value")
.setDownloadPath(Environment.getExternalStorageDirectory().path + "/hhhhhhhh.apk") .setDownloadPath(Environment.getExternalStorageDirectory().path + "/hhhhhhhh.apk")
.start() .start()

@ -245,7 +245,7 @@ public class SingleTaskActivity extends BaseActivity<ActivitySingleBinding> {
//.addHeader("Cookie", "BAIDUID=648E5FF020CC69E8DD6F492D1068AAA9:FG=1; BIDUPSID=648E5FF020CC69E8DD6F492D1068AAA9; PSTM=1519099573; BD_UPN=12314753; locale=zh; BDSVRTM=0") //.addHeader("Cookie", "BAIDUID=648E5FF020CC69E8DD6F492D1068AAA9:FG=1; BIDUPSID=648E5FF020CC69E8DD6F492D1068AAA9; PSTM=1519099573; BD_UPN=12314753; locale=zh; BDSVRTM=0")
//.useServerFileName(true) //.useServerFileName(true)
//.setRequestMode(RequestEnum.GET) //.setRequestMode(RequestEnum.GET)
.setFilePath(Environment.getExternalStorageDirectory().getPath() + "/ggsg3.apk") .setFilePath(Environment.getExternalStorageDirectory().getPath() + "/ggsg4.apk")
//.resetState() //.resetState()
.start(); .start();
//.add(); //.add();

@ -47,7 +47,7 @@ public class DownloadGroupActivity extends BaseActivity<ActivityDownloadGroupBin
super.init(savedInstanceState); super.init(savedInstanceState);
Aria.download(this).register(); Aria.download(this).register();
setTitle("任务组"); setTitle("任务组");
mUrls = getModule(GroupModule.class).getUrls1(); mUrls = getModule(GroupModule.class).getUrls();
DownloadGroupTaskEntity entity = Aria.download(this).getGroupTask(mUrls); DownloadGroupTaskEntity entity = Aria.download(this).getGroupTask(mUrls);
if (entity != null && entity.getEntity() != null) { if (entity != null && entity.getEntity() != null) {
DownloadGroupEntity groupEntity = entity.getEntity(); DownloadGroupEntity groupEntity = entity.getEntity();
@ -91,7 +91,7 @@ public class DownloadGroupActivity extends BaseActivity<ActivityDownloadGroupBin
.setGroupAlias("任务组测试") .setGroupAlias("任务组测试")
//.setSubFileName(getModule(GroupModule.class).getSubName2()) //.setSubFileName(getModule(GroupModule.class).getSubName2())
.setSubFileName(getModule(GroupModule.class).getSubName()) .setSubFileName(getModule(GroupModule.class).getSubName())
.updateUrls(temp) //.updateUrls(temp)
.start(); .start();
break; break;
case R.id.stop: case R.id.stop:

@ -32,7 +32,7 @@ public class GroupModule extends BaseModule {
public List<String> getUrls() { public List<String> getUrls() {
List<String> urls = new ArrayList<>(); List<String> urls = new ArrayList<>();
String[] str = getContext().getResources().getStringArray(R.array.group_url4); String[] str = getContext().getResources().getStringArray(R.array.group_urls_1);
Collections.addAll(urls, str); Collections.addAll(urls, str);
return urls; return urls;
} }

@ -82,9 +82,9 @@ public class TestFTPActivity extends BaseActivity<ActivityTestBinding> {
.loadFtp(FILE_PATH) .loadFtp(FILE_PATH)
.login("lao", "123456") .login("lao", "123456")
.setUploadUrl(URL) .setUploadUrl(URL)
//.asFtps() .asFtps()
//.setStorePath("/mnt/sdcard/Download/server.crt") .setStorePath("/mnt/sdcard/Download/server.crt")
//.setAlias("www.laoyuyu.me") .setAlias("www.laoyuyu.me")
.start(); .start();
//Uri uri = Uri.parse("ftp://z:z@dygod18.com:21211/[电影天堂www.dy2018.com]猩球崛起3:终极之战BD国英双语中英双字.mkv"); //Uri uri = Uri.parse("ftp://z:z@dygod18.com:21211/[电影天堂www.dy2018.com]猩球崛起3:终极之战BD国英双语中英双字.mkv");
//ALog.d(TAG, "sh = " + uri.getScheme() + ", user = " + uri.getUserInfo() + ", host = " + uri.getHost() + ", port = " + uri.getPort() + " remotePath = " + uri.getPath()); //ALog.d(TAG, "sh = " + uri.getScheme() + ", user = " + uri.getUserInfo() + ", host = " + uri.getHost() + ", port = " + uri.getPort() + " remotePath = " + uri.getPath());

@ -85,7 +85,7 @@
</string-array> </string-array>
<string-array name="group_names"> <string-array name="group_names">
<!--<item>王者荣耀.apk</item>--> <item>王者荣耀.apk</item>
<item>战斗吧剑灵.apk</item> <item>战斗吧剑灵.apk</item>
<!--<item>天魔幻想.apk</item>--> <!--<item>天魔幻想.apk</item>-->
</string-array> </string-array>

@ -34,7 +34,7 @@ import java.util.Properties;
* Created by lyy on 2016/12/8. * Created by lyy on 2016/12/8.
* 信息配置 * 信息配置
*/ */
class Configuration { public class Configuration {
static final String TAG = "Configuration"; static final String TAG = "Configuration";
static final String DOWNLOAD_CONFIG_FILE = "/Aria/DownloadConfig.properties"; static final String DOWNLOAD_CONFIG_FILE = "/Aria/DownloadConfig.properties";
static final String UPLOAD_CONFIG_FILE = "/Aria/UploadConfig.properties"; static final String UPLOAD_CONFIG_FILE = "/Aria/UploadConfig.properties";

@ -1,6 +1,6 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules. // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript { buildscript {
// ext.kotlin_version = '1.1.51' ext.kotlin_version = '1.1.51'
repositories { repositories {
jcenter() jcenter()
mavenCentral() mavenCentral()
@ -9,7 +9,7 @@ buildscript {
// classpath 'com.android.tools.build:gradle:2.3.3' // classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.android.tools.build:gradle:2.2.2' classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.novoda:bintray-release:0.5.0' classpath 'com.novoda:bintray-release:0.5.0'
// classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7' // classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7'
// classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' // classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
@ -39,7 +39,7 @@ task clean(type: Delete) {
ext { ext {
userOrg = 'arialyy' userOrg = 'arialyy'
groupId = 'com.arialyy.aria' groupId = 'com.arialyy.aria'
publishVersion = '3.4.11' publishVersion = '3.4.12'
// publishVersion = '1.0.3' //FTP插件 // publishVersion = '1.0.3' //FTP插件
repoName='maven' repoName='maven'
desc = 'android 下载框架' desc = 'android 下载框架'

Loading…
Cancel
Save