Using plugin prevents openDatabase() on Android

Fixes #11
This commit is contained in:
Sebastián Katzer 2014-07-13 13:21:06 +02:00
parent 59f848b293
commit 75339c5fb5
3 changed files with 7 additions and 5 deletions

View File

@ -54,6 +54,7 @@ cordova plugin rm de.appplant.cordova.plugin.printer
## ChangeLog ## ChangeLog
#### Version 0.6.0 (not yet released) #### Version 0.6.0 (not yet released)
- [bugfix]: Printing wasn't possible because `isServiceAvailable` returns False IOS - [bugfix]: Printing wasn't possible because `isServiceAvailable` returns False IOS
- [bugfix]: Using plugin prevents openDatabase() on Android
- [feature]: Added Windows8 support<br> - [feature]: Added Windows8 support<br>
*Thanks to* ***pirvudoru*** *Thanks to* ***pirvudoru***

View File

@ -230,13 +230,14 @@ public class Printer extends CordovaPlugin {
page.setVisibility(View.INVISIBLE); page.setVisibility(View.INVISIBLE);
page.getSettings().setJavaScriptEnabled(false); page.getSettings().setJavaScriptEnabled(false);
page.getSettings().setDatabaseEnabled(true);
page.setWebViewClient( new WebViewClient() { page.setWebViewClient( new WebViewClient() {
@Override @Override
public void onPageFinished(final WebView page, String url) { public void onPageFinished(final WebView page, String url) {
new Handler().postDelayed( new Runnable() { new Handler().postDelayed( new Runnable() {
@Override @Override
public void run() { public void run() {
Bitmap screenshot = self.takeScreenshot(page); Bitmap screenshot = self.takeScreenshot(page);
File tmpFile = self.saveScreenshotToTmpFile(screenshot); File tmpFile = self.saveScreenshotToTmpFile(screenshot);
ViewGroup vg = (ViewGroup)(page.getParent()); ViewGroup vg = (ViewGroup)(page.getParent());
@ -244,7 +245,7 @@ public class Printer extends CordovaPlugin {
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(tmpFile)); intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(tmpFile));
vg.removeView(page); vg.removeView(page);
} }
}, 1000); }, 1000);
} }
}); });

View File

@ -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 * @param {String} content
* HTML string or DOM node * 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 * @param {Object?} options
* Platform specific options * Platform specific options
*/ */