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

Commit 20219a3e authored by Julia Reynolds's avatar Julia Reynolds Committed by Android (Google) Code Review
Browse files

Merge "Fix background on ExpandablePreference" into main

parents aa3f7da3 73be7dd9
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) {