Generate SSD action row layout from typed Jerboa
ober
1efad978964eb6ed45a20db1cacbaefd3f57f862
--- a/templates/ssd-review.ss +++ b/templates/ssd-review.ss @@ -4730,6 +4730,8 @@ (android widget AutoCompleteTextView) (android widget EditText) (android widget Button) + (android widget LinearLayout) + (android widget LinearLayout LayoutParams) (android widget TextView) (android widget Toast) (androidx documentfile provider DocumentFile) @@ -4879,6 +4881,7 @@ autoCompleteInstallFiringArcVisibilityWatcher autoCompleteInstallBoxTypeDialogBehavior buttonSetOnClickAction + mainActivityAddActionRowButtons permissionResultGranted downloadAccessBeforeRuntimePermissions downloadAccessFromPermission activityResultRejected pageNavigationBlocked pageNavigationBlockedForUri @@ -4943,6 +4946,7 @@ (type File) (type InputStream) (type OutputStream) + (type LayoutParams) (type Cursor) (type Intent) (type Uri) @@ -4965,6 +4969,7 @@ (type TextView) (type TextWatcher) (type Toast) + (type LinearLayout) (type UUID) (type ViewportState) (record BoxTypeDialogState @@ -5142,6 +5147,23 @@ (button : Button) (listener : (-> View Unit))) : Unit (kotlin-member-call setOnClickListener)) + (extern (linearLayoutWeightedWrapContentParams + (width : Int32) + (height : Int32) + (weight : Float32)) : LayoutParams + (kotlin-call LinearLayout LayoutParams)) + (extern (linearLayoutParamsSetMarginsRaw + (params : LayoutParams) + (left : Int32) + (top : Int32) + (right : Int32) + (bottom : Int32)) : Unit + (kotlin-member-call setMargins)) + (extern (linearLayoutAddButtonViewWithParamsRaw + (layout : LinearLayout) + (button : Button) + (params : LayoutParams)) : Unit + (kotlin-member-call addView)) (extern (makeThread (runnable : Runnable)) : Thread (kotlin-call Thread)) (extern (threadStartRaw (thread : Thread)) : Unit @@ -6813,6 +6835,32 @@ button (lambda ((unused : View)) (invoke action)))) + (def (linearLayoutAddWeightedButton + (layout : LinearLayout) + (button : Button) + (marginPx : Int32)) : Unit + (let ((params (linearLayoutWeightedWrapContentParams + (int32 0) + (int32 -2) + (float32 1.0)))) + (begin + (linearLayoutParamsSetMarginsRaw + params marginPx marginPx marginPx marginPx) + (linearLayoutAddButtonViewWithParamsRaw layout button params)))) + (def (mainActivityAddActionRowButtons + (layout : LinearLayout) + (buttons : (List Button)) + (marginPx : Int32)) : Unit + (begin + (for/fold ((ignored (int32 0))) + ((i (in-range (int32 0) (list-size buttons)))) + (begin + (linearLayoutAddWeightedButton + layout + (list-ref buttons i) + marginPx) + ignored)) + (begin))) (def (runBackground (action : (-> Unit))) : Unit (threadStartRaw (makeThread @@ -9413,11 +9461,7 @@ " LinearLayout(this).apply {" " orientation = LinearLayout.HORIZONTAL" " gravity = Gravity.CENTER_VERTICAL" - " buttons.forEach { item ->" - " val params = LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.WRAP_CONTENT, 1f)" - " params.setMargins(dp(3), dp(3), dp(3), dp(3))" - " addView(item, params)" - " }" + " mainActivityAddActionRowButtons(this, buttons.asList(), dp(3))" " }" "" " private fun boxTypeInput(): AutoCompleteTextView ="