Move SSD manual dialog text to typed Kotlin

ober

d5273eee16412aab8b1c53302c172dc865a78390

diff --git a/templates/ssd-review.ss b/templates/ssd-review.ss
index b20fa5d..1ffd958 100644
--- a/templates/ssd-review.ss
+++ b/templates/ssd-review.ss
@@ -3728,6 +3728,8 @@
                 formatActivityDuration groupDisplayLabel appendModeStatus
                 selectedGroupStatus sessionCountsStatus rotatedPageStatus
                 manualGroupLabel manualCellCount editedGroupCount
+                areaSelectionStatus detectedIdsCountText
+                detectedBoxesTitle detectedBoxesMessage
                 clampPageIndex shiftPageIndex displayGroupCanvasLabel
                 dropdownHeight dialogPageNumber nullableLowercaseOrEmpty
                 selectModeStatus selectionResultStatus detectStartStatus
@@ -3885,6 +3887,26 @@
             (if (> count (int32 400))
               (int32 400)
               count)))
+        (def (areaSelectionStatus (applyAsSsdArea : Bool) (detectedCount : Int32)) : String
+          (if applyAsSsdArea
+            "SSD area selected; applying boundary..."
+            (string-append
+              "Selected "
+              (string-append
+                (int32->string detectedCount)
+                " boxes; opening editor..."))))
+        (def (detectedIdsCountText (detectedCount : Int32)) : String
+          (if (> detectedCount (int32 0))
+            (int32->string detectedCount)
+            "1"))
+        (def (detectedBoxesTitle (detectedCount : Int32)) : String
+          (string-append
+            (int32->string detectedCount)
+            " detected boxes"))
+        (def (detectedBoxesMessage (detectedCount : Int32)) : String
+          (if (> detectedCount (int32 0))
+            (detectedBoxesTitle detectedCount)
+            "No detected boxes; enter manual count"))
         (def (dropdownHeight (screenHeight : Int32)) : Int32
           (let ((third (/ screenHeight (int32 3))))
             (if (> third (int32 620))
@@ -5609,11 +5631,7 @@
 	       "            return"
 	       "        }"
 	       "        val applyAsSsdArea = ssdAreaMode"
-	       "        val statusText = if (applyAsSsdArea) {"
-	       "            \"SSD area selected; applying boundary...\""
-	       "        } else {"
-	       "            \"Selected ${detectedIds.size} boxes; opening editor...\""
-	       "        }"
+	       "        val statusText = areaSelectionStatus(applyAsSsdArea, detectedIds.size)"
 	       "        setStatus(statusText)"
 	       "        reviewView.postDelayed({"
 	       "            if (currentSession == null) {"
@@ -5653,7 +5671,7 @@
        "        val count = EditText(this).apply {"
        "            hint = \"Count\""
        "            inputType = InputType.TYPE_CLASS_NUMBER"
-       "            setText(if (detectedIds.isNotEmpty()) detectedIds.size.toString() else \"1\")"
+       "            setText(detectedIdsCountText(detectedIds.size))"
        "        }"
        "        layout.addView(label)"
        "        layout.addView(boxType)"
@@ -5661,7 +5679,7 @@
        "        layout.addView(count)"
        "        wireBoxTypeDialogBehavior(label, boxType, firingArc)"
        "        val dialog = AlertDialog.Builder(this)"
-       "            .setTitle(\"${if (detectedIds.isNotEmpty()) detectedIds.size else 0} detected boxes\")"
+       "            .setTitle(detectedBoxesTitle(detectedIds.size))"
        "            .setView(layout)"
        "            .setNegativeButton(\"Cancel\", null)"
        "            .setPositiveButton(\"Approve\", null)"
@@ -5691,12 +5709,12 @@
        "        val count = EditText(this).apply {"
        "            hint = \"Count\""
        "            inputType = InputType.TYPE_CLASS_NUMBER"
-       "            setText(if (detectedIds.isNotEmpty()) detectedIds.size.toString() else \"1\")"
+       "            setText(detectedIdsCountText(detectedIds.size))"
        "        }"
        "        val title = \"Append to ${groupDisplayLabel(group)}\""
        "        val dialog = AlertDialog.Builder(this)"
        "            .setTitle(title)"
-       "            .setMessage(if (detectedIds.isNotEmpty()) \"${detectedIds.size} detected boxes\" else \"No detected boxes; enter manual count\")"
+       "            .setMessage(detectedBoxesMessage(detectedIds.size))"
        "            .setView(count)"
        "            .setNegativeButton(\"Cancel\") { _, _ ->"
        "                appendMode = false"