Get rid of constant K9.INBOX

Use Account.getInboxFolderName() instead
This commit is contained in:
cketti 2011-05-08 02:17:23 +02:00
parent 92ea452163
commit f4931a3167
3 changed files with 10 additions and 12 deletions

View File

@ -33,6 +33,11 @@ import java.util.concurrent.ConcurrentHashMap;
* and delete itself given a Preferences to work with. Each account is defined by a UUID.
*/
public class Account implements BaseAccount {
/**
* Default value for the inbox folder (never changes for POP3 and IMAP)
*/
public static final String INBOX = "INBOX";
public static final String EXPUNGE_IMMEDIATELY = "EXPUNGE_IMMEDIATELY";
public static final String EXPUNGE_MANUALLY = "EXPUNGE_MANUALLY";
public static final String EXPUNGE_ON_POLL = "EXPUNGE_ON_POLL";
@ -181,8 +186,8 @@ public class Account implements BaseAccount {
mEnableMoveButtons = false;
mIsSignatureBeforeQuotedText = false;
mExpungePolicy = EXPUNGE_IMMEDIATELY;
mAutoExpandFolderName = K9.INBOX;
mInboxFolderName = K9.INBOX;
mAutoExpandFolderName = INBOX;
mInboxFolderName = INBOX;
mMaxPushFolders = 10;
mChipColor = (new Random()).nextInt(0xffffff) + 0xff000000;
goToUnreadMessageSearch = false;
@ -248,7 +253,7 @@ public class Account implements BaseAccount {
mNotifySelfNewMail = prefs.getBoolean(mUuid + ".notifySelfNewMail", true);
mNotifySync = prefs.getBoolean(mUuid + ".notifyMailCheck", false);
mDeletePolicy = prefs.getInt(mUuid + ".deletePolicy", 0);
mInboxFolderName = prefs.getString(mUuid + ".inboxFolderName", K9.INBOX);
mInboxFolderName = prefs.getString(mUuid + ".inboxFolderName", INBOX);
mDraftsFolderName = prefs.getString(mUuid + ".draftsFolderName", "Drafts");
mSentFolderName = prefs.getString(mUuid + ".sentFolderName", "Sent");
mTrashFolderName = prefs.getString(mUuid + ".trashFolderName", "Trash");
@ -273,7 +278,7 @@ public class Account implements BaseAccount {
compressionMap.put(type, useCompression);
}
mAutoExpandFolderName = prefs.getString(mUuid + ".autoExpandFolderName", K9.INBOX);
mAutoExpandFolderName = prefs.getString(mUuid + ".autoExpandFolderName", INBOX);
mAccountNumber = prefs.getInt(mUuid + ".accountNumber", 0);

View File

@ -216,12 +216,6 @@ public class K9 extends Application {
public static final String[] UNACCEPTABLE_ATTACHMENT_DOWNLOAD_TYPES = new String[] {
};
/**
* The special name "INBOX" is used throughout the application to mean "Whatever folder
* the server refers to as the user's Inbox. Placed here to ease use.
*/
public static final String INBOX = "INBOX";
/**
* For use when displaying that no folder is selected
*/

View File

@ -6,7 +6,6 @@ import android.content.Context;
import com.fsck.k9.Account;
import com.fsck.k9.AccountStats;
import com.fsck.k9.K9;
import com.fsck.k9.R;
import com.fsck.k9.controller.MessagingListener;
import com.fsck.k9.service.MailService;
@ -35,7 +34,7 @@ public class ActivityListener extends MessagingListener {
if (mLoadingFolderName != null || mLoadingHeaderFolderName != null) {
String displayName = mLoadingFolderName;
if (K9.INBOX.equalsIgnoreCase(displayName)) {
if (mAccount.getInboxFolderName().equalsIgnoreCase(displayName)) {
displayName = context.getString(R.string.special_mailbox_name_inbox);
} else if ((mAccount != null) && mAccount.getOutboxFolderName().equals(displayName)) {
displayName = context.getString(R.string.special_mailbox_name_outbox);