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);
}
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));
}
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();
}
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);
}
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;
}
Aggregations