1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-24 02:12:15 -05:00

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; initialFolder = null;
mStartup = false; mStartup = false;
savedFolderName = savedInstanceState.getString(STATE_CURRENT_FOLDER); savedFolderName = savedInstanceState.getString(STATE_CURRENT_FOLDER);
if (savedFolderName != null)
{
mSelectedContextFolder = mAdapter.getFolder(savedFolderName);
}
} }
if (mStartup if (mStartup
@ -327,6 +331,18 @@ public class FolderList extends K9ListActivity
onOpenFolder(initialFolder, true); onOpenFolder(initialFolder, true);
} }
else 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); 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 * We manually save and restore the list's state because our adapter is
* slow. * slow.
*/ */
mListView.setSaveEnabled(false); mListView.setSaveEnabled(true);
mInflater = getLayoutInflater(); mInflater = getLayoutInflater();
@ -366,13 +382,9 @@ public class FolderList extends K9ListActivity
setTitle(mAccount.getDescription()); setTitle(mAccount.getDescription());
if (savedFolderName != null)
{
mSelectedContextFolder = mAdapter.getFolder(savedFolderName);
}
}
} }
@Override public Object onRetainNonConfigurationInstance() @Override public Object onRetainNonConfigurationInstance()
{ {
return mAdapter.mFolders; return mAdapter.mFolders;
@ -393,6 +405,9 @@ public class FolderList extends K9ListActivity
{ {
super.onResume(); super.onResume();
if (mAdapter == null)
initializeActivityView();
MessagingController.getInstance(getApplication()).addListener(mAdapter.mListener); MessagingController.getInstance(getApplication()).addListener(mAdapter.mListener);
mAccount.refresh(Preferences.getPreferences(this)); mAccount.refresh(Preferences.getPreferences(this));
MessagingController.getInstance(getApplication()).getAccountUnreadCount(this, mAccount, mAdapter.mListener); MessagingController.getInstance(getApplication()).getAccountUnreadCount(this, mAccount, mAdapter.mListener);