Move SSD PDF found status to typed Kotlin
ober
f0f8fb919654f8da0841123dedeba501baa65458
--- a/templates/ssd-review.ss +++ b/templates/ssd-review.ss @@ -1182,7 +1182,7 @@ (export make-SsdPdfChoice SsdPdfChoice? SsdPdfChoice-label SsdPdfChoice-uri ssdPdfChoiceLabels ssdPdfChoiceUriAt - ssdPdfUniqueChoicesByLabel) + ssdPdfUniqueChoicesByLabel ssdPdfFoundStatus) (type Int32) (type Uri) (record SsdPdfChoice @@ -1196,6 +1196,12 @@ labels))) (def (ssdPdfChoiceUriAt (choices : (List SsdPdfChoice)) (index : Int32)) : Uri (SsdPdfChoice-uri (list-ref choices index))) + (def (ssdPdfFoundStatus (choices : (List SsdPdfChoice))) : String + (string-append + "Found " + (string-append + (int32->string (list-size choices)) + " SSD PDFs"))) (def (ssdPdfUniqueChoicesByLabel (choices : (List SsdPdfChoice))) : (MutableList SsdPdfChoice) (let ((seen (mutable-set-empty String))) (for/fold ((out (mutable-list-empty SsdPdfChoice))) @@ -4852,7 +4858,7 @@ " return@runOnUiThread" " }" " showPdfChoiceDialog(choices, \"Open SSD PDF\")" - " setStatus(\"Found ${choices.size} SSD PDFs\")" + " setStatus(ssdPdfFoundStatus(choices))" " }" " } catch (error: Exception) {" " runOnUiThread {" @@ -4873,7 +4879,7 @@ " .setNeutralButton(\"Change Folder\") { _, _ -> chooseSsdPdfFolder() }" " .setPositiveButton(\"Open Any\") { _, _ -> openAnyPdf() }" " .show()" - " setStatus(\"Found ${choices.size} SSD PDFs\")" + " setStatus(ssdPdfFoundStatus(choices))" " }" "" " private fun showNoSsdPdfsDialog() {"