diff --git a/Aria/src/main/java/com/arialyy/aria/core/download/CheckDGEntityUtil.java b/Aria/src/main/java/com/arialyy/aria/core/download/CheckDGEntityUtil.java index 1be5ad86..d78e9bae 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/download/CheckDGEntityUtil.java +++ b/Aria/src/main/java/com/arialyy/aria/core/download/CheckDGEntityUtil.java @@ -15,7 +15,9 @@ */ package com.arialyy.aria.core.download; +import android.text.LoginFilter; import android.text.TextUtils; +import android.util.Log; import com.arialyy.aria.core.common.RequestEnum; import com.arialyy.aria.core.common.controller.FeatureController; import com.arialyy.aria.core.inf.ICheckEntityUtil; @@ -240,9 +242,6 @@ public class CheckDGEntityUtil implements ICheckEntityUtil { mWrapper.getSubNameTemp().remove(index); } } - - mEntity.setGroupHash(CommonUtil.getMd5Code(mEntity.getUrls())); - return true; } diff --git a/HttpComponent/src/main/java/com/arialyy/aria/http/download/HttpDGInfoTask.java b/HttpComponent/src/main/java/com/arialyy/aria/http/download/HttpDGInfoTask.java index 82b2d3b0..619c1a0d 100644 --- a/HttpComponent/src/main/java/com/arialyy/aria/http/download/HttpDGInfoTask.java +++ b/HttpComponent/src/main/java/com/arialyy/aria/http/download/HttpDGInfoTask.java @@ -108,8 +108,14 @@ public final class HttpDGInfoTask implements IInfoTask { new Thread(new Runnable() { @Override public void run() { for (DTaskWrapper dTaskWrapper : wrapper.getSubTaskWrapper()) { - if (dTaskWrapper.getEntity().getFileSize() > 0) { + DownloadEntity subEntity = dTaskWrapper.getEntity(); + if (subEntity.getFileSize() > 0) { count.getAndIncrement(); + if (subEntity.getCurrentProgress() < subEntity.getFileSize()){ + // 如果没有完成需要拷贝一份数据 + cloneHeader(dTaskWrapper); + } + checkGetSizeComplete(count.get(), failCount.get()); continue; } cloneHeader(dTaskWrapper); diff --git a/HttpComponent/src/main/java/com/arialyy/aria/http/download/HttpDGLoader.java b/HttpComponent/src/main/java/com/arialyy/aria/http/download/HttpDGLoader.java index 159c40ca..3bd59e0d 100644 --- a/HttpComponent/src/main/java/com/arialyy/aria/http/download/HttpDGLoader.java +++ b/HttpComponent/src/main/java/com/arialyy/aria/http/download/HttpDGLoader.java @@ -54,13 +54,8 @@ final class HttpDGLoader extends AbsGroupLoader { } onPostStart(); for (DTaskWrapper wrapper : getWrapper().getSubTaskWrapper()) { - File subFile = new File(wrapper.getEntity().getFilePath()); - if (wrapper.getEntity().getFileSize() > 0 - && subFile.exists() - && subFile.length() == wrapper.getEntity().getFileSize()) { - continue; - } DownloadEntity dEntity = wrapper.getEntity(); + startSubLoader(createSubLoader(wrapper, dEntity.getFileSize() < 0)); } } diff --git a/PublicComponent/src/main/java/com/arialyy/aria/core/group/AbsGroupLoader.java b/PublicComponent/src/main/java/com/arialyy/aria/core/group/AbsGroupLoader.java index 430a3210..381cbefb 100644 --- a/PublicComponent/src/main/java/com/arialyy/aria/core/group/AbsGroupLoader.java +++ b/PublicComponent/src/main/java/com/arialyy/aria/core/group/AbsGroupLoader.java @@ -101,12 +101,12 @@ public abstract class AbsGroupLoader implements ILoaderVisitor, ILoader { for (DTaskWrapper wrapper : mGTWrapper.getSubTaskWrapper()) { long fileLen = checkFileExists(wrapper.getEntity().getFilePath()); if (wrapper.getEntity().getState() == IEntity.STATE_COMPLETE - && fileLen != -1 + && fileLen > 0 && fileLen == wrapper.getEntity().getFileSize()) { - mState.updateCompleteNum(); + //mState.updateCompleteNum(); mCurrentLocation += wrapper.getEntity().getFileSize(); } else { - if (fileLen == -1) { + if (fileLen <= 0) { wrapper.getEntity().setCurrentProgress(0); } wrapper.getEntity().setState(IEntity.STATE_POST_PRE); diff --git a/PublicComponent/src/main/java/com/arialyy/aria/core/group/GroupRunState.java b/PublicComponent/src/main/java/com/arialyy/aria/core/group/GroupRunState.java index 112d6184..d1af88a3 100644 --- a/PublicComponent/src/main/java/com/arialyy/aria/core/group/GroupRunState.java +++ b/PublicComponent/src/main/java/com/arialyy/aria/core/group/GroupRunState.java @@ -17,6 +17,7 @@ package com.arialyy.aria.core.group; import com.arialyy.aria.core.listener.IDGroupListener; import com.arialyy.aria.core.wrapper.AbsTaskWrapper; +import com.arialyy.aria.util.ALog; import java.util.HashSet; import java.util.Set; import java.util.concurrent.atomic.AtomicBoolean; @@ -26,6 +27,7 @@ import java.util.concurrent.atomic.AtomicInteger; * 组合任务执行中的状态信息 */ public final class GroupRunState { + private String TAG = "GroupRunState"; /** * 子任务数 */ diff --git a/PublicComponent/src/main/java/com/arialyy/aria/orm/DelegateFind.java b/PublicComponent/src/main/java/com/arialyy/aria/orm/DelegateFind.java index 417b1925..dc1f0b45 100644 --- a/PublicComponent/src/main/java/com/arialyy/aria/orm/DelegateFind.java +++ b/PublicComponent/src/main/java/com/arialyy/aria/orm/DelegateFind.java @@ -216,14 +216,16 @@ class DelegateFind extends AbsDelegate { } else { sql = sb.toString(); } - boolean paged=false; + boolean paged = false; if (page != -1 && num != -1) { - paged=true; - sql = sql.concat(String.format(" Group by %s LIMIT %s,%s", pTableName.concat(".").concat(m.parentColumn()), (page - 1) * num, num)); + paged = true; + sql = sql.concat(String.format(" Group by %s LIMIT %s,%s", + pTableName.concat(".").concat(m.parentColumn()), (page - 1) * num, num)); } Cursor cursor = db.rawQuery(sql, null); List data = - newInstanceEntity(wrapperClazz, parentClazz, childClazz, cursor, pColumn, cColumn,paged, db,m.entityColumn(),m.parentColumn()); + newInstanceEntity(wrapperClazz, parentClazz, childClazz, cursor, pColumn, cColumn, + paged, db, m.entityColumn(), m.parentColumn()); closeCursor(cursor); return data; @@ -247,7 +249,8 @@ class DelegateFind extends AbsDelegate { Class wrapperClazz, Class

parentClazz, Class childClazz, Cursor cursor, - List pColumn, List cColumn,boolean paged,SQLiteDatabase db,String entityColumn,String parentColumn) { + List pColumn, List cColumn, boolean paged, SQLiteDatabase db, + String entityColumn, String parentColumn) { List wrappers = new ArrayList<>(); SparseArray> childs = new SparseArray<>(); // 所有子表数据 SparseArray parents = new SparseArray<>(); // 所有父表数据 @@ -259,12 +262,13 @@ class DelegateFind extends AbsDelegate { childs.put(pRowId, new ArrayList()); parents.put(pRowId, createParent(pRowId, parentClazz, pColumn, cursor)); } - if(paged){ - List list = createChildren(db, childClazz, pColumn, entityColumn, parentColumn, parents.get(pRowId)); - if(list!=null) + if (paged) { + List list = createChildren(db, childClazz, pColumn, entityColumn, parentColumn, + parents.get(pRowId)); + if (list != null) { childs.get(pRowId).addAll(list); - } - else { + } + } else { childs.get(pRowId).add(createChild(childClazz, cColumn, cursor)); } } @@ -296,25 +300,28 @@ class DelegateFind extends AbsDelegate { return wrappers; } + /** * 创建子对象集合 */ - private List createChildren(SQLiteDatabase db,Class childClazz, List pColumn, - String entityColumn,String parentColumn,DbEntity parents) - throws IllegalAccessException { + private List createChildren(SQLiteDatabase db, Class childClazz, + List pColumn, + String entityColumn, String parentColumn, DbEntity parents) + throws IllegalAccessException { for (Field field : pColumn) { field.setAccessible(true); - if(field.getName().equals(parentColumn)){ + if (field.getName().equals(parentColumn)) { Object o = field.get(parents); - if(o instanceof String) { + if (o instanceof String) { o = URLEncoder.encode((String) o); } - return findData(db,childClazz,entityColumn+"='"+o+"'"); + return findData(db, childClazz, entityColumn + "='" + o + "'"); } } return new ArrayList(); } + /** * 创建子对象 */ diff --git a/app/src/main/assets/aria_config.xml b/app/src/main/assets/aria_config.xml index 4f373352..8edfc6d5 100644 --- a/app/src/main/assets/aria_config.xml +++ b/app/src/main/assets/aria_config.xml @@ -22,7 +22,7 @@ - + - +