Example usage for android.webkit WebView setWebViewClient

List of usage examples for android.webkit WebView setWebViewClient

Introduction

In this page you can find the example usage for android.webkit WebView setWebViewClient.

Prototype

public void setWebViewClient(WebViewClient client) 

Source Link

Document

Sets the WebViewClient that will receive various notifications and requests.

Usage

From source file:MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    WebView webview = new WebView(this);
    setContentView(webview);//from   w w w . j av  a 2s  .  c  o m
    webview.loadUrl("https://www.java2s.com/");
    webview.setWebViewClient(new WebViewClient());

    WebSettings webSettings = webview.getSettings();
    webSettings.setJavaScriptEnabled(true);
    webSettings.setBuiltInZoomControls(true);
}

From source file:im.neon.util.VectorUtils.java

/**
 * Open a webview above the current activity.
 *
 * @param context the application context
 * @param url     the url to open// w  ww. j a  va  2  s  .c om
 */
private static void displayInWebview(final Context context, String url) {
    AlertDialog.Builder alert = new AlertDialog.Builder(context);

    WebView wv = new WebView(context);
    wv.loadUrl(url);
    wv.setWebViewClient(new WebViewClient() {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            view.loadUrl(url);

            return true;
        }
    });

    alert.setView(wv);
    alert.setPositiveButton(android.R.string.ok, null);
    alert.show();
}

From source file:com.hhs.hfnavigator.slidingtabs.schedules.MidRegFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_webview, null);

    progressWheel = (ProgressWheel) root.findViewById(R.id.webViewProgress);

    swipeRefreshLayout = (SwipeRefreshLayout) root.findViewById(R.id.swipe);
    swipeRefreshLayout.setEnabled(false);
    progressWheel.spin();//w  w w  .  ja v a2s  .  c  o  m
    final WebView webView = (WebView) root.findViewById(R.id.webView);
    if (webView != null) {
        webView.setWebViewClient(new WebViewClient() {

            public void onPageFinished(WebView view, String url) {
                progressWheel.stopSpinning();
            }
        });
        webView.loadUrl("https://docs.google.com/document/d/1FEFRSCql8AXKBsVoiawX9E087oaPbcQh-f-Ou4yKaIE/pub");
        webView.getSettings().setJavaScriptEnabled(true);
        webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
        webView.getSettings().setBuiltInZoomControls(true);
        webView.getSettings().setDisplayZoomControls(false);
    }
    return root;
}

From source file:com.hhs.hfnavigator.slidingtabs.tools.PortalFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_webview, null);

    progressWheel = (ProgressWheel) root.findViewById(R.id.webViewProgress);

    swipeRefreshLayout = (SwipeRefreshLayout) root.findViewById(R.id.swipe);
    swipeRefreshLayout.setEnabled(false);
    progressWheel.spin();/*from   ww  w  .  jav a  2 s  . c o  m*/
    final WebView webView = (WebView) root.findViewById(R.id.webView);
    if (webView != null) {
        webView.setWebViewClient(new WebViewClient() {

            public void onPageFinished(WebView view, String url) {
                progressWheel.stopSpinning();
            }
        });
        webView.loadUrl("https://harborfieldscsd.esboces.org/campus/portal/harborfields.jsp");
        webView.getSettings().setJavaScriptEnabled(true);
        webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
        webView.getSettings().setBuiltInZoomControls(true);
        webView.getSettings().setDisplayZoomControls(false);
    }
    return root;
}

From source file:com.hhs.hfnavigator.slidingtabs.hhs.AboutFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_webview, null);

    progressWheel = (ProgressWheel) root.findViewById(R.id.webViewProgress);

    swipeRefreshLayout = (SwipeRefreshLayout) root.findViewById(R.id.swipe);
    swipeRefreshLayout.setEnabled(false);
    progressWheel.spin();/* ww  w.j  a  v  a 2  s  .  c o m*/
    final WebView webView = (WebView) root.findViewById(R.id.webView);
    if (webView != null) {
        webView.setWebViewClient(new WebViewClient() {

            public void onPageFinished(WebView view, String url) {
                progressWheel.stopSpinning();
            }
        });
        webView.loadUrl("http://www.harborfieldscsd.net/our_schools/harborfields_high_school");
        webView.getSettings().setJavaScriptEnabled(true);
        webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
        webView.getSettings().setBuiltInZoomControls(true);
        webView.getSettings().setDisplayZoomControls(false);
    }
    return root;
}

From source file:com.hhs.hfnavigator.slidingtabs.home.PollsFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_webview, null);

    progressWheel = (ProgressWheel) root.findViewById(R.id.webViewProgress);

    swipeRefreshLayout = (SwipeRefreshLayout) root.findViewById(R.id.swipe);
    swipeRefreshLayout.setEnabled(false);
    progressWheel.spin();//from   w w w .j  a  va  2  s. c o m
    final WebView webView = (WebView) root.findViewById(R.id.webView);
    if (webView != null) {
        webView.setWebViewClient(new WebViewClient() {

            public void onPageFinished(WebView view, String url) {
                progressWheel.stopSpinning();
            }
        });
        webView.loadUrl("https://docs.google.com/document/d/1Y8c9GwN0nkRBRHau1SCRrvAmRK1LQiV7Omn13KsMMqc/pub");
        webView.getSettings().setJavaScriptEnabled(true);
        webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
        webView.getSettings().setBuiltInZoomControls(true);
        webView.getSettings().setDisplayZoomControls(false);
    }
    return root;
}

From source file:com.chatwingsdk.fragments.EnterpriseAuthenticateFragment.java

private void setup(WebView mWebView) {
    mWebView.setWebViewClient(mWebviewClient);
    mWebView.getSettings().setJavaScriptEnabled(true);
    mWebView.setWebChromeClient(new WebChromeClient() {
        @Override//from w  ww.  ja v  a2  s .co m
        public void onProgressChanged(WebView view, int newProgress) {
            super.onProgressChanged(view, newProgress);
            mProgressView.setProgress(newProgress);
            if (newProgress == 100) {
                mProgressView.setVisibility(View.GONE);
            }
        }
    });
}

From source file:com.hhs.hfnavigator.slidingtabs.hhs.LibFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_webview, null);

    progressWheel = (ProgressWheel) root.findViewById(R.id.webViewProgress);

    swipeRefreshLayout = (SwipeRefreshLayout) root.findViewById(R.id.swipe);
    swipeRefreshLayout.setEnabled(false);
    progressWheel.spin();/*from  w  w w .  j a  va2 s . c om*/
    final WebView webView = (WebView) root.findViewById(R.id.webView);
    if (webView != null) {
        webView.setWebViewClient(new WebViewClient() {

            public void onPageFinished(WebView view, String url) {
                progressWheel.stopSpinning();
            }
        });
        webView.loadUrl("https://hscsd.follettdestiny.com/common/welcome.jsp?context=saas30_3133764");
        webView.getSettings().setJavaScriptEnabled(true);
        webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
        webView.getSettings().setBuiltInZoomControls(true);
        webView.getSettings().setDisplayZoomControls(false);

    }
    return root;
}

From source file:com.hhs.hfnavigator.slidingtabs.tools.CastleFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_webview, null);

    progressWheel = (ProgressWheel) root.findViewById(R.id.webViewProgress);

    swipeRefreshLayout = (SwipeRefreshLayout) root.findViewById(R.id.swipe);
    swipeRefreshLayout.setEnabled(false);
    progressWheel.spin();/* w w w .  j  a v a2s.  co  m*/
    final WebView webView = (WebView) root.findViewById(R.id.webView);
    if (webView != null) {
        webView.setWebViewClient(new WebViewClient() {

            public void onPageFinished(WebView view, String url) {
                progressWheel.stopSpinning();
            }
        });
        webView.loadUrl("http://www.castlelearning.com/mobile");
        webView.getSettings().setJavaScriptEnabled(true);
        webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
        webView.getSettings().setBuiltInZoomControls(true);
        webView.getSettings().setDisplayZoomControls(false);

    }
    return root;
}

From source file:com.hhs.hfnavigator.slidingtabs.tools.EdmodoFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_webview, null);

    progressWheel = (ProgressWheel) root.findViewById(R.id.webViewProgress);

    swipeRefreshLayout = (SwipeRefreshLayout) root.findViewById(R.id.swipe);
    swipeRefreshLayout.setEnabled(false);
    progressWheel.spin();//from  ww w .jav a2s  .c  o m
    final WebView webView = (WebView) root.findViewById(R.id.webView);
    if (webView != null) {
        webView.setWebViewClient(new WebViewClient() {

            public void onPageFinished(WebView view, String url) {
                progressWheel.stopSpinning();
            }
        });
        webView.loadUrl("http://www.edmodo.com/m");
        webView.getSettings().setJavaScriptEnabled(true);
        webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
        webView.getSettings().setBuiltInZoomControls(true);
        webView.getSettings().setDisplayZoomControls(false);

    }
    return root;
}