Merge "Make message list behave nicely when it's in back stack"

This commit is contained in:
Makoto Onuki 2011-06-06 14:33:19 -07:00 committed by Android (Google) Code Review
commit d42b3222fb

View File

@ -343,7 +343,6 @@ public class MessageListFragment extends ListFragment
setHasOptionsMenu(true); setHasOptionsMenu(true);
mController = Controller.getInstance(mActivity); mController = Controller.getInstance(mActivity);
mRefreshManager = RefreshManager.getInstance(mActivity); mRefreshManager = RefreshManager.getInstance(mActivity);
mRefreshManager.registerListener(mRefreshListener);
mListAdapter = new MessagesAdapter(mActivity, this); mListAdapter = new MessagesAdapter(mActivity, this);
setListAdapter(mListAdapter); setListAdapter(mListAdapter);
@ -412,8 +411,9 @@ public class MessageListFragment extends ListFragment
Log.d(Logging.LOG_TAG, this + " onResume"); Log.d(Logging.LOG_TAG, this + " onResume");
} }
super.onResume(); super.onResume();
mResumed = true;
adjustMessageNotification(false); adjustMessageNotification(false);
mRefreshManager.registerListener(mRefreshListener);
mResumed = true;
} }
@Override @Override
@ -432,6 +432,9 @@ public class MessageListFragment extends ListFragment
if (Logging.DEBUG_LIFECYCLE && Email.DEBUG) { if (Logging.DEBUG_LIFECYCLE && Email.DEBUG) {
Log.d(Logging.LOG_TAG, this + " onStop"); Log.d(Logging.LOG_TAG, this + " onStop");
} }
mTaskTracker.cancellAllInterrupt();
mRefreshManager.unregisterListener(mRefreshListener);
super.onStop(); super.onStop();
} }
@ -440,6 +443,7 @@ public class MessageListFragment extends ListFragment
if (Logging.DEBUG_LIFECYCLE && Email.DEBUG) { if (Logging.DEBUG_LIFECYCLE && Email.DEBUG) {
Log.d(Logging.LOG_TAG, this + " onDestroyView"); Log.d(Logging.LOG_TAG, this + " onDestroyView");
} }
updateSelectionMode();
super.onDestroyView(); super.onDestroyView();
} }
@ -448,8 +452,6 @@ public class MessageListFragment extends ListFragment
if (Logging.DEBUG_LIFECYCLE && Email.DEBUG) { if (Logging.DEBUG_LIFECYCLE && Email.DEBUG) {
Log.d(Logging.LOG_TAG, this + " onDestroy"); Log.d(Logging.LOG_TAG, this + " onDestroy");
} }
mTaskTracker.cancellAllInterrupt();
mRefreshManager.unregisterListener(mRefreshListener);
finishSelectionMode(); finishSelectionMode();
super.onDestroy(); super.onDestroy();
@ -1272,7 +1274,7 @@ public class MessageListFragment extends ListFragment
*/ */
public void updateSelectionMode() { public void updateSelectionMode() {
final int numSelected = getSelectedCount(); final int numSelected = getSelectedCount();
if ((numSelected == 0) || mDisableCab) { if ((numSelected == 0) || mDisableCab || !isViewCreated()) {
finishSelectionMode(); finishSelectionMode();
return; return;
} }