|
|
|
|
@ -123,24 +123,24 @@ public class CustomWebView extends WebView { |
|
|
|
|
String cookie = CookieManager.getInstance().getCookie(url); |
|
|
|
|
if (!TextUtils.isEmpty(cookie)) news.put("cookie", cookie); |
|
|
|
|
for (String key : headers.keySet()) if (keys.contains(key.toLowerCase())) news.put(key, headers.get(key)); |
|
|
|
|
onSuccess(news, url); |
|
|
|
|
onParseSuccess(news, url); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void stop(boolean error) { |
|
|
|
|
stopLoading(); |
|
|
|
|
loadUrl("about:blank"); |
|
|
|
|
App.removeCallbacks(timer); |
|
|
|
|
if (error) onError(); |
|
|
|
|
if (error) onParseError(); |
|
|
|
|
else callback = null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void onSuccess(Map<String, String> news, String url) { |
|
|
|
|
private void onParseSuccess(Map<String, String> news, String url) { |
|
|
|
|
if (callback != null) callback.onParseSuccess(news, url, from); |
|
|
|
|
App.post(() -> stop(false)); |
|
|
|
|
callback = null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void onError() { |
|
|
|
|
private void onParseError() { |
|
|
|
|
if (callback != null) callback.onParseError(); |
|
|
|
|
callback = null; |
|
|
|
|
} |
|
|
|
|
|