mirror of
https://gitee.com/zhangsken/AndroidIDE.git
synced 2026-10-16 07:49:44 +08:00
fix(uidesigner): suppress exceptions thrown while editing attribute values (closes #873)
This commit is contained in:
+8
-3
@@ -76,7 +76,7 @@ class AttrValueEditorFragment : Fragment() {
|
||||
val header = this.header ?: return
|
||||
val view = this.viewModel.view ?: return
|
||||
val attr = this.viewModel.selectedAttr ?: return
|
||||
|
||||
|
||||
val ns = attr.namespace?.prefix?.let { "${it}:" } ?: ""
|
||||
header.name.text = "${ns}${attr.name}"
|
||||
header.desc.text = attr.namespace?.uri ?: ""
|
||||
@@ -90,10 +90,15 @@ class AttrValueEditorFragment : Fragment() {
|
||||
)
|
||||
textView.dropDownVerticalOffset = -binding.root.height
|
||||
textView.showDropDown()
|
||||
|
||||
|
||||
val value = binding.attrValue.text.toString()
|
||||
attr.value = value
|
||||
view.applyAttribute(attr.copyAttr(value = value))
|
||||
try {
|
||||
view.applyAttribute(attr.copyAttr(value = value))
|
||||
} catch (e: Exception) {
|
||||
// When the user is editing the attribute value, it is always invalid and cannot be
|
||||
// resolved. Exceptions may be thrown while parsing the value which should be ignored
|
||||
}
|
||||
}
|
||||
|
||||
textView.setText(attr.value)
|
||||
|
||||
Reference in New Issue
Block a user