|
|
|
|
@ -77,6 +77,11 @@ public class CustomWebView extends WebView { |
|
|
|
|
setWebViewClient(webViewClient()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void addView() { |
|
|
|
|
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(1, 1); |
|
|
|
|
if (App.activity() != null) App.activity().addContentView(this, params); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public CustomWebView start(String key, String from, Map<String, String> headers, String url, String click, ParseCallback callback, boolean detect) { |
|
|
|
|
App.post(timer, Constant.TIMEOUT_PARSE_WEB); |
|
|
|
|
this.callback = callback; |
|
|
|
|
@ -84,6 +89,7 @@ public class CustomWebView extends WebView { |
|
|
|
|
this.click = click; |
|
|
|
|
this.from = from; |
|
|
|
|
this.key = key; |
|
|
|
|
addView(); |
|
|
|
|
start(url, headers); |
|
|
|
|
return this; |
|
|
|
|
} |
|
|
|
|
@ -142,7 +148,7 @@ public class CustomWebView extends WebView { |
|
|
|
|
|
|
|
|
|
private void showDialog() { |
|
|
|
|
if (dialog != null || App.activity() == null) return; |
|
|
|
|
if (getParent() != null) ((ViewGroup) getParent()).removeView(this); |
|
|
|
|
removeView(); |
|
|
|
|
dialog = new AlertDialog.Builder(App.activity()).setView(this).show(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -200,8 +206,13 @@ public class CustomWebView extends WebView { |
|
|
|
|
callback = null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void removeView() { |
|
|
|
|
if (getParent() != null) ((ViewGroup) getParent()).removeView(this); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void stop(boolean error) { |
|
|
|
|
hideDialog(); |
|
|
|
|
removeView(); |
|
|
|
|
stopLoading(); |
|
|
|
|
loadUrl(BLANK); |
|
|
|
|
App.removeCallbacks(timer); |
|
|
|
|
|