This commit is contained in:
@@ -26,8 +26,8 @@ dependencies {
|
|||||||
testCompile 'junit:junit:4.12'
|
testCompile 'junit:junit:4.12'
|
||||||
compile 'com.android.support:appcompat-v7:23.1.1'
|
compile 'com.android.support:appcompat-v7:23.1.1'
|
||||||
compile project(':AriaAnnotations')
|
compile project(':AriaAnnotations')
|
||||||
// compile 'com.arialyy.aria:aria-ftp-plug:1.0.4'
|
compile 'com.arialyy.aria:aria-ftp-plug:1.0.4'
|
||||||
|
|
||||||
compile project(':AriaFtpPlug')
|
// compile project(':AriaFtpPlug')
|
||||||
}
|
}
|
||||||
apply from: 'bintray-release.gradle'
|
apply from: 'bintray-release.gradle'
|
||||||
|
|||||||
@@ -113,10 +113,21 @@ class ConfigHelper extends DefaultHandler {
|
|||||||
case "logLevel":
|
case "logLevel":
|
||||||
loadLogLevel(value);
|
loadLogLevel(value);
|
||||||
break;
|
break;
|
||||||
|
case "netCheck":
|
||||||
|
loadNetCheck(value);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void loadNetCheck(String value) {
|
||||||
|
boolean b = checkBoolean(value), temp = false;
|
||||||
|
if (b) {
|
||||||
|
temp = Boolean.valueOf(value);
|
||||||
|
}
|
||||||
|
mAppConfig.netCheck = temp;
|
||||||
|
}
|
||||||
|
|
||||||
private void loadUseBroadcast(String value) {
|
private void loadUseBroadcast(String value) {
|
||||||
boolean b = checkBoolean(value), temp = false;
|
boolean b = checkBoolean(value), temp = false;
|
||||||
|
|
||||||
|
|||||||
@@ -34,8 +34,7 @@ import com.arialyy.aria.util.ALog;
|
|||||||
import com.arialyy.aria.util.CommonUtil;
|
import com.arialyy.aria.util.CommonUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by lyy on 2016/8/22.
|
* Created by lyy on 2016/8/22. 下载命令
|
||||||
* 下载命令
|
|
||||||
*/
|
*/
|
||||||
public abstract class AbsNormalCmd<T extends AbsTaskEntity> extends AbsCmd<T> {
|
public abstract class AbsNormalCmd<T extends AbsTaskEntity> extends AbsCmd<T> {
|
||||||
/**
|
/**
|
||||||
@@ -84,7 +83,7 @@ public abstract class AbsNormalCmd<T extends AbsTaskEntity> extends AbsCmd<T> {
|
|||||||
*/
|
*/
|
||||||
void sendWaitState() {
|
void sendWaitState() {
|
||||||
if (tempTask != null) {
|
if (tempTask != null) {
|
||||||
sendWaitState(tempTask);
|
sendWaitState(tempTask);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,14 +36,14 @@ public interface ISchedulers<Task extends AbsTask> extends Handler.Callback {
|
|||||||
String TASK_TYPE = "ARIA_TASK_TYPE";
|
String TASK_TYPE = "ARIA_TASK_TYPE";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 广播接收器中通过TASK_STATE字段获取任务状态 普通任务的有:
|
* 广播接收器中通过TASK_STATE字段获取任务状态
|
||||||
* </br>
|
*
|
||||||
* {@link #NO_SUPPORT_BREAK_POINT}、{@link #PRE}、{@link #POST_PRE}、{@link #START}、{@link
|
* 普通任务的有: {@link #NO_SUPPORT_BREAK_POINT}、{@link #PRE}、{@link
|
||||||
* #STOP}、{@link #FAIL}、{@link #CANCEL}、{@link #COMPLETE}、{@link #RUNNING}、{@link #RESUME}、{@link
|
* #POST_PRE}、{@link #START}、{@link #STOP}、{@link #FAIL}、{@link #CANCEL}、{@link #COMPLETE}、{@link
|
||||||
* #WAIT}
|
* #RUNNING}、{@link #RESUME}、{@link #WAIT}
|
||||||
* </br>
|
*
|
||||||
* 子任务的有:{@link #SUB_PRE}、{@link #SUB_START}、{@link #SUB_STOP}、{@link #SUB_CANCEL}、{@link
|
* 子任务的有:{@link #SUB_PRE}、{@link #SUB_START}、{@link
|
||||||
* #SUB_FAIL}、{@link #SUB_RUNNING}、{@link #SUB_COMPLETE}
|
* #SUB_STOP}、{@link #SUB_CANCEL}、{@link #SUB_FAIL}、{@link #SUB_RUNNING}、{@link #SUB_COMPLETE}
|
||||||
*/
|
*/
|
||||||
String TASK_STATE = "ARIA_TASK_STATE";
|
String TASK_STATE = "ARIA_TASK_STATE";
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import android.net.ConnectivityManager;
|
|||||||
import android.net.NetworkInfo;
|
import android.net.NetworkInfo;
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import com.arialyy.aria.core.Aria;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 跟网络相关的工具类
|
* 跟网络相关的工具类
|
||||||
@@ -54,6 +55,9 @@ public class NetUtils {
|
|||||||
* @return {@code true} 网络已连接、{@code false}网络未连接
|
* @return {@code true} 网络已连接、{@code false}网络未连接
|
||||||
*/
|
*/
|
||||||
public static boolean isConnected(Context context) {
|
public static boolean isConnected(Context context) {
|
||||||
|
if (!Aria.get(context).getAppConfig().isNetCheck()){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
ConnectivityManager cm =
|
ConnectivityManager cm =
|
||||||
(ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
(ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||||
NetworkInfo ni = cm.getActiveNetworkInfo();
|
NetworkInfo ni = cm.getActiveNetworkInfo();
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
<!--android:name=".download.group.DownloadGroupActivity"-->
|
<!--android:name=".download.group.DownloadGroupActivity"-->
|
||||||
<!--android:name=".MainActivity"-->
|
<!--android:name=".MainActivity"-->
|
||||||
<activity
|
<activity
|
||||||
android:name=".upload.FtpUploadActivity"
|
android:name=".download.SingleTaskActivity"
|
||||||
android:label="@string/app_name">
|
android:label="@string/app_name">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN"/>
|
<action android:name="android.intent.action.MAIN"/>
|
||||||
|
|||||||
@@ -6,6 +6,8 @@
|
|||||||
<useAriaCrashHandler value="true"/>
|
<useAriaCrashHandler value="true"/>
|
||||||
<!--设置Aria的日志级别,{@link ALog#LOG_LEVEL_VERBOSE}-->
|
<!--设置Aria的日志级别,{@link ALog#LOG_LEVEL_VERBOSE}-->
|
||||||
<logLevel value="2"/>
|
<logLevel value="2"/>
|
||||||
|
<!-- 是否检查网络 -->
|
||||||
|
<netCheck value="false"/>
|
||||||
</app>
|
</app>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,14 @@ public class BaseApplication extends Application {
|
|||||||
if (BuildConfig.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
|
if (BuildConfig.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
|
||||||
StrictMode.setThreadPolicy(
|
StrictMode.setThreadPolicy(
|
||||||
new StrictMode.ThreadPolicy.Builder().detectAll().penaltyLog().build());
|
new StrictMode.ThreadPolicy.Builder().detectAll().penaltyLog().build());
|
||||||
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectAll().penaltyLog().build());
|
StrictMode.VmPolicy policy = new StrictMode.VmPolicy.Builder()
|
||||||
|
//.detectLeakedSqlLiteObjects()
|
||||||
|
//.detectLeakedClosableObjects()
|
||||||
|
.detectAll()
|
||||||
|
.penaltyDeath()
|
||||||
|
.penaltyLog()
|
||||||
|
.build();
|
||||||
|
StrictMode.setVmPolicy(policy);
|
||||||
}
|
}
|
||||||
|
|
||||||
registerReceiver(new ConnectionChangeReceiver(),
|
registerReceiver(new ConnectionChangeReceiver(),
|
||||||
|
|||||||
@@ -32,8 +32,7 @@ import com.arialyy.simple.databinding.ActivityFtpUploadBinding;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by lyy on 2017/7/28.
|
* Created by lyy on 2017/7/28. Ftp 文件上传demo
|
||||||
* Ftp 文件上传demo
|
|
||||||
*/
|
*/
|
||||||
public class FtpUploadActivity extends BaseActivity<ActivityFtpUploadBinding> {
|
public class FtpUploadActivity extends BaseActivity<ActivityFtpUploadBinding> {
|
||||||
private final String FILE_PATH = "/mnt/sdcard/AriaPrj.rar";
|
private final String FILE_PATH = "/mnt/sdcard/AriaPrj.rar";
|
||||||
|
|||||||
@@ -27,9 +27,9 @@ import java.io.File;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by lyy on 2016/12/8. 信息配置
|
* Created by lyy on 2016/12/8. 信息配置 kotlin 方式有bug,不能将public去掉
|
||||||
*/
|
*/
|
||||||
final class Configuration {
|
public final class Configuration {
|
||||||
private static final String TAG = "Configuration";
|
private static final String TAG = "Configuration";
|
||||||
private static final String DOWNLOAD_CONFIG_FILE = "/Aria/AriaDownload.cfg";
|
private static final String DOWNLOAD_CONFIG_FILE = "/Aria/AriaDownload.cfg";
|
||||||
private static final String UPLOAD_CONFIG_FILE = "/Aria/AriaUpload.cfg";
|
private static final String UPLOAD_CONFIG_FILE = "/Aria/AriaUpload.cfg";
|
||||||
@@ -207,9 +207,7 @@ final class Configuration {
|
|||||||
int maxSpeed = 0;
|
int maxSpeed = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否使用广播
|
* 是否使用广播 除非无法使用注解,否则不建议使用广播来接受任务 {@code true} 使用广播,{@code false} 不适用广播
|
||||||
* 除非无法使用注解,否则不建议使用广播来接受任务
|
|
||||||
* {@code true} 使用广播,{@code false} 不适用广播
|
|
||||||
*/
|
*/
|
||||||
boolean useBroadcast = false;
|
boolean useBroadcast = false;
|
||||||
|
|
||||||
@@ -479,7 +477,19 @@ final class Configuration {
|
|||||||
*/
|
*/
|
||||||
int logLevel;
|
int logLevel;
|
||||||
|
|
||||||
private AppConfig() {
|
/**
|
||||||
|
* 是否检查网络,{@code true}检查网络
|
||||||
|
*/
|
||||||
|
boolean netCheck = true;
|
||||||
|
|
||||||
|
public boolean isNetCheck() {
|
||||||
|
return netCheck;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AppConfig setNetCheck(boolean netCheck) {
|
||||||
|
this.netCheck = netCheck;
|
||||||
|
save();
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AppConfig setLogLevel(int level) {
|
public AppConfig setLogLevel(int level) {
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ task clean(type: Delete) {
|
|||||||
ext {
|
ext {
|
||||||
userOrg = 'arialyy'
|
userOrg = 'arialyy'
|
||||||
groupId = 'com.arialyy.aria'
|
groupId = 'com.arialyy.aria'
|
||||||
publishVersion = '3.5.2'
|
publishVersion = '3.5.3_dev_1'
|
||||||
// publishVersion = '1.0.4' //FTP插件
|
// publishVersion = '1.0.4' //FTP插件
|
||||||
repoName='maven'
|
repoName='maven'
|
||||||
desc = 'android 下载框架'
|
desc = 'android 下载框架'
|
||||||
|
|||||||
Reference in New Issue
Block a user