NullPointerException
This commit is contained in:
@@ -134,6 +134,10 @@ public class ExpandableCardView extends CardView {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
||||||
|
if (outerView != null || innerView != null) {
|
||||||
|
log.w("This should not happen (onLayout)! Inner views are null!", innerView, outerView);
|
||||||
|
return;
|
||||||
|
}
|
||||||
removeAllViews();
|
removeAllViews();
|
||||||
int x = getPaddingLeft();
|
int x = getPaddingLeft();
|
||||||
int y = getPaddingTop();
|
int y = getPaddingTop();
|
||||||
@@ -153,7 +157,12 @@ public class ExpandableCardView extends CardView {
|
|||||||
@Override
|
@Override
|
||||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||||
if (MeasureSpec.getSize(widthMeasureSpec) == 0 && MeasureSpec.getMode(widthMeasureSpec) != MeasureSpec.UNSPECIFIED || MeasureSpec.getSize(heightMeasureSpec) == 0 && MeasureSpec.getMode(heightMeasureSpec) != MeasureSpec.UNSPECIFIED) {
|
if (MeasureSpec.getSize(widthMeasureSpec) == 0 && MeasureSpec.getMode(widthMeasureSpec) != MeasureSpec.UNSPECIFIED || MeasureSpec.getSize(heightMeasureSpec) == 0 && MeasureSpec.getMode(heightMeasureSpec) != MeasureSpec.UNSPECIFIED) {
|
||||||
log.w("This should not happen! Invalid dimension size");
|
log.w("This should not happen (onMeasure)! Invalid dimension size");
|
||||||
|
setMeasuredDimension(reconcileSize(10, widthMeasureSpec), reconcileSize(10, heightMeasureSpec));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (outerView != null || innerView != null) {
|
||||||
|
log.w("This should not happen (onMeasure)! Inner views are null!", innerView, outerView);
|
||||||
setMeasuredDimension(reconcileSize(10, widthMeasureSpec), reconcileSize(10, heightMeasureSpec));
|
setMeasuredDimension(reconcileSize(10, widthMeasureSpec), reconcileSize(10, heightMeasureSpec));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user