use of android.webkit.WebSettings in project ETSMobile-Android2 by ApplETS.
the class MonETSFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
ViewGroup v = (ViewGroup) inflater.inflate(R.layout.fragment_web_view, container, false);
super.onCreateView(inflater, v, savedInstanceState);
webView = (WebView) v.findViewById(R.id.webView);
final WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
loadingView.showLoadingView();
webView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(final WebView view, final String url) {
view.loadUrl(url);
return false;
}
@Override
public void onPageFinished(WebView view, String url) {
// super.onPageFinished(view, url);
LoadingView.hideLoadingView(loadingView);
}
@Override
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
}
});
webView.loadUrl("https://portail.etsmtl.ca/");
AnalyticsHelper.getInstance(getActivity()).sendScreenEvent(getClass().getSimpleName());
return v;
}
use of android.webkit.WebSettings in project ETSMobile-Android2 by ApplETS.
the class BiblioFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
ViewGroup v = (ViewGroup) inflater.inflate(R.layout.fragment_web_view, container, false);
super.onCreateView(inflater, v, savedInstanceState);
webView = (WebView) v.findViewById(R.id.webView);
final WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
loadingView.showLoadingView();
webView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(final WebView view, final String url) {
view.loadUrl(url);
return false;
}
@Override
public void onPageFinished(WebView view, String url) {
// super.onPageFinished(view, url);
LoadingView.hideLoadingView(loadingView);
}
@Override
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
view.loadUrl("file:///android_asset/webview_error_page.html");
}
});
webView.loadUrl(getActivity().getString(R.string.url_biblio));
AnalyticsHelper.getInstance(getActivity()).sendScreenEvent(getClass().getSimpleName());
return v;
}
use of android.webkit.WebSettings 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.WebSettings in project UltimateAndroid by cymcsg.
the class WebViewActivity method initWebView.
private void initWebView() {
mWebView.setWebViewClient(new WebViewClient());
mWebView.setWebChromeClient(new WebChromeClient());
WebSettings settings = mWebView.getSettings();
settings.setSavePassword(true);
settings.setSaveFormData(true);
settings.setJavaScriptEnabled(true);
settings.setSupportZoom(false);
settings.setCacheMode(WebSettings.LOAD_NO_CACHE);
settings.setDomStorageEnabled(true);
settings.setSupportMultipleWindows(false);
mWebView.loadUrl("http://developer.android.com");
}
use of android.webkit.WebSettings in project UltimateAndroid by cymcsg.
the class Html5Webview method init.
private void init(Context context) {
mContext = context;
Activity mActivity = (Activity) mContext;
mLayout = new FrameLayout(context);
mBrowserFrameLayout = (FrameLayout) LayoutInflater.from(mActivity).inflate(R.layout.custom_screen, null);
mContentView = (FrameLayout) mBrowserFrameLayout.findViewById(R.id.main_content);
mCustomViewContainer = (FrameLayout) mBrowserFrameLayout.findViewById(R.id.fullscreen_custom_content);
mLayout.addView(mBrowserFrameLayout, COVER_SCREEN_PARAMS);
// Configure the webview
WebSettings s = getSettings();
s.setBuiltInZoomControls(true);
s.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);
s.setUseWideViewPort(true);
s.setLoadWithOverviewMode(true);
// s.setSavePassword(true);
s.setSaveFormData(true);
s.setJavaScriptEnabled(true);
mWebChromeClient = new MyWebChromeClient();
setWebChromeClient(mWebChromeClient);
setWebViewClient(new WebViewClient());
setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
// enable navigator.geolocation
// s.setGeolocationEnabled(true);
// s.setGeolocationDatabasePath("/data/data/org.itri.html5webview/databases/");
// enable Web Storage: localStorage, sessionStorage
s.setDomStorageEnabled(true);
mContentView.addView(this);
}
Aggregations