增加 正文字号设置,加载Gif,Httpdns防止网络劫持,游戏截图横屏修改

This commit is contained in:
khy
2016-07-11 17:26:40 +08:00
parent 2a4c8a01b9
commit fa6cc8dfaf
12 changed files with 355 additions and 96 deletions

View File

@ -4,6 +4,7 @@ import android.content.Context;
import android.text.TextUtils;
import android.util.Log;
import com.gh.common.util.HttpdnsUtils;
import com.gh.common.util.Trace;
import com.gh.common.util.Utils;
@ -52,14 +53,28 @@ public class DownloadThread extends Thread {
fileOutputStream = new FileOutputStream(entry.getPath());
}
//Httpdns替换地址
String newUrl = HttpdnsUtils.getUrls(context, entry.getUrl());
if (newUrl == null){
newUrl = entry.getUrl();
Utils.log("HttpDnsService::获取新地址失败,用原地址进行下载,原地址为::"+newUrl);
}else {
Utils.log("HttpDnsService::获取新地址成功,目标地址为::"+newUrl);
}
URL url = new URL(entry.getUrl());
HttpURLConnection connection = (HttpURLConnection) url
.openConnection();
// HttpURLConnection connection = (HttpURLConnection) url
// .openConnection();
HttpURLConnection connection = (HttpURLConnection) new URL(newUrl).openConnection();
connection.setRequestMethod("GET");
connection.setConnectTimeout(CONNECT_TIME);
connection.setReadTimeout(READ_TIME);
connection.setRequestProperty("RANGE",
"bytes=" + targetFile.length() + "-");
// 设置HTTP请求头Host域
connection.setRequestProperty("Host",url.getHost());
//设置自动重定向
connection.setInstanceFollowRedirects(true);
Trace.getInstance().debug(DownloadThread.class.getSimpleName(),