Skip to content

Commit 095daeb

Browse files
Update plugin for PSPDFKit 4.3.0 (#29)
* Add new configuration options * Add missing dependencies * Bump plugin versions * Update README.md
1 parent d3a594b commit 095daeb

File tree

5 files changed

+33
-21
lines changed

5 files changed

+33
-21
lines changed

README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,16 @@ You can use the `options` parameter to configure PSPDFKit. Here is a list of val
4848
```javascript
4949
var options {
5050
backgroundColor: '#EFEFEF', // hex-color of the page background
51-
disableOutline: true, // hide the outline menu (default: false)
52-
disableShare: true, // hide share button (default: false)
53-
disablePrinting: true, // hide option to print (default: false)
54-
disableBookmarkList: true, // hide bookmark list (default: false)
5551
disableAnnotationList: true, // hide annotation list (default: false)
56-
disableDocumentEditor: true, // hide document editor (default: false)
52+
disableAnnotationNoteHinting: true, // hide small notes next to annotations that have a text set (default: false)
5753
disableBookmarkEditing: true, // hide bookmark editing (default: false)
54+
disableBookmarkList: true, // hide bookmark list (default: false)
55+
disableCopyPaste: true, // disable annotation copy/paste (default: false)
56+
disableDocumentEditor: true, // hide document editor (default: false)
57+
disableOutline: true, // hide the outline menu (default: false)
58+
disablePrinting: true, // hide option to print (default: false)
59+
disableShare: true, // hide share button (default: false)
60+
disableUndoRedo: true, // disable undo/redo system (default: false)
5861
hidePageLabels: true, // hide page labels (if available in PDF) in page overlay and thumbnail grid (default: false)
5962
hidePageNumberOverlay: false, // hide the overlay showing the current page (default: false)
6063
thumbnailBarMode: PSPDFKit.ThumbnailBarMode.THUMBNAIL_BAR_MODE_DEFAULT, // show static thumbnail bar. Also valid: THUMBNAIL_BAR_MODE_DEFAULT, THUMBNAIL_BAR_MODE_SCROLLABLE

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pspdfkit-cordova-android",
3-
"version": "4.2.1",
3+
"version": "4.3.0",
44
"description": "Integration of the PSPDFKit for Android library.",
55
"cordova": {
66
"id": "pspdfkit-cordova-android",
@@ -21,7 +21,7 @@
2121
],
2222
"engines": {
2323
"cordovaDependencies": {
24-
"4.2.1": { "cordova-android": ">=7.0.0" }
24+
"4.3.0": { "cordova-android": ">=7.0.0" }
2525
}
2626
},
2727
"author": "PSPDFKit",

plugin.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
~ UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
1212
~ This notice may not be removed from this file.
1313
-->
14-
<plugin id="pspdfkit-cordova-android" version="4.2.1" xmlns="http://apache.org/cordova/ns/plugins/1.0"
14+
<plugin id="pspdfkit-cordova-android" version="4.3.0" xmlns="http://apache.org/cordova/ns/plugins/1.0"
1515
xmlns:android="http://schemas.android.com/apk/res/android">
1616
<name>PSPDFKit-Android</name>
1717
<description>Integration of the PSPDFKit for Android library.</description>

src/android/java/com/pspdfkit/cordova/PSPDFKitCordovaPlugin.java

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -113,24 +113,33 @@ public class PSPDFKitCordovaPlugin extends CordovaPlugin {
113113
final Object value = options.get(option);
114114

115115
try {
116-
if ("backgroundColor".equals(option)) {
116+
if ("autosaveEnabled".equals(option)) {
117+
builder.autosaveEnabled((Boolean) value);
118+
} else if ("backgroundColor".equals(option)) {
117119
builder.backgroundColor(Color.parseColor((String) value));
120+
} else if ("disableAnnotationList".equals(option) && ((Boolean) value)) {
121+
builder.disableAnnotationList();
122+
} else if ("disableAnnotationNoteHinting".equals(option)) {
123+
builder.setAnnotationNoteHintingEnabled(!(Boolean) value);
124+
} else if ("disableBookmarkEditing".equals(option) && ((Boolean) value)) {
125+
builder.disableBookmarkEditing();
126+
} else if ("disableBookmarkList".equals(option) && ((Boolean) value)) {
127+
builder.disableBookmarkList();
128+
} else if("disableCopyPaste".equals(option)) {
129+
if((Boolean) value) builder.disableCopyPaste();
130+
else builder.enableCopyPaste();
131+
} else if ("disableDocumentEditor".equals(option) && ((Boolean) value)) {
132+
builder.disableDocumentEditor();
118133
} else if ("disableOutline".equals(option) && ((Boolean) value)) {
119134
builder.disableOutline();
135+
} else if ("disablePrinting".equals(option) && ((Boolean) value)) {
136+
builder.disablePrinting();
120137
} else if ("disableSearch".equals(option) && ((Boolean) value)) {
121138
builder.disableSearch();
122139
} else if ("disableShare".equals(option) && ((Boolean) value)) {
123140
builder.disableShare();
124-
} else if ("disablePrinting".equals(option) && ((Boolean) value)) {
125-
builder.disablePrinting();
126-
} else if ("disableBookmarkList".equals(option) && ((Boolean) value)) {
127-
builder.disableBookmarkList();
128-
} else if ("disableAnnotationList".equals(option) && ((Boolean) value)) {
129-
builder.disableAnnotationList();
130-
} else if ("disableDocumentEditor".equals(option) && ((Boolean) value)) {
131-
builder.disableDocumentEditor();
132-
} else if ("disableBookmarkEditing".equals(option) && ((Boolean) value)) {
133-
builder.disableBookmarkEditing();
141+
} else if ("disableUndoRedo".equals(option)) {
142+
builder.undoEnabled(!(Boolean) value);
134143
} else if ("hidePageLabels".equals(option) && ((Boolean) value)) {
135144
builder.hidePageLabels();
136145
} else if ("hidePageNumberOverlay".equals(option) && ((Boolean) value)) {
@@ -168,8 +177,6 @@ public class PSPDFKitCordovaPlugin extends CordovaPlugin {
168177
if ("SEARCH_INLINE".equals(searchType)) builder.setSearchType(PdfActivityConfiguration.SEARCH_INLINE);
169178
else if ("SEARCH_MODULAR".equals(searchType)) builder.setSearchType(PdfActivityConfiguration.SEARCH_MODULAR);
170179
else throw new IllegalArgumentException(String.format("Invalid search type: %s", value));
171-
} else if ("autosaveEnabled".equals(option)) {
172-
builder.autosaveEnabled(options.getBoolean("autosaveEnabled"));
173180
} else if ("annotationEditing".equals(option)) {
174181
final JSONObject annotationEditing = options.getJSONObject("annotationEditing");
175182
final Iterator<String> annotationOptionIterator = annotationEditing.keys();

src/android/pspdfkit.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,7 @@ dependencies {
3535
compile 'io.reactivex.rxjava2:rxjava:2.1.3'
3636
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
3737
compile 'com.getkeepsafe.relinker:relinker:1.2.2'
38+
compile 'com.facebook.device.yearclass:yearclass:2.0.0'
39+
compile 'org.jetbrains.kotlin:kotlin-stdlib:1.2.20'
3840
compile 'com.pspdfkit:pspdfkit:+@aar'
3941
}

0 commit comments

Comments
 (0)