summaryrefslogtreecommitdiffstats
path: root/core/java/android/widget
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android/widget')
-rw-r--r--core/java/android/widget/AbsListView.java5
-rw-r--r--core/java/android/widget/ListView.java22
2 files changed, 19 insertions, 8 deletions
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index 3f38f2e..27020c5 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -334,6 +334,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
* the drawing cache was enabled on the children
*/
boolean mCachingStarted;
+ boolean mCachingActive;
/**
* The position of the view that received the down motion event
@@ -4169,7 +4170,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
if (mScrollingCacheEnabled && !mCachingStarted) {
setChildrenDrawnWithCacheEnabled(true);
setChildrenDrawingCacheEnabled(true);
- mCachingStarted = true;
+ mCachingStarted = mCachingActive = true;
}
}
@@ -4178,7 +4179,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
mClearScrollingCache = new Runnable() {
public void run() {
if (mCachingStarted) {
- mCachingStarted = false;
+ mCachingStarted = mCachingActive = false;
setChildrenDrawnWithCacheEnabled(false);
if ((mPersistentDrawingCache & PERSISTENT_SCROLLING_CACHE) == 0) {
setChildrenDrawingCacheEnabled(false);
diff --git a/core/java/android/widget/ListView.java b/core/java/android/widget/ListView.java
index 12a0ebf..2802144 100644
--- a/core/java/android/widget/ListView.java
+++ b/core/java/android/widget/ListView.java
@@ -3013,12 +3013,9 @@ public class ListView extends AbsListView {
return mItemsCanFocus;
}
- /**
- * @hide Pending API council approval.
- */
@Override
public boolean isOpaque() {
- return (mCachingStarted && mIsCacheColorOpaque && mDividerIsOpaque &&
+ return (mCachingActive && mIsCacheColorOpaque && mDividerIsOpaque &&
hasOpaqueScrollbars()) || super.isOpaque();
}
@@ -3071,6 +3068,10 @@ public class ListView extends AbsListView {
@Override
protected void dispatchDraw(Canvas canvas) {
+ if (mCachingStarted) {
+ mCachingActive = true;
+ }
+
// Draw the dividers
final int dividerHeight = mDividerHeight;
final Drawable overscrollHeader = mOverScrollHeader;
@@ -3164,7 +3165,6 @@ public class ListView extends AbsListView {
}
} else {
int top;
- int listTop = effectivePaddingTop;
final int scrollY = mScrollY;
@@ -3181,7 +3181,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 (top > listTop) {
+ if (top > effectivePaddingTop) {
if ((areAllItemsSelectable ||
(adapter.isEnabled(first + i) && (i == count - 1 ||
adapter.isEnabled(first + i + 1))))) {
@@ -3220,6 +3220,15 @@ public class ListView extends AbsListView {
super.dispatchDraw(canvas);
}
+ @Override
+ protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
+ boolean more = super.drawChild(canvas, child, drawingTime);
+ if (mCachingActive && child.mCachingFailed) {
+ mCachingActive = false;
+ }
+ return more;
+ }
+
/**
* Draws a divider for the given child in the given bounds.
*
@@ -3558,6 +3567,7 @@ public class ListView extends AbsListView {
@Override
public boolean onTouchEvent(MotionEvent ev) {
+ //noinspection SimplifiableIfStatement
if (mItemsCanFocus && ev.getAction() == MotionEvent.ACTION_DOWN && ev.getEdgeFlags() != 0) {
// Don't handle edge touches immediately -- they may actually belong to one of our
// descendants.