From 296d7d3614fec5f6ecfb3c9ca9fd4cd630482566 Mon Sep 17 00:00:00 2001 From: Makoto Onuki Date: Mon, 6 Jun 2011 10:39:05 -0700 Subject: [PATCH] Make message list behave nicely when it's in back stack - Hide CAB when it has no views. - Stop pending tasks and refresh callbacks when it's paused. Change-Id: Idaae9061237ce9f923c002d659e8e12407e4bad1 --- .../android/email/activity/MessageListFragment.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/com/android/email/activity/MessageListFragment.java b/src/com/android/email/activity/MessageListFragment.java index f2ea078d0..a72173308 100644 --- a/src/com/android/email/activity/MessageListFragment.java +++ b/src/com/android/email/activity/MessageListFragment.java @@ -343,7 +343,6 @@ public class MessageListFragment extends ListFragment setHasOptionsMenu(true); mController = Controller.getInstance(mActivity); mRefreshManager = RefreshManager.getInstance(mActivity); - mRefreshManager.registerListener(mRefreshListener); mListAdapter = new MessagesAdapter(mActivity, this); setListAdapter(mListAdapter); @@ -412,8 +411,9 @@ public class MessageListFragment extends ListFragment Log.d(Logging.LOG_TAG, this + " onResume"); } super.onResume(); - mResumed = true; adjustMessageNotification(false); + mRefreshManager.registerListener(mRefreshListener); + mResumed = true; } @Override @@ -432,6 +432,9 @@ public class MessageListFragment extends ListFragment if (Logging.DEBUG_LIFECYCLE && Email.DEBUG) { Log.d(Logging.LOG_TAG, this + " onStop"); } + mTaskTracker.cancellAllInterrupt(); + mRefreshManager.unregisterListener(mRefreshListener); + super.onStop(); } @@ -440,6 +443,7 @@ public class MessageListFragment extends ListFragment if (Logging.DEBUG_LIFECYCLE && Email.DEBUG) { Log.d(Logging.LOG_TAG, this + " onDestroyView"); } + updateSelectionMode(); super.onDestroyView(); } @@ -448,8 +452,6 @@ public class MessageListFragment extends ListFragment if (Logging.DEBUG_LIFECYCLE && Email.DEBUG) { Log.d(Logging.LOG_TAG, this + " onDestroy"); } - mTaskTracker.cancellAllInterrupt(); - mRefreshManager.unregisterListener(mRefreshListener); finishSelectionMode(); super.onDestroy(); @@ -1272,7 +1274,7 @@ public class MessageListFragment extends ListFragment */ public void updateSelectionMode() { final int numSelected = getSelectedCount(); - if ((numSelected == 0) || mDisableCab) { + if ((numSelected == 0) || mDisableCab || !isViewCreated()) { finishSelectionMode(); return; }