|
|
|
|
@ -4,6 +4,7 @@ import android.Manifest; |
|
|
|
|
import android.app.Activity; |
|
|
|
|
import android.content.ClipboardManager; |
|
|
|
|
import android.content.Context; |
|
|
|
|
import android.net.Uri; |
|
|
|
|
import android.os.Build; |
|
|
|
|
import android.os.IBinder; |
|
|
|
|
import android.provider.Settings; |
|
|
|
|
@ -94,27 +95,26 @@ public class Utils { |
|
|
|
|
return headers; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static String checkProxy(String url) { |
|
|
|
|
if (url.startsWith("proxy://")) return url.replace("proxy://", Server.get().getAddress("proxy?")); |
|
|
|
|
return url; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static String checkClan(String text) { |
|
|
|
|
if (text.contains("/localhost/")) text = text.replace("/localhost/", "/"); |
|
|
|
|
if (text.startsWith("clan")) text = text.replace("clan", "file"); |
|
|
|
|
return text; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static String convert(String text) { |
|
|
|
|
return text.startsWith("file") ? Server.get().getAddress(text) : text; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static String convert(String baseUrl, String text) { |
|
|
|
|
if (TextUtils.isEmpty(text)) return ""; |
|
|
|
|
if (text.startsWith("clan")) return checkClan(text); |
|
|
|
|
return UriUtil.resolve(baseUrl, text); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static String convert(String url) { |
|
|
|
|
Uri uri = Uri.parse(url); |
|
|
|
|
if ("file".equals(uri.getScheme())) return Server.get().getAddress(url); |
|
|
|
|
if ("local".equals(uri.getScheme())) return Server.get().getAddress(uri.getHost()); |
|
|
|
|
if ("proxy".equals(uri.getScheme())) return url.replace("proxy://", Server.get().getAddress("proxy?")); |
|
|
|
|
return url; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static String getMd5(String src) { |
|
|
|
|
try { |
|
|
|
|
if (TextUtils.isEmpty(src)) return ""; |
|
|
|
|
|