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

Commit e32edc61 authored by Romain Guy's avatar Romain Guy
Browse files

Fixes #1884152. This change improves how the opaque property is handled with respect to dividers.

If the list is opaque and its background is not, then we want to fill a solid rect where the dividers should be when they are skipped for non-selectable items. When the list is opaque and the background is also opaque, there is no need to draw something in lieu of the dividers since the background will do it for us.
parent d9cc7659
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -2851,9 +2851,15 @@ public class ListView extends AbsListView {
            final int first = mFirstPosition;
            final boolean areAllItemsSelectable = mAreAllItemsSelectable;
            final ListAdapter adapter = mAdapter;
            final boolean isOpaque = isOpaque();
            if (isOpaque && mDividerPaint == null) {
            // If the list is opaque *and* the background is not, we want to
            // fill a rect where the dividers would be for non-selectable items
            // If the list is opaque and the background is also opaque, we don't
            // need to draw anything since the background will do it for us
            final boolean fillForMissingDividers = isOpaque() && !super.isOpaque();

            if (fillForMissingDividers && mDividerPaint == null && mIsCacheColorOpaque) {
                mDividerPaint = new Paint();
                mDividerPaint.setColor(getCacheColorHint());
            }
            final Paint paint = mDividerPaint;

@@ -2874,7 +2880,7 @@ public class ListView extends AbsListView {
                                bounds.top = bottom;
                                bounds.bottom = bottom + dividerHeight;
                                drawDivider(canvas, bounds, i);
                            } else if (isOpaque) {
                            } else if (fillForMissingDividers) {
                                bounds.top = bottom;
                                bounds.bottom = bottom + dividerHeight;
                                canvas.drawRect(bounds, paint);
@@ -2903,7 +2909,7 @@ public class ListView extends AbsListView {
                                // position. Give -1 when there is no child above the
                                // divider.
                                drawDivider(canvas, bounds, i - 1);
                            } else if (isOpaque) {
                            } else if (fillForMissingDividers) {
                                bounds.top = top - dividerHeight;
                                bounds.bottom = top;
                                canvas.drawRect(bounds, paint);