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