-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated Android PlatformPrintJobController.onComplete implementation,…
… removed unused PlatformPrintJobControllerCreationParams.onComplete param
- Loading branch information
Showing
13 changed files
with
196 additions
and
30 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
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
123 changes: 123 additions & 0 deletions
123
...webview_android/android/src/main/java/android/print/InAppWebViewPrintDocumentAdapter.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,123 @@ | ||
package android.print; | ||
|
||
import android.os.Bundle; | ||
import android.os.CancellationSignal; | ||
import android.os.ParcelFileDescriptor; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.annotation.Nullable; | ||
|
||
public class InAppWebViewPrintDocumentAdapter extends PrintDocumentAdapter { | ||
@NonNull | ||
private final PrintDocumentAdapter delegate; | ||
@Nullable | ||
private final PrintDocumentAdapterCallback callback; | ||
|
||
public InAppWebViewPrintDocumentAdapter(@NonNull PrintDocumentAdapter delegate, @Nullable PrintDocumentAdapterCallback callback) { | ||
this.delegate = delegate; | ||
this.callback = callback; | ||
} | ||
|
||
@Override | ||
public void onStart() { | ||
this.delegate.onStart(); | ||
if (this.callback != null) this.callback.onStart(); | ||
} | ||
|
||
@Override | ||
public void onLayout(PrintAttributes oldAttributes, PrintAttributes newAttributes, CancellationSignal cancellationSignal, LayoutResultCallback layoutResultCallback, Bundle extras) { | ||
this.delegate.onLayout(oldAttributes, newAttributes, cancellationSignal, new LayoutResultCallback() { | ||
@Override | ||
public void onLayoutFinished(PrintDocumentInfo info, boolean changed) { | ||
layoutResultCallback.onLayoutFinished(info, changed); | ||
if (callback != null) callback.onLayoutFinished(info, changed); | ||
} | ||
|
||
@Override | ||
public void onLayoutFailed(CharSequence error) { | ||
layoutResultCallback.onLayoutFailed(error); | ||
if (callback != null) callback.onLayoutFailed(error); | ||
} | ||
|
||
@Override | ||
public void onLayoutCancelled() { | ||
layoutResultCallback.onLayoutCancelled(); | ||
if (callback != null) callback.onLayoutCancelled(); | ||
} | ||
}, extras); | ||
|
||
if (callback != null) callback.onLayout(oldAttributes, newAttributes, cancellationSignal, layoutResultCallback, extras); | ||
} | ||
|
||
@Override | ||
public void onWrite(PageRange[] pages, ParcelFileDescriptor destination, CancellationSignal cancellationSignal, WriteResultCallback writeResultCallback) { | ||
this.delegate.onWrite(pages, destination, cancellationSignal, new WriteResultCallback() { | ||
@Override | ||
public void onWriteFinished(PageRange[] pages) { | ||
writeResultCallback.onWriteFinished(pages); | ||
if (callback != null) callback.onWriteFinished(pages); | ||
} | ||
|
||
@Override | ||
public void onWriteFailed(CharSequence error) { | ||
writeResultCallback.onWriteFailed(error); | ||
if (callback != null) callback.onWriteFailed(error); | ||
} | ||
|
||
@Override | ||
public void onWriteCancelled() { | ||
writeResultCallback.onWriteCancelled(); | ||
if (callback != null) callback.onWriteCancelled(); | ||
} | ||
}); | ||
if (callback != null) callback.onWrite(pages, destination, cancellationSignal, writeResultCallback); | ||
} | ||
|
||
@Override | ||
public void onFinish() { | ||
this.delegate.onFinish(); | ||
if (this.callback != null) this.callback.onFinish(); | ||
} | ||
|
||
public static class PrintDocumentAdapterCallback { | ||
public void onStart() { | ||
/* do nothing - stub */ | ||
} | ||
|
||
public void onFinish() { | ||
/* do nothing - stub */ | ||
} | ||
|
||
public void onLayout(PrintAttributes oldAttributes, PrintAttributes newAttributes, CancellationSignal cancellationSignal, LayoutResultCallback layoutResultCallback, Bundle extras) { | ||
/* do nothing - stub */ | ||
} | ||
|
||
public void onLayoutFinished(PrintDocumentInfo info, boolean changed) { | ||
/* do nothing - stub */ | ||
} | ||
|
||
public void onLayoutFailed(CharSequence error) { | ||
/* do nothing - stub */ | ||
} | ||
|
||
public void onLayoutCancelled() { | ||
/* do nothing - stub */ | ||
} | ||
|
||
public void onWrite(PageRange[] pages, ParcelFileDescriptor destination, CancellationSignal cancellationSignal, WriteResultCallback writeResultCallback) { | ||
/* do nothing - stub */ | ||
} | ||
|
||
public void onWriteFinished(PageRange[] pages) { | ||
/* do nothing - stub */ | ||
} | ||
|
||
public void onWriteFailed(CharSequence error) { | ||
/* do nothing - stub */ | ||
} | ||
|
||
public void onWriteCancelled() { | ||
/* do nothing - stub */ | ||
} | ||
} | ||
} |
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
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.