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