From 75339c5fb50ce10b960e6d17035c4579bb33e62c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Katzer?= Date: Sun, 13 Jul 2014 13:21:06 +0200 Subject: [PATCH] Using plugin prevents openDatabase() on Android Fixes #11 --- README.md | 1 + src/android/Printer.java | 7 ++++--- www/printer.js | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 427da1f..d25a542 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,7 @@ cordova plugin rm de.appplant.cordova.plugin.printer ## ChangeLog #### Version 0.6.0 (not yet released) - [bugfix]: Printing wasn't possible because `isServiceAvailable` returns False IOS +- [bugfix]: Using plugin prevents openDatabase() on Android - [feature]: Added Windows8 support
*Thanks to* ***pirvudoru*** diff --git a/src/android/Printer.java b/src/android/Printer.java index 8151886..96c36b1 100644 --- a/src/android/Printer.java +++ b/src/android/Printer.java @@ -230,13 +230,14 @@ public class Printer extends CordovaPlugin { page.setVisibility(View.INVISIBLE); page.getSettings().setJavaScriptEnabled(false); + page.getSettings().setDatabaseEnabled(true); page.setWebViewClient( new WebViewClient() { @Override public void onPageFinished(final WebView page, String url) { new Handler().postDelayed( new Runnable() { - @Override - public void run() { + @Override + public void run() { Bitmap screenshot = self.takeScreenshot(page); File tmpFile = self.saveScreenshotToTmpFile(screenshot); ViewGroup vg = (ViewGroup)(page.getParent()); @@ -244,7 +245,7 @@ public class Printer extends CordovaPlugin { intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(tmpFile)); vg.removeView(page); - } + } }, 1000); } }); diff --git a/www/printer.js b/www/printer.js index fde5a88..1744689 100755 --- a/www/printer.js +++ b/www/printer.js @@ -46,11 +46,11 @@ Printer.prototype = { }, /** - * Sends the content to the printer app or service. + * Sends the content to a printer app or service. * * @param {String} content * HTML string or DOM node - * if latter, innerHTML is used to get the contents + * if latter, innerHTML is used to get the content * @param {Object?} options * Platform specific options */