Java Code Examples for android.webkit.WebView#stopLoading()
The following examples show how to use
android.webkit.WebView#stopLoading() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CallActivity.java From sealrtc-android with MIT License | 6 votes |
public void destroyWebView(WebView mWebView) { if (mWebView != null) { try { ViewParent parent = mWebView.getParent(); if (parent != null) { ((ViewGroup) parent).removeView(mWebView); } mWebView.stopLoading(); mWebView.getSettings().setJavaScriptEnabled(false); mWebView.clearHistory(); mWebView.clearView(); mWebView.removeAllViews(); mWebView.destroy(); } catch (Exception e) { e.printStackTrace(); } } }
Example 2
Source File: AgentWebUtils.java From AgentWeb with Apache License 2.0 | 6 votes |
static final void clearWebView(WebView m) { if (m == null) { return; } if (Looper.myLooper() != Looper.getMainLooper()) { return; } m.loadUrl("about:blank"); m.stopLoading(); if (m.getHandler() != null) { m.getHandler().removeCallbacksAndMessages(null); } m.removeAllViews(); ViewGroup mViewGroup = null; if ((mViewGroup = ((ViewGroup) m.getParent())) != null) { mViewGroup.removeView(m); } m.setWebChromeClient(null); m.setWebViewClient(null); m.setTag(null); m.clearHistory(); m.destroy(); m = null; }
Example 3
Source File: HongKongLoginWebview.java From letv with Apache License 2.0 | 6 votes |
public void onPageFinished(WebView view, String url) { try { String path = new URL(url).getPath(); LogInfo.log("ZSM onPageFinished path = " + path); if (path.contains("checklogin")) { LeResponseMessage response = LeMessageManager.getInstance().dispatchMessage(new LeMessage(LeMessageIds.MSG_WEBVIEW_COOKIE_SSO_TOKEN, url)); if (LeResponseMessage.checkResponseMessageValidity(response, String.class)) { PreferencesManager.getInstance().setSso_tk((String) response.getData()); } view.setVisibility(4); view.loadUrl("javascript:window.handler.show(document.body.innerText);"); view.stopLoading(); } } catch (Exception e) { e.printStackTrace(); } }
Example 4
Source File: AbstractViewQuery.java From COCOQuery with Apache License 2.0 | 6 votes |
/** * Clear a view. Applies to ImageView, WebView, and TextView. * * @return self */ public T clear() { if (view != null) { if (view instanceof ImageView) { ImageView iv = ((ImageView) view); iv.setImageBitmap(null); } else if (view instanceof WebView) { WebView wv = ((WebView) view); wv.stopLoading(); wv.clearView(); } else if (view instanceof TextView) { TextView tv = ((TextView) view); tv.setText(""); } } return self(); }
Example 5
Source File: CloudFlarePasser.java From Dashchan with Apache License 2.0 | 6 votes |
@Override public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); if ("Just a moment...".equals(view.getTitle())) { wasChecked = true; } else { String cookie = null; boolean success = false; if (wasChecked) { cookie = StringUtils.nullIfEmpty(extractCookie(url, COOKIE_CLOUDFLARE)); if (cookie != null) { success = true; } } storeCookie(chanName, cookie, url); view.stopLoading(); for (CheckHolder checkHolder : checkHolders) { synchronized (checkHolder) { checkHolder.success = success; checkHolder.ready = true; checkHolder.notifyAll(); } } handleNextJavaScript(); } }
Example 6
Source File: AdWebView.java From mobile-sdk-android with Apache License 2.0 | 5 votes |
@SuppressWarnings("deprecation") @Override public void onLoadResource(WebView view, String url) { if (url.startsWith("http")) { HitTestResult hitTestResult; try { hitTestResult = getHitTestResult(); if (hitTestResult == null) { return; } // check that the hitTestResult matches the url if (hitTestResult.getExtra() == null || !hitTestResult.getExtra().equals(url)) { return; } } catch (NullPointerException e) { return; } switch (hitTestResult.getType()) { default: break; case HitTestResult.ANCHOR_TYPE: case HitTestResult.IMAGE_ANCHOR_TYPE: case HitTestResult.SRC_ANCHOR_TYPE: case HitTestResult.SRC_IMAGE_ANCHOR_TYPE: loadURLInCorrectBrowser(url); view.stopLoading(); fireAdClicked(); break; } } }
Example 7
Source File: ThemeFragment.java From 4pdaClient-plus with Apache License 2.0 | 5 votes |
@Override public void run() { mUrl = null; mLoadingFinished = true; if (mReference != null) { WebView webView = mReference.get(); if (webView != null) { webView.stopLoading(); } } }
Example 8
Source File: WebViewActivity.java From iBeebo with GNU General Public License v3.0 | 5 votes |
@Override public void onPageStarted(WebView view, String url, Bitmap favicon) { showProgress(); if (url.startsWith(SeniorUrl.SeniorUrl_Public)) { view.stopLoading(); handleRedirectUrl(view, url, WebViewActivity.this); return; } super.onPageStarted(view, url, favicon); }
Example 9
Source File: Utility.java From iBeebo with GNU General Public License v3.0 | 5 votes |
public static void recycleViewGroupAndChildViews(ViewGroup viewGroup, boolean recycleBitmap) { for (int i = 0; i < viewGroup.getChildCount(); i++) { View child = viewGroup.getChildAt(i); if (child instanceof WebView) { WebView webView = (WebView) child; webView.loadUrl("about:blank"); webView.stopLoading(); continue; } if (child instanceof ViewGroup) { recycleViewGroupAndChildViews((ViewGroup) child, true); continue; } if (child instanceof ImageView) { ImageView iv = (ImageView) child; Drawable drawable = iv.getDrawable(); if (drawable instanceof BitmapDrawable) { BitmapDrawable bitmapDrawable = (BitmapDrawable) drawable; Bitmap bitmap = bitmapDrawable.getBitmap(); if (recycleBitmap && bitmap != null) { bitmap.recycle(); } } iv.setImageBitmap(null); iv.setBackground(null); continue; } child.setBackground(null); } viewGroup.setBackground(null); }
Example 10
Source File: JSWebViewActivity.java From iBeebo with GNU General Public License v3.0 | 5 votes |
@Override public void onPageStarted(WebView view, String url, Bitmap favicon) { showProgress(); if (url.startsWith(SeniorUrl.SeniorUrl_Public)) { view.stopLoading(); handleRedirectUrl(view, url, JSWebViewActivity.this); return; } super.onPageStarted(view, url, favicon); }
Example 11
Source File: Utility.java From iBeebo with GNU General Public License v3.0 | 5 votes |
public static void recycleViewGroupAndChildViews(ViewGroup viewGroup, boolean recycleBitmap) { for (int i = 0; i < viewGroup.getChildCount(); i++) { View child = viewGroup.getChildAt(i); if (child instanceof WebView) { WebView webView = (WebView) child; webView.loadUrl("about:blank"); webView.stopLoading(); continue; } if (child instanceof ViewGroup) { recycleViewGroupAndChildViews((ViewGroup) child, true); continue; } if (child instanceof ImageView) { ImageView iv = (ImageView) child; Drawable drawable = iv.getDrawable(); if (drawable instanceof BitmapDrawable) { BitmapDrawable bitmapDrawable = (BitmapDrawable) drawable; Bitmap bitmap = bitmapDrawable.getBitmap(); if (recycleBitmap && bitmap != null) { bitmap.recycle(); } } iv.setImageBitmap(null); iv.setBackground(null); continue; } child.setBackground(null); } viewGroup.setBackground(null); }
Example 12
Source File: JSWebViewActivity.java From iBeebo with GNU General Public License v3.0 | 5 votes |
@Override public void onPageStarted(WebView view, String url, Bitmap favicon) { showProgress(); if (url.startsWith(SeniorUrl.SeniorUrl_Public)) { view.stopLoading(); handleRedirectUrl(view, url, JSWebViewActivity.this); return; } super.onPageStarted(view, url, favicon); }
Example 13
Source File: GSIDWebViewActivity.java From iBeebo with GNU General Public License v3.0 | 5 votes |
@Override public void onPageStarted(WebView view, String url, Bitmap favicon) { showProgress(); if (url.startsWith(SeniorUrl.SeniorUrl_Public)) { view.stopLoading(); handleRedirectUrl(view, url, GSIDWebViewActivity.this); return; } super.onPageStarted(view, url, favicon); }
Example 14
Source File: WebViewHelper.java From Android-PWA-Wrapper with GNU General Public License v3.0 | 5 votes |
private boolean handleUrlLoad(WebView view, String url) { // prevent loading content that isn't ours if (!url.startsWith(Constants.WEBAPP_URL)) { // stop loading // stopping only would cause the PWA to freeze, need to reload the app as a workaround view.stopLoading(); view.reload(); // open external URL in Browser/3rd party apps instead try { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); if (intent.resolveActivity(activity.getPackageManager()) != null) { activity.startActivity(intent); } else { showNoAppDialog(activity); } } catch (Exception e) { showNoAppDialog(activity); } // return value for shouldOverrideUrlLoading return true; } else { // let WebView load the page! // activate loading animation screen uiManager.setLoading(true); // return value for shouldOverrideUrlLoading return false; } }
Example 15
Source File: WebViewActivity.java From iBeebo with GNU General Public License v3.0 | 5 votes |
@Override public void onPageStarted(WebView view, String url, Bitmap favicon) { showProgress(); if (url.startsWith(SeniorUrl.SeniorUrl_Public)) { view.stopLoading(); handleRedirectUrl(view, url, WebViewActivity.this); return; } super.onPageStarted(view, url, favicon); }
Example 16
Source File: OAuthActivity.java From iBeebo with GNU General Public License v3.0 | 5 votes |
@Override public void onPageStarted(WebView view, String url, Bitmap favicon) { mCircleProgressBar.setVisibility(View.VISIBLE); DevLog.printLog("OAUTH_ACTIVITY-onPageStarted:", "" + url); if (url.startsWith(mIsAuthPro ? WeiboOAuthConstances.HACK_DIRECT_URL : WeiboOAuthConstances.DIRECT_URL)) { handleRedirectUrl(url); view.stopLoading(); return; } super.onPageStarted(view, url, favicon); }
Example 17
Source File: LetvOpenIDOAuthLoginActivity.java From letv with Apache License 2.0 | 5 votes |
public void onPageFinished(WebView view, String url) { try { if (new URL(url).getPath().contains("callbackdata")) { view.setVisibility(4); view.loadUrl("javascript:window.handler.show(document.body.innerText);"); view.stopLoading(); } } catch (Exception e) { e.printStackTrace(); } }
Example 18
Source File: HWWebView.java From RePlugin-GameSdk with Apache License 2.0 | 5 votes |
@Override public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { // TODO Auto-generated method stub view.stopLoading(); HWUtils.logError(TAG, errorCode + "\n" + description + "\n" + failingUrl); view.clearView(); showErrorPage(); super.onReceivedError(view, errorCode, description, failingUrl); }
Example 19
Source File: JSAutoLogin.java From iBeebo with GNU General Public License v3.0 | 4 votes |
@Override public void onPageStarted(WebView view, String url, Bitmap favicon) { DevLog.printLog("JSAutoLogin onPageStarted", url); if (url.startsWith(SeniorUrl.SeniorUrl_Public)) { view.stopLoading(); CookieManager cookieManager = CookieManager.getInstance(); String cookie = cookieManager.getCookie(url); String uid = ""; String uname = ""; String gsid = ""; AccountDatabaseManager manager = new AccountDatabaseManager(mContext); if (!TextUtils.isEmpty(cookie)) { String[] cookies = cookie.split("; "); for (String string : cookies) { String oneLine = Uri.decode(Uri.decode(string)); if (oneLine.contains("SUB=")) { DevLog.printLog("GSID", "" + oneLine); gsid = oneLine.split("SUB=")[1]; } String uidtmp = PatternUtils.macthUID(oneLine); if (!TextUtils.isEmpty(uidtmp)) { uid = uidtmp; } uname = PatternUtils.macthUname(oneLine); if (!TextUtils.isEmpty(uname)) { manager.updateAccount(AccountTable.ACCOUNT_TABLE, uid, AccountTable.USER_NAME, uname); manager.updateAccount(AccountTable.ACCOUNT_TABLE, uid, AccountTable.GSID, gsid); BeeboApplication.getInstance().updateAccountBean(); } } } Log.d("Weibo-Cookie", "after for : " + uid); if (uid.equals(mAccountBean.getUid())) { if (mListener != null) { mListener.onAutoLonin(true); } manager.updateAccount(AccountTable.ACCOUNT_TABLE, uid, AccountTable.COOKIE, cookie); BeeboApplication.getInstance().updateAccountBean(); } else if (!TextUtils.isEmpty(uid)) { mWebView.loadUrl(url); } return; } super.onPageStarted(view, url, favicon); }
Example 20
Source File: WebViewCache.java From tysq-android with GNU General Public License v3.0 | 4 votes |
/** * 获取webview * @return */ public WebView getWebView(){ WebView webView = mWebViewList.remove(0); webView.stopLoading(); return webView; }