diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1ddf..00000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Aria/build.gradle b/Aria/build.gradle index a5ed9184..1fa8d679 100644 --- a/Aria/build.gradle +++ b/Aria/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' android { compileSdkVersion 23 - buildToolsVersion "23.0.2" + buildToolsVersion '25.0.2' defaultConfig { minSdkVersion 9 diff --git a/Aria/src/main/java/com/arialyy/aria/core/Aria.java b/Aria/src/main/java/com/arialyy/aria/core/Aria.java index a897e990..c1b20207 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/Aria.java +++ b/Aria/src/main/java/com/arialyy/aria/core/Aria.java @@ -27,7 +27,6 @@ import android.content.Context; import android.os.Build; import android.widget.PopupWindow; import com.arialyy.aria.core.download.DownloadReceiver; -import com.arialyy.aria.core.scheduler.DownloadSchedulers; import com.arialyy.aria.core.scheduler.IDownloadSchedulerListener; import com.arialyy.aria.core.scheduler.ISchedulerListener; import com.arialyy.aria.core.download.DownloadTask; @@ -207,8 +206,8 @@ import com.arialyy.aria.core.upload.UploadTask; /** * 下载任务状态监听 */ - public static class DownloadSchedulerListener implements - IDownloadSchedulerListener { + public static class DownloadSchedulerListener + implements IDownloadSchedulerListener { @Override public void onTaskPre(DownloadTask task) { diff --git a/Aria/src/main/java/com/arialyy/aria/core/AriaManager.java b/Aria/src/main/java/com/arialyy/aria/core/AriaManager.java index 3be6dd9f..c896c415 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/AriaManager.java +++ b/Aria/src/main/java/com/arialyy/aria/core/AriaManager.java @@ -257,7 +257,10 @@ import java.util.Map; } else if (obj instanceof Application) { key = clsName; } - } else { + } + if (obj instanceof Activity || obj instanceof Service) { + key = clsName; + } else if (obj instanceof Application) { key = clsName; } if (TextUtils.isEmpty(key)) { diff --git a/Aria/src/main/java/com/arialyy/aria/core/download/ConnectionHelp.java b/Aria/src/main/java/com/arialyy/aria/core/download/ConnectionHelp.java index 65705cf1..0476ce8f 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/download/ConnectionHelp.java +++ b/Aria/src/main/java/com/arialyy/aria/core/download/ConnectionHelp.java @@ -77,6 +77,9 @@ class ConnectionHelp { "image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/xaml+xml, application/vnd.ms-xpsdocument, application/x-ms-xbap, application/x-ms-application, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*"); ////用于处理Disconnect 不起作用问题 //conn.setRequestProperty("Connection", "close"); + conn.setRequestProperty("Connection", "Keep-Alive"); + //302获取重定向地址 + conn.setInstanceFollowRedirects(false); return conn; } } diff --git a/Aria/src/main/java/com/arialyy/aria/core/download/DownloadEntity.java b/Aria/src/main/java/com/arialyy/aria/core/download/DownloadEntity.java index 3ab34a32..aa46891d 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/download/DownloadEntity.java +++ b/Aria/src/main/java/com/arialyy/aria/core/download/DownloadEntity.java @@ -30,15 +30,6 @@ import com.arialyy.aria.orm.DbEntity; * !!!并且需要Parcelable时需要手动填写rowID; */ public class DownloadEntity extends DbEntity implements Parcelable, IEntity { - @Ignore public static final Creator CREATOR = new Creator() { - @Override public DownloadEntity createFromParcel(Parcel source) { - return new DownloadEntity(source); - } - - @Override public DownloadEntity[] newArray(int size) { - return new DownloadEntity[size]; - } - }; @Ignore private long speed = 0; //下载速度 @Ignore private int failNum = 0; private String downloadUrl = ""; //下载路径 @@ -50,25 +41,12 @@ public class DownloadEntity extends DbEntity implements Parcelable, IEntity { private boolean isDownloadComplete = false; //是否下载完成 private long currentProgress = 0; //当前下载进度 private long completeTime; //完成时间 + private boolean isRedirect = false; + private String redirectUrl = ""; //重定向链接 public DownloadEntity() { } - protected DownloadEntity(Parcel in) { - this.downloadUrl = in.readString(); - this.downloadPath = in.readString(); - this.fileName = in.readString(); - this.str = in.readString(); - this.completeTime = in.readLong(); - this.fileSize = in.readLong(); - this.state = in.readInt(); - this.isDownloadComplete = in.readByte() != 0; - this.currentProgress = in.readLong(); - this.failNum = in.readInt(); - this.speed = in.readLong(); - this.rowID = in.readInt(); - } - public String getStr() { return str; } @@ -164,16 +142,40 @@ public class DownloadEntity extends DbEntity implements Parcelable, IEntity { return (DownloadEntity) super.clone(); } + public boolean isRedirect() { + return isRedirect; + } + + public void setRedirect(boolean redirect) { + isRedirect = redirect; + } + + public String getRedirectUrl() { + return redirectUrl; + } + + public void setRedirectUrl(String redirectUrl) { + this.redirectUrl = redirectUrl; + } + @Override public String toString() { return "DownloadEntity{" - + "downloadUrl='" + + "speed=" + + speed + + ", failNum=" + + failNum + + ", downloadUrl='" + downloadUrl + '\'' + ", downloadPath='" + downloadPath + '\'' - + ", completeTime=" - + completeTime + + ", fileName='" + + fileName + + '\'' + + ", str='" + + str + + '\'' + ", fileSize=" + fileSize + ", state=" @@ -182,8 +184,13 @@ public class DownloadEntity extends DbEntity implements Parcelable, IEntity { + isDownloadComplete + ", currentProgress=" + currentProgress - + ", failNum=" - + failNum + + ", completeTime=" + + completeTime + + ", isRedirect=" + + isRedirect + + ", redirectUrl='" + + redirectUrl + + '\'' + '}'; } @@ -192,17 +199,44 @@ public class DownloadEntity extends DbEntity implements Parcelable, IEntity { } @Override public void writeToParcel(Parcel dest, int flags) { + dest.writeLong(this.speed); + dest.writeInt(this.failNum); dest.writeString(this.downloadUrl); dest.writeString(this.downloadPath); dest.writeString(this.fileName); dest.writeString(this.str); - dest.writeLong(this.completeTime); dest.writeLong(this.fileSize); dest.writeInt(this.state); dest.writeByte(this.isDownloadComplete ? (byte) 1 : (byte) 0); dest.writeLong(this.currentProgress); - dest.writeInt(this.failNum); - dest.writeLong(this.speed); - dest.writeInt(this.rowID); + dest.writeLong(this.completeTime); + dest.writeByte(this.isRedirect ? (byte) 1 : (byte) 0); + dest.writeString(this.redirectUrl); + } + + protected DownloadEntity(Parcel in) { + this.speed = in.readLong(); + this.failNum = in.readInt(); + this.downloadUrl = in.readString(); + this.downloadPath = in.readString(); + this.fileName = in.readString(); + this.str = in.readString(); + this.fileSize = in.readLong(); + this.state = in.readInt(); + this.isDownloadComplete = in.readByte() != 0; + this.currentProgress = in.readLong(); + this.completeTime = in.readLong(); + this.isRedirect = in.readByte() != 0; + this.redirectUrl = in.readString(); } + + @Ignore public static final Creator CREATOR = new Creator() { + @Override public DownloadEntity createFromParcel(Parcel source) { + return new DownloadEntity(source); + } + + @Override public DownloadEntity[] newArray(int size) { + return new DownloadEntity[size]; + } + }; } \ No newline at end of file diff --git a/Aria/src/main/java/com/arialyy/aria/core/download/DownloadTarget.java b/Aria/src/main/java/com/arialyy/aria/core/download/DownloadTarget.java index 3e5c0334..e23acbe5 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/download/DownloadTarget.java +++ b/Aria/src/main/java/com/arialyy/aria/core/download/DownloadTarget.java @@ -17,6 +17,7 @@ package com.arialyy.aria.core.download; import android.support.annotation.NonNull; import android.text.TextUtils; +import android.util.Log; import com.arialyy.aria.core.RequestEnum; import com.arialyy.aria.core.inf.AbsTarget; import com.arialyy.aria.core.queue.DownloadTaskQueue; @@ -44,6 +45,13 @@ public class DownloadTarget extends AbsTarget protected TASK_ENTITY taskEntity; protected String targetName; + /** + * 重定向后,新url的key,默认为location + */ + protected void _setRedirectUrlKey(String redirectUrlKey) { + if (TextUtils.isEmpty(redirectUrlKey)) { + Log.w("AbsTarget", "重定向后,新url的key不能为null"); + return; + } + taskEntity.redirectUrlKey = redirectUrlKey; + } + /** * 获取任务文件大小 * diff --git a/Aria/src/main/java/com/arialyy/aria/core/inf/ITaskEntity.java b/Aria/src/main/java/com/arialyy/aria/core/inf/ITaskEntity.java index e9f621a2..003d6d1a 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/inf/ITaskEntity.java +++ b/Aria/src/main/java/com/arialyy/aria/core/inf/ITaskEntity.java @@ -34,5 +34,10 @@ public abstract class ITaskEntity { */ public RequestEnum requestEnum = RequestEnum.GET; + /** + * 重定向后,新url的key + */ + public String redirectUrlKey = "location"; + public abstract IEntity getEntity(); } diff --git a/Aria/src/main/java/com/arialyy/aria/core/scheduler/DownloadSchedulers.java b/Aria/src/main/java/com/arialyy/aria/core/scheduler/DownloadSchedulers.java index d7cab16d..2ef63d82 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/scheduler/DownloadSchedulers.java +++ b/Aria/src/main/java/com/arialyy/aria/core/scheduler/DownloadSchedulers.java @@ -95,7 +95,6 @@ public class DownloadSchedulers implements ISchedulers { startNextTask(); break; case FAIL: - //mQueue.removeTask(entity); handleFailTask(task); break; } diff --git a/Aria/src/main/java/com/arialyy/aria/orm/DBMapping.java b/Aria/src/main/java/com/arialyy/aria/orm/DBMapping.java new file mode 100644 index 00000000..54dda504 --- /dev/null +++ b/Aria/src/main/java/com/arialyy/aria/orm/DBMapping.java @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2016 AriaLyy(https://github.com/AriaLyy/Aria) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.arialyy.aria.orm; + +import java.util.HashMap; +import java.util.Map; + +/** + * Created by Aria.Lao on 2017/4/6. + * DB映射表 + */ +public class DBMapping { + static Map mapping = new HashMap<>(); + + static { + mapping.put("DownloadEntity", "com.arialyy.aria.core.download.DownloadEntity"); + mapping.put("UploadEntity", "com.arialyy.aria.core.upload.UploadEntity"); + } +} diff --git a/Aria/src/main/java/com/arialyy/aria/orm/DbUtil.java b/Aria/src/main/java/com/arialyy/aria/orm/DbUtil.java index 443bd98d..1e691daa 100644 --- a/Aria/src/main/java/com/arialyy/aria/orm/DbUtil.java +++ b/Aria/src/main/java/com/arialyy/aria/orm/DbUtil.java @@ -21,6 +21,7 @@ import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.support.annotation.NonNull; +import android.text.TextUtils; import android.util.Log; import com.arialyy.aria.util.CheckUtil; import com.arialyy.aria.util.CommonUtil; @@ -37,12 +38,12 @@ public class DbUtil { private static final String TAG = "DbUtil"; private static final Object LOCK = new Object(); private volatile static DbUtil INSTANCE = null; - private int CREATE_TABLE = 0; - private int TABLE_EXISTS = 1; - private int INSERT_DATA = 2; - private int MODIFY_DATA = 3; - private int FIND_DATA = 4; - private int FIND_ALL_DATA = 5; + private static final int CREATE_TABLE = 0; + private static final int TABLE_EXISTS = 1; + private static final int INSERT_DATA = 2; + private static final int MODIFY_DATA = 3; + private static final int FIND_DATA = 4; + private static final int FIND_ALL_DATA = 5; private int DEL_DATA = 6; private int ROW_ID = 7; private SQLiteDatabase mDb; @@ -53,6 +54,11 @@ public class DbUtil { } private DbUtil(Context context) { + //mHelper = new SqlHelper(context.getApplicationContext(), new SqlHelper.UpgradeListener() { + // @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { + // + // } + //}); mHelper = new SqlHelper(context.getApplicationContext()); } @@ -136,9 +142,10 @@ public class DbUtil { } sb.append(i > 0 ? ", " : ""); try { + Object value = field.get(dbEntity); sb.append(field.getName()) .append("='") - .append(field.get(dbEntity).toString()) + .append(value == null ? "" : value.toString()) .append("'"); } catch (IllegalAccessException e) { e.printStackTrace(); @@ -156,15 +163,24 @@ public class DbUtil { * 遍历所有数据 */ synchronized List findAllData(Class clazz) { - if (!tableExists(clazz)) { - createTable(clazz); + if (mDb == null || !mDb.isOpen()) { + mDb = mHelper.getReadableDatabase(); + } + return findAllData(mDb, clazz); + } + + /** + * 遍历所有数据 + */ + static synchronized List findAllData(SQLiteDatabase db, Class clazz) { + if (!tableExists(db, clazz)) { + createTable(db, clazz, null); } - mDb = mHelper.getReadableDatabase(); StringBuilder sb = new StringBuilder(); sb.append("SELECT rowid, * FROM ").append(CommonUtil.getClassName(clazz)); print(FIND_ALL_DATA, sb.toString()); - Cursor cursor = mDb.rawQuery(sb.toString(), null); - return cursor.getCount() > 0 ? newInstanceEntity(clazz, cursor) : null; + Cursor cursor = db.rawQuery(sb.toString(), null); + return cursor.getCount() > 0 ? newInstanceEntity(db, clazz, cursor) : null; } /** @@ -186,7 +202,7 @@ public class DbUtil { sql = String.format(sql, params); print(FIND_DATA, sql); Cursor cursor = mDb.rawQuery(sql, null); - return cursor.getCount() > 0 ? newInstanceEntity(clazz, cursor) : null; + return cursor.getCount() > 0 ? newInstanceEntity(mDb, clazz, cursor) : null; } /** @@ -215,18 +231,17 @@ public class DbUtil { } print(FIND_DATA, sb.toString()); Cursor cursor = mDb.rawQuery(sb.toString(), null); - return cursor.getCount() > 0 ? newInstanceEntity(clazz, cursor) : null; + return cursor.getCount() > 0 ? newInstanceEntity(mDb, clazz, cursor) : null; } /** * 插入数据 */ - synchronized void insertData(DbEntity dbEntity) { + static synchronized void insertData(SQLiteDatabase db, DbEntity dbEntity) { Class clazz = dbEntity.getClass(); - if (!tableExists(clazz)) { - createTable(clazz); + if (!tableExists(db, clazz)) { + createTable(db, clazz, null); } - mDb = mHelper.getWritableDatabase(); Field[] fields = CommonUtil.getFields(clazz); if (fields != null && fields.length > 0) { StringBuilder sb = new StringBuilder(); @@ -259,8 +274,18 @@ public class DbUtil { } sb.append(")"); print(INSERT_DATA, sb.toString()); - mDb.execSQL(sb.toString()); + db.execSQL(sb.toString()); + } + } + + /** + * 插入数据 + */ + synchronized void insertData(DbEntity dbEntity) { + if (mDb == null || !mDb.isOpen()) { + mDb = mHelper.getReadableDatabase(); } + insertData(mDb, dbEntity); close(); } @@ -271,6 +296,10 @@ public class DbUtil { if (mDb == null || !mDb.isOpen()) { mDb = mHelper.getReadableDatabase(); } + return tableExists(mDb, clazz); + } + + static synchronized boolean tableExists(SQLiteDatabase db, Class clazz) { Cursor cursor = null; try { StringBuilder sb = new StringBuilder(); @@ -278,7 +307,7 @@ public class DbUtil { sb.append(CommonUtil.getClassName(clazz)); sb.append("'"); print(TABLE_EXISTS, sb.toString()); - cursor = mDb.rawQuery(sb.toString(), null); + cursor = db.rawQuery(sb.toString(), null); if (cursor != null && cursor.moveToNext()) { int count = cursor.getInt(0); if (count > 0) { @@ -289,22 +318,20 @@ public class DbUtil { e.printStackTrace(); } finally { if (cursor != null) cursor.close(); - close(); + if (db != null) { + db.close(); + } } return false; } - /** - * 创建表 - */ - private synchronized void createTable(Class clazz) { - if (mDb == null || !mDb.isOpen()) { - mDb = mHelper.getWritableDatabase(); - } + static synchronized void createTable(SQLiteDatabase db, Class clazz, String tableName) { Field[] fields = CommonUtil.getFields(clazz); if (fields != null && fields.length > 0) { StringBuilder sb = new StringBuilder(); - sb.append("create table ").append(CommonUtil.getClassName(clazz)).append("("); + sb.append("create table ") + .append(TextUtils.isEmpty(tableName) ? CommonUtil.getClassName(clazz) : tableName) + .append("("); for (Field field : fields) { field.setAccessible(true); if (ignoreField(field)) { @@ -336,15 +363,31 @@ public class DbUtil { String str = sb.toString(); str = str.substring(0, str.length() - 1) + ");"; print(CREATE_TABLE, str); - mDb.execSQL(str); + db.execSQL(str); + } + if (db != null) { + db.close(); } - close(); + } + + synchronized void createTable(Class clazz, String tableName) { + if (mDb == null || !mDb.isOpen()) { + mDb = mHelper.getWritableDatabase(); + } + createTable(mDb, clazz, tableName); + } + + /** + * 创建表 + */ + private synchronized void createTable(Class clazz) { + createTable(clazz, null); } /** * @return true 忽略该字段 */ - private boolean ignoreField(Field field) { + static boolean ignoreField(Field field) { // field.isSynthetic(), 使用as热启动App时,AS会自动给你的clss添加change字段 Ignore ignore = field.getAnnotation(Ignore.class); return (ignore != null && ignore.value()) || field.isSynthetic(); @@ -355,28 +398,28 @@ public class DbUtil { * * @param type {@link DbUtil} */ - private void print(int type, String sql) { + private static void print(int type, String sql) { if (true) { return; } String str = ""; switch (type) { - case 0: + case CREATE_TABLE: str = "创建表 >>>> "; break; - case 1: + case TABLE_EXISTS: str = "表是否存在 >>>> "; break; - case 2: + case INSERT_DATA: str = "插入数据 >>>> "; break; - case 3: + case MODIFY_DATA: str = "修改数据 >>>> "; break; - case 4: + case FIND_DATA: str = "查询一行数据 >>>> "; break; - case 5: + case FIND_ALL_DATA: str = "遍历整个数据库 >>>> "; break; } @@ -440,8 +483,8 @@ public class DbUtil { /** * 根据数据游标创建一个具体的对象 */ - private synchronized List newInstanceEntity(Class clazz, - Cursor cursor) { + private static synchronized List newInstanceEntity(SQLiteDatabase db, + Class clazz, Cursor cursor) { Field[] fields = CommonUtil.getFields(clazz); List entitys = new ArrayList<>(); if (fields != null && fields.length > 0) { @@ -486,7 +529,10 @@ public class DbUtil { } } cursor.close(); - close(); + //close(); + if (db != null) { + db.close(); + } return entitys; } } \ No newline at end of file diff --git a/Aria/src/main/java/com/arialyy/aria/orm/SqlHelper.java b/Aria/src/main/java/com/arialyy/aria/orm/SqlHelper.java index 211d8e1e..23ebf7b0 100644 --- a/Aria/src/main/java/com/arialyy/aria/orm/SqlHelper.java +++ b/Aria/src/main/java/com/arialyy/aria/orm/SqlHelper.java @@ -17,17 +17,29 @@ package com.arialyy.aria.orm; import android.content.Context; +import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.text.TextUtils; +import android.util.Log; +import com.arialyy.aria.util.CommonUtil; +import java.io.File; +import java.lang.reflect.Field; +import java.util.List; +import java.util.Set; /** * Created by lyy on 2015/11/2. * sql帮助类 */ final class SqlHelper extends SQLiteOpenHelper { - protected static String DB_NAME; - protected static int VERSION = -1; + interface UpgradeListener { + public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion); + } + + private UpgradeListener mUpgradeListener; + static String DB_NAME; + static int VERSION = -1; static { if (TextUtils.isEmpty(DB_NAME)) { @@ -38,7 +50,12 @@ final class SqlHelper extends SQLiteOpenHelper { } } - public SqlHelper(Context context) { + //SqlHelper(Context context, UpgradeListener listener) { + // super(context, DB_NAME, null, VERSION); + // mUpgradeListener = listener; + //} + + SqlHelper(Context context) { super(context, DB_NAME, null, VERSION); } @@ -47,6 +64,82 @@ final class SqlHelper extends SQLiteOpenHelper { } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { + try { + if (oldVersion < newVersion) { + handleDbUpdate(db); + } + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } + } + /** + * 处理数据库升级 + * + * @throws ClassNotFoundException + */ + private void handleDbUpdate(SQLiteDatabase db) throws ClassNotFoundException { + if (db == null) { + Log.d("SqlHelper", "db 为 null"); + return; + } else if (!db.isOpen()) { + Log.d("SqlHelper", "db已关闭"); + return; + } + Set tables = DBMapping.mapping.keySet(); + for (String tableName : tables) { + Class clazz = Class.forName(DBMapping.mapping.get(tableName)); + if (DbUtil.tableExists(db, clazz)) { + String countColumnSql = "SELECT rowid FROM " + tableName; + Cursor cursor = db.rawQuery(countColumnSql, null); + int dbColumnNum = cursor.getColumnCount(); + int newEntityColumnNum = getEntityAttr(clazz); + if (dbColumnNum != newEntityColumnNum) { + back(db, clazz); + } + } + } + } + + /** + * 备份 + */ + private void back(SQLiteDatabase db, Class clazz) { + String oldTableName = CommonUtil.getClassName(clazz); + //备份数据 + List list = DbUtil.findAllData(db, clazz); + //修改原来表名字 + String alertSql = "alter table " + oldTableName + " rename to " + oldTableName + "_temp"; + db.beginTransaction(); + db.execSQL(alertSql); + //创建一个原来新表 + DbUtil.createTable(db, clazz, null); + for (DbEntity entity : list) { + DbUtil.insertData(db, entity); + } + //删除原来的表 + String deleteSQL = "drop table IF EXISTS " + oldTableName + "_temp"; + db.execSQL(deleteSQL); + db.setTransactionSuccessful(); + db.endTransaction(); + db.close(); + } + + /** + * 获取实体的字段数 + */ + private int getEntityAttr(Class clazz) { + int count = 1; + Field[] fields = CommonUtil.getFields(clazz); + if (fields != null && fields.length > 0) { + for (Field field : fields) { + field.setAccessible(true); + if (DbUtil.ignoreField(field)) { + continue; + } + count++; + } + } + return count; } } \ No newline at end of file diff --git a/README.md b/README.md index c7b889c8..7a05bc3b 100644 --- a/README.md +++ b/README.md @@ -141,6 +141,7 @@ compile 'com.arialyy.aria:Aria:3.0.0' 有任何问题,可以在[issues](https://github.com/AriaLyy/Aria/issues)给我留言反馈。 *** + ## 开发日志 + v_3.0.0 添加上传任务支持,修复一些已发现的bug + v_2.4.4 修复不支持断点的下载链接拿不到文件大小的问题 diff --git a/app/build.gradle b/app/build.gradle index f8fe4165..b863586e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'com.android.application' android { compileSdkVersion 23 - buildToolsVersion "23.0.2" + buildToolsVersion '25.0.2' defaultConfig { applicationId "com.arialyy.simple" diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro deleted file mode 100644 index 80105608..00000000 --- a/app/proguard-rules.pro +++ /dev/null @@ -1,17 +0,0 @@ -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in D:\sdk/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the proguardFiles -# directive in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} diff --git a/app/src/main/java/com/arialyy/simple/download/SingleTaskActivity.java b/app/src/main/java/com/arialyy/simple/download/SingleTaskActivity.java index ff595bbb..a1228987 100644 --- a/app/src/main/java/com/arialyy/simple/download/SingleTaskActivity.java +++ b/app/src/main/java/com/arialyy/simple/download/SingleTaskActivity.java @@ -57,7 +57,8 @@ public class SingleTaskActivity extends BaseActivity { //"https://atom-installer.github.com/v1.13.0/AtomSetup.exe?s=1484074138&ext=.exe"; //"http://static.gaoshouyou.com/d/22/94/822260b849944492caadd2983f9bb624.apk"; //不支持断点的链接 - "http://ox.konsung.net:5555/ksdc-web/download/downloadFile/?fileName=ksdc_1.0.2.apk&rRange=0-"; + //"http://ox.konsung.net:5555/ksdc-web/download/downloadFile/?fileName=ksdc_1.0.2.apk&rRange=0-"; + "http://172.18.104.50:8080/download/_302turn"; @Bind(R.id.progressBar) HorizontalProgressBarWithNumber mPb; @Bind(R.id.start) Button mStart; @Bind(R.id.stop) Button mStop; diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index dfa38c80..510df605 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -25,7 +25,7 @@ - http://g37.gdl.netease.com/onmyoji_netease.apk + http://g37.gdl.netease.com/onmyoji_netease_1.apk http://static.gaoshouyou.com/d/eb/f2/dfeba30541f209ab8a50d847fc1661ce.apk http://rs.0.gaoshouyou.com/d/51/46/58514d126c46b8a3f27fc8c7db3b09ec.apk http://rs.0.gaoshouyou.com/d/23/69/07238f952669727878d7a0e180534c8b.apk diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ab4c9191..1be3bb7c 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,4 +1,4 @@ -#Mon Oct 24 17:59:34 CST 2016 +#Tue Mar 14 19:13:43 CST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/img/performance.png b/img/performance.png index cc29de09..953b7a5e 100644 Binary files a/img/performance.png and b/img/performance.png differ