Automation: fix UI selection
This commit is contained in:
parent
d9fcf61b0a
commit
9935ff90a1
2 changed files with 6 additions and 4 deletions
|
@ -26,8 +26,10 @@ class InputDropdownMenu(private val resourceHelper: ResourceHelper) : Element()
|
||||||
|
|
||||||
override fun addToLayout(root: LinearLayout) {
|
override fun addToLayout(root: LinearLayout) {
|
||||||
val spinner = Spinner(root.context)
|
val spinner = Spinner(root.context)
|
||||||
spinner.adapter = ArrayAdapter(root.context,
|
spinner.adapter = ArrayAdapter(
|
||||||
R.layout.spinner_centered, itemList).also {
|
root.context,
|
||||||
|
R.layout.spinner_centered, itemList
|
||||||
|
).also {
|
||||||
it.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
|
it.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
|
||||||
}
|
}
|
||||||
spinner.layoutParams = LinearLayout.LayoutParams(
|
spinner.layoutParams = LinearLayout.LayoutParams(
|
||||||
|
@ -42,7 +44,7 @@ class InputDropdownMenu(private val resourceHelper: ResourceHelper) : Element()
|
||||||
|
|
||||||
override fun onNothingSelected(parent: AdapterView<*>?) {}
|
override fun onNothingSelected(parent: AdapterView<*>?) {}
|
||||||
}
|
}
|
||||||
spinner.setSelection(0)
|
for (i in 0 until itemList.size) if (itemList[i] == value) spinner.setSelection(i)
|
||||||
root.addView(LinearLayout(root.context).also {
|
root.addView(LinearLayout(root.context).also {
|
||||||
it.orientation = LinearLayout.VERTICAL
|
it.orientation = LinearLayout.VERTICAL
|
||||||
it.layoutParams = LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
it.layoutParams = LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
||||||
|
|
|
@ -34,7 +34,7 @@ class InputProfileName(private val resourceHelper: ResourceHelper, private val a
|
||||||
|
|
||||||
override fun onNothingSelected(parent: AdapterView<*>?) {}
|
override fun onNothingSelected(parent: AdapterView<*>?) {}
|
||||||
}
|
}
|
||||||
spinner.setSelection(0)
|
for (i in 0 until profileList.size) if (profileList[i] == value) spinner.setSelection(i)
|
||||||
val l = LinearLayout(root.context)
|
val l = LinearLayout(root.context)
|
||||||
l.orientation = LinearLayout.VERTICAL
|
l.orientation = LinearLayout.VERTICAL
|
||||||
l.layoutParams = LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
l.layoutParams = LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
||||||
|
|
Loading…
Reference in a new issue