-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
PSPDFKit
committed
Jul 19, 2022
1 parent
cb2c9ea
commit dbd3363
Showing
59 changed files
with
7,640 additions
and
6,345 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
109 changes: 109 additions & 0 deletions
109
android/src/main/java/com/pspdfkit/react/ToolbarMenuItemsAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
/* | ||
* ToolbarMenuItemsAdapter.java | ||
* | ||
* PSPDFKit | ||
* | ||
* Copyright © 2022 PSPDFKit GmbH. All rights reserved. | ||
* | ||
* THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW | ||
* AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE PSPDFKIT LICENSE AGREEMENT. | ||
* UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. | ||
* This notice may not be removed from this file. | ||
*/ | ||
|
||
package com.pspdfkit.react; | ||
|
||
import com.facebook.react.bridge.ReadableArray; | ||
import com.pspdfkit.configuration.activity.PdfActivityConfiguration; | ||
import com.pspdfkit.configuration.sharing.ShareFeatures; | ||
|
||
import io.reactivex.annotations.NonNull; | ||
|
||
/** | ||
* This class is used for mapping the toolbar menu items for customization. | ||
*/ | ||
public class ToolbarMenuItemsAdapter { | ||
|
||
// Toolbar customization items. | ||
private static final String TOOLBAR_ITEM_SEARCH = "searchButtonItem"; | ||
private static final String TOOLBAR_ITEM_READER_VIEW = "readerViewButtonItem"; | ||
private static final String TOOLBAR_ITEM_ANNOTATIONS = "annotationButtonItem"; | ||
private static final String TOOLBAR_ITEM_THUMBNAILS = "thumbnailsButtonItem"; | ||
private static final String TOOLBAR_ITEM_SHARE = "shareButtonItem"; | ||
private static final String TOOLBAR_ITEM_SETTINGS = "settingsButtonItem"; | ||
private static final String TOOLBAR_ITEM_OUTLINE = "outlineButtonItem"; | ||
private static final String TOOLBAR_ITEM_BOOKMARKS = "bookmarkButtonItem"; | ||
private static final String TOOLBAR_ITEM_PRINT = "printButtonItem"; | ||
private static final String TOOLBAR_ITEM_ANNOTATION_LIST = "annotationListButtonItem"; | ||
private static final String TOOLBAR_ITEM_DOCUMENT_INFO_VIEW = "documentInfoViewButtonItem"; | ||
|
||
private final PdfActivityConfiguration.Builder newConfigurations; | ||
|
||
/** | ||
* @param currentConfiguration The current configurations. | ||
* @param toolbarItems The toolbar items to be customized. | ||
*/ | ||
public ToolbarMenuItemsAdapter(@NonNull final PdfActivityConfiguration.Builder currentConfiguration, @NonNull final ReadableArray toolbarItems) { | ||
PdfActivityConfiguration.Builder configuration = disableDefaultToolbarItems(currentConfiguration); | ||
|
||
for (int i = 0; i < toolbarItems.size(); i++) { | ||
String toolbarItem = toolbarItems.getString(i); | ||
switch (toolbarItem) { | ||
case TOOLBAR_ITEM_SEARCH: | ||
configuration.enableSearch(); | ||
break; | ||
case TOOLBAR_ITEM_READER_VIEW: | ||
configuration.enableReaderView(true); | ||
break; | ||
case TOOLBAR_ITEM_ANNOTATIONS: | ||
configuration.enableAnnotationEditing(); | ||
break; | ||
case TOOLBAR_ITEM_THUMBNAILS: | ||
configuration.showThumbnailGrid(); | ||
break; | ||
case TOOLBAR_ITEM_SHARE: | ||
configuration.setEnabledShareFeatures(ShareFeatures.all()); | ||
break; | ||
case TOOLBAR_ITEM_SETTINGS: | ||
configuration.showSettingsMenu(); | ||
break; | ||
case TOOLBAR_ITEM_OUTLINE: | ||
configuration.enableOutline(); | ||
break; | ||
case TOOLBAR_ITEM_BOOKMARKS: | ||
configuration.enableBookmarkList(); | ||
break; | ||
case TOOLBAR_ITEM_PRINT: | ||
configuration.enablePrinting(); | ||
break; | ||
case TOOLBAR_ITEM_ANNOTATION_LIST: | ||
configuration.enableAnnotationList(); | ||
break; | ||
case TOOLBAR_ITEM_DOCUMENT_INFO_VIEW: | ||
configuration.enableDocumentInfoView(); | ||
break; | ||
} | ||
} | ||
newConfigurations = configuration; | ||
} | ||
|
||
private PdfActivityConfiguration.Builder disableDefaultToolbarItems(final PdfActivityConfiguration.Builder configuration) { | ||
configuration.disableSearch() | ||
.enableReaderView(false) | ||
.disableAnnotationEditing() | ||
.hideThumbnailGrid() | ||
.setEnabledShareFeatures(ShareFeatures.none()) | ||
.hideSettingsMenu() | ||
.hideThumbnailGrid() | ||
.disableOutline() | ||
.disableAnnotationList() | ||
.disablePrinting() | ||
.disableBookmarkList() | ||
.disableDocumentInfoView(); | ||
return configuration; | ||
} | ||
|
||
public PdfActivityConfiguration build() { | ||
return newConfigurations.build(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ Pod::Spec.new do |s| | |
DESC | ||
s.authors = { 'PSPDFKit GmbH' => '[email protected]' } | ||
s.homepage = 'https://pspdfkit.com/guides/react-native/' | ||
s.platform = :ios, '13.0' | ||
s.platform = :ios, '14.0' | ||
s.module_name = 'PSPDFKitReactNativeiOS' | ||
s.source = { :git => 'https://github.com/PSPDFKit/react-native' } | ||
s.source_files = 'ios/*.{xcodeproj}', 'ios/RCTPSPDFKit/*.{h,m,swift}', 'ios/RCTPSPDFKit/Converters/*.{h,m,swift}' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
./android | ||
./ios | ||
./assets | ||
./node_modules/**/*.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
module.exports = { | ||
root: true, | ||
extends: '@react-native-community', | ||
rules: { | ||
'react/no-string-refs': 'off', | ||
'no-alert': 'off', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
module.exports = { | ||
bracketSpacing: false, | ||
jsxBracketSameLine: true, | ||
bracketSpacing: true, | ||
bracketSameLine: false, | ||
singleQuote: true, | ||
trailingComma: 'all', | ||
arrowParens: 'avoid', | ||
"endOfLine": "auto", | ||
"printWidth": 80, | ||
"tabWidth": 2, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.