use of android.webkit.WebView in project DroidPlugin by DroidPluginTeam.
the class WebViewTestActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_web_view_test);
mWebView = (WebView) findViewById(R.id.webview);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
return true;
}
});
mWebView.loadUrl("http://www.baidu.com");
}
use of android.webkit.WebView in project bilibili-android-client by HotBitmapGG.
the class BrowserActivity method setupWebView.
@SuppressLint("SetJavaScriptEnabled")
private void setupWebView() {
progressBar.spin();
final WebSettings webSettings = mWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE);
webSettings.setDomStorageEnabled(true);
webSettings.setGeolocationEnabled(true);
webSettings.setUseWideViewPort(true);
webSettings.setLoadWithOverviewMode(true);
mWebView.getSettings().setBlockNetworkImage(true);
mWebView.setWebViewClient(webViewClient);
mWebView.requestFocus(View.FOCUS_DOWN);
mWebView.getSettings().setDefaultTextEncodingName("UTF-8");
mWebView.setWebChromeClient(new WebChromeClient() {
@Override
public boolean onJsAlert(WebView view, String url, String message, final JsResult result) {
AlertDialog.Builder b2 = new AlertDialog.Builder(BrowserActivity.this).setTitle(R.string.app_name).setMessage(message).setPositiveButton("确定", (dialog, which) -> result.confirm());
b2.setCancelable(false);
b2.create();
b2.show();
return true;
}
});
mWebView.loadUrl(url);
}
use of android.webkit.WebView in project OneSignal-Android-SDK by OneSignal.
the class GreenActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_green);
String openURL = getIntent().getStringExtra("openURL");
final TextView textView = (TextView) findViewById(R.id.debug_view);
textView.setText("URL from additionalData: " + openURL);
Button onBackButton = (Button) (findViewById(R.id.back_button));
onBackButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(getApplicationContext(), MainActivity.class);
startActivity(intent);
}
});
WebView webView = (WebView) (findViewById(R.id.webview));
webView.getSettings().setJavaScriptEnabled(true);
webView.setWebViewClient(new WebViewClient());
if (openURL == null) {
webView.loadUrl("https://google.com");
} else {
webView.loadUrl(openURL);
}
}
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);
}
Aggregations