Generate SSD autocomplete inputs from typed Jerboa

ober

b21b8b15a1e40587ab553c8a3b386d42f2a3f8ee

diff --git a/templates/ssd-review.ss b/templates/ssd-review.ss
index ecdae15..7e57983 100644
--- a/templates/ssd-review.ss
+++ b/templates/ssd-review.ss
@@ -4775,11 +4775,13 @@
                       (android net Uri)
                       (android os ParcelFileDescriptor)
                       (android text Editable)
+                      (android text InputType)
                       (android text TextWatcher)
                       (android view ScaleGestureDetector)
                       (android view ScaleGestureDetector SimpleOnScaleGestureListener)
                       (android view View)
                       (android view Window)
+                      (android widget ArrayAdapter)
                       (android widget AutoCompleteTextView)
                       (android widget EditText)
                       (android widget Button)
@@ -4959,6 +4961,7 @@
                 autoCompleteUpdateFiringArcVisibility
                 autoCompleteInstallFiringArcVisibilityWatcher
                 autoCompleteInstallBoxTypeDialogBehavior
+                mainActivityBoxTypeInput mainActivityFiringArcInput
                 buttonSetOnClickAction mainActivityButton
                 mainActivityActionRow
                 mainActivityAddActionRowButtons
@@ -5015,6 +5018,7 @@
         (type AlertDialog)
         (type Builder)
         (type AdapterView)
+        (type ArrayAdapter)
         (type AutoCompleteTextView)
         (type Button)
         (type ButtonKind)
@@ -5192,6 +5196,34 @@
         (extern (alertDialogWindowOrNull
                   (dialog : AlertDialog)) : (Nullable Window)
           (kotlin-member-get window))
+        (extern (autoCompleteForActivity
+                  (activity : MainActivity)) : AutoCompleteTextView
+          (kotlin-call AutoCompleteTextView))
+        (extern (androidSimpleDropdownItem1Line) : Int32
+          (kotlin-value android R layout simple_dropdown_item_1line))
+        (extern (inputTypeClassText) : Int32
+          (kotlin-value InputType TYPE_CLASS_TEXT))
+        (extern (stringArrayAdapter
+                  (activity : MainActivity)
+                  (layoutResource : Int32)
+                  (items : (List String))) : ArrayAdapter
+          (kotlin-call ArrayAdapter))
+        (extern (autoCompleteInputTypeSetRaw
+                  (view : AutoCompleteTextView)
+                  (inputType : Int32)) : Unit
+          (kotlin-member-set inputType))
+        (extern (autoCompleteThresholdSetRaw
+                  (view : AutoCompleteTextView)
+                  (threshold : Int32)) : Unit
+          (kotlin-member-set threshold))
+        (extern (autoCompleteHintSetRaw
+                  (view : AutoCompleteTextView)
+                  (hint : String)) : Unit
+          (kotlin-member-set hint))
+        (extern (autoCompleteSetAdapterRaw
+                  (view : AutoCompleteTextView)
+                  (adapter : ArrayAdapter)) : Unit
+          (kotlin-member-call setAdapter))
         (extern (autoCompleteDropDownHeightSet
                   (view : AutoCompleteTextView)
                   (height : Int32)) : Unit
@@ -7467,6 +7499,37 @@
                     (lambda ()
                       (autoCompleteShowDropDownRaw view)))
                   (begin))))))
+        (def (mainActivityBoxTypeInput
+               (activity : MainActivity)
+               (displays : (List String))) : AutoCompleteTextView
+          (let ((view (autoCompleteForActivity activity)))
+            (begin
+              (autoCompleteInputTypeSetRaw view (inputTypeClassText))
+              (autoCompleteThresholdSetRaw view (int32 1))
+              (autoCompleteSetAdapterRaw
+                view
+                (stringArrayAdapter
+                  activity
+                  (androidSimpleDropdownItem1Line)
+                  displays))
+              (autoCompleteInstallDropdownOpeners view)
+              view)))
+        (def (mainActivityFiringArcInput
+               (activity : MainActivity)
+               (displays : (List String))) : AutoCompleteTextView
+          (let ((view (autoCompleteForActivity activity)))
+            (begin
+              (autoCompleteHintSetRaw view "Firing arc, e.g. FA/FH/LS/RS")
+              (autoCompleteInputTypeSetRaw view (inputTypeClassText))
+              (autoCompleteThresholdSetRaw view (int32 0))
+              (autoCompleteSetAdapterRaw
+                view
+                (stringArrayAdapter
+                  activity
+                  (androidSimpleDropdownItem1Line)
+                  displays))
+              (autoCompleteInstallDropdownOpeners view)
+              view)))
         (def (autoCompleteFocusAndShowDropdown
                (dialog : AlertDialog)
                (view : AutoCompleteTextView)) : Unit
@@ -10467,7 +10530,6 @@
        "import android.view.Gravity"
        "import android.view.HapticFeedbackConstants"
        "import android.view.View"
-       "import android.widget.ArrayAdapter"
        "import android.widget.AutoCompleteTextView"
        "import android.widget.Button"
        "import android.widget.EditText"
@@ -10593,23 +10655,6 @@
        "        return root"
        "    }"
        ""
-       "    private fun boxTypeInput(): AutoCompleteTextView ="
-       "        AutoCompleteTextView(this).apply {"
-       "            inputType = InputType.TYPE_CLASS_TEXT"
-       "            threshold = 1"
-       "            setAdapter(ArrayAdapter(this@MainActivity, android.R.layout.simple_dropdown_item_1line, boxTypeDisplays))"
-       "            autoCompleteInstallDropdownOpeners(this)"
-       "        }"
-       ""
-       "    private fun firingArcInput(): AutoCompleteTextView ="
-       "        AutoCompleteTextView(this).apply {"
-       "            hint = \"Firing arc, e.g. FA/FH/LS/RS\""
-       "            inputType = InputType.TYPE_CLASS_TEXT"
-       "            threshold = 0"
-       "            setAdapter(ArrayAdapter(this@MainActivity, android.R.layout.simple_dropdown_item_1line, firingArcDisplays))"
-       "            autoCompleteInstallDropdownOpeners(this)"
-       "        }"
-       ""
        "    private fun openPdf() {"
        "        val remembered = getPreferences(MODE_PRIVATE).getString(PREF_SSD_PDF_TREE_URI, null)"
        "        mainActivityOpenPdfAsync(this, remembered)"
@@ -10765,10 +10810,10 @@
        "            hint = \"Label, e.g. Phaser-1\""
        "            inputType = InputType.TYPE_CLASS_TEXT"
        "        }"
-       "        val boxType = boxTypeInput().apply {"
+       "        val boxType = mainActivityBoxTypeInput(this, boxTypeDisplays).apply {"
        "            hint = \"Box type id/name\""
        "        }"
-       "        val firingArc = firingArcInput()"
+       "        val firingArc = mainActivityFiringArcInput(this, firingArcDisplays)"
        "        val count = EditText(this).apply {"
        "            hint = \"Count\""
        "            inputType = InputType.TYPE_CLASS_NUMBER"
@@ -10829,11 +10874,11 @@
        "            setText(resolvedLabelForBoxTypeAndroid(this@MainActivity, group.label, typeDisplay, group.boxTypeId))"
        "            selectAll()"
        "        }"
-       "        val boxType = boxTypeInput().apply {"
+       "        val boxType = mainActivityBoxTypeInput(this, boxTypeDisplays).apply {"
        "            hint = \"Box type id/name\""
        "            setText(boxTypesDisplayAndroid(this@MainActivity, group.boxTypeId), false)"
        "        }"
-       "        val firingArc = firingArcInput().apply {"
+       "        val firingArc = mainActivityFiringArcInput(this, firingArcDisplays).apply {"
        "            setText(group.firingArc, false)"
        "        }"
        "        val count = EditText(this).apply {"