summaryrefslogtreecommitdiff
path: root/layout-inspector/src
diff options
context:
space:
mode:
authorJens Ole Lauridsen <jlauridsen@google.com>2022-02-04 10:59:31 -0800
committerJens Ole Lauridsen <jlauridsen@google.com>2022-02-05 00:49:05 +0000
commitfd31ed7b17998df94af9c5876044d519e1cca058 (patch)
tree6ce052cce032d155e6121107778a38898855f101 /layout-inspector/src
parentb1e6ab228ff61c4283504e59a38d27d0e7137d6c (diff)
downloadidea-fd31ed7b17998df94af9c5876044d519e1cca058.tar.gz
Fix color in the resolution editor
The links in the properties panel of the layout inspector was painting white on white when a row was selected in the properties panel. The problem with the bold color mentioned in the bug was fixed by ag/16763402. But the above painting problem is still present. Fixes: 204391134 Test: N/A Change-Id: If5a892c7ede1f9648e6aac238763ea328d9f5d44
Diffstat (limited to 'layout-inspector/src')
-rw-r--r--layout-inspector/src/com/android/tools/idea/layoutinspector/ui/ResolutionElementEditor.kt10
1 files changed, 8 insertions, 2 deletions
diff --git a/layout-inspector/src/com/android/tools/idea/layoutinspector/ui/ResolutionElementEditor.kt b/layout-inspector/src/com/android/tools/idea/layoutinspector/ui/ResolutionElementEditor.kt
index 2f419012604..ce281e0087c 100644
--- a/layout-inspector/src/com/android/tools/idea/layoutinspector/ui/ResolutionElementEditor.kt
+++ b/layout-inspector/src/com/android/tools/idea/layoutinspector/ui/ResolutionElementEditor.kt
@@ -26,6 +26,7 @@ import com.android.tools.property.panel.api.PropertyEditorModel
import com.android.tools.property.ptable.PTableGroupItem
import com.google.common.annotations.VisibleForTesting
import com.intellij.ide.ui.laf.darcula.DarculaUIUtil
+import com.intellij.ui.JBColor
import com.intellij.ui.components.JBLabel
import com.intellij.util.ui.JBUI
import com.intellij.util.ui.UIUtil
@@ -66,6 +67,7 @@ class ResolutionElementEditor(
add(linkPanel, BorderLayout.SOUTH)
linkPanel.layout = BoxLayout(linkPanel, BoxLayout.Y_AXIS)
linkPanel.isVisible = false
+ linkPanel.isOpaque = false
linkPanel.background = UIUtil.TRANSPARENT_COLOR
editorModel.addListener { updateFromModel() }
editor.addMouseListener(object : MouseAdapter() {
@@ -87,12 +89,13 @@ class ResolutionElementEditor(
val locations = view?.let { resourceLookup.findFileLocations(property, it) } ?: listOf()
val classLocation = (property as? InspectorGroupPropertyItem)?.classLocation
val hideLinkPanel = (locations.isEmpty() && classLocation == null) || (property is PTableGroupItem && !editorModel.isExpandedTableItem)
+ val isSelected = editorModel.isUsedInRendererWithSelection
linkPanel.isVisible = !hideLinkPanel
editorModel.isCustomHeight = !hideLinkPanel
- background = if (editorModel.isUsedInRendererWithSelection) UIUtil.getTableBackground(true, true) else UIUtil.TRANSPARENT_COLOR
+ isOpaque = isSelected
+ background = if (isSelected) UIUtil.getTableBackground(true, true) else UIUtil.TRANSPARENT_COLOR
if (!hideLinkPanel) {
linkPanel.removeAll()
- val isSelected = editorModel.isUsedInRendererWithSelection
val isOverridden = property is ResolutionStackItem
classLocation?.let { linkPanel.add(SourceLocationLink(it, isSelected, false)) }
when (locations.size) {
@@ -128,10 +131,12 @@ class ResolutionElementEditor(
init {
val mainPanel = JPanel()
mainPanel.layout = BoxLayout(mainPanel, BoxLayout.X_AXIS)
+ mainPanel.isOpaque = false
mainPanel.background = UIUtil.TRANSPARENT_COLOR
mainPanel.border = JBUI.Borders.emptyLeft(8)
val isExtraPanelVisible = model.isExpanded(property)
extraPanel.layout = BoxLayout(extraPanel, BoxLayout.Y_AXIS)
+ extraPanel.isOpaque = false
extraPanel.background = UIUtil.TRANSPARENT_COLOR
extraPanel.isVisible = isExtraPanelVisible
extraPanel.border = JBUI.Borders.emptyLeft(24)
@@ -158,6 +163,7 @@ class ResolutionElementEditor(
}
add(mainPanel, BorderLayout.CENTER)
add(extraPanel, BorderLayout.SOUTH)
+ isOpaque = false
background = UIUtil.TRANSPARENT_COLOR
alignmentX = Component.LEFT_ALIGNMENT
}