Fix NullPointerException when the user clicks on a "new mail"

notification.  Resolves Issue 1001
This commit is contained in:
Jesse Vincent 2010-01-08 23:18:44 +00:00
parent 81fd4749cc
commit e1c686d40d

View file

@ -318,6 +318,10 @@ public class FolderList extends K9ListActivity
initialFolder = null;
mStartup = false;
savedFolderName = savedInstanceState.getString(STATE_CURRENT_FOLDER);
if (savedFolderName != null)
{
mSelectedContextFolder = mAdapter.getFolder(savedFolderName);
}
}
if (mStartup
@ -327,6 +331,18 @@ public class FolderList extends K9ListActivity
onOpenFolder(initialFolder, true);
}
else
{
initializeActivityView();
}
}
/* There are two times when we might need to initialize the activity view
* onCreate
* OR
* onResume if the initial onCreate opened a folder directly
*/
private void initializeActivityView()
{
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
@ -348,7 +364,7 @@ public class FolderList extends K9ListActivity
* We manually save and restore the list's state because our adapter is
* slow.
*/
mListView.setSaveEnabled(false);
mListView.setSaveEnabled(true);
mInflater = getLayoutInflater();
@ -366,13 +382,9 @@ public class FolderList extends K9ListActivity
setTitle(mAccount.getDescription());
if (savedFolderName != null)
{
mSelectedContextFolder = mAdapter.getFolder(savedFolderName);
}
}
}
@Override public Object onRetainNonConfigurationInstance()
{
return mAdapter.mFolders;
@ -393,6 +405,9 @@ public class FolderList extends K9ListActivity
{
super.onResume();
if (mAdapter == null)
initializeActivityView();
MessagingController.getInstance(getApplication()).addListener(mAdapter.mListener);
mAccount.refresh(Preferences.getPreferences(this));
MessagingController.getInstance(getApplication()).getAccountUnreadCount(this, mAccount, mAdapter.mListener);