修改插件化提示框显示位置为所有界面,修复卸载后不自动跳安装bug,修复下载量超100%bug,添加打包渠道106
This commit is contained in:
@ -56,11 +56,11 @@ public class DownloadThread extends Thread {
|
||||
|
||||
//Httpdns替换地址
|
||||
String newUrl = HttpdnsUtils.getUrls(context, entry.getUrl());
|
||||
if (newUrl == null){
|
||||
if (newUrl == null) {
|
||||
newUrl = entry.getUrl();
|
||||
getNewurlSuccess = false;
|
||||
Utils.log("HttpDnsService::获取新地址失败,用原地址进行下载,原地址为::"+newUrl);
|
||||
}else {
|
||||
} else {
|
||||
getNewurlSuccess = true;
|
||||
Utils.log("HttpDnsService::获取新地址成功,目标地址为::"+newUrl);
|
||||
}
|
||||
@ -72,16 +72,13 @@ public class DownloadThread extends Thread {
|
||||
connection.setRequestMethod("GET");
|
||||
connection.setConnectTimeout(CONNECT_TIME);
|
||||
connection.setReadTimeout(READ_TIME);
|
||||
connection.setRequestProperty("RANGE",
|
||||
"bytes=" + targetFile.length() + "-");
|
||||
|
||||
//获取新地址成功,设置HTTP请求头Host域
|
||||
if (getNewurlSuccess){
|
||||
if (getNewurlSuccess &&newUrl.endsWith(".apk") ){
|
||||
//非.apk,结尾的下载地址不需要加请求头Host域
|
||||
if (newUrl.endsWith(".apk")){
|
||||
connection.setRequestProperty("Host",url.getHost());
|
||||
}
|
||||
}else {
|
||||
connection.setRequestProperty("RANGE",
|
||||
"bytes=" + targetFile.length() + "-");
|
||||
connection.setRequestProperty("Host", url.getHost());
|
||||
}
|
||||
|
||||
//设置自动重定向
|
||||
@ -103,6 +100,10 @@ public class DownloadThread extends Thread {
|
||||
connection.setReadTimeout(READ_TIME);
|
||||
connection.setRequestProperty("RANGE",
|
||||
"bytes=" + targetFile.length() + "-");
|
||||
if (getNewurlSuccess &&newUrl.endsWith(".apk") ){
|
||||
//非.apk,结尾的下载地址不需要加请求头Host域
|
||||
connection.setRequestProperty("Host", url.getHost());
|
||||
}
|
||||
//设置自动重定向
|
||||
connection.setInstanceFollowRedirects(true);
|
||||
}
|
||||
@ -141,7 +142,8 @@ public class DownloadThread extends Thread {
|
||||
int len;
|
||||
while ((len = bis.read(buffer)) != -1) {
|
||||
bos.write(buffer, 0, len);
|
||||
listener.onProgressChanged(len);
|
||||
// listener.onProgressChanged(len);
|
||||
listener.onProgressChanged(targetFile.length(), len);
|
||||
if (status == DownloadStatus.pause
|
||||
|| status == DownloadStatus.cancel) {
|
||||
listener.onStatusChanged(status);
|
||||
|
||||
Reference in New Issue
Block a user