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

Commit 179de8a3 authored by Romain Guy's avatar Romain Guy
Browse files

Avoid unnecessary tests when drawing ListView dividers.

Change-Id: I5f2797ee92f5e3ed01eab0cf7f2acfe436b0c595
parent 020057bd
Loading
Loading
Loading
Loading
+14 −16
Original line number Diff line number Diff line
@@ -2968,7 +2968,7 @@ public class ListView extends AbsListView {
            // 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 = drawDividers && isOpaque() && !super.isOpaque();
            final boolean fillForMissingDividers = isOpaque() && !super.isOpaque();

            if (fillForMissingDividers && mDividerPaint == null && mIsCacheColorOpaque) {
                mDividerPaint = new Paint();
@@ -2978,7 +2978,7 @@ public class ListView extends AbsListView {

            final int listBottom = mBottom - mTop - mListPadding.bottom + mScrollY;
            if (!mStackFromBottom) {
                int bottom = 0;
                int bottom;
                
                final int scrollY = mScrollY;
                for (int i = 0; i < count; i++) {
@@ -2987,7 +2987,6 @@ public class ListView extends AbsListView {
                        View child = getChildAt(i);
                        bottom = child.getBottom();
                        // Don't draw dividers next to items that are not enabled
                        if (drawDividers) {
                        if ((areAllItemsSelectable ||
                                (adapter.isEnabled(first + i) && (i == count - 1 ||
                                        adapter.isEnabled(first + i + 1))))) {
@@ -3001,7 +3000,6 @@ public class ListView extends AbsListView {
                        }
                    }
                }
                }
            } else {
                int top;
                int listTop = mListPadding.top;
@@ -3014,7 +3012,7 @@ public class ListView extends AbsListView {
                        View child = getChildAt(i);
                        top = child.getTop();
                        // Don't draw dividers next to items that are not enabled
                        if (drawDividers && top > listTop) {
                        if (top > listTop) {
                            if ((areAllItemsSelectable ||
                                    (adapter.isEnabled(first + i) && (i == count - 1 ||
                                            adapter.isEnabled(first + i + 1))))) {
@@ -3034,7 +3032,7 @@ public class ListView extends AbsListView {
                    }
                }
                
                if (count > 0 && scrollY > 0 && drawDividers) {
                if (count > 0 && scrollY > 0) {
                    bounds.top = listBottom;
                    bounds.bottom = listBottom + dividerHeight;
                    drawDivider(canvas, bounds, -1);