1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-30 13:12:25 -05:00

svn merge -c 794 ../issue4-1.X/ .

svn merge -c 800 ../issue4-1.X/ .
svn merge -c 803 ../issue4-1.X/ .

Issue 654
This commit is contained in:
Daniel Applebaum 2009-10-03 06:11:29 +00:00
parent 3bb0d08855
commit 02889cfe37
2 changed files with 28 additions and 21 deletions

View File

@ -73,6 +73,8 @@ public class FolderList extends K9ListActivity {
private static final String EXTRA_ACCOUNT = "account";
private static final String EXTRA_INITIAL_FOLDER = "initialFolder";
private static final String STATE_CURRENT_FOLDER = "com.android.email.activity.folderlist_folder";
private static final String EXTRA_CLEAR_NOTIFICATION = "clearNotification";
@ -100,13 +102,12 @@ public class FolderList extends K9ListActivity {
private DateFormat timeFormat = null;
private SORT_TYPE sortType = SORT_TYPE.SORT_DATE;
private boolean sortAscending = true;
private boolean sortDateAscending = false;
private boolean mStartup = false;
private static final ThreadPoolExecutor threadPool = new ThreadPoolExecutor(1, 1, 120000L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue());
@ -379,7 +380,7 @@ public class FolderList extends K9ListActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String savedFolderName = null;
Intent intent = getIntent();
mAccount = (Account)intent.getSerializableExtra(EXTRA_ACCOUNT);
Log.v(Email.LOG_TAG, "savedInstanceState: " + (savedInstanceState==null));
@ -396,6 +397,7 @@ public class FolderList extends K9ListActivity {
else {
mInitialFolder = null;
mStartup = false;
savedFolderName = savedInstanceState.getString(STATE_CURRENT_FOLDER);
}
Log.v(Email.LOG_TAG, "mInitialFolder: " + mInitialFolder);
@ -440,7 +442,7 @@ public class FolderList extends K9ListActivity {
}
setListAdapter(mAdapter);
if (savedInstanceState != null) {
mRestoringState = true;
//onRestoreListState(savedInstanceState);
@ -448,6 +450,11 @@ public class FolderList extends K9ListActivity {
}
setTitle(mAccount.getDescription());
if (savedFolderName != null)
{
mSelectedContextFolder = mAdapter.getFolder(savedFolderName);
}
}
}
@ -480,6 +487,15 @@ public class FolderList extends K9ListActivity {
notifMgr.cancel(-1000 - mAccount.getAccountNumber());
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
if (mSelectedContextFolder != null)
{
outState.putString(STATE_CURRENT_FOLDER, mSelectedContextFolder.name);
}
}
@Override public boolean onKeyDown(int keyCode, KeyEvent event) {
//Shortcuts that work no matter what is selected
@ -682,13 +698,10 @@ public class FolderList extends K9ListActivity {
return super.onContextItemSelected(item);
}
private Account mSelectedContextAccount = null;
private FolderInfoHolder mSelectedContextFolder = null;
private void onMarkAllAsRead(final Account account, final String folder) {
mSelectedContextAccount = account;
mSelectedContextFolder = mAdapter.getFolder(folder);
showDialog(DIALOG_MARK_ALL_AS_READ);
}
@ -728,7 +741,7 @@ public class FolderList extends K9ListActivity {
try {
MessagingController.getInstance(getApplication()).markAllMessagesRead(mSelectedContextAccount, mSelectedContextFolder.name);
MessagingController.getInstance(getApplication()).markAllMessagesRead(mAccount, mSelectedContextFolder.name);
for (MessageInfoHolder holder : mSelectedContextFolder.messages) {
holder.read = true;

View File

@ -819,15 +819,8 @@ public class MessageList extends K9ListActivity {
MessageCompose.actionForward(this, mAccount, holder.message);
}
private void onMarkAllAsRead(final Account account, final String folder) {
private Account mSelectedContextAccount = null;
private FolderInfoHolder mSelectedContextFolder = null;
private void onMarkAllAsRead(final Account account, final String folder) {
mSelectedContextAccount = account;
mSelectedContextFolder = mAdapter.getFolder(folder);
showDialog(DIALOG_MARK_ALL_AS_READ);
}
@ -836,6 +829,7 @@ public class MessageList extends K9ListActivity {
switch (id) {
case DIALOG_MARK_ALL_AS_READ:
return createMarkAllAsReadDialog();
}
return super.onCreateDialog(id);
@ -845,7 +839,7 @@ public class MessageList extends K9ListActivity {
switch (id) {
case DIALOG_MARK_ALL_AS_READ:
((AlertDialog)dialog).setMessage(getString(R.string.mark_all_as_read_dlg_instructions_fmt,
mSelectedContextFolder.displayName));
mCurrentFolder.displayName));
break;
@ -858,20 +852,20 @@ public class MessageList extends K9ListActivity {
return new AlertDialog.Builder(this)
.setTitle(R.string.mark_all_as_read_dlg_title)
.setMessage(getString(R.string.mark_all_as_read_dlg_instructions_fmt,
mSelectedContextFolder.displayName))
mCurrentFolder.displayName))
.setPositiveButton(R.string.okay_action, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
dismissDialog(DIALOG_MARK_ALL_AS_READ);
try {
MessagingController.getInstance(getApplication()).markAllMessagesRead(mSelectedContextAccount, mSelectedContextFolder.name);
MessagingController.getInstance(getApplication()).markAllMessagesRead(mAccount, mCurrentFolder.name);
for (MessageInfoHolder holder : mSelectedContextFolder.messages) {
for (MessageInfoHolder holder : mCurrentFolder.messages) {
holder.read = true;
}
mSelectedContextFolder.unreadMessageCount = 0;
mCurrentFolder.unreadMessageCount = 0;
mHandler.dataChanged();