Search in sources :

Example 96 with WebView

use of android.webkit.WebView in project android-classyshark by google.

the class SourceViewerActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_source_viewer);
    getWindow().getDecorView().setBackgroundColor(Color.BLACK);
    ActionBar bar = getSupportActionBar();
    bar.setBackgroundDrawable(new ColorDrawable(0xff606060));
    String result = "";
    try {
        String name = getIntent().getStringExtra(ClassesListActivity.SELECTED_CLASS_NAME);
        String barName = name.substring(name.lastIndexOf(".") + 1);
        bar.setTitle((Html.fromHtml("<font color=\"#FFFF80\">" + barName + "</font>")));
        result = getIntent().getStringExtra(ClassesListActivity.SELECTED_CLASS_DUMP);
    } catch (Exception e) {
        e.printStackTrace();
    }
    sourceCodeText = result;
    sourceCodeText = HtmlEscapers.htmlEscaper().escape(sourceCodeText);
    WebView webView = (WebView) findViewById(R.id.source_view);
    webView.getSettings().setJavaScriptEnabled(true);
    webView.getSettings().setDefaultTextEncodingName("utf-8");
    webView.setWebViewClient(new WebViewClient() {

        @Override
        public void onPageFinished(WebView view, String url) {
        }
    });
    webView.loadDataWithBaseURL("file:///android_asset/", "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"><html xmlns=\"http://www.w3.org/1999/xhtml\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /><script src=\"run_prettify.js?skin=sons-of-obsidian\"></script></head><body bgcolor=\"#000000\"><pre class=\"prettyprint \">" + sourceCodeText + "</pre></body></html>", "text/html", "UTF-8", null);
}
Also used : ColorDrawable(android.graphics.drawable.ColorDrawable) WebView(android.webkit.WebView) ActionBar(android.support.v7.app.ActionBar) WebViewClient(android.webkit.WebViewClient)

Example 97 with WebView

use of android.webkit.WebView in project physical-web by google.

the class OobActivity method initializeWebView.

@SuppressLint("SetJavaScriptEnabled")
private void initializeWebView() {
    WebView webView = (WebView) findViewById(R.id.oob_webview);
    // Force the background color to update (it uses the color specified in the layout xml)
    webView.setBackgroundColor(0x000);
    webView.getSettings().setJavaScriptEnabled(true);
    webView.setWebViewClient(new WebViewClient());
    webView.loadUrl(getString(R.string.url_getting_started));
}
Also used : WebView(android.webkit.WebView) WebViewClient(android.webkit.WebViewClient) SuppressLint(android.annotation.SuppressLint)

Example 98 with WebView

use of android.webkit.WebView in project Rashr by DsLNeXuS.

the class SettingsFragment method showChangelog.

public static void showChangelog(Context AppContext) {
    AlertDialog.Builder dialog = new AlertDialog.Builder(AppContext);
    dialog.setTitle(R.string.changelog);
    WebView changes = new WebView(AppContext);
    changes.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
    changes.setWebViewClient(new WebViewClient());
    changes.loadUrl(Const.CHANGELOG_URL);
    changes.clearCache(true);
    dialog.setView(changes);
    dialog.show();
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) WebView(android.webkit.WebView) WebViewClient(android.webkit.WebViewClient)

Example 99 with WebView

use of android.webkit.WebView in project android_frameworks_base by DirtyUnicorns.

the class ScrollableWebViewActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    WebView webView = new WebView(this);
    webView.loadData(sHtml, "text/html", null);
    webView.setVerticalScrollBarEnabled(true);
    setContentView(webView);
}
Also used : WebView(android.webkit.WebView)

Example 100 with WebView

use of android.webkit.WebView in project android_frameworks_base by DirtyUnicorns.

the class WebViewFragment method onCreateView.

/**
     * Called to instantiate the view. Creates and returns the WebView.
     */
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (mWebView != null) {
        mWebView.destroy();
    }
    mWebView = new WebView(getContext());
    mIsWebViewAvailable = true;
    return mWebView;
}
Also used : WebView(android.webkit.WebView)

Aggregations

WebView (android.webkit.WebView)309 WebViewClient (android.webkit.WebViewClient)98 View (android.view.View)77 WebSettings (android.webkit.WebSettings)42 Intent (android.content.Intent)39 SuppressLint (android.annotation.SuppressLint)33 WebChromeClient (android.webkit.WebChromeClient)31 TextView (android.widget.TextView)26 DialogInterface (android.content.DialogInterface)23 LinearLayout (android.widget.LinearLayout)23 ImageView (android.widget.ImageView)22 Bitmap (android.graphics.Bitmap)18 AlertDialog (android.app.AlertDialog)17 Test (org.junit.Test)15 Uri (android.net.Uri)12 Bundle (android.os.Bundle)11 Handler (android.os.Handler)11 Drawable (android.graphics.drawable.Drawable)10 Button (android.widget.Button)10 FrameLayout (android.widget.FrameLayout)10