重新整理ShareUtils,增加社区相关分享

This commit is contained in:
kehaoyuan
2018-01-05 18:17:39 +08:00
parent 4a7384d371
commit d118f54bd3
17 changed files with 335 additions and 257 deletions

View File

@ -102,40 +102,40 @@ public class TimestampUtils {
*/
public static String addTimestamp(String url) {
// TODO: 22/12/17 刷新版
if (TextUtils.isEmpty(url)) {
return url;
}
if (url.contains("?")) {
String u = url + "&timestamp=" + System.currentTimeMillis();
return u;
} else {
String u = url + "?timestamp=" + System.currentTimeMillis();
return u;
}
// // TODO: 22/12/17 刷新版
// if (TextUtils.isEmpty(url)) {
// return url;
// }
// int cd = 0;
// for (String key : getCdMap().keySet()) {
// if (Pattern.matches(key, url)) {
// cd = getCdMap().get(key);
// break;
// }
// }
// if (cd == 0) {
// return url;
// }
// if (url.contains("?")) {
// String u = url + "&timestamp=" + getTimestamp(url, cd);
//// Utils.log("url = " + u);
// String u = url + "&timestamp=" + System.currentTimeMillis();
// return u;
// } else {
// String u = url + "?timestamp=" + getTimestamp(url, cd);
//// Utils.log("url = " + u);
// String u = url + "?timestamp=" + System.currentTimeMillis();
// return u;
// }
if (TextUtils.isEmpty(url)) {
return url;
}
int cd = 0;
for (String key : getCdMap().keySet()) {
if (Pattern.matches(key, url)) {
cd = getCdMap().get(key);
break;
}
}
if (cd == 0) {
return url;
}
if (url.contains("?")) {
String u = url + "&timestamp=" + getTimestamp(url, cd);
// Utils.log("url = " + u);
return u;
} else {
String u = url + "?timestamp=" + getTimestamp(url, cd);
// Utils.log("url = " + u);
return u;
}
}
private static ArrayMap<String, Integer> getCdMap() {