修复head头部信息过长时出现的崩溃问题 https://github.com/AriaLyy/Aria/issues/177
This commit is contained in:
@@ -150,7 +150,21 @@ public abstract class AbsTarget<TARGET extends AbsTarget, ENTITY extends AbsEnti
|
||||
* @param header 头部value
|
||||
*/
|
||||
public TARGET addHeader(@NonNull String key, @NonNull String header) {
|
||||
return addHeader(key, header, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 给url请求添加头部
|
||||
*
|
||||
* @param key 头部key
|
||||
* @param header 头部value
|
||||
* @param refreshHeader 更新数据库中保存的头部信息
|
||||
*/
|
||||
public TARGET addHeader(@NonNull String key, @NonNull String header, boolean refreshHeader) {
|
||||
mTaskEntity.headers.put(key, header);
|
||||
if (refreshHeader) {
|
||||
mTaskEntity.update();
|
||||
}
|
||||
return (TARGET) this;
|
||||
}
|
||||
|
||||
@@ -158,12 +172,24 @@ public abstract class AbsTarget<TARGET extends AbsTarget, ENTITY extends AbsEnti
|
||||
* 给url请求添加头部
|
||||
*/
|
||||
public TARGET addHeaders(Map<String, String> headers) {
|
||||
return addHeaders(headers, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 给url请求添加头部
|
||||
*
|
||||
* @param refreshHeader 更新数据库中保存的头部信息
|
||||
*/
|
||||
public TARGET addHeaders(Map<String, String> headers, boolean refreshHeader) {
|
||||
if (headers != null && headers.size() > 0) {
|
||||
Set<String> keys = headers.keySet();
|
||||
for (String key : keys) {
|
||||
mTaskEntity.headers.put(key, headers.get(key));
|
||||
}
|
||||
}
|
||||
if (refreshHeader) {
|
||||
mTaskEntity.update();
|
||||
}
|
||||
return (TARGET) this;
|
||||
}
|
||||
|
||||
|
@@ -34,8 +34,7 @@ import java.util.Map;
|
||||
class DBConfig {
|
||||
static Map<String, Class> 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)) {
|
||||
|
@@ -175,7 +175,8 @@ final class SqlHelper extends SQLiteOpenHelper {
|
||||
+ " WHERE "
|
||||
+ column
|
||||
+ " MATCH '"
|
||||
+ mathSql + "'";
|
||||
+ mathSql
|
||||
+ "'";
|
||||
|
||||
Cursor cursor = db.rawQuery(sql, null);
|
||||
List<T> 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;
|
||||
}
|
||||
|
@@ -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
|
||||
|
@@ -5,7 +5,7 @@
|
||||
<download>
|
||||
|
||||
<!--设置下载线程,线程下载数改变后,新的下载任务才会生效,如果任务大小小于1m,该设置也不会生效-->
|
||||
<threadNum value="1"/>
|
||||
<threadNum value="3"/>
|
||||
|
||||
<!--设置下载队列最大任务数, 默认为2-->
|
||||
<maxTaskNum value="2"/>
|
||||
|
@@ -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<ActivitySingleBinding> {
|
||||
|
||||
@@ -59,7 +61,8 @@ public class SingleTaskActivity extends BaseActivity<ActivitySingleBinding> {
|
||||
//"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<ActivitySingleBinding> {
|
||||
private void startD(){
|
||||
//Aria.get(this).setLogLevel(ALog.LOG_CLOSE);
|
||||
//Aria.download(this).load("aaaa.apk");
|
||||
Map<String, String> 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();
|
||||
}
|
||||
|
||||
|
@@ -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 下载框架'
|
||||
|
Reference in New Issue
Block a user