use of android.webkit.WebSettings in project focus-android by mozilla-mobile.
the class WebViewProvider method create.
public static View create(Context context, AttributeSet attrs) {
final SystemWebView webkitView = new SystemWebView(context, attrs);
final WebSettings settings = webkitView.getSettings();
setupView(webkitView);
configureDefaultSettings(context, settings);
applyAppSettings(context, settings);
return webkitView;
}
use of android.webkit.WebSettings in project AndroidNews by zhjohow.
the class NewsBrowserActivity method setWebViewSettings.
private void setWebViewSettings() {
WebSettings webSettings = webView.getSettings();
// 打开页面时, 自适应屏幕
// 将图片调整到适合webview的大小
webSettings.setUseWideViewPort(true);
// 缩放至屏幕的大小
webSettings.setLoadWithOverviewMode(true);
// 便页面支持缩放
// 支持js
webSettings.setJavaScriptEnabled(true);
// 支持缩放
webSettings.setSupportZoom(true);
// webSettings.setBuiltInZoomControls(true); // 放大和缩小的按钮,容易引发异常 http://blog.csdn.net/dreamer0924/article/details/34082687
webSettings.setAppCacheEnabled(true);
webSettings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
}
use of android.webkit.WebSettings in project CCIP-Android by CCIP-App.
the class PuzzleFragment method onCreateView.
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
View view = inflater.inflate(R.layout.fragment_web, container, false);
setHasOptionsMenu(true);
mActivity = getActivity();
progressBar = (ProgressBar) view.findViewById(R.id.progressBar);
webView = (WebView) view.findViewById(R.id.webView);
webView.setWebViewClient(new WebViewClient() {
@Override
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
super.onReceivedError(view, request, error);
view.loadUrl(URL_NO_NETWORK);
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.getContext().startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
return true;
}
});
webView.setWebChromeClient(new WebChromeViewClient(progressBar));
if (PreferenceUtil.getToken(getActivity()) != null) {
webView.loadUrl(URL_PUZZLE + PreferenceUtil.getToken(getActivity()));
} else {
webView.loadUrl("data:text/html, <div>Please login</div>");
}
WebSettings settings = webView.getSettings();
settings.setJavaScriptEnabled(true);
settings.setDomStorageEnabled(true);
if (Build.VERSION.SDK_INT >= 21) {
settings.setMixedContentMode(WebSettings.MIXED_CONTENT_COMPATIBILITY_MODE);
}
return view;
}
use of android.webkit.WebSettings in project CCIP-Android by CCIP-App.
the class StaffFragment method onCreateView.
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
View view = inflater.inflate(R.layout.fragment_web, container, false);
progressBar = (ProgressBar) view.findViewById(R.id.progressBar);
webView = (WebView) view.findViewById(R.id.webView);
webView.setWebChromeClient(new WebChromeViewClient(progressBar));
webView.setWebViewClient(new OfficialWebViewClient());
webView.loadUrl(URL_STAFFS);
WebSettings settings = webView.getSettings();
settings.setJavaScriptEnabled(true);
settings.setDomStorageEnabled(true);
if (Build.VERSION.SDK_INT >= 21) {
settings.setMixedContentMode(WebSettings.MIXED_CONTENT_COMPATIBILITY_MODE);
}
return view;
}
use of android.webkit.WebSettings in project EasyBridge by easilycoder.
the class EasyBridgeWebView method initWebView.
@SuppressLint({ "SetJavaScriptEnabled", "AddJavascriptInterface" })
private void initWebView() {
// 开启JavaScript的支持
WebSettings webSettings = getSettings();
if (webSettings != null) {
webSettings.setJavaScriptEnabled(true);
}
addJavascriptInterface(easyBridge, MAPPING_JS_INTERFACE_NAME);
EasyBridgeWebChromeClient webChromeClient = new EasyBridgeWebChromeClient(this);
setWebChromeClient(webChromeClient);
}
Aggregations