Java Code Examples for android.webkit.WebSettings#setLoadWithOverviewMode()
The following examples show how to use
android.webkit.WebSettings#setLoadWithOverviewMode() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Web3View.java From Web3View with GNU General Public License v3.0 | 6 votes |
@SuppressLint("SetJavaScriptEnabled") private void init() { jsInjectorClient = new JsInjectorClient(getContext()); webViewClient = new Web3ViewClient(jsInjectorClient, new UrlHandlerManager()); WebSettings webSettings = super.getSettings(); webSettings.setJavaScriptEnabled(true); webSettings.setCacheMode(WebSettings.LOAD_DEFAULT); webSettings.setBuiltInZoomControls(true); webSettings.setDisplayZoomControls(false); webSettings.setUseWideViewPort(true); webSettings.setLoadWithOverviewMode(true); webSettings.setDomStorageEnabled(true); addJavascriptInterface(new SignCallbackJSInterface( this, innerOnSignTransactionListener, innerOnSignMessageListener, innerOnSignPersonalMessageListener, innerOnSignTypedMessageListener), "trust"); super.setWebViewClient(webViewClient); }
Example 2
Source File: WebViewActivity.java From UGank with GNU General Public License v3.0 | 6 votes |
public void initWebView() { WebSettings settings = mWebView.getSettings(); settings.setLoadWithOverviewMode(true); settings.setJavaScriptEnabled(true); settings.setAppCacheEnabled(true); settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN); settings.setSupportZoom(true); mWebView.setWebChromeClient(new MyWebChrome()); mWebView.setWebViewClient(new MyWebClient()); mWebView.setOnScrollChangedCallback(new ObservableWebView.OnScrollChangedCallback() { @Override public void onScroll(int dx, int dy) { if (dy > 0) { mFloatingActionButton.hide(); } else { mFloatingActionButton.show(); } } }); }
Example 3
Source File: FastWebActivity.java From FastLib with Apache License 2.0 | 6 votes |
protected void initAgentWeb() { mAgentBuilder = AgentWeb.with(this) .setAgentWebParent(mContainer, new ViewGroup.LayoutParams(-1, -1)) .useDefaultIndicator(getProgressColor() != -1 ? getProgressColor() : ContextCompat.getColor(mContext, R.color.colorTitleText), getProgressHeight()) .useMiddlewareWebChrome(new MiddlewareWebChromeBase() { @Override public void onReceivedTitle(WebView view, String title) { super.onReceivedTitle(view, title); mCurrentUrl = view.getUrl(); mTitleBar.setTitleMainText(title); } }) .setSecurityType(AgentWeb.SecurityType.STRICT_CHECK); setAgentWeb(mAgentBuilder); mAgentWeb = mAgentBuilder .createAgentWeb()// .ready() .go(mUrl); WebSettings webSettings = mAgentWeb.getAgentWebSettings().getWebSettings(); //设置webView自适应屏幕 webSettings.setUseWideViewPort(true); webSettings.setLoadWithOverviewMode(true); setAgentWeb(mAgentWeb); }
Example 4
Source File: MyAdvancedWebView.java From SlimSocial-for-Facebook with GNU General Public License v2.0 | 6 votes |
public void setDesktopMode(final boolean enabled) { final WebSettings webSettings = getSettings(); final String newUserAgent; if (enabled) { newUserAgent = webSettings.getUserAgentString() .replace("Mobile", "eliboM") .replace("Android", "diordnA"); } else { newUserAgent = webSettings.getUserAgentString() .replace("eliboM", "Mobile") .replace("diordnA", "Android"); } webSettings.setUserAgentString(newUserAgent); webSettings.setUseWideViewPort(enabled); webSettings.setLoadWithOverviewMode(enabled); webSettings.setSupportZoom(enabled); webSettings.setBuiltInZoomControls(enabled); }
Example 5
Source File: WebTextActivity.java From YCCustomText with Apache License 2.0 | 6 votes |
public void initWebView(String data) { WebView mWebView = findViewById(R.id.showdiarys); WebSettings settings = mWebView.getSettings(); //settings.setUseWideViewPort(true);//调整到适合webview的大小,不过尽量不要用,有些手机有问题 settings.setLoadWithOverviewMode(true);//设置WebView是否使用预览模式加载界面。 mWebView.setVerticalScrollBarEnabled(false);//不能垂直滑动 mWebView.setHorizontalScrollBarEnabled(false);//不能水平滑动 settings.setTextSize(WebSettings.TextSize.NORMAL);//通过设置WebSettings,改变HTML中文字的大小 settings.setJavaScriptCanOpenWindowsAutomatically(true);//支持通过JS打开新窗口 //设置WebView属性,能够执行Javascript脚本 mWebView.getSettings().setJavaScriptEnabled(true);//设置js可用 mWebView.setWebViewClient(new WebViewClient()); mWebView.addJavascriptInterface(new AndroidJavaScript(getApplication()), "android");//设置js接口 settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);//支持内容重新布局 mWebView.loadUrl(data); }
Example 6
Source File: WebViewerActivity.java From NGA-CLIENT-VER-OPEN-SOURCE with GNU General Public License v2.0 | 6 votes |
private void load() { final String uri = getPath(); final WebSettings settings = mWebView.getSettings(); if (uri.endsWith(".swf")) { mWebView.setWebChromeClient(new WebChromeClient()); //settings.setPluginState(PluginState.ON); mWebView.loadUrl(uri); } else {//images settings.setSupportZoom(true); settings.setJavaScriptEnabled(true); settings.setBuiltInZoomControls(true); // settings.setUseWideViewPort(true); settings.setLoadWithOverviewMode(true); //settings.setUserAgentString(IPHONE_UA); mWebView.loadUrl(uri); } }
Example 7
Source File: WebViewFragment.java From NestedTouchScrollingLayout with MIT License | 6 votes |
private void initWebSettings() { WebSettings settings = this.mWebView.getSettings(); settings.setJavaScriptEnabled(true); settings.setUseWideViewPort(true); settings.setLoadWithOverviewMode(true); settings.setSupportZoom(false); settings.setDisplayZoomControls(false); settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NORMAL); settings.supportMultipleWindows(); settings.setSupportMultipleWindows(true); settings.setDomStorageEnabled(true); settings.setDatabaseEnabled(true); settings.setAppCacheEnabled(true); settings.setAppCachePath(this.mWebView.getContext().getCacheDir().getAbsolutePath()); settings.setAllowFileAccess(true); settings.setLoadsImagesAutomatically(true); settings.setDefaultTextEncodingName("UTF-8"); }
Example 8
Source File: WebViewActivity.java From Tok-Android with GNU General Public License v3.0 | 6 votes |
private void initSetting() { WebSettings settings = mWebView.getSettings(); settings.setAppCacheEnabled(false); settings.setCacheMode(WebSettings.LOAD_NO_CACHE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { WebView.setWebContentsDebuggingEnabled(true); } String userAgent = settings.getUserAgentString(); settings.setUserAgentString( userAgent + " TokAndroid/" + String.valueOf(BuildConfig.VERSION_NAME)); settings.setJavaScriptEnabled(true); settings.setAllowFileAccessFromFileURLs(false); settings.setAllowUniversalAccessFromFileURLs(false); settings.setDomStorageEnabled(true); settings.setAllowFileAccess(true); settings.setAppCacheEnabled(true); settings.setCacheMode(WebSettings.LOAD_DEFAULT); settings.setDatabaseEnabled(true); settings.setSupportZoom(true); settings.setBuiltInZoomControls(true); settings.setDisplayZoomControls(false); settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN); settings.setUseWideViewPort(true); settings.setLoadWithOverviewMode(true); }
Example 9
Source File: PictureActivity.java From SlimSocial-for-Facebook with GNU General Public License v2.0 | 6 votes |
private void SetupPictureWebView() { webViewPicture = findViewById(R.id.webViewPicture); webViewPicture.setListener(this, this); // webViewPicture.setDesktopMode(true); //webViewPicture.requestFocus(View.F); getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);//remove the keyboard issue WebSettings settings = webViewPicture.getSettings(); settings.setBuiltInZoomControls(true); settings.setUseWideViewPort(true); settings.setJavaScriptEnabled(true); settings.setLoadWithOverviewMode(true); settings.setDisplayZoomControls(false); }
Example 10
Source File: GankWebActivity.java From Gank-Veaer with GNU General Public License v3.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mUrl = getIntent().getStringExtra("feed_url"); mTitle = getIntent().getStringExtra("feed_title"); mToolbar.setTitle(mTitle); WebSettings settings = mWebView.getSettings(); settings.setJavaScriptEnabled(true); settings.setLoadWithOverviewMode(true); settings.setAppCacheEnabled(true); settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN); settings.setSupportZoom(true); settings.setDomStorageEnabled(true); mWebView.setWebChromeClient(new ChromeClient()); mWebView.setWebViewClient(new LoveClient()); mWebView.setLayerType(View.LAYER_TYPE_SOFTWARE, null); mWebView.loadUrl(mUrl); }
Example 11
Source File: YouTubePlayerWebView.java From android-inline-youtube-view with Apache License 2.0 | 6 votes |
/** * Initialises YoutubeWebView with given videoId and youtubeListener */ @SuppressLint("SetJavaScriptEnabled") private void initWebView(String webViewUrl) { WebSettings set = this.getSettings(); set.setJavaScriptEnabled(true); set.setUseWideViewPort(true); set.setLoadWithOverviewMode(true); set.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NORMAL); set.setCacheMode(WebSettings.LOAD_DEFAULT); set.setPluginState(WebSettings.PluginState.ON_DEMAND); set.setAllowContentAccess(true); set.setAllowFileAccess(false); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { set.setMediaPlaybackRequiresUserGesture(false); } this.setLayerType(View.LAYER_TYPE_NONE, null); this.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED); this.loadUrl(webViewUrl); if (BuildConfig.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { setWebContentsDebuggingEnabled(true); } this.setWebViewClient(initWebViewClient()); }
Example 12
Source File: WebBrowserActivity.java From Dashchan with Apache License 2.0 | 5 votes |
@SuppressLint("SetJavaScriptEnabled") @Override protected void onCreate(Bundle savedInstanceState) { ResourceUtils.applyPreferredTheme(this); super.onCreate(savedInstanceState); setTitle(R.string.action_browser); getActionBar().setDisplayHomeAsUpEnabled(true); ViewUtils.applyToolbarStyle(this, null); WebView webView = new WebView(this); this.webView = webView; WebSettings settings = webView.getSettings(); settings.setBuiltInZoomControls(true); settings.setDisplayZoomControls(false); settings.setUseWideViewPort(true); settings.setLoadWithOverviewMode(true); settings.setJavaScriptEnabled(true); settings.setDomStorageEnabled(true); webView.setWebViewClient(new CustomWebViewClient()); webView.setWebChromeClient(new CustomWebChromeClient()); progressView = new ProgressView(this); float density = ResourceUtils.obtainDensity(this); FrameLayout frameLayout = new FrameLayout(this); frameLayout.addView(webView, FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT); frameLayout.addView(progressView, FrameLayout.LayoutParams.MATCH_PARENT, (int) (3f * density + 0.5f)); setContentView(frameLayout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); webView.setDownloadListener(this); WebViewUtils.clearAll(webView); webView.loadUrl(getIntent().getData().toString()); registerForContextMenu(webView); }
Example 13
Source File: NewsDetailFragment.java From Companion-For-PUBG-Android with MIT License | 5 votes |
private void setWebView(@NonNull final String newsSrc) { if (newsWebView != null) { WebSettings settings = this.newsWebView.getSettings(); settings.setUseWideViewPort(true); settings.setBuiltInZoomControls(true); settings.setLoadWithOverviewMode(true); this.newsWebView.loadUrl(newsSrc); } }
Example 14
Source File: LoveVideoView.java From gank.io-unofficial-android-client with Apache License 2.0 | 5 votes |
void init() { setWebViewClient(new LoveClient()); setWebChromeClient(new Chrome()); WebSettings webSettings = getSettings(); webSettings.setJavaScriptEnabled(true); webSettings.setAllowFileAccess(true); webSettings.setDatabaseEnabled(true); webSettings.setDomStorageEnabled(true); webSettings.setSaveFormData(false); webSettings.setAppCacheEnabled(true); webSettings.setCacheMode(WebSettings.LOAD_DEFAULT); webSettings.setLoadWithOverviewMode(false); webSettings.setUseWideViewPort(true); }
Example 15
Source File: WebViewActivity.java From CloudReader with Apache License 2.0 | 4 votes |
@SuppressLint("SetJavaScriptEnabled") private void initWebView() { WebSettings ws = webView.getSettings(); // 网页内容的宽度适配 ws.setLoadWithOverviewMode(true); ws.setUseWideViewPort(true); // 保存表单数据 ws.setSaveFormData(true); // 是否应该支持使用其屏幕缩放控件和手势缩放 ws.setSupportZoom(true); ws.setBuiltInZoomControls(true); ws.setDisplayZoomControls(false); // 启动应用缓存 ws.setAppCacheEnabled(true); // 设置缓存模式 ws.setCacheMode(WebSettings.LOAD_DEFAULT); // 告诉WebView启用JavaScript执行。默认的是false。 ws.setJavaScriptEnabled(true); // 页面加载好以后,再放开图片 ws.setBlockNetworkImage(false); // 使用localStorage则必须打开 ws.setDomStorageEnabled(true); // 排版适应屏幕 ws.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS); // WebView是否新窗口打开(加了后可能打不开网页) // ws.setSupportMultipleWindows(true); // webview从5.0开始默认不允许混合模式,https中不能加载http资源,需要设置开启。 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { ws.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); } /** 设置字体默认缩放大小(改变网页字体大小,setTextSize api14被弃用)*/ ws.setTextZoom(100); mWebChromeClient = new MyWebChromeClient(this); webView.setWebChromeClient(mWebChromeClient); // 与js交互 webView.addJavascriptInterface(new ImageClickInterface(this), "injectedObject"); webView.setWebViewClient(new MyWebViewClient(this)); webView.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { return handleLongImage(); } }); }
Example 16
Source File: BitWebViewFragment.java From tysq-android with GNU General Public License v3.0 | 4 votes |
private void initWebViewSetting(WebSettings settings) { //支持js脚本 settings.setJavaScriptEnabled(true); //支持缩放 settings.setSupportZoom(true); //支持缩放 settings.setBuiltInZoomControls(true); //去除缩放按钮 settings.setDisplayZoomControls(false); //扩大比例的缩放 settings.setUseWideViewPort(true); //自适应屏幕 settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN); settings.setLoadWithOverviewMode(true); //多窗口 settings.supportMultipleWindows(); //关闭webview中缓存 settings.setCacheMode(WebSettings.LOAD_NO_CACHE); //设置可以访问文件 settings.setAllowFileAccess(true); //当webview调用requestFocus时为webview设置节点 settings.setNeedInitialFocus(true); //支持通过JS打开新窗口 settings.setJavaScriptCanOpenWindowsAutomatically(true); //支持自动加载图片 settings.setLoadsImagesAutomatically(true); //启用地理定位 // settings.setGeolocationEnabled(true); //设置渲染优先级 settings.setRenderPriority(WebSettings.RenderPriority.HIGH); // 设置支持本地存储 settings.setDatabaseEnabled(true); //设置支持DomStorage settings.setDomStorageEnabled(true); addJavascriptInterface(); }
Example 17
Source File: BaseWebFragment.java From Android-Application-ZJB with Apache License 2.0 | 4 votes |
protected void initialize() { //添加H5的基本参数 UrlParserManager.getInstance().addParams(UrlParserManager.METHOD_CHANNEL, "app"); mParamBuilder = getParams(); mUrl = UrlParserManager.getInstance().parsePlaceholderUrl(mParamBuilder.getUrl()); mWebView.setProgressbar(mProgressBar); WebSettings ws = mWebView.getSettings(); ws.setBuiltInZoomControls(false); // 缩放 ws.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS); ws.setUseWideViewPort(true); ws.setLoadWithOverviewMode(true); ws.setSaveFormData(true); ws.setDomStorageEnabled(true);//开启 database storage API 功能 //设置自定义UserAgent String agent = ws.getUserAgentString(); ws.setUserAgentString(createUserAgent(agent)); mWebView.setDownloadListener((url, userAgent, contentDisposition, mimeType, contentLength) -> { if (url != null && url.startsWith("http://")) startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url))); }); mWebView.loadUrl(mUrl); mWebView.setOnKeyListener((v, keyCode, event) -> { if (event.getAction() == KeyEvent.ACTION_DOWN) { //表示按返回键时的操作 if (keyCode == KeyEvent.KEYCODE_BACK && mWebView.canGoBack()) { mWebView.goBack(); //后退 return true; //已处理 } } return false; }); mWebView.setDefaultHandler(new DefaultHandler()); //注册分享方法 mWebView.registerHandler("shareJs", (data, function) -> { try { if (!TextUtils.isEmpty(data)) { WebShareBean shareBean = GsonUtil.fromJson(data, WebShareBean.class); shareJs(shareBean); } } catch (Exception e) { e.printStackTrace(); } }); //注册设置标题方法 mWebView.registerHandler("webTitleJs", ((data, function) -> webTitleJs(data))); //注册设置分享按钮方法 mWebView.registerHandler("disableShareJs", ((data, function) -> { if ("true".equals(data)) { disableShareJs(true); } else { disableShareJs(false); } })); //注册微信支付 mWebView.registerHandler("wxPayJs", ((data, function) -> wxPayJs(data))); }
Example 18
Source File: WebContainerActivity.java From likequanmintv with Apache License 2.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.act_web_container); SystemBarUtils.setStatusBarTranslate(this,R.color.colorPrimary); imgBack=(ImageView)findViewById(R.id.imgBack); imgForward=(ImageView)findViewById(R.id.imgForward); tvTitle=(TextView)findViewById(R.id.title); imgBack.setOnClickListener(this); imgForward.setOnClickListener(this); mWebView= (WebView) findViewById(R.id.mWebView); Bundle bundle = getIntent().getExtras(); if (null!=bundle){ title=bundle.getString(Intent.EXTRA_TITLE,"全民tv"); url=bundle.getString(Intent.EXTRA_TEXT,""); isAd=bundle.getBoolean("isAd",false); tvTitle.setText(""+title); } if (isAd){ imgForward.setVisibility(View.VISIBLE); imgBack.setVisibility(View.GONE); } mWebView.setWebChromeClient(new WebChromeClient()); mWebView.setWebViewClient(new WebViewClient()); WebSettings settings = mWebView.getSettings(); //允许使用js settings.setJavaScriptEnabled(true); //支持缩放 settings.setSupportZoom(true); // //出现缩放工具 settings.setBuiltInZoomControls(true); // settings.setUseWideViewPort(true); // settings.setLoadWithOverviewMode(true); //让网页自适应屏幕宽度 // settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN); mWebView.loadUrl(url); }
Example 19
Source File: WebViewActivity.java From ByWebView with Apache License 2.0 | 4 votes |
@SuppressLint({"SetJavaScriptEnabled", "AddJavascriptInterface"}) private void initWebView() { WebSettings ws = webView.getSettings(); // 保存表单数据 ws.setSaveFormData(true); // 是否应该支持使用其屏幕缩放控件和手势缩放 ws.setSupportZoom(true); ws.setBuiltInZoomControls(true); ws.setDisplayZoomControls(false); // 启动应用缓存 ws.setAppCacheEnabled(true); // 设置缓存模式 ws.setCacheMode(WebSettings.LOAD_DEFAULT); // setDefaultZoom api19被弃用 // 网页内容的宽度自适应屏幕 ws.setLoadWithOverviewMode(true); ws.setUseWideViewPort(true); // 网页缩放至100,一般的网页达到屏幕宽度效果,个别除外 // webView.setInitialScale(100); // 关掉下滑弧形阴影 // webView.setOverScrollMode(WebView.OVER_SCROLL_NEVER); // 告诉WebView启用JavaScript执行。默认的是false。 ws.setJavaScriptEnabled(true); // 页面加载好以后,再放开图片 ws.setBlockNetworkImage(false); // 使用localStorage则必须打开 ws.setDomStorageEnabled(true); // 排版适应屏幕 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { ws.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS); } else { ws.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NORMAL); } // WebView是否新窗口打开(加了后可能打不开网页) // ws.setSupportMultipleWindows(true); // webview从5.0开始默认不允许混合模式,https中不能加载http资源,需要设置开启。 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { ws.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); } /** 设置字体默认缩放大小(改变网页字体大小,setTextSize api14被弃用)*/ ws.setTextZoom(100); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { webView.setScrollBarSize(WebTools.dp2px(this, 3)); } mWebChromeClient = new MyWebChromeClient(this); webView.setWebChromeClient(mWebChromeClient); // 与js交互 webView.addJavascriptInterface(new MyJavascriptInterface(this), "injectedObject"); webView.setWebViewClient(new MyWebViewClient(this)); webView.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { return handleLongImage(); } }); }
Example 20
Source File: WebView.java From unity-ads-android with Apache License 2.0 | 4 votes |
public WebView(Context context) { super(context); WebSettings settings = getSettings(); if(Build.VERSION.SDK_INT >= 16) { settings.setAllowFileAccessFromFileURLs(true); settings.setAllowUniversalAccessFromFileURLs(true); } if (Build.VERSION.SDK_INT >= 19) { try { _evaluateJavascript = android.webkit.WebView.class.getMethod("evaluateJavascript", String.class, ValueCallback.class); } catch(NoSuchMethodException e) { DeviceLog.exception("Method evaluateJavascript not found", e); _evaluateJavascript = null; } } settings.setAppCacheEnabled(false); settings.setBlockNetworkImage(false); settings.setBlockNetworkLoads(false); settings.setBuiltInZoomControls(false); settings.setCacheMode(WebSettings.LOAD_NO_CACHE); settings.setDatabaseEnabled(false); if(Build.VERSION.SDK_INT >= 11) { settings.setDisplayZoomControls(false); } settings.setDomStorageEnabled(false); if(Build.VERSION.SDK_INT >= 11) { settings.setEnableSmoothTransition(false); } settings.setGeolocationEnabled(false); settings.setJavaScriptCanOpenWindowsAutomatically(false); settings.setJavaScriptEnabled(true); settings.setLightTouchEnabled(false); settings.setLoadWithOverviewMode(false); settings.setLoadsImagesAutomatically(true); if(Build.VERSION.SDK_INT >= 17) { settings.setMediaPlaybackRequiresUserGesture(false); } if(Build.VERSION.SDK_INT >= 21) { settings.setMixedContentMode(WebSettings.MIXED_CONTENT_NEVER_ALLOW); } settings.setNeedInitialFocus(true); settings.setPluginState(WebSettings.PluginState.OFF); settings.setRenderPriority(WebSettings.RenderPriority.NORMAL); settings.setSaveFormData(false); settings.setSavePassword(false); settings.setSupportMultipleWindows(false); settings.setSupportZoom(false); settings.setUseWideViewPort(true); setHorizontalScrollBarEnabled(false); setVerticalScrollBarEnabled(false); setInitialScale(0); setBackgroundColor(Color.TRANSPARENT); ViewUtilities.setBackground(this, new ColorDrawable(Color.TRANSPARENT)); setBackgroundResource(0); addJavascriptInterface(new WebViewBridgeInterface(), "webviewbridge"); }