From 68fc48d3a9be52e9d2f775a2886e80a9ea41aa1e Mon Sep 17 00:00:00 2001 From: Pratyush Date: Fri, 6 May 2022 22:37:20 +0530 Subject: [PATCH] add on (doc) loaded callback --- app/src/main/assets/viewer.js | 1 + app/src/main/java/app/grapheneos/pdfviewer/PdfViewer.java | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/app/src/main/assets/viewer.js b/app/src/main/assets/viewer.js index 0e04afa..280015d 100644 --- a/app/src/main/assets/viewer.js +++ b/app/src/main/assets/viewer.js @@ -210,6 +210,7 @@ function loadDocument() { } loadingTask.promise.then(function (newDoc) { + channel.onLoaded(); pdfDoc = newDoc; channel.setNumPages(pdfDoc.numPages); pdfDoc.getMetadata().then(function (data) { diff --git a/app/src/main/java/app/grapheneos/pdfviewer/PdfViewer.java b/app/src/main/java/app/grapheneos/pdfviewer/PdfViewer.java index 6e96173..f8250c7 100644 --- a/app/src/main/java/app/grapheneos/pdfviewer/PdfViewer.java +++ b/app/src/main/java/app/grapheneos/pdfviewer/PdfViewer.java @@ -202,6 +202,10 @@ public class PdfViewer extends AppCompatActivity implements LoaderManager.Loader showPasswordPrompt(); } + @JavascriptInterface + public void onLoaded() { + } + @JavascriptInterface public String getPassword() { return mEncryptedDocumentPassword != null ? mEncryptedDocumentPassword : "";