From 37e21ab968e3944b10304a620c3b0ecfe5175668 Mon Sep 17 00:00:00 2001 From: Makoto Onuki Date: Mon, 19 Jul 2010 17:14:54 -0700 Subject: [PATCH] Don't call setListAdapter until adapter is ready. ListFragment shows the "Loading..." animation for us until setListAdapter is first called. In order to make use of it, setListAdapter should be called only when the underlying data is ready. Change-Id: Iac903b1f10ad7ed4be04446ddb2d2172e84bfe16 --- src/com/android/email/activity/MailboxListFragment.java | 2 +- src/com/android/email/activity/MessageListFragment.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/com/android/email/activity/MailboxListFragment.java b/src/com/android/email/activity/MailboxListFragment.java index cb382542d..9410970ce 100644 --- a/src/com/android/email/activity/MailboxListFragment.java +++ b/src/com/android/email/activity/MailboxListFragment.java @@ -93,7 +93,6 @@ public class MailboxListFragment extends ListFragment implements OnItemClickList registerForContextMenu(listView); mListAdapter = new MailboxesAdapter(mActivity); - setListAdapter(mListAdapter); } /** @@ -247,6 +246,7 @@ public class MailboxListFragment extends ListFragment implements OnItemClickList if (cursor.isClosed()) return; mListAdapter.changeCursor(cursor); + setListAdapter(mListAdapter); updateMessageCount(); } } diff --git a/src/com/android/email/activity/MessageListFragment.java b/src/com/android/email/activity/MessageListFragment.java index b7f69783f..dda793efe 100644 --- a/src/com/android/email/activity/MessageListFragment.java +++ b/src/com/android/email/activity/MessageListFragment.java @@ -154,7 +154,6 @@ public class MessageListFragment extends ListFragment implements OnItemClickList listView.setItemsCanFocus(false); mListAdapter = new MessagesAdapter(mActivity, new Handler(), this); - setListAdapter(mListAdapter); mListFooterView = getActivity().getLayoutInflater().inflate( R.layout.message_list_item_footer, listView, false); @@ -861,6 +860,7 @@ public class MessageListFragment extends ListFragment implements OnItemClickList // TODO changeCursor(null)?? mListAdapter.changeCursor(cursor); + setListAdapter(mListAdapter); // changeCursor occurs the jumping of position in ListView, so it's need to restore // the position;