Generate SSD page rendering from typed Jerboa
ober
d470396105a7d9bbfffae87cc33a5ee216e19d6e
--- a/templates/ssd-review.ss +++ b/templates/ssd-review.ss @@ -4947,6 +4947,7 @@ mainActivityLoadPdfAsync mainActivityOpenPdfAsync mainActivityShowSsdPdfBrowserAsync + mainActivityRenderCurrentPage mainActivityDetectCurrentAsync mainActivityInstallApproveAreaDialogButton mainActivityInstallAppendDialogButton @@ -5804,6 +5805,9 @@ (extern (mainActivityPageIndexRaw (activity : MainActivity)) : Int32 (kotlin-member-get pageIndex)) + (extern (mainActivityReviewViewRaw + (activity : MainActivity)) : SsdReviewView + (kotlin-member-get reviewView)) (extern (mainActivityRenderPdfPageRaw (activity : MainActivity) (uri : Uri) @@ -5827,6 +5831,11 @@ (activity : MainActivity) (includeViewport : Bool)) : Unit (kotlin-member-call persistCurrentPdfState)) + (extern (mainActivityRestoredViewportForRaw + (activity : MainActivity) + (uri : Uri) + (page : Int32)) : (Nullable ViewportState) + (kotlin-member-call restoredViewportFor)) (extern (mainActivityCurrentSessionRaw (activity : MainActivity)) : (Nullable SsdSession) (kotlin-member-get currentSession)) @@ -5847,9 +5856,6 @@ (activity : MainActivity) (text : String)) : Unit (kotlin-member-call setStatus)) - (extern (mainActivityRenderCurrentPageRaw - (activity : MainActivity)) : Unit - (kotlin-member-call renderCurrentPage)) (extern (mainActivityFindDownloadSsdPdfsRaw (activity : MainActivity)) : (List SsdPdfChoice) (kotlin-member-call findDownloadSsdPdfs)) @@ -6900,7 +6906,7 @@ activity (shiftPageIndex pageIndex pageCount delta)) (mainActivityPersistCurrentPdfStateRaw activity #f) - (mainActivityRenderCurrentPageRaw activity)))) + (mainActivityRenderCurrentPage activity)))) (def (mainActivityShowPageDialog (activity : MainActivity) (uri : (Nullable Uri)) @@ -7635,7 +7641,7 @@ imported (truthStoreStorageSummary store))) (if (pdfUriLoaded (mainActivityPdfUriRaw activity)) - (mainActivityRenderCurrentPageRaw activity) + (mainActivityRenderCurrentPage activity) (begin))))) (begin))))) (def (mainActivityHandleAreaSelected @@ -8661,7 +8667,7 @@ (mainActivitySetPageIndex activity (- (nullablePageNumberOrOne page) (int32 1))) - (mainActivityRenderCurrentPageRaw activity)) + (mainActivityRenderCurrentPage activity)) (begin)))))) (def (mainActivityLogClientEventAsync (activity : MainActivity) @@ -8828,7 +8834,7 @@ imported (truthStoreStorageSummary store))) (if (pdfUriLoaded (mainActivityPdfUriRaw activity)) - (mainActivityRenderCurrentPageRaw activity) + (mainActivityRenderCurrentPage activity) (begin)))))) (catch (error : Exception) (mainActivityRunOnUiThreadRaw @@ -8956,6 +8962,35 @@ (int32 0) (int32 0)))))))) (begin)))))))) + (def (mainActivityRenderCurrentPage + (activity : MainActivity)) : Unit + (if (pdfUriLoaded (mainActivityPdfUriRaw activity)) + (let ((uri (uriOrEmpty (mainActivityPdfUriRaw activity)))) + (let ((renderPageIndex (mainActivityPageIndexRaw activity))) + (let ((renderGeneration + (mainActivityAdvanceLoadGeneration + activity + (mainActivityLoadGenerationRaw activity))) + (renderPdfName (mainActivityPdfNameRaw activity)) + (renderPdfSha1 (mainActivityPdfSha1Raw activity)) + (renderPageCount + (mainActivityPageCountValueRaw activity)) + (restoredViewport + (mainActivityRestoredViewportForRaw + activity + uri + renderPageIndex))) + (mainActivityRenderCurrentPageAsync + activity + (mainActivityReviewViewRaw activity) + uri + renderPageIndex + renderGeneration + renderPdfName + renderPdfSha1 + renderPageCount + restoredViewport)))) + (begin))) (def (mainActivityRenderCurrentPageAsync (activity : MainActivity) (view : SsdReviewView) @@ -9098,7 +9133,7 @@ (loadedPdfStatus (mainActivityPdfNameRaw activity) count)) - (mainActivityRenderCurrentPageRaw + (mainActivityRenderCurrentPage activity)))))) (catch (error : Exception) (mainActivityRunOnUiThreadRaw @@ -11580,28 +11615,6 @@ " return root" " }" "" - " internal fun renderCurrentPage() {" - " if (!pdfUriLoaded(pdfUri)) return" - " val uri = uriOrEmpty(pdfUri)" - " val renderPageIndex = pageIndex" - " val renderGeneration = mainActivityAdvanceLoadGeneration(this, loadGeneration)" - " val renderPdfName = pdfName" - " val renderPdfSha1 = pdfSha1" - " val renderPageCount = pageCount" - " val restoredViewport = restoredViewportFor(uri, renderPageIndex)" - " mainActivityRenderCurrentPageAsync(" - " this," - " reviewView," - " uri," - " renderPageIndex," - " renderGeneration," - " renderPdfName," - " renderPdfSha1," - " renderPageCount," - " restoredViewport" - " )" - " }" - "" " internal fun detectCurrent(" " forceDetect: Boolean = false," " expectedGeneration: Int = loadGeneration," @@ -11872,7 +11885,7 @@ " edit.apply()" " }" "" - " private fun restoredViewportFor(uri: Uri, page: Int): ViewportState? {" + " internal fun restoredViewportFor(uri: Uri, page: Int): ViewportState? {" " val prefs = getPreferences(MODE_PRIVATE)" " if (!savedViewportAvailable(prefs.getString(PREF_LAST_PDF_URI, null), uri.toString(), prefs.getInt(PREF_LAST_VIEWPORT_PAGE_INDEX, -1), page, prefs.contains(PREF_LAST_VIEWPORT_SCALE))) return null" " return ViewportState("