Skip to content

Commit

Permalink
[Android] enableReadingModeQuickMenu prop (#668)
Browse files Browse the repository at this point in the history
* added prop disableReadingModeQuickMenu (android only) + ios blank implementation due to hygen generated prop

* Updating JS files

* Updating package version

* update api.md

* Update API.md

* change to enable for consistent with native android

* change disabled to enabled for all mentions

consistent with native api

* Update API.md

* Update DocumentViewViewManager.java

* Delete example/yarn.lock

not intended

* Update App.js

missed test line

* fix logic as can't extract toolmanager as is

* default true

* Delete ios/RNTPTDocumentView.m

unneed ios blank implementation

* Delete ios/RNTPTDocumentViewManager.m

same as last commit

* Delete ios/RNTPTDocumentView.h

^

* Revert "Delete ios/RNTPTDocumentView.m"

This reverts commit f0c13f7.

* Revert "Delete ios/RNTPTDocumentViewManager.m"

This reverts commit 9703d81.

* Revert "Delete ios/RNTPTDocumentView.h"

This reverts commit 9d8834d.

* remove blank ios

* Update RNTPTDocumentView.h

random space + cleaning PR

* edit mEnableQuickMenu

* name for consistency

* missed variable change

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
darrenchann and github-actions[bot] authored Sep 15, 2023
1 parent 83ae002 commit 9f9b2c1
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 2 deletions.
13 changes: 12 additions & 1 deletion API.md
Original file line number Diff line number Diff line change
Expand Up @@ -3971,4 +3971,15 @@ fieldHightlightColor | object | the form field highlight color, in the format `{

```js
this._viewer.setFormFieldHighlightColor({red: 0, green: 0, blue: 255, alpha: 128}); // blue color
```
```

#### enableReadingModeQuickMenu
bool, optional, defaults to true (Android Only)

Defines whether the viewer disables long press quick menu in read-only. If false, the UI will not allow the user to long press to open the quick menu.

```js
<DocumentView
enableReadingModeQuickMenu={false}
/>
```
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,11 @@ public void setMaxSignatureCount(DocumentView documentView, int maxSignatureCoun
}

// Hygen Generated Props
@ReactProp(name = "enableReadingModeQuickMenu")
public void setEnableReadingModeQuickMenu(DocumentView documentView, boolean enabled) {
documentView.setEnableReadingModeQuickMenu(enabled);
}

@ReactProp(name = "forceAppTheme")
public void setForceAppTheme(DocumentView documentView, @NonNull String forcedAppThemeItems) {
documentView.setForceAppTheme(forcedAppThemeItems);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ public class DocumentView extends com.pdftron.pdf.controls.DocumentView2 {
private boolean mUseStylusAsPen = true;
private boolean mSignWithStamps;

private boolean mEnableReadingModeQuickMenu = true;

public boolean isBookmarkListVisible = true;
public boolean isOutlineListVisible = true;
public boolean isAnnotationListVisible = true;
Expand Down Expand Up @@ -770,6 +772,10 @@ public void setCurrentToolbar(String toolbarTag) {
}

// Hygen Generated Props
public void setEnableReadingModeQuickMenu(boolean enabled) {
mEnableReadingModeQuickMenu = enabled;
}

public void setForceAppTheme(String forcedAppThemeItems) {
if (THEME_DARK.equals(forcedAppThemeItems)) {
PdfViewCtrlSettingsManager.setColorMode(getContext(), PdfViewCtrlSettingsManager.KEY_PREF_COLOR_MODE_NIGHT);
Expand Down Expand Up @@ -3098,6 +3104,7 @@ public void onTabDocumentLoaded(String tag) {

getToolManager().setStylusAsPen(mUseStylusAsPen);
getToolManager().setSignSignatureFieldsWithStamps(mSignWithStamps);
getToolManager().setReflowTextSelectionMenuEnabled(mEnableReadingModeQuickMenu);

getToolManager().getUndoRedoManger().addUndoRedoStateChangeListener(mUndoRedoStateChangedListener);

Expand Down
1 change: 1 addition & 0 deletions lib/src/DocumentView/DocumentView.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ const propTypes = {
overrideToolbarButtonBehavior: arrayOf(Config.Buttons),
onToolbarButtonPress: func(),
// Hygen Generated Props
enableReadingModeQuickMenu: PropTypes.bool,
forceAppTheme: oneOf(Config.ThemeOptions),
signatureColors: PropTypes.arrayOf(PropTypes.exact({
red: PropTypes.number.isRequired,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "react-native-pdftron",
"title": "React Native Pdftron",
"version": "3.0.3-26",
"version": "3.0.3-27",
"description": "React Native Pdftron",
"main": "./lib/index.js",
"typings": "index.ts",
Expand Down
1 change: 1 addition & 0 deletions src/DocumentView/DocumentView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ const propTypes = {
onToolbarButtonPress: func<(event: {id: string}) => void>(),

// Hygen Generated Props
enableReadingModeQuickMenu: PropTypes.bool,
forceAppTheme: oneOf<Config.ThemeOptions>(Config.ThemeOptions),
signatureColors: PropTypes.arrayOf(PropTypes.exact({
red: PropTypes.number.isRequired,
Expand Down

0 comments on commit 9f9b2c1

Please sign in to comment.