Search in sources :

Example 66 with WebView

use of android.webkit.WebView in project Inscription by MartinvanZ.

the class CustomChangelogActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_custom_changelog);
    final ChangeLogDialog changeLog = new ChangeLogDialog(this);
    final WebView webView = (WebView) findViewById(R.id.webView1);
    webView.loadDataWithBaseURL(null, changeLog.getHTML(), "text/html", "utf-8", null);
}
Also used : WebView(android.webkit.WebView) ChangeLogDialog(com.inscription.ChangeLogDialog)

Example 67 with WebView

use of android.webkit.WebView in project MWM-for-Android-Gen1 by MetaWatchOpenProjects.

the class MetaWatch method showAbout.

void showAbout() {
    WebView webView = new WebView(this);
    String html = "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" /><title>About</title></head><body>" + "<h1>MetaWatch</h1>" + "<p>Version " + Utils.getVersion(this) + ".</p>" + "<p>&copy; Copyright 2011 Meta Watch Ltd.</p>" + "</body></html>";
    webView.loadData(html, "text/html", "utf-8");
    new AlertDialog.Builder(this).setView(webView).setCancelable(true).setPositiveButton("OK", new DialogInterface.OnClickListener() {

        //@Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    }).show();
}
Also used : DialogInterface(android.content.DialogInterface) WebView(android.webkit.WebView)

Example 68 with WebView

use of android.webkit.WebView in project phonegap-facebook-plugin by Wizcorp.

the class WebDialog method createCrossImage.

private void createCrossImage() {
    crossImageView = new ImageView(getContext());
    // Dismiss the dialog when user click on the 'x'
    crossImageView.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            dismiss();
        }
    });
    Drawable crossDrawable = getContext().getResources().getDrawable(R.drawable.com_facebook_close);
    crossImageView.setImageDrawable(crossDrawable);
    /* 'x' should not be visible while webview is loading
         * make it visible only after webview has fully loaded
         */
    crossImageView.setVisibility(View.INVISIBLE);
}
Also used : Drawable(android.graphics.drawable.Drawable) ImageView(android.widget.ImageView) ImageView(android.widget.ImageView) WebView(android.webkit.WebView)

Example 69 with WebView

use of android.webkit.WebView in project phonegap-facebook-plugin by Wizcorp.

the class WebDialog method setUpWebView.

@SuppressLint("SetJavaScriptEnabled")
private void setUpWebView(int margin) {
    LinearLayout webViewContainer = new LinearLayout(getContext());
    webView = new WebView(getContext()) {

        /* Prevent NPE on Motorola 2.2 devices
             * See https://groups.google.com/forum/?fromgroups=#!topic/android-developers/ktbwY2gtLKQ
             */
        @Override
        public void onWindowFocusChanged(boolean hasWindowFocus) {
            try {
                super.onWindowFocusChanged(hasWindowFocus);
            } catch (NullPointerException e) {
            }
        }
    };
    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);
    webView.getSettings().setSaveFormData(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 70 with WebView

use of android.webkit.WebView in project remusic by aa112901.

the class TopFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_top, container, false);
    webView = (WebView) view.findViewById(R.id.webview);
    webView.getSettings().setJavaScriptEnabled(true);
    webView.getSettings().setUserAgentString("Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36");
    webView.setWebViewClient(new WebViewClient() {

        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            // 根据传入的参数再去加载新的网页
            view.loadUrl(url);
            // 表示当前WebView可以处理打开新网页的请求,不用借助系统浏览器
            return true;
        }
    });
    webView.loadUrl("http://music.163.com/#/discover/toplist?id=19723756");
    return view;
}
Also used : WebView(android.webkit.WebView) View(android.view.View) WebView(android.webkit.WebView) WebViewClient(android.webkit.WebViewClient)

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