Search in sources :

Example 56 with WebView

use of android.webkit.WebView in project materialistic by hidroh.

the class ReadabilityFragmentTest method testFontSizeMenu.

@Test
public void testFontSizeMenu() {
    verify(readabilityClient).parse(eq("1"), eq("http://example.com/article.html"), callback.capture());
    callback.getValue().onResponse("<div>content</div>");
    fragment.onOptionsItemSelected(new RoboMenuItem(R.id.menu_font_options));
    assertThat(fragment.getFragmentManager()).hasFragmentWithTag(PopupSettingsFragment.class.getName());
    PreferenceManager.getDefaultSharedPreferences(activity).edit().putString(activity.getString(R.string.pref_readability_text_size), "3").apply();
    WebView webView = (WebView) activity.findViewById(R.id.web_view);
    shadowOf(webView).getWebViewClient().onPageFinished(webView, "about:blank");
    assertThat(shadowOf(webView).getLastLoadDataWithBaseURL().data).contains("20");
    assertEquals(R.style.AppTextSize_XLarge, Preferences.Theme.resolvePreferredReadabilityTextSize(activity));
    controller.pause().stop().destroy();
}
Also used : WebView(android.webkit.WebView) ShadowWebView(io.github.hidroh.materialistic.test.shadow.ShadowWebView) RoboMenuItem(org.robolectric.fakes.RoboMenuItem) Test(org.junit.Test)

Example 57 with WebView

use of android.webkit.WebView in project openkit-android by OpenKit.

the class WebDialog method setUpWebView.

@SuppressLint("SetJavaScriptEnabled")
private void setUpWebView(int margin) {
    LinearLayout webViewContainer = new LinearLayout(getContext());
    webView = new WebView(getContext());
    webView.setVerticalScrollBarEnabled(false);
    webView.setHorizontalScrollBarEnabled(false);
    webView.setWebViewClient(new DialogWebViewClient());
    webView.getSettings().setJavaScriptEnabled(true);
    webView.loadUrl(url);
    webView.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    webView.setVisibility(View.INVISIBLE);
    webView.getSettings().setSavePassword(false);
    webViewContainer.setPadding(margin, margin, margin, margin);
    webViewContainer.addView(webView);
    webViewContainer.setBackgroundColor(BACKGROUND_GRAY);
    contentFrameLayout.addView(webViewContainer);
}
Also used : FrameLayout(android.widget.FrameLayout) WebView(android.webkit.WebView) LinearLayout(android.widget.LinearLayout) SuppressLint(android.annotation.SuppressLint)

Example 58 with WebView

use of android.webkit.WebView in project Klyph by jonathangerbaud.

the class WebDialog method setUpWebView.

@SuppressLint("SetJavaScriptEnabled")
private void setUpWebView(int margin) {
    LinearLayout webViewContainer = new LinearLayout(getContext());
    webView = new WebView(getContext());
    webView.setVerticalScrollBarEnabled(false);
    webView.setHorizontalScrollBarEnabled(false);
    webView.setWebViewClient(new DialogWebViewClient());
    webView.getSettings().setJavaScriptEnabled(true);
    webView.loadUrl(url);
    webView.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    webView.setVisibility(View.INVISIBLE);
    webView.getSettings().setSavePassword(false);
    webViewContainer.setPadding(margin, margin, margin, margin);
    webViewContainer.addView(webView);
    webViewContainer.setBackgroundColor(BACKGROUND_GRAY);
    contentFrameLayout.addView(webViewContainer);
}
Also used : FrameLayout(android.widget.FrameLayout) WebView(android.webkit.WebView) LinearLayout(android.widget.LinearLayout) SuppressLint(android.annotation.SuppressLint)

Example 59 with WebView

use of android.webkit.WebView in project musicbrainz-android by jdamcd.

the class WebFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View layout = inflater.inflate(R.layout.fragment_webview, container, false);
    webView = (WebView) layout.findViewById(R.id.webview);
    loadWebView();
    return layout;
}
Also used : View(android.view.View) WebView(android.webkit.WebView)

Example 60 with WebView

use of android.webkit.WebView in project Klyph by jonathangerbaud.

the class FbDialog method setUpWebView.

private void setUpWebView(int margin) {
    LinearLayout webViewContainer = new LinearLayout(getContext());
    mWebView = new WebView(getContext());
    mWebView.setVerticalScrollBarEnabled(false);
    mWebView.setHorizontalScrollBarEnabled(false);
    mWebView.setWebViewClient(new FbDialog.FbWebViewClient());
    mWebView.getSettings().setJavaScriptEnabled(true);
    mWebView.getSettings().setUserAgentString("Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_7; en-us) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Safari/530.17");
    mWebView.loadUrl(mUrl);
    mWebView.setLayoutParams(FILL);
    mWebView.setVisibility(View.INVISIBLE);
    mWebView.getSettings().setSavePassword(false);
    webViewContainer.setPadding(margin, margin, margin, margin);
    webViewContainer.addView(mWebView);
    mContent.addView(webViewContainer);
}
Also used : WebView(android.webkit.WebView) LinearLayout(android.widget.LinearLayout)

Aggregations

WebView (android.webkit.WebView)328 WebViewClient (android.webkit.WebViewClient)108 View (android.view.View)82 WebSettings (android.webkit.WebSettings)48 Intent (android.content.Intent)42 SuppressLint (android.annotation.SuppressLint)37 WebChromeClient (android.webkit.WebChromeClient)37 TextView (android.widget.TextView)28 DialogInterface (android.content.DialogInterface)23 LinearLayout (android.widget.LinearLayout)23 ImageView (android.widget.ImageView)22 Bitmap (android.graphics.Bitmap)19 AlertDialog (android.app.AlertDialog)17 Test (org.junit.Test)15 Uri (android.net.Uri)12 Bundle (android.os.Bundle)12 Handler (android.os.Handler)11 WebResourceRequest (android.webkit.WebResourceRequest)11 Drawable (android.graphics.drawable.Drawable)10 Button (android.widget.Button)10