Skip to content

Commit

Permalink
This is now useable on phonegap 8.2.2 with cordova 7+
Browse files Browse the repository at this point in the history
  • Loading branch information
tmalbonph committed Aug 12, 2019
1 parent 885926a commit d0971ee
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 17 deletions.
21 changes: 15 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
# cordova-plugin-sunmi-inner-printer
Cordova/Ionic Plugin for Sunmi V1 Printer
## cordova-plugin-sunmi-inner-printer

Tested with [email protected]!
Cordova/Ionic Plugin for Sunmi V1 Printer

Plugin based on https://github.com/labibramadhan/cordova-sunmi-inner-printer

# Changes as follows:
### Changes as follows:

#### Changelog Aug 11, 2019

1. Add `framework directive` into `plugin.xml` to automatically add `"com.sunmi:sunmiui:latest.release"` into gradle.

2. Replaced `canvas.save(Canvas.ALL_SAVE_FLAG)` with `canvas.save()` on `BitmapUtils.java`

3. Update version to `1.1.1`

#### Changelog Oct 16, 2018

1. Plugin based on [https://github.com/silviocamposs/cordova-plugin-sunmi-inner-printer](https://github.com/tmalbonph/cordova-plugin-sunmi-inner-printer/commit/c1e57f8a7db8416c644de96f6563a589f1ecc520)

2. Updated the AIDL with version 2.1
2. Updated the `AIDL` with `version 2.1`

3. Bump version to 1.1.0
3. Bump version to `1.1.0`
14 changes: 8 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"name": "cordova-plugin-sunmi-inner-printer",
"version": "1.1.0",
"description": "Cordova/Ionic Sunmi V1 Inner Printer",
"cordova": {
"id": "cordova-plugin-sunmi-inner-printer",
Expand All @@ -10,15 +9,18 @@
},
"repository": {
"type": "git",
"url": "https://github.com/silviocamposs/cordova-plugin-sunmi-inner-printer"
"url": "git://github.com/tmalbonph/cordova-plugin-sunmi-inner-printer.git"
},
"author": {
"name": "tmalbonph"
},
"author": "Silvio Campos",
"license": "MIT",
"engines": {
"cordovaDependencies": {
"3.0.0": {
"cordova-android": ">=6.3.0"
"7.1.0": {
"cordova-android": ">=7.1.0"
}
}
}
},
"version": "1.1.1"
}
7 changes: 5 additions & 2 deletions plugin.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<plugin
xmlns="http://www.phonegap.com/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android" id="cordova-plugin-sunmi-inner-printer" version="1.1.0">
xmlns:android="http://schemas.android.com/apk/res/android" id="cordova-plugin-sunmi-inner-printer" version="1.1.1">
<name>SunmiInnerPrinter</name>
<engines>
<engine name="cordova" version=">=3.0.0"/>
<engine name="cordova" version=">=7.1.0"/>
<engine name="cordova-android" version=">=7.1.0"/>
</engines>
<js-module src="www/innerprinter.js" name="InnerPrinter">
<clobbers target="sunmiInnerPrinter" />
</js-module>
<platform name="android">
<preference name="ANDROID_SUPPORT_V13_VERSION" default="27.+"/>
<framework src="com.sunmi:sunmiui:latest.release"/>
<config-file target="res/xml/config.xml" parent="/*">
<feature name="Printer">
<param name="android-package" value="com.sunmi.innerprinter.Printer"/>
Expand Down
8 changes: 5 additions & 3 deletions src/android/com/sunmi/utils/BitmapUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@

/**
* bitmap操作的工具类
*
* <p>
* change canvas.save() in drawTextToBitmap.
* </p>
* @author longtao.li
* 2012-10-18
*
* @version 2019-08-11, tmalbonph.
*/
public class BitmapUtils {

Expand Down Expand Up @@ -441,7 +443,7 @@ public static Bitmap drawTextToBitmap(Context gContext, int gResId, String gText

canvas.drawText(gText, x, y, paint);

canvas.save(Canvas.ALL_SAVE_FLAG);
canvas.save(); //canvas.save(Canvas.ALL_SAVE_FLAG);
canvas.restore();

return bitmap;
Expand Down

0 comments on commit d0971ee

Please sign in to comment.