Example usage for android.webkit WebView getSettings

List of usage examples for android.webkit WebView getSettings

Introduction

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

Prototype

public WebSettings getSettings() 

Source Link

Document

Gets the WebSettings object used to control the settings for this WebView.

Usage

From source file:org.namelessrom.devicecontrol.modules.about.PrivacyFragment.java

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

    final WebView wv = (WebView) view.findViewById(R.id.dialog_help_webview);
    wv.getSettings().setTextZoom(90);

    final String url = AppResources.get().isDarkTheme() ? "file:///android_asset/privacy_dark.html"
            : "file:///android_asset/privacy.html";
    wv.loadUrl(url);/*  w ww . j  a v  a 2s . co  m*/

    return view;
}

From source file:com.rizal.lovins.smartkasir.fragment.HomeAdminFragment.java

@SuppressLint("SetJavaScriptEnabled")
@Override//w w  w . j ava2  s.c o  m
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_home_admin, container, false);

    WebView mWebView = (WebView) view.findViewById(R.id.webViewAdmin);
    WebSettings webSettings = mWebView.getSettings();
    webSettings.setJavaScriptEnabled(true);
    mWebView.getSettings().setBuiltInZoomControls(false);
    mWebView.getSettings().setDisplayZoomControls(false);
    mWebView.loadUrl("file:///android_asset/license/index.html");

    return view;
}

From source file:com.rizal.lovins.smartkasir.fragment.HomeKasirFragment.java

@SuppressLint("SetJavaScriptEnabled")
@Override/*from www  .  ja va  2  s .c o  m*/
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_home_kasir, container, false);

    WebView mWebView = (WebView) view.findViewById(R.id.webViewKasir);
    WebSettings webSettings = mWebView.getSettings();
    webSettings.setJavaScriptEnabled(true);
    mWebView.getSettings().setBuiltInZoomControls(false);
    mWebView.getSettings().setDisplayZoomControls(false);
    mWebView.loadUrl("file:///android_asset/license/index_kasir.html");

    return view;
}

From source file:com.abcvoipsip.ui.help.Faq.java

public View getCustomView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.faq, container, false);
    WebView webView = (WebView) v.findViewById(R.id.webview);
    webView.getSettings().setJavaScriptEnabled(true);
    webView.setWebViewClient(new FaqWebViewClient(v));
    webView.loadUrl(FAQ_URL);// w  ww . j ava  2s.com
    return v;
}

From source file:org.feedhenry.saml.fragments.WebViewFragment.java

@Nullable
@Override//from   w  w  w  .java2 s.c o m
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    String ssoStringURL = getArguments().getString(URL);

    View view = View.inflate(getActivity(), R.layout.fragment_webview, null);

    WebView webView = (WebView) view.findViewById(R.id.ssoWebView);
    webView.getSettings().setUseWideViewPort(true);
    webView.getSettings().setLoadWithOverviewMode(true);
    webView.getSettings().setJavaScriptEnabled(true);
    webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
    webView.setWebViewClient(new WebViewClient() {
        @Override
        public void onPageStarted(WebView view, String url, Bitmap favicon) {
            // It' logged
            if (url.endsWith("login/ok")) {
                SAMLActivity activity = (SAMLActivity) getActivity();
                activity.retrieveUserData();
            }
        }
    });
    webView.loadUrl(ssoStringURL);

    return view;
}

From source file:com.salesforce.marketingcloud.android.demoapp.ui.OriginalDocsActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    WebView markdownView = (WebView) findViewById(R.id.markdownView);
    markdownView.getSettings().setJavaScriptEnabled(true);
    markdownView.loadUrl(getResources().getString(R.string.official_remote_url));
    markdownView.setWebViewClient(new WebViewClient() {
        @Override/* www. j av a  2  s  . co  m*/
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            view.loadUrl(url);
            return false;
        }
    });

    MarketingCloudSdk.requestSdk(new MarketingCloudSdk.WhenReadyListener() {
        @Override
        public void ready(MarketingCloudSdk marketingCloudSdk) {
            marketingCloudSdk.getAnalyticsManager().trackPageView("data://OriginalDocsActivity",
                    getResources().getString(R.string.official_remote_url), null, null);
        }
    });
}

From source file:com.customlbs.android.presentation.legal.LicenseDetailFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    WebView webView = new WebView(getActivity());
    webView.loadUrl("file:///android_asset/" + licensePath);
    webView.getSettings().setSupportZoom(true);
    webView.getSettings().setBuiltInZoomControls(true);

    return webView;
}

From source file:jp.mydns.sys1yagi.android.printingframeworksample.html.HtmlPrintActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_html_print);

    final WebView webView = (WebView) findViewById(R.id.webview);
    webView.getSettings().setSupportZoom(true);
    webView.getSettings().setBuiltInZoomControls(true);
    webView.setWebViewClient(new WebViewClient() {
        @Override/*from   w w  w  .  ja v  a2s  .  c om*/
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            return false;
        }
    });
    webView.loadUrl("http://visible-true.blogspot.jp/");

    findViewById(R.id.print_button).setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            printHtml(webView.getTitle() + ".pdf", webView);
        }
    });
}

From source file:ca.rmen.android.networkmonitor.app.speedtest.SpeedTestAboutFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    Log.v(TAG, "onCreateView");
    View rootView = inflater.inflate(R.layout.fragment_speed_test_about, container, false);
    WebView wv = (WebView) rootView.findViewById(R.id.webview);
    wv.setBackgroundColor(0);// ww w. j  a v a 2 s . c  o m
    wv.getSettings().setDefaultFontSize(14);
    wv.loadUrl(getString(R.string.speed_test_about_file));
    return rootView;
}

From source file:com.xperia64.cosi.WebFragment.java

@SuppressLint("SetJavaScriptEnabled")
public void updateUrl(String url) {
    curURL = url;/*from w  w  w  .  j a va 2  s  .  c  o  m*/
    WebView webview = (WebView) getView().findViewById(R.id.web);
    webview.getSettings().setJavaScriptEnabled(true);
    webview.loadUrl(url);
}