Skip to content

Commit

Permalink
#40 Add none action if user don't want open file even share
Browse files Browse the repository at this point in the history
  • Loading branch information
Gkemon committed Aug 15, 2022
1 parent 666c1f2 commit 8d6d635
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ android {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.13.2'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void onClick(View v) {
.fromLayoutXML(R.layout.layout_print_horizontal_scroll)
.setFileName("Demo-Horizontal-Scroll-View-Text")
.setFolderNameOrPath("MyFolder/MyDemoHorizontalText/")
.actionAfterPDFGeneration(PdfGenerator.ActionAfterPDFGeneration.SHARE)
.actionAfterPDFGeneration(PdfGenerator.ActionAfterPDFGeneration.NONE)
.build(new PdfGeneratorListener() {
@Override
public void onFailure(FailureResponse failureResponse) {
Expand Down Expand Up @@ -104,7 +104,7 @@ public void onClick(View v) {
.fromViewID(MainActivity.this, R.id.tv_print_area)
.setFileName("Demo-Landscape")
.setFolderNameOrPath("MyFolder/MyDemoLandscape/")
.actionAfterPDFGeneration(PdfGenerator.ActionAfterPDFGeneration.OPEN)
.actionAfterPDFGeneration(PdfGenerator.ActionAfterPDFGeneration.SHARE)
.build(new PdfGeneratorListener() {
@Override
public void onFailure(FailureResponse failureResponse) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public interface Build {
}

public enum ActionAfterPDFGeneration {
OPEN, SHARE
OPEN, SHARE, NONE
}

public enum PrintingMode {
Expand Down Expand Up @@ -355,7 +355,8 @@ private void print() {
})
.subscribe(() -> {
postSuccess(document, filePath, pageWidthInPixel, pageHeightInPixel);
dealAfterGeneration(actionAfterPDFGeneration);
if (actionAfterPDFGeneration != ActionAfterPDFGeneration.NONE)
dealAfterGeneration(actionAfterPDFGeneration);
}, this::postFailure);


Expand Down

0 comments on commit 8d6d635

Please sign in to comment.