Java Code Examples for android.webkit.WebView#enableSlowWholeDocumentDraw()
The following examples show how to use
android.webkit.WebView#enableSlowWholeDocumentDraw() .
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: WebViewActivity.java From ViewCapture with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { WebView.enableSlowWholeDocumentDraw(); } setContentView(R.layout.activity_web_view); setActionBarTitle("WebView Capture"); webView=findViewById(R.id.webView); webView.loadUrl("https://github.com/HelloHuDi"); webView.setWebViewClient(new WebViewClient(){ @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } }); }
Example 2
Source File: MarkdownPreviewView.java From MarkdownEditors with Apache License 2.0 | 6 votes |
@SuppressLint({"AddJavascriptInterface", "SetJavaScriptEnabled"}) private void init(Context context) { if (!isInEditMode()) { this.mContext = context; // setOrientation(VERTICAL); if (VERSION.SDK_INT >= 21) { WebView.enableSlowWholeDocumentDraw(); } this.mWebView = new WebView(this.mContext); this.mWebView.getSettings().setJavaScriptEnabled(true); this.mWebView.setVerticalScrollBarEnabled(false); this.mWebView.setHorizontalScrollBarEnabled(false); this.mWebView.addJavascriptInterface(new JavaScriptInterface(this), "handler"); this.mWebView.setWebViewClient(new MdWebViewClient(this)); this.mWebView.loadUrl("file:///android_asset/markdown.html"); addView(this.mWebView, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); } }
Example 3
Source File: MarkdownPreviewView.java From HaiNaBaiChuan with Apache License 2.0 | 6 votes |
@SuppressLint({"AddJavascriptInterface", "SetJavaScriptEnabled"}) private void init(Context context) { if (!isInEditMode()) { this.mContext = context; // setOrientation(VERTICAL); if (VERSION.SDK_INT >= 21) { WebView.enableSlowWholeDocumentDraw(); } this.mWebView = new WebView(this.mContext); this.mWebView.getSettings().setJavaScriptEnabled(true); this.mWebView.setVerticalScrollBarEnabled(false); this.mWebView.setHorizontalScrollBarEnabled(false); this.mWebView.addJavascriptInterface(new JavaScriptInterface(this), "handler"); this.mWebView.setWebViewClient(new MdWebViewClient(this)); this.mWebView.loadUrl("file:///android_asset/markdown.html"); addView(this.mWebView, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); } }
Example 4
Source File: WebScraper.java From VehicleInfoOCR with GNU General Public License v3.0 | 5 votes |
public WebScraper(final Context context) { this.context = context; web = new WebView(context); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { WebView.enableSlowWholeDocumentDraw(); } handler = new Handler(); web.getSettings().setJavaScriptEnabled(true); web.getSettings().setDomStorageEnabled(true);//added web.getSettings().setBlockNetworkImage(true); web.getSettings().setLoadsImagesAutomatically(false); // // web.getSettings().setLoadWithOverviewMode(true); // web.getSettings().setUseWideViewPort(true); // // web.getSettings().setSupportZoom(true); // web.getSettings().setBuiltInZoomControls(true); // web.getSettings().setDisplayZoomControls(false); // // web.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY); // web.setScrollbarFadingEnabled(false); JSInterface jInterface = new JSInterface(context); web.addJavascriptInterface(jInterface, "HtmlViewer"); userAgent = web.getSettings().getUserAgentString(); web.setWebViewClient(new WebViewClient() { public void onPageFinished(WebView view, String url) { // forward the page loaded event- if (onpageloadedlistener != null) { onpageloadedlistener.loaded(url); } web.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)); web.layout(0, 0, web.getMeasuredWidth(), web.getMeasuredHeight()); web.setDrawingCacheEnabled(true); } }); }
Example 5
Source File: MarkdownViewer.java From OmniList with GNU Affero General Public License v3.0 | 5 votes |
@SuppressLint({"AddJavascriptInterface", "SetJavaScriptEnabled"}) private void init() { if (Build.VERSION.SDK_INT >= 21) WebView.enableSlowWholeDocumentDraw(); this.getSettings().setJavaScriptEnabled(true); this.setVerticalScrollBarEnabled(true); this.setHorizontalScrollBarEnabled(false); this.addJavascriptInterface(this, "jsCallback"); this.webViewClient = new MdWebViewClient(onLoadingFinishListener, onAttachmentClickedListener); this.setWebViewClient(webViewClient); }
Example 6
Source File: MarkDownView.java From android with MIT License | 5 votes |
private void initView() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { WebView.enableSlowWholeDocumentDraw(); } mWebView.getSettings().setJavaScriptEnabled(true); mWebView.setVerticalScrollBarEnabled(true); mWebView.setHorizontalScrollBarEnabled(false); mWebView.setWebViewClient(new MyWebViewClient()); mWebView.setWebChromeClient(new MyWebChromeClient()); mWebView.loadUrl(DEFAULT_PATH); }
Example 7
Source File: WebViewActivity.java From Android_framework with BSD 2-Clause "Simplified" License | 5 votes |
protected void initView() { //http://stackoverflow.com/questions/30078157/webview-draw-not-properly-working-on-latest-android-system-webview-update if (Build.VERSION.SDK_INT >= 21) WebView.enableSlowWholeDocumentDraw(); setContentView(R.layout.activity_test_webview); $(R.id.btn_webview).setOnClickListener(this); $(R.id.btn_screenshot).setOnClickListener(this); }