Move SSD browser messages to typed Kotlin
ober
ae0fd667fe12c844a4979a6182a741fe62195160
--- a/templates/ssd-review.ss +++ b/templates/ssd-review.ss @@ -3749,6 +3749,10 @@ hashingPdfStatus loadedPdfStatus openFailedStatus appendDialogTitle appendCanceledNoGroupStatus appendCanceledStatus + scanningSsdPdfsStatus noSsdPdfsTitle + noSsdPdfsInFolderMessage noSsdPdfsChooseFolderStatus + openSsdPdfTitle noSsdPdfsDialogMessage + noSsdPdfsFoundStatus clampPageIndex shiftPageIndex displayGroupCanvasLabel dropdownHeight dialogPageNumber nullableLowercaseOrEmpty selectModeStatus selectionResultStatus detectStartStatus @@ -4096,6 +4100,22 @@ "Append canceled: no selected group") (def (appendCanceledStatus) : String "Append canceled") + (def (scanningSsdPdfsStatus) : String + "Scanning folder for SSD PDFs...") + (def (noSsdPdfsTitle) : String + "No SSD PDFs") + (def (noSsdPdfsInFolderMessage) : String + "No PDF filenames containing \"ssd\" were found in that folder.") + (def (noSsdPdfsChooseFolderStatus) : String + "No SSD PDFs found; choose another folder") + (def (openSsdPdfTitle) : String + "Open SSD PDF") + (def (noSsdPdfsDialogMessage (hasDirectAccess : Bool)) : String + (if hasDirectAccess + "No PDF filenames containing \"ssd\" were found in Downloads or the remembered folder." + "No SSD PDFs were found through Android's Downloads index. Grant Downloads access for a direct scan, choose a folder, or open a PDF manually.")) + (def (noSsdPdfsFoundStatus) : String + "No SSD PDFs found") (def (dropdownHeight (screenHeight : Int32)) : Int32 (let ((third (/ screenHeight (int32 3)))) (if (> third (int32 620)) @@ -6225,22 +6245,22 @@ " }" "" " private fun showSsdPdfBrowser(treeUri: Uri) {" - " setStatus(\"Scanning folder for SSD PDFs...\")" + " setStatus(scanningSsdPdfsStatus())" " thread {" " try {" " val choices = findSsdPdfsFromTree(treeUri)" " runOnUiThread {" " if (choices.isEmpty()) {" " AlertDialog.Builder(this)" - " .setTitle(\"No SSD PDFs\")" - " .setMessage(\"No PDF filenames containing \\\"ssd\\\" were found in that folder.\")" + " .setTitle(noSsdPdfsTitle())" + " .setMessage(noSsdPdfsInFolderMessage())" " .setNegativeButton(\"Cancel\", null)" " .setPositiveButton(\"Choose Folder\") { _, _ -> chooseSsdPdfFolder() }" " .show()" - " setStatus(\"No SSD PDFs found; choose another folder\")" + " setStatus(noSsdPdfsChooseFolderStatus())" " return@runOnUiThread" " }" - " showPdfChoiceDialog(choices, \"Open SSD PDF\")" + " showPdfChoiceDialog(choices, openSsdPdfTitle())" " setStatus(ssdPdfFoundStatus(choices))" " }" " } catch (error: Exception) {" @@ -6266,19 +6286,15 @@ " }" "" " private fun showNoSsdPdfsDialog() {" - " val message = if (hasDirectDownloadAccess()) {" - " \"No PDF filenames containing \\\"ssd\\\" were found in Downloads or the remembered folder.\"" - " } else {" - " \"No SSD PDFs were found through Android's Downloads index. Grant Downloads access for a direct scan, choose a folder, or open a PDF manually.\"" - " }" + " val message = noSsdPdfsDialogMessage(hasDirectDownloadAccess())" " AlertDialog.Builder(this)" - " .setTitle(\"No SSD PDFs\")" + " .setTitle(noSsdPdfsTitle())" " .setMessage(message)" " .setNegativeButton(\"Open Any\") { _, _ -> openAnyPdf() }" " .setNeutralButton(\"Choose Folder\") { _, _ -> chooseSsdPdfFolder() }" " .setPositiveButton(\"Access Downloads\") { _, _ -> requestDownloadAccess() }" " .show()" - " setStatus(\"No SSD PDFs found\")" + " setStatus(noSsdPdfsFoundStatus())" " }" "" " private fun findSsdPdfsFromTree(treeUri: Uri): List<SsdPdfChoice> {"