From 8bcdf35353df77ea812b3751e1e6be2c91c60b8f Mon Sep 17 00:00:00 2001 From: AriaLyy <511455842@qq.com> Date: Wed, 27 Dec 2017 21:17:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dhead=E5=A4=B4=E9=83=A8?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E8=BF=87=E9=95=BF=E6=97=B6=E5=87=BA=E7=8E=B0?= =?UTF-8?q?=E7=9A=84=E5=B4=A9=E6=BA=83=E9=97=AE=E9=A2=98=20https://github.?= =?UTF-8?q?com/AriaLyy/Aria/issues/177?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/arialyy/aria/core/inf/AbsTarget.java | 26 +++++++++++++++++++ .../java/com/arialyy/aria/orm/DBConfig.java | 3 +-- .../java/com/arialyy/aria/orm/SqlHelper.java | 8 +++--- DEV_LOG.md | 2 ++ app/src/main/assets/aria_config.xml | 2 +- .../simple/download/SingleTaskActivity.java | 15 ++++++++--- build.gradle | 2 +- 7 files changed, 47 insertions(+), 11 deletions(-) diff --git a/Aria/src/main/java/com/arialyy/aria/core/inf/AbsTarget.java b/Aria/src/main/java/com/arialyy/aria/core/inf/AbsTarget.java index ea30b47f..ab174537 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/inf/AbsTarget.java +++ b/Aria/src/main/java/com/arialyy/aria/core/inf/AbsTarget.java @@ -150,7 +150,21 @@ public abstract class AbsTarget headers) { + return addHeaders(headers, false); + } + + /** + * 给url请求添加头部 + * + * @param refreshHeader 更新数据库中保存的头部信息 + */ + public TARGET addHeaders(Map headers, boolean refreshHeader) { if (headers != null && headers.size() > 0) { Set keys = headers.keySet(); for (String key : keys) { mTaskEntity.headers.put(key, headers.get(key)); } } + if (refreshHeader) { + mTaskEntity.update(); + } return (TARGET) this; } diff --git a/Aria/src/main/java/com/arialyy/aria/orm/DBConfig.java b/Aria/src/main/java/com/arialyy/aria/orm/DBConfig.java index 748f063d..d691dec1 100644 --- a/Aria/src/main/java/com/arialyy/aria/orm/DBConfig.java +++ b/Aria/src/main/java/com/arialyy/aria/orm/DBConfig.java @@ -34,8 +34,7 @@ import java.util.Map; class DBConfig { static Map mapping = new HashMap<>(); static String DB_NAME; - //static int VERSION = 16; - static int VERSION = 18; + static int VERSION = 20; static { if (TextUtils.isEmpty(DB_NAME)) { 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 e07d7c9a..bc4671c3 100644 --- a/Aria/src/main/java/com/arialyy/aria/orm/SqlHelper.java +++ b/Aria/src/main/java/com/arialyy/aria/orm/SqlHelper.java @@ -175,7 +175,8 @@ final class SqlHelper extends SQLiteOpenHelper { + " WHERE " + column + " MATCH '" - + mathSql + "'"; + + mathSql + + "'"; Cursor cursor = db.rawQuery(sql, null); List data = cursor.getCount() > 0 ? newInstanceEntity(db, clazz, cursor) : null; @@ -486,8 +487,7 @@ final class SqlHelper extends SQLiteOpenHelper { } Class type = field.getType(); sb.append(field.getName()); - if (type == String.class || type == Map.class || type == List.class || SqlUtil.isOneToOne( - field) || type.isEnum()) { + if (type == String.class || SqlUtil.isOneToOne(field) || type.isEnum()) { sb.append(" varchar"); } else if (type == int.class || type == Integer.class) { sb.append(" interger"); @@ -503,6 +503,8 @@ final class SqlHelper extends SQLiteOpenHelper { sb.append(" data"); } else if (type == byte.class || type == Byte.class) { sb.append(" blob"); + } else if (type == Map.class || type == List.class) { + sb.append(" text"); } else { continue; } diff --git a/DEV_LOG.md b/DEV_LOG.md index b088dc4f..b7753db3 100644 --- a/DEV_LOG.md +++ b/DEV_LOG.md @@ -1,6 +1,8 @@ ## 开发日志 + v_3.3.8 - 添加POST支持 + - 任务执行的过程中,如果调用removeRecord()方法,将会取消任务 https://github.com/AriaLyy/Aria/issues/174 + - 修复一个数据库初始化的问题 https://github.com/AriaLyy/Aria/issues/173 + v_3.3.7 - 修复一个线程重启的问题 https://github.com/AriaLyy/Aria/issues/160 - 修复配置文件异常问题、格式化速度为0问题 https://github.com/AriaLyy/Aria/issues/161 diff --git a/app/src/main/assets/aria_config.xml b/app/src/main/assets/aria_config.xml index 7255c73f..92324c01 100644 --- a/app/src/main/assets/aria_config.xml +++ b/app/src/main/assets/aria_config.xml @@ -5,7 +5,7 @@ - + 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 14361bff..fd14a025 100644 --- a/app/src/main/java/com/arialyy/simple/download/SingleTaskActivity.java +++ b/app/src/main/java/com/arialyy/simple/download/SingleTaskActivity.java @@ -43,6 +43,8 @@ import com.arialyy.simple.R; import com.arialyy.simple.base.BaseActivity; import com.arialyy.simple.databinding.ActivitySingleBinding; import java.io.File; +import java.util.HashMap; +import java.util.Map; public class SingleTaskActivity extends BaseActivity { @@ -59,7 +61,8 @@ public class SingleTaskActivity extends BaseActivity { //"http://down8.androidgame-store.com/201706122321/97967927DD4E53D9905ECAA7874C8128/new/game1/19/45319/com.neuralprisma-2.5.2.174-2000174_1494784835.apk?f=web_1"; //不支持断点的链接 //"http://ox.konsung.net:5555/ksdc-web/download/downloadFile/?fileName=ksdc_1.0.2.apk&rRange=0-"; - "http://gdown.baidu.com/data/wisegame/0904344dee4a2d92/QQ_718.apk"; + //"http://gdown.baidu.com/data/wisegame/0904344dee4a2d92/QQ_718.apk"; + "http://qudao.5535.cn/one/game.html?game=531&cpsuser=xiaoeryu2"; @Bind(R.id.start) Button mStart; @Bind(R.id.stop) Button mStop; @Bind(R.id.cancel) Button mCancel; @@ -214,11 +217,15 @@ public class SingleTaskActivity extends BaseActivity { private void startD(){ //Aria.get(this).setLogLevel(ALog.LOG_CLOSE); //Aria.download(this).load("aaaa.apk"); + Map map = new HashMap<>(); + map.put("User-Agent", "Mozilla/5.0 (Linux; Android 4.4.4; Nexus 5 Build/KTU84P; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.132 Mobile MQQBrowser/6.2 TBS/043722 Safari/537.36"); + map.put("Cookie", "BAIDUID=DFC7EF42C60AD1ACF0BA94389AA67F13:FG=1; H_WISE_SIDS=121192_104493_114745_121434_119046_100098_120212_121140_118882_118858_118850_118820_118792_121254_121534_121214_117588_117242_117431_119974_120597_121043_121422_120943_121175_121272_117552_120482_121013_119962_119145_120851_120841_120034_121325_116407_121109_120654_110085_120708; PSINO=7; BDORZ=AE84CDB3A529C0F8A2B9DCDD1D18B695"); Aria.download(SingleTaskActivity.this) .load(DOWNLOAD_URL) - .addHeader("groupName", "value") - .setRequestMode(RequestEnum.POST) - .setDownloadPath(Environment.getExternalStorageDirectory().getPath() + "/hhhhhhhh.apk") + //.addHeader("groupName", "value") + .addHeaders(map) + //.setRequestMode(RequestEnum.POST) + .setDownloadPath(Environment.getExternalStorageDirectory().getPath() + "/ggsg.apk") .start(); } diff --git a/build.gradle b/build.gradle index dca1776b..c0cc2f4d 100644 --- a/build.gradle +++ b/build.gradle @@ -39,7 +39,7 @@ task clean(type: Delete) { ext { userOrg = 'arialyy' groupId = 'com.arialyy.aria' - publishVersion = '3.3.7' + publishVersion = '3.3.8' // publishVersion = '1.0.3' //FTP插件 repoName='maven' desc = 'android 下载框架'