diff options
author | Romain Guy <romainguy@android.com> | 2009-05-29 10:33:36 -0700 |
---|---|---|
committer | Romain Guy <romainguy@android.com> | 2009-05-29 10:33:36 -0700 |
commit | e32edc614e62ac874a969d3cc6bb1e0c0c3f2607 (patch) | |
tree | acab5f1e9471f7ed7daae85aee60d827794ed8ee /core/java/android | |
parent | d9cc7659fa9b8544e2a3ca7b7040fbd79afdf7ea (diff) | |
download | frameworks_base-e32edc614e62ac874a969d3cc6bb1e0c0c3f2607.zip frameworks_base-e32edc614e62ac874a969d3cc6bb1e0c0c3f2607.tar.gz frameworks_base-e32edc614e62ac874a969d3cc6bb1e0c0c3f2607.tar.bz2 |
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.
Diffstat (limited to 'core/java/android')
-rw-r--r-- | core/java/android/widget/ListView.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/core/java/android/widget/ListView.java b/core/java/android/widget/ListView.java index 10d8f55..99cf6f8 100644 --- a/core/java/android/widget/ListView.java +++ b/core/java/android/widget/ListView.java @@ -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); |