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

reduce duplication of code

This commit is contained in:
Jesse Vincent 2009-12-27 16:51:38 +00:00
parent c953ff2c1b
commit 9d417133b5

View File

@ -466,7 +466,8 @@ public class MessageList
mAdapter.messages.clear();
mAdapter.notifyDataSetChanged();
if (mFolderName != null) {
if (mFolderName != null)
{
mController.listLocalMessagesSynchronous(mAccount, mFolderName, mAdapter.mListener);
NotificationManager notifMgr = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
@ -1027,7 +1028,8 @@ public class MessageList
switch (id)
{
case DIALOG_MARK_ALL_AS_READ:
if (mCurrentFolder != null ) {
if (mCurrentFolder != null)
{
((AlertDialog)dialog).setMessage(getString(R.string.mark_all_as_read_dlg_instructions_fmt,
mCurrentFolder.displayName));
}
@ -1115,7 +1117,8 @@ public class MessageList
switch (itemId)
{
case R.id.check_mail:
if (mFolderName != null) {
if (mFolderName != null)
{
checkMail(mAccount, mFolderName);
}
return true;
@ -1169,13 +1172,15 @@ public class MessageList
return true;
case R.id.mark_all_as_read:
if (mFolderName != null ) {
if (mFolderName != null)
{
onMarkAllAsRead(mAccount, mFolderName);
}
return true;
case R.id.folder_settings:
if (mFolderName != null ) {
if (mFolderName != null)
{
FolderSettings.actionSettings(this, mAccount, mFolderName);
}
return true;
@ -1237,7 +1242,8 @@ public class MessageList
return true;
case R.id.expunge:
if (mCurrentFolder != null ) {
if (mCurrentFolder != null)
{
onExpunge(mAccount, mCurrentFolder.name);
}
return true;
@ -1474,7 +1480,7 @@ public class MessageList
{
super.synchronizeMailboxStarted(account, folder);
if (account.equals(mAccount) && mFolderName != null && folder.equals(mFolderName))
if (updateForMe(account, folder))
{
mHandler.progress(true);
mHandler.folderLoading(folder, true);
@ -1490,7 +1496,7 @@ public class MessageList
{
super.synchronizeMailboxFinished(account, folder, totalMessagesInMailbox, numNewMessages);
if (account.equals(mAccount) && mFolderName != null && folder.equals(mFolderName))
if (updateForMe(account, folder))
{
mHandler.progress(false);
mHandler.folderLoading(folder, false);
@ -1504,7 +1510,7 @@ public class MessageList
{
super.synchronizeMailboxFailed(account, folder, message);
if (account.equals(mAccount) && mFolderName != null && folder.equals(mFolderName))
if (updateForMe(account, folder))
{
// Perhaps this can be restored, if done in the mHandler thread
// Toast.makeText(MessageList.this, message, Toast.LENGTH_LONG).show();
@ -1547,7 +1553,7 @@ public class MessageList
@Override
public void synchronizeMailboxAddOrUpdateMessage(Account account, String folder, Message message)
{
if (account.equals(mAccount) && mFolderName != null && folder.equals(mFolderName))
if (updateForMe(account, folder))
{
addOrUpdateMessage(folder, message);
}
@ -1598,7 +1604,7 @@ public class MessageList
@Override
public void listLocalMessagesRemoveMessage(Account account, String folder,Message message)
{
if (account.equals(mAccount) && mFolderName != null && folder.equals(mFolderName))
if (updateForMe(account, folder))
{
MessageInfoHolder holder = getMessage(message.getUid());
if (holder != null)
@ -1612,7 +1618,7 @@ public class MessageList
@Override
public void listLocalMessagesAddMessages(Account account, String folder, List<Message> messages)
{
if (account.equals(mAccount) && mFolderName != null && folder.equals(mFolderName))
if (updateForMe(account, folder))
{
addOrUpdateMessages(folder, messages);
}
@ -1623,16 +1629,16 @@ public class MessageList
@Override
public void listLocalMessagesUpdateMessage(Account account, String folder, Message message)
{
if (account.equals(mAccount) && mFolderName != null && folder.equals(mFolderName))
if (updateForMe(account, folder))
{
addOrUpdateMessage(folder, message);
}
}
@Override
public void folderStatusChanged(Account account, String folderName, int unreadMessageCount)
public void folderStatusChanged(Account account, String folder, int unreadMessageCount)
{
if (account.equals(mAccount) && mFolderName != null && folderName.equals(mFolderName))
if (updateForMe(account, folder))
{
mUnreadMessageCount = unreadMessageCount;
mHandler.refreshTitle();
@ -1640,6 +1646,18 @@ public class MessageList
}
private boolean updateForMe(Account account, String folder)
{
if (account.equals(mAccount) && mFolderName != null && folder.equals(mFolderName))
{
return true;
}
else
{
return false;
}
}
public void pendingCommandsProcessing(Account account)