From 93db1852bee2b1a23f051308e3634f58d33cb2c0 Mon Sep 17 00:00:00 2001 From: Makoto Onuki Date: Thu, 2 Sep 2010 15:41:34 -0700 Subject: [PATCH] MailboxList: Show the rotating icon when there's no mailbox If the cursor is empty, hide the list and let the framework show the rotating icon. (Don't set an empty cursor, which makes the list just blank.) We do this for only MailboxList because we know we'll get mailboxes soon enough. We can't do this on MessageList because there may be really no messages even if we wait. Bug 2927973 Change-Id: Ic0346d2d90d03489072eb95a123281f60cda44dd --- .../email/activity/MailboxListFragment.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/com/android/email/activity/MailboxListFragment.java b/src/com/android/email/activity/MailboxListFragment.java index 2d18799b2..51c1a7875 100644 --- a/src/com/android/email/activity/MailboxListFragment.java +++ b/src/com/android/email/activity/MailboxListFragment.java @@ -264,11 +264,16 @@ public class MailboxListFragment extends ListFragment implements OnItemClickList lss = new Utility.ListStateSaver(lv); } - // Set the adapter. - mListAdapter.changeCursor(cursor); - setListAdapter(mListAdapter); - setListShown(true); - highlightSelectedMailbox(); + if (cursor.getCount() == 0) { + mListAdapter.changeCursor(null); + setListShown(false); + } else { + // Set the adapter. + mListAdapter.changeCursor(cursor); + setListAdapter(mListAdapter); + setListShown(true); + highlightSelectedMailbox(); + } // Restore the state lss.restore(lv);