From 3cb08624ce21ff2b2b901b6ecd2c92054bc29e46 Mon Sep 17 00:00:00 2001 From: Lucas Rocha Date: Sun, 17 Mar 2013 11:12:09 +0000 Subject: [PATCH] Bug 851894 - Only update empty state when emptyview is not null (r=mfinkle) --- mobile/android/base/widget/TwoWayView.java | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/mobile/android/base/widget/TwoWayView.java b/mobile/android/base/widget/TwoWayView.java index 9823aeb810c8..608d8132e4c0 100644 --- a/mobile/android/base/widget/TwoWayView.java +++ b/mobile/android/base/widget/TwoWayView.java @@ -778,7 +778,10 @@ public class TwoWayView extends AdapterView implements checkSelectionChanged(); } - updateEmptyStatus(); + if (mEmptyView != null) { + updateEmptyStatus(); + } + requestLayout(); } @@ -4623,7 +4626,7 @@ public class TwoWayView extends AdapterView implements } private void updateEmptyStatus() { - boolean isEmpty = mAdapter == null || mAdapter.isEmpty(); + final boolean isEmpty = (mAdapter == null || mAdapter.isEmpty()); if (isEmpty) { if (mEmptyView != null) { mEmptyView.setVisibility(View.VISIBLE); @@ -4641,8 +4644,10 @@ public class TwoWayView extends AdapterView implements this.onLayout(false, getLeft(), getTop(), getRight(), getBottom()); } } else { - if (mEmptyView != null) + if (mEmptyView != null) { mEmptyView.setVisibility(View.GONE); + } + setVisibility(View.VISIBLE); } } @@ -4665,7 +4670,11 @@ public class TwoWayView extends AdapterView implements } else { rememberSyncState(); } - updateEmptyStatus(); + + if (mEmptyView != null) { + updateEmptyStatus(); + } + requestLayout(); } @@ -4691,7 +4700,10 @@ public class TwoWayView extends AdapterView implements mNeedSync = false; - updateEmptyStatus(); + if (mEmptyView != null) { + updateEmptyStatus(); + } + requestLayout(); } }