-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #350 from PSPDFKit/rad/annotation-processing
Add API for annotation processing
- Loading branch information
Showing
14 changed files
with
623 additions
and
59 deletions.
There are no files selected for viewing
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
56 changes: 56 additions & 0 deletions
56
android/src/main/java/com/pspdfkit/react/helper/ConversionHelpers.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,56 @@ | ||
package com.pspdfkit.react.helper; | ||
|
||
import androidx.annotation.Nullable; | ||
|
||
import com.pspdfkit.annotations.AnnotationType; | ||
|
||
import java.util.EnumSet; | ||
|
||
public class ConversionHelpers { | ||
|
||
public static EnumSet<AnnotationType> getAnnotationTypeFromString(@Nullable final String type) { | ||
if (type == null || "all".equalsIgnoreCase(type)) { | ||
return EnumSet.allOf(AnnotationType.class); | ||
} | ||
if ("pspdfkit/ink".equalsIgnoreCase(type)) { | ||
return EnumSet.of(AnnotationType.INK); | ||
} | ||
if ("pspdfkit/link".equalsIgnoreCase(type)) { | ||
return EnumSet.of(AnnotationType.LINK); | ||
} | ||
if ("pspdfkit/markup/highlight".equalsIgnoreCase(type)) { | ||
return EnumSet.of(AnnotationType.HIGHLIGHT); | ||
} | ||
if ("pspdfkit/markup/squiggly".equalsIgnoreCase(type)) { | ||
return EnumSet.of(AnnotationType.SQUIGGLY); | ||
} | ||
if ("pspdfkit/markup/strikeout".equalsIgnoreCase(type)) { | ||
return EnumSet.of(AnnotationType.STRIKEOUT); | ||
} | ||
if ("pspdfkit/markup/underline".equalsIgnoreCase(type)) { | ||
return EnumSet.of(AnnotationType.UNDERLINE); | ||
} | ||
if ("pspdfkit/note".equalsIgnoreCase(type)) { | ||
return EnumSet.of(AnnotationType.NOTE); | ||
} | ||
if ("pspdfkit/shape/ellipse".equalsIgnoreCase(type)) { | ||
return EnumSet.of(AnnotationType.CIRCLE); | ||
} | ||
if ("pspdfkit/shape/line".equalsIgnoreCase(type)) { | ||
return EnumSet.of(AnnotationType.LINE); | ||
} | ||
if ("pspdfkit/shape/polygon".equalsIgnoreCase(type)) { | ||
return EnumSet.of(AnnotationType.POLYGON); | ||
} | ||
if ("pspdfkit/shape/polyline".equalsIgnoreCase(type)) { | ||
return EnumSet.of(AnnotationType.POLYLINE); | ||
} | ||
if ("pspdfkit/shape/rectangle".equalsIgnoreCase(type)) { | ||
return EnumSet.of(AnnotationType.SQUARE); | ||
} | ||
if ("pspdfkit/text".equalsIgnoreCase(type)) { | ||
return EnumSet.of(AnnotationType.FREETEXT); | ||
} | ||
return EnumSet.noneOf(AnnotationType.class); | ||
} | ||
} |
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
18 changes: 18 additions & 0 deletions
18
ios/RCTPSPDFKit/Converters/RCTConvert+PSPDFAnnotationChange.h
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,18 @@ | ||
// | ||
// Copyright © 2020 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. | ||
// | ||
|
||
#import <React/RCTConvert.h> | ||
@import PSPDFKit; | ||
@import PSPDFKitUI; | ||
|
||
@interface RCTConvert (PSPDFAnnotationChange) | ||
|
||
+ (PSPDFAnnotationChange)PSPDFAnnotationChange:(NSString *)annotationChange; | ||
|
||
@end |
28 changes: 28 additions & 0 deletions
28
ios/RCTPSPDFKit/Converters/RCTConvert+PSPDFAnnotationChange.m
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,28 @@ | ||
// | ||
// Copyright © 2020 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. | ||
// | ||
|
||
#import "RCTConvert+PSPDFAnnotationChange.h" | ||
|
||
@implementation RCTConvert (PSPDFAnnotationChange) | ||
|
||
+ (PSPDFAnnotationChange)PSPDFAnnotationChange:(NSString *)annotationChange { | ||
if ([annotationChange isEqualToString:@"flatten"]) { | ||
return PSPDFAnnotationChangeFlatten; | ||
} else if ([annotationChange isEqualToString:@"remove"]) { | ||
return PSPDFAnnotationChangeRemove; | ||
} else if ([annotationChange isEqualToString:@"embed"]) { | ||
return PSPDFAnnotationChangeEmbed; | ||
} else if ([annotationChange isEqualToString:@"print"]) { | ||
return PSPDFAnnotationChangePrint; | ||
} else { | ||
return PSPDFAnnotationChangeEmbed; | ||
} | ||
} | ||
|
||
@end |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Oops, something went wrong.