From 9515a228792c894aab9563fd01922a02bedfa986 Mon Sep 17 00:00:00 2001 From: Bhuvaneshwaran Date: Fri, 27 Dec 2024 15:08:24 +0530 Subject: [PATCH] Fix callback --- .../acutecoder/pdfviewerdemo/ComposePdfViewerActivity.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/acutecoder/pdfviewerdemo/ComposePdfViewerActivity.kt b/app/src/main/java/com/acutecoder/pdfviewerdemo/ComposePdfViewerActivity.kt index 40b62de..e9b9d1f 100644 --- a/app/src/main/java/com/acutecoder/pdfviewerdemo/ComposePdfViewerActivity.kt +++ b/app/src/main/java/com/acutecoder/pdfviewerdemo/ComposePdfViewerActivity.kt @@ -168,7 +168,9 @@ private fun Activity.MainScreen( PdfViewer( modifier = Modifier.fillMaxSize(), containerColor = MaterialTheme.colorScheme.surfaceContainer, - afterLoadSource = { + onReady = { loadSource -> + loadSource() + pdfSettingsManager.restore(this) setPdfViewer(this) addListener(object : PdfListener { @@ -412,7 +414,9 @@ private fun Activity.MainScreenWithScrollModeSupport() { PdfViewer( modifier = Modifier.fillMaxSize(), containerColor = Color.Transparent, - afterLoadSource = { + onReady = { loadSource -> + loadSource() + showPageButtons = pageScrollMode == PdfViewer.PageScrollMode.SINGLE_PAGE showPageNumber = pageScrollMode == PdfViewer.PageScrollMode.SINGLE_PAGE || pageScrollMode == PdfViewer.PageScrollMode.HORIZONTAL