Controls UI - Fix title icon

Remove the hardcoded reference, and retrieve the current selected item

Bug: 150705462
Test: manual
Change-Id: I8401e61392ab5568e23cd9a253a3c75e863783ba
This commit is contained in:
Matt Pietal
2020-03-04 08:22:03 -05:00
parent 6820d68e25
commit aaccdbee8a

View File

@@ -293,8 +293,13 @@ class ControlsUiControllerImpl @Inject constructor (
* for this dialog. Use a textView with the ListPopupWindow to achieve
* a similar effect
*/
val item = adapter.findSelectionItem(selectedStructure) ?: adapter.getItem(0)
parent.requireViewById<TextView>(R.id.app_or_structure_spinner).apply {
setText((adapter.findSelectionItem(selectedStructure) ?: adapter.getItem(0)).getTitle())
setText(item.getTitle())
}
parent.requireViewById<ImageView>(R.id.app_icon).apply {
setContentDescription(item.getTitle())
setImageDrawable(item.icon)
}
val anchor = parent.requireViewById<ViewGroup>(R.id.controls_header)
anchor.setOnClickListener(object : View.OnClickListener {
@@ -330,11 +335,6 @@ class ControlsUiControllerImpl @Inject constructor (
}
}
})
parent.requireViewById<ImageView>(R.id.app_icon).apply {
setContentDescription("My Home")
setImageDrawable(items[0].icon)
}
}
private fun loadPreference(structures: List<StructureInfo>): StructureInfo {