summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJin Cao <jinyan@google.com>2014-08-05 19:52:14 -0700
committerJin Cao <jinyan@google.com>2014-08-05 19:52:14 -0700
commitee6766a2c6938dbb4c975d93732d7033eecd90a5 (patch)
tree71266e7774f06222e0a44694194808937d2bd0d8 /src
parentcc1479374d9f7d09aa12b526ec6323ef205689ec (diff)
downloadandroid_packages_apps_UnifiedEmail-ee6766a2c6938dbb4c975d93732d7033eecd90a5.tar.gz
android_packages_apps_UnifiedEmail-ee6766a2c6938dbb4c975d93732d7033eecd90a5.tar.bz2
android_packages_apps_UnifiedEmail-ee6766a2c6938dbb4c975d93732d7033eecd90a5.zip
Properly check CursorStatus.ERROR
ConversationCursor is considered to be ready to show if the status is error (e.g. no connection). Move the check for adapter's count to after we try to show footer based on the cursor status. b/16739103 Change-Id: Ia94672710ce46d4b8035a0f8eba7e0827d453b3d
Diffstat (limited to 'src')
-rw-r--r--src/com/android/mail/browse/ConversationCursor.java4
-rw-r--r--src/com/android/mail/ui/ConversationListFragment.java17
2 files changed, 11 insertions, 10 deletions
diff --git a/src/com/android/mail/browse/ConversationCursor.java b/src/com/android/mail/browse/ConversationCursor.java
index 7f18adf70..6215a1b34 100644
--- a/src/com/android/mail/browse/ConversationCursor.java
+++ b/src/com/android/mail/browse/ConversationCursor.java
@@ -2491,9 +2491,9 @@ public final class ConversationCursor implements Cursor, ConversationCursorOpera
return false;
}
Bundle extras = cursor.getExtras();
- // if no extras, default to LOADING state (so isWaitingForResults check will pass)
final int status = (extras == null) ? UIProvider.CursorStatus.LOADING :
extras.getInt(UIProvider.CursorExtraKeys.EXTRA_STATUS);
- return (cursor.getCount() > 0 || UIProvider.CursorStatus.COMPLETE == status);
+ return (cursor.getCount() > 0 || UIProvider.CursorStatus.ERROR == status ||
+ UIProvider.CursorStatus.COMPLETE == status);
}
}
diff --git a/src/com/android/mail/ui/ConversationListFragment.java b/src/com/android/mail/ui/ConversationListFragment.java
index 02f73bc45..15a562b7b 100644
--- a/src/com/android/mail/ui/ConversationListFragment.java
+++ b/src/com/android/mail/ui/ConversationListFragment.java
@@ -884,20 +884,21 @@ public final class ConversationListFragment extends ListFragment implements
private void hideLoadingViewAndShowContents() {
final ConversationCursor cursor = getConversationListCursor();
- // Even though cursor might be empty, the list adapter might have teasers. So we check the
- // list adapter count if the cursor is fully/partially loaded.
- if (cursor != null && ConversationCursor.isCursorReadyToShow(cursor) &&
- mListAdapter.getCount() == 0) {
- showEmptyView();
- } else {
- showListView();
- }
final boolean showFooter = mFooterView.updateStatus(cursor);
// Update the sync status bar with sync results if needed
checkSyncStatus();
mListAdapter.setFooterVisibility(showFooter);
mLoadingViewPending = false;
mHandler.removeCallbacks(mLoadingViewRunnable);
+
+ // Even though cursor might be empty, the list adapter might have teasers/footers.
+ // So we check the list adapter count if the cursor is fully/partially loaded.
+ if (cursor != null && ConversationCursor.isCursorReadyToShow(cursor) &&
+ mListAdapter.getCount() == 0) {
+ showEmptyView();
+ } else {
+ showListView();
+ }
}
private void setSwipeAction() {