Merge change 2397 into donut
* changes: Fixes NPE in ListViews with non-selectable items. This was caused by a weird initialization issue in ListView and AbsListView: a private final field instanciated in the declaration in ListView was used in AbsListView<init> via an overriden method and that field was somehow null at this time. This fix moves the instanciation at a later point.
This commit is contained in:
@@ -134,7 +134,7 @@ public class ListView extends AbsListView {
|
|||||||
|
|
||||||
// used for temporary calculations.
|
// used for temporary calculations.
|
||||||
private final Rect mTempRect = new Rect();
|
private final Rect mTempRect = new Rect();
|
||||||
private final Paint mDividerPaint = new Paint();
|
private Paint mDividerPaint;
|
||||||
|
|
||||||
// the single allocated result per list view; kinda cheesey but avoids
|
// the single allocated result per list view; kinda cheesey but avoids
|
||||||
// allocating these thingies too often.
|
// allocating these thingies too often.
|
||||||
@@ -2824,6 +2824,9 @@ public class ListView extends AbsListView {
|
|||||||
final boolean opaque = (color >>> 24) == 0xFF;
|
final boolean opaque = (color >>> 24) == 0xFF;
|
||||||
mIsCacheColorOpaque = opaque;
|
mIsCacheColorOpaque = opaque;
|
||||||
if (opaque) {
|
if (opaque) {
|
||||||
|
if (mDividerPaint == null) {
|
||||||
|
mDividerPaint = new Paint();
|
||||||
|
}
|
||||||
mDividerPaint.setColor(color);
|
mDividerPaint.setColor(color);
|
||||||
}
|
}
|
||||||
super.setCacheColorHint(color);
|
super.setCacheColorHint(color);
|
||||||
@@ -2849,6 +2852,9 @@ public class ListView extends AbsListView {
|
|||||||
final boolean areAllItemsSelectable = mAreAllItemsSelectable;
|
final boolean areAllItemsSelectable = mAreAllItemsSelectable;
|
||||||
final ListAdapter adapter = mAdapter;
|
final ListAdapter adapter = mAdapter;
|
||||||
final boolean isOpaque = isOpaque();
|
final boolean isOpaque = isOpaque();
|
||||||
|
if (isOpaque && mDividerPaint == null) {
|
||||||
|
mDividerPaint = new Paint();
|
||||||
|
}
|
||||||
final Paint paint = mDividerPaint;
|
final Paint paint = mDividerPaint;
|
||||||
|
|
||||||
if (!mStackFromBottom) {
|
if (!mStackFromBottom) {
|
||||||
|
|||||||
Reference in New Issue
Block a user