Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 73be7dd9 authored by Julia Reynolds's avatar Julia Reynolds
Browse files

Fix background on ExpandablePreference

Test: manual
Test: HighlightablePreferenceGroupAdapter
Bug: 396873207
Flag: EXEMPT bug fix
Change-Id: Ifbe5747aa38fcee9564c24c0f69ecd340e8da0ff
parent 04fb5fa3
Loading
Loading
Loading
Loading
+31 −33
Original line number Diff line number Diff line
@@ -127,17 +127,6 @@ open class SettingsPreferenceGroupAdapter(preferenceGroup: PreferenceGroup) :
                    currentParent = pref
                }

                // ExpandablePreference is PreferenceGroup but it should handle round corner
                is Expandable -> {
                    // When ExpandablePreference is expanded, we treat is as the first item.
                    if (pref.isExpanded()) {
                        currentParent = pref as? PreferenceGroup
                        startIndex = i
                        cornerStyles[i] = cornerStyles[i] or ROUND_CORNER_TOP or ROUND_CORNER_CENTER
                        endIndex = -1
                    }
                }

                // SpacePreference should not have round corner background.
                is SpacePreference -> {
                    cornerStyles[i] = 0
@@ -145,6 +134,14 @@ open class SettingsPreferenceGroupAdapter(preferenceGroup: PreferenceGroup) :
                }

                else -> {
                    // When ExpandablePreference is expanded, we treat is as the first item.
                    if (pref is Expandable && pref.isExpanded()) {
                        currentParent = pref as? PreferenceGroup
                        startIndex = i
                        cornerStyles[i] = cornerStyles[i] or ROUND_CORNER_TOP or ROUND_CORNER_CENTER
                        endIndex = -1
                    } else {

                        val parent = pref?.parent

                        // item in the group should have round corner background.
@@ -178,6 +175,7 @@ open class SettingsPreferenceGroupAdapter(preferenceGroup: PreferenceGroup) :
                }
            }
        }
    }

    /** handle roundCorner background */
    private fun updateBackground(holder: PreferenceViewHolder, position: Int) {