From ac6221f4fa20e6c67b32be8ede43b58c8fa393e2 Mon Sep 17 00:00:00 2001
From: Vincent Breitmoser
Date: Mon, 27 Mar 2017 11:18:36 +0200
Subject: [PATCH 1/6] rename fields in Account
---
k9mail/src/main/java/com/fsck/k9/Account.java | 961 +++++++++---------
1 file changed, 481 insertions(+), 480 deletions(-)
diff --git a/k9mail/src/main/java/com/fsck/k9/Account.java b/k9mail/src/main/java/com/fsck/k9/Account.java
index 07cd50b3b..33a465a5c 100644
--- a/k9mail/src/main/java/com/fsck/k9/Account.java
+++ b/k9mail/src/main/java/com/fsck/k9/Account.java
@@ -159,48 +159,48 @@ public class Account implements BaseAccount, StoreConfig {
public static final boolean DEFAULT_SORT_ASCENDING = false;
public static final long NO_OPENPGP_KEY = 0;
- private DeletePolicy mDeletePolicy = DeletePolicy.NEVER;
+ private DeletePolicy deletePolicy = DeletePolicy.NEVER;
- private final String mUuid;
- private String mStoreUri;
+ private final String accountUuid;
+ private String storeUri;
/**
* Storage provider ID, used to locate and manage the underlying DB/file
* storage
*/
- private String mLocalStorageProviderId;
- private String mTransportUri;
- private String mDescription;
- private String mAlwaysBcc;
- private int mAutomaticCheckIntervalMinutes;
- private int mDisplayCount;
- private int mChipColor;
- private long mLatestOldMessageSeenTime;
- private boolean mNotifyNewMail;
- private FolderMode mFolderNotifyNewMailMode;
- private boolean mNotifySelfNewMail;
- private boolean mNotifyContactsMailOnly;
- private String mInboxFolderName;
- private String mDraftsFolderName;
- private String mSentFolderName;
- private String mTrashFolderName;
- private String mArchiveFolderName;
- private String mSpamFolderName;
- private String mAutoExpandFolderName;
- private FolderMode mFolderDisplayMode;
- private FolderMode mFolderSyncMode;
- private FolderMode mFolderPushMode;
- private FolderMode mFolderTargetMode;
- private int mAccountNumber;
- private boolean mPushPollOnConnect;
- private boolean mNotifySync;
- private SortType mSortType;
- private Map mSortAscending = new HashMap<>();
- private ShowPictures mShowPictures;
- private boolean mIsSignatureBeforeQuotedText;
- private Expunge mExpungePolicy = Expunge.EXPUNGE_IMMEDIATELY;
- private int mMaxPushFolders;
- private int mIdleRefreshMinutes;
+ private String localStorageProviderId;
+ private String transportUri;
+ private String description;
+ private String alwaysBcc;
+ private int automaticCheckIntervalMinutes;
+ private int displayCount;
+ private int chipColor;
+ private long latestOldMessageSeenTime;
+ private boolean notifyNewMail;
+ private FolderMode folderNotifyNewMailMode;
+ private boolean notifySelfNewMail;
+ private boolean notifyContactsMailOnly;
+ private String inboxFolderName;
+ private String draftsFolderName;
+ private String sentFolderName;
+ private String trashFolderName;
+ private String archiveFolderName;
+ private String spamFolderName;
+ private String autoExpandFolderName;
+ private FolderMode folderDisplayMode;
+ private FolderMode folderSyncMode;
+ private FolderMode folderPushMode;
+ private FolderMode folderTargetMode;
+ private int accountNumber;
+ private boolean pushPollOnConnect;
+ private boolean notifySync;
+ private SortType sortType;
+ private Map sortAscending = new HashMap<>();
+ private ShowPictures showPictures;
+ private boolean isSignatureBeforeQuotedText;
+ private Expunge expungePolicy = Expunge.EXPUNGE_IMMEDIATELY;
+ private int maxPushFolders;
+ private int idleRefreshMinutes;
private boolean goToUnreadMessageSearch;
private final Map compressionMap = new ConcurrentHashMap<>();
private Searchable searchableFolders;
@@ -209,28 +209,28 @@ public class Account implements BaseAccount, StoreConfig {
private int maximumAutoDownloadMessageSize;
// Tracks if we have sent a notification for this account for
// current set of fetched messages
- private boolean mRingNotified;
- private MessageFormat mMessageFormat;
- private boolean mMessageFormatAuto;
- private boolean mMessageReadReceipt;
- private QuoteStyle mQuoteStyle;
- private String mQuotePrefix;
- private boolean mDefaultQuotedTextShown;
- private boolean mReplyAfterQuote;
- private boolean mStripSignature;
- private boolean mSyncRemoteDeletions;
- private long mCryptoKey;
- private boolean mMarkMessageAsReadOnView;
- private boolean mAlwaysShowCcBcc;
- private boolean mAllowRemoteSearch;
- private boolean mRemoteSearchFullText;
- private int mRemoteSearchNumResults;
+ private boolean ringNotified;
+ private MessageFormat messageFormat;
+ private boolean messageFormatAuto;
+ private boolean messageReadReceipt;
+ private QuoteStyle quoteStyle;
+ private String quotePrefix;
+ private boolean defaultQuotedTextShown;
+ private boolean replyAfterQuote;
+ private boolean stripSignature;
+ private boolean syncRemoteDeletions;
+ private long pgpCryptoKey;
+ private boolean markMessageAsReadOnView;
+ private boolean alwaysShowCcBcc;
+ private boolean allowRemoteSearch;
+ private boolean remoteSearchFullText;
+ private int remoteSearchNumResults;
- private ColorChip mUnreadColorChip;
- private ColorChip mReadColorChip;
+ private ColorChip unreadColorChip;
+ private ColorChip readColorChip;
- private ColorChip mFlaggedUnreadColorChip;
- private ColorChip mFlaggedReadColorChip;
+ private ColorChip flaggedUnreadColorChip;
+ private ColorChip flaggedReadColorChip;
/**
@@ -241,7 +241,7 @@ public class Account implements BaseAccount, StoreConfig {
* password for the incoming and/or outgoing server.
*
*/
- private boolean mEnabled;
+ private boolean isEnabled;
/**
* Name of the folder that was last selected for a copy or move operation.
@@ -253,7 +253,7 @@ public class Account implements BaseAccount, StoreConfig {
private List identities;
- private NotificationSetting mNotificationSetting = new NotificationSetting();
+ private NotificationSetting notificationSetting = new NotificationSetting();
public enum FolderMode {
NONE, ALL, FIRST_CLASS, FIRST_AND_SECOND_CLASS, NOT_SECOND_CLASS
@@ -276,51 +276,51 @@ public class Account implements BaseAccount, StoreConfig {
}
protected Account(Context context) {
- mUuid = UUID.randomUUID().toString();
- mLocalStorageProviderId = StorageManager.getInstance(context).getDefaultProviderId();
- mAutomaticCheckIntervalMinutes = -1;
- mIdleRefreshMinutes = 24;
- mPushPollOnConnect = true;
- mDisplayCount = K9.DEFAULT_VISIBLE_LIMIT;
- mAccountNumber = -1;
- mNotifyNewMail = true;
- mFolderNotifyNewMailMode = FolderMode.ALL;
- mNotifySync = true;
- mNotifySelfNewMail = true;
- mNotifyContactsMailOnly = false;
- mFolderDisplayMode = FolderMode.NOT_SECOND_CLASS;
- mFolderSyncMode = FolderMode.FIRST_CLASS;
- mFolderPushMode = FolderMode.FIRST_CLASS;
- mFolderTargetMode = FolderMode.NOT_SECOND_CLASS;
- mSortType = DEFAULT_SORT_TYPE;
- mSortAscending.put(DEFAULT_SORT_TYPE, DEFAULT_SORT_ASCENDING);
- mShowPictures = ShowPictures.NEVER;
- mIsSignatureBeforeQuotedText = false;
- mExpungePolicy = Expunge.EXPUNGE_IMMEDIATELY;
- mAutoExpandFolderName = INBOX;
- mInboxFolderName = INBOX;
- mMaxPushFolders = 10;
- mChipColor = pickColor(context);
+ accountUuid = UUID.randomUUID().toString();
+ localStorageProviderId = StorageManager.getInstance(context).getDefaultProviderId();
+ automaticCheckIntervalMinutes = -1;
+ idleRefreshMinutes = 24;
+ pushPollOnConnect = true;
+ displayCount = K9.DEFAULT_VISIBLE_LIMIT;
+ accountNumber = -1;
+ notifyNewMail = true;
+ folderNotifyNewMailMode = FolderMode.ALL;
+ notifySync = true;
+ notifySelfNewMail = true;
+ notifyContactsMailOnly = false;
+ folderDisplayMode = FolderMode.NOT_SECOND_CLASS;
+ folderSyncMode = FolderMode.FIRST_CLASS;
+ folderPushMode = FolderMode.FIRST_CLASS;
+ folderTargetMode = FolderMode.NOT_SECOND_CLASS;
+ sortType = DEFAULT_SORT_TYPE;
+ sortAscending.put(DEFAULT_SORT_TYPE, DEFAULT_SORT_ASCENDING);
+ showPictures = ShowPictures.NEVER;
+ isSignatureBeforeQuotedText = false;
+ expungePolicy = Expunge.EXPUNGE_IMMEDIATELY;
+ autoExpandFolderName = INBOX;
+ inboxFolderName = INBOX;
+ maxPushFolders = 10;
+ chipColor = pickColor(context);
goToUnreadMessageSearch = false;
subscribedFoldersOnly = false;
maximumPolledMessageAge = -1;
maximumAutoDownloadMessageSize = 32768;
- mMessageFormat = DEFAULT_MESSAGE_FORMAT;
- mMessageFormatAuto = DEFAULT_MESSAGE_FORMAT_AUTO;
- mMessageReadReceipt = DEFAULT_MESSAGE_READ_RECEIPT;
- mQuoteStyle = DEFAULT_QUOTE_STYLE;
- mQuotePrefix = DEFAULT_QUOTE_PREFIX;
- mDefaultQuotedTextShown = DEFAULT_QUOTED_TEXT_SHOWN;
- mReplyAfterQuote = DEFAULT_REPLY_AFTER_QUOTE;
- mStripSignature = DEFAULT_STRIP_SIGNATURE;
- mSyncRemoteDeletions = true;
- mCryptoKey = NO_OPENPGP_KEY;
- mAllowRemoteSearch = false;
- mRemoteSearchFullText = false;
- mRemoteSearchNumResults = DEFAULT_REMOTE_SEARCH_NUM_RESULTS;
- mEnabled = true;
- mMarkMessageAsReadOnView = true;
- mAlwaysShowCcBcc = false;
+ messageFormat = DEFAULT_MESSAGE_FORMAT;
+ messageFormatAuto = DEFAULT_MESSAGE_FORMAT_AUTO;
+ messageReadReceipt = DEFAULT_MESSAGE_READ_RECEIPT;
+ quoteStyle = DEFAULT_QUOTE_STYLE;
+ quotePrefix = DEFAULT_QUOTE_PREFIX;
+ defaultQuotedTextShown = DEFAULT_QUOTED_TEXT_SHOWN;
+ replyAfterQuote = DEFAULT_REPLY_AFTER_QUOTE;
+ stripSignature = DEFAULT_STRIP_SIGNATURE;
+ syncRemoteDeletions = true;
+ pgpCryptoKey = NO_OPENPGP_KEY;
+ allowRemoteSearch = false;
+ remoteSearchFullText = false;
+ remoteSearchNumResults = DEFAULT_REMOTE_SEARCH_NUM_RESULTS;
+ isEnabled = true;
+ markMessageAsReadOnView = true;
+ alwaysShowCcBcc = false;
searchableFolders = Searchable.ALL;
@@ -332,13 +332,13 @@ public class Account implements BaseAccount, StoreConfig {
identity.setDescription(context.getString(R.string.default_identity_description));
identities.add(identity);
- mNotificationSetting = new NotificationSetting();
- mNotificationSetting.setVibrate(false);
- mNotificationSetting.setVibratePattern(0);
- mNotificationSetting.setVibrateTimes(5);
- mNotificationSetting.setRing(true);
- mNotificationSetting.setRingtone("content://settings/system/notification_sound");
- mNotificationSetting.setLedColor(mChipColor);
+ notificationSetting = new NotificationSetting();
+ notificationSetting.setVibrate(false);
+ notificationSetting.setVibratePattern(0);
+ notificationSetting.setVibrateTimes(5);
+ notificationSetting.setRing(true);
+ notificationSetting.setRingtone("content://settings/system/notification_sound");
+ notificationSetting.setLedColor(chipColor);
cacheChips();
}
@@ -366,7 +366,7 @@ public class Account implements BaseAccount, StoreConfig {
}
protected Account(Preferences preferences, String uuid) {
- this.mUuid = uuid;
+ this.accountUuid = uuid;
loadAccount(preferences);
}
@@ -377,105 +377,106 @@ public class Account implements BaseAccount, StoreConfig {
Storage storage = preferences.getStorage();
- mStoreUri = Base64.decode(storage.getString(mUuid + ".storeUri", null));
- mLocalStorageProviderId = storage.getString(mUuid + ".localStorageProvider", StorageManager.getInstance(K9.app).getDefaultProviderId());
- mTransportUri = Base64.decode(storage.getString(mUuid + ".transportUri", null));
- mDescription = storage.getString(mUuid + ".description", null);
- mAlwaysBcc = storage.getString(mUuid + ".alwaysBcc", mAlwaysBcc);
- mAutomaticCheckIntervalMinutes = storage.getInt(mUuid + ".automaticCheckIntervalMinutes", -1);
- mIdleRefreshMinutes = storage.getInt(mUuid + ".idleRefreshMinutes", 24);
- mPushPollOnConnect = storage.getBoolean(mUuid + ".pushPollOnConnect", true);
- mDisplayCount = storage.getInt(mUuid + ".displayCount", K9.DEFAULT_VISIBLE_LIMIT);
- if (mDisplayCount < 0) {
- mDisplayCount = K9.DEFAULT_VISIBLE_LIMIT;
+ storeUri = Base64.decode(storage.getString(accountUuid + ".storeUri", null));
+ localStorageProviderId = storage.getString(
+ accountUuid + ".localStorageProvider", StorageManager.getInstance(K9.app).getDefaultProviderId());
+ transportUri = Base64.decode(storage.getString(accountUuid + ".transportUri", null));
+ description = storage.getString(accountUuid + ".description", null);
+ alwaysBcc = storage.getString(accountUuid + ".alwaysBcc", alwaysBcc);
+ automaticCheckIntervalMinutes = storage.getInt(accountUuid + ".automaticCheckIntervalMinutes", -1);
+ idleRefreshMinutes = storage.getInt(accountUuid + ".idleRefreshMinutes", 24);
+ pushPollOnConnect = storage.getBoolean(accountUuid + ".pushPollOnConnect", true);
+ displayCount = storage.getInt(accountUuid + ".displayCount", K9.DEFAULT_VISIBLE_LIMIT);
+ if (displayCount < 0) {
+ displayCount = K9.DEFAULT_VISIBLE_LIMIT;
}
- mLatestOldMessageSeenTime = storage.getLong(mUuid + ".latestOldMessageSeenTime", 0);
- mNotifyNewMail = storage.getBoolean(mUuid + ".notifyNewMail", false);
+ latestOldMessageSeenTime = storage.getLong(accountUuid + ".latestOldMessageSeenTime", 0);
+ notifyNewMail = storage.getBoolean(accountUuid + ".notifyNewMail", false);
- mFolderNotifyNewMailMode = getEnumStringPref(storage, mUuid + ".folderNotifyNewMailMode", FolderMode.ALL);
- mNotifySelfNewMail = storage.getBoolean(mUuid + ".notifySelfNewMail", true);
- mNotifyContactsMailOnly = storage.getBoolean(mUuid + ".notifyContactsMailOnly", false);
- mNotifySync = storage.getBoolean(mUuid + ".notifyMailCheck", false);
- mDeletePolicy = DeletePolicy.fromInt(storage.getInt(mUuid + ".deletePolicy", DeletePolicy.NEVER.setting));
- mInboxFolderName = storage.getString(mUuid + ".inboxFolderName", INBOX);
- mDraftsFolderName = storage.getString(mUuid + ".draftsFolderName", "Drafts");
- mSentFolderName = storage.getString(mUuid + ".sentFolderName", "Sent");
- mTrashFolderName = storage.getString(mUuid + ".trashFolderName", "Trash");
- mArchiveFolderName = storage.getString(mUuid + ".archiveFolderName", "Archive");
- mSpamFolderName = storage.getString(mUuid + ".spamFolderName", "Spam");
- mExpungePolicy = getEnumStringPref(storage, mUuid + ".expungePolicy", Expunge.EXPUNGE_IMMEDIATELY);
- mSyncRemoteDeletions = storage.getBoolean(mUuid + ".syncRemoteDeletions", true);
+ folderNotifyNewMailMode = getEnumStringPref(storage, accountUuid + ".folderNotifyNewMailMode", FolderMode.ALL);
+ notifySelfNewMail = storage.getBoolean(accountUuid + ".notifySelfNewMail", true);
+ notifyContactsMailOnly = storage.getBoolean(accountUuid + ".notifyContactsMailOnly", false);
+ notifySync = storage.getBoolean(accountUuid + ".notifyMailCheck", false);
+ deletePolicy = DeletePolicy.fromInt(storage.getInt(accountUuid + ".deletePolicy", DeletePolicy.NEVER.setting));
+ inboxFolderName = storage.getString(accountUuid + ".inboxFolderName", INBOX);
+ draftsFolderName = storage.getString(accountUuid + ".draftsFolderName", "Drafts");
+ sentFolderName = storage.getString(accountUuid + ".sentFolderName", "Sent");
+ trashFolderName = storage.getString(accountUuid + ".trashFolderName", "Trash");
+ archiveFolderName = storage.getString(accountUuid + ".archiveFolderName", "Archive");
+ spamFolderName = storage.getString(accountUuid + ".spamFolderName", "Spam");
+ expungePolicy = getEnumStringPref(storage, accountUuid + ".expungePolicy", Expunge.EXPUNGE_IMMEDIATELY);
+ syncRemoteDeletions = storage.getBoolean(accountUuid + ".syncRemoteDeletions", true);
- mMaxPushFolders = storage.getInt(mUuid + ".maxPushFolders", 10);
- goToUnreadMessageSearch = storage.getBoolean(mUuid + ".goToUnreadMessageSearch", false);
- subscribedFoldersOnly = storage.getBoolean(mUuid + ".subscribedFoldersOnly", false);
- maximumPolledMessageAge = storage.getInt(mUuid + ".maximumPolledMessageAge", -1);
- maximumAutoDownloadMessageSize = storage.getInt(mUuid + ".maximumAutoDownloadMessageSize", 32768);
- mMessageFormat = getEnumStringPref(storage, mUuid + ".messageFormat", DEFAULT_MESSAGE_FORMAT);
- mMessageFormatAuto = storage.getBoolean(mUuid + ".messageFormatAuto", DEFAULT_MESSAGE_FORMAT_AUTO);
- if (mMessageFormatAuto && mMessageFormat == MessageFormat.TEXT) {
- mMessageFormat = MessageFormat.AUTO;
+ maxPushFolders = storage.getInt(accountUuid + ".maxPushFolders", 10);
+ goToUnreadMessageSearch = storage.getBoolean(accountUuid + ".goToUnreadMessageSearch", false);
+ subscribedFoldersOnly = storage.getBoolean(accountUuid + ".subscribedFoldersOnly", false);
+ maximumPolledMessageAge = storage.getInt(accountUuid + ".maximumPolledMessageAge", -1);
+ maximumAutoDownloadMessageSize = storage.getInt(accountUuid + ".maximumAutoDownloadMessageSize", 32768);
+ messageFormat = getEnumStringPref(storage, accountUuid + ".messageFormat", DEFAULT_MESSAGE_FORMAT);
+ messageFormatAuto = storage.getBoolean(accountUuid + ".messageFormatAuto", DEFAULT_MESSAGE_FORMAT_AUTO);
+ if (messageFormatAuto && messageFormat == MessageFormat.TEXT) {
+ messageFormat = MessageFormat.AUTO;
}
- mMessageReadReceipt = storage.getBoolean(mUuid + ".messageReadReceipt", DEFAULT_MESSAGE_READ_RECEIPT);
- mQuoteStyle = getEnumStringPref(storage, mUuid + ".quoteStyle", DEFAULT_QUOTE_STYLE);
- mQuotePrefix = storage.getString(mUuid + ".quotePrefix", DEFAULT_QUOTE_PREFIX);
- mDefaultQuotedTextShown = storage.getBoolean(mUuid + ".defaultQuotedTextShown", DEFAULT_QUOTED_TEXT_SHOWN);
- mReplyAfterQuote = storage.getBoolean(mUuid + ".replyAfterQuote", DEFAULT_REPLY_AFTER_QUOTE);
- mStripSignature = storage.getBoolean(mUuid + ".stripSignature", DEFAULT_STRIP_SIGNATURE);
+ messageReadReceipt = storage.getBoolean(accountUuid + ".messageReadReceipt", DEFAULT_MESSAGE_READ_RECEIPT);
+ quoteStyle = getEnumStringPref(storage, accountUuid + ".quoteStyle", DEFAULT_QUOTE_STYLE);
+ quotePrefix = storage.getString(accountUuid + ".quotePrefix", DEFAULT_QUOTE_PREFIX);
+ defaultQuotedTextShown = storage.getBoolean(accountUuid + ".defaultQuotedTextShown", DEFAULT_QUOTED_TEXT_SHOWN);
+ replyAfterQuote = storage.getBoolean(accountUuid + ".replyAfterQuote", DEFAULT_REPLY_AFTER_QUOTE);
+ stripSignature = storage.getBoolean(accountUuid + ".stripSignature", DEFAULT_STRIP_SIGNATURE);
for (NetworkType type : NetworkType.values()) {
- Boolean useCompression = storage.getBoolean(mUuid + ".useCompression." + type,
+ Boolean useCompression = storage.getBoolean(accountUuid + ".useCompression." + type,
true);
compressionMap.put(type, useCompression);
}
- mAutoExpandFolderName = storage.getString(mUuid + ".autoExpandFolderName", INBOX);
+ autoExpandFolderName = storage.getString(accountUuid + ".autoExpandFolderName", INBOX);
- mAccountNumber = storage.getInt(mUuid + ".accountNumber", 0);
+ accountNumber = storage.getInt(accountUuid + ".accountNumber", 0);
- mChipColor = storage.getInt(mUuid + ".chipColor", ColorPicker.getRandomColor());
+ chipColor = storage.getInt(accountUuid + ".chipColor", ColorPicker.getRandomColor());
- mSortType = getEnumStringPref(storage, mUuid + ".sortTypeEnum", SortType.SORT_DATE);
+ sortType = getEnumStringPref(storage, accountUuid + ".sortTypeEnum", SortType.SORT_DATE);
- mSortAscending.put(mSortType, storage.getBoolean(mUuid + ".sortAscending", false));
+ sortAscending.put(sortType, storage.getBoolean(accountUuid + ".sortAscending", false));
- mShowPictures = getEnumStringPref(storage, mUuid + ".showPicturesEnum", ShowPictures.NEVER);
+ showPictures = getEnumStringPref(storage, accountUuid + ".showPicturesEnum", ShowPictures.NEVER);
- mNotificationSetting.setVibrate(storage.getBoolean(mUuid + ".vibrate", false));
- mNotificationSetting.setVibratePattern(storage.getInt(mUuid + ".vibratePattern", 0));
- mNotificationSetting.setVibrateTimes(storage.getInt(mUuid + ".vibrateTimes", 5));
- mNotificationSetting.setRing(storage.getBoolean(mUuid + ".ring", true));
- mNotificationSetting.setRingtone(storage.getString(mUuid + ".ringtone",
+ notificationSetting.setVibrate(storage.getBoolean(accountUuid + ".vibrate", false));
+ notificationSetting.setVibratePattern(storage.getInt(accountUuid + ".vibratePattern", 0));
+ notificationSetting.setVibrateTimes(storage.getInt(accountUuid + ".vibrateTimes", 5));
+ notificationSetting.setRing(storage.getBoolean(accountUuid + ".ring", true));
+ notificationSetting.setRingtone(storage.getString(accountUuid + ".ringtone",
"content://settings/system/notification_sound"));
- mNotificationSetting.setLed(storage.getBoolean(mUuid + ".led", true));
- mNotificationSetting.setLedColor(storage.getInt(mUuid + ".ledColor", mChipColor));
+ notificationSetting.setLed(storage.getBoolean(accountUuid + ".led", true));
+ notificationSetting.setLedColor(storage.getInt(accountUuid + ".ledColor", chipColor));
- mFolderDisplayMode = getEnumStringPref(storage, mUuid + ".folderDisplayMode", FolderMode.NOT_SECOND_CLASS);
+ folderDisplayMode = getEnumStringPref(storage, accountUuid + ".folderDisplayMode", FolderMode.NOT_SECOND_CLASS);
- mFolderSyncMode = getEnumStringPref(storage, mUuid + ".folderSyncMode", FolderMode.FIRST_CLASS);
+ folderSyncMode = getEnumStringPref(storage, accountUuid + ".folderSyncMode", FolderMode.FIRST_CLASS);
- mFolderPushMode = getEnumStringPref(storage, mUuid + ".folderPushMode", FolderMode.FIRST_CLASS);
+ folderPushMode = getEnumStringPref(storage, accountUuid + ".folderPushMode", FolderMode.FIRST_CLASS);
- mFolderTargetMode = getEnumStringPref(storage, mUuid + ".folderTargetMode", FolderMode.NOT_SECOND_CLASS);
+ folderTargetMode = getEnumStringPref(storage, accountUuid + ".folderTargetMode", FolderMode.NOT_SECOND_CLASS);
- searchableFolders = getEnumStringPref(storage, mUuid + ".searchableFolders", Searchable.ALL);
+ searchableFolders = getEnumStringPref(storage, accountUuid + ".searchableFolders", Searchable.ALL);
- mIsSignatureBeforeQuotedText = storage.getBoolean(mUuid + ".signatureBeforeQuotedText", false);
+ isSignatureBeforeQuotedText = storage.getBoolean(accountUuid + ".signatureBeforeQuotedText", false);
identities = loadIdentities(storage);
- mCryptoKey = storage.getLong(mUuid + ".cryptoKey", NO_OPENPGP_KEY);
- mAllowRemoteSearch = storage.getBoolean(mUuid + ".allowRemoteSearch", false);
- mRemoteSearchFullText = storage.getBoolean(mUuid + ".remoteSearchFullText", false);
- mRemoteSearchNumResults = storage.getInt(mUuid + ".remoteSearchNumResults", DEFAULT_REMOTE_SEARCH_NUM_RESULTS);
+ pgpCryptoKey = storage.getLong(accountUuid + ".cryptoKey", NO_OPENPGP_KEY);
+ allowRemoteSearch = storage.getBoolean(accountUuid + ".allowRemoteSearch", false);
+ remoteSearchFullText = storage.getBoolean(accountUuid + ".remoteSearchFullText", false);
+ remoteSearchNumResults = storage.getInt(accountUuid + ".remoteSearchNumResults", DEFAULT_REMOTE_SEARCH_NUM_RESULTS);
- mEnabled = storage.getBoolean(mUuid + ".enabled", true);
- mMarkMessageAsReadOnView = storage.getBoolean(mUuid + ".markMessageAsReadOnView", true);
- mAlwaysShowCcBcc = storage.getBoolean(mUuid + ".alwaysShowCcBcc", false);
+ isEnabled = storage.getBoolean(accountUuid + ".enabled", true);
+ markMessageAsReadOnView = storage.getBoolean(accountUuid + ".markMessageAsReadOnView", true);
+ alwaysShowCcBcc = storage.getBoolean(accountUuid + ".alwaysShowCcBcc", false);
cacheChips();
// Use email address as account description if necessary
- if (mDescription == null) {
- mDescription = getEmail();
+ if (description == null) {
+ description = getEmail();
}
}
@@ -488,7 +489,7 @@ public class Account implements BaseAccount, StoreConfig {
// Create a list of all account UUIDs excluding this account
List newUuids = new ArrayList<>(uuids.length);
for (String uuid : uuids) {
- if (!uuid.equals(mUuid)) {
+ if (!uuid.equals(accountUuid)) {
newUuids.add(uuid);
}
}
@@ -501,77 +502,77 @@ public class Account implements BaseAccount, StoreConfig {
editor.putString("accountUuids", accountUuids);
}
- editor.remove(mUuid + ".storeUri");
- editor.remove(mUuid + ".transportUri");
- editor.remove(mUuid + ".description");
- editor.remove(mUuid + ".name");
- editor.remove(mUuid + ".email");
- editor.remove(mUuid + ".alwaysBcc");
- editor.remove(mUuid + ".automaticCheckIntervalMinutes");
- editor.remove(mUuid + ".pushPollOnConnect");
- editor.remove(mUuid + ".idleRefreshMinutes");
- editor.remove(mUuid + ".lastAutomaticCheckTime");
- editor.remove(mUuid + ".latestOldMessageSeenTime");
- editor.remove(mUuid + ".notifyNewMail");
- editor.remove(mUuid + ".notifySelfNewMail");
- editor.remove(mUuid + ".deletePolicy");
- editor.remove(mUuid + ".draftsFolderName");
- editor.remove(mUuid + ".sentFolderName");
- editor.remove(mUuid + ".trashFolderName");
- editor.remove(mUuid + ".archiveFolderName");
- editor.remove(mUuid + ".spamFolderName");
- editor.remove(mUuid + ".autoExpandFolderName");
- editor.remove(mUuid + ".accountNumber");
- editor.remove(mUuid + ".vibrate");
- editor.remove(mUuid + ".vibratePattern");
- editor.remove(mUuid + ".vibrateTimes");
- editor.remove(mUuid + ".ring");
- editor.remove(mUuid + ".ringtone");
- editor.remove(mUuid + ".folderDisplayMode");
- editor.remove(mUuid + ".folderSyncMode");
- editor.remove(mUuid + ".folderPushMode");
- editor.remove(mUuid + ".folderTargetMode");
- editor.remove(mUuid + ".signatureBeforeQuotedText");
- editor.remove(mUuid + ".expungePolicy");
- editor.remove(mUuid + ".syncRemoteDeletions");
- editor.remove(mUuid + ".maxPushFolders");
- editor.remove(mUuid + ".searchableFolders");
- editor.remove(mUuid + ".chipColor");
- editor.remove(mUuid + ".led");
- editor.remove(mUuid + ".ledColor");
- editor.remove(mUuid + ".goToUnreadMessageSearch");
- editor.remove(mUuid + ".subscribedFoldersOnly");
- editor.remove(mUuid + ".maximumPolledMessageAge");
- editor.remove(mUuid + ".maximumAutoDownloadMessageSize");
- editor.remove(mUuid + ".messageFormatAuto");
- editor.remove(mUuid + ".quoteStyle");
- editor.remove(mUuid + ".quotePrefix");
- editor.remove(mUuid + ".sortTypeEnum");
- editor.remove(mUuid + ".sortAscending");
- editor.remove(mUuid + ".showPicturesEnum");
- editor.remove(mUuid + ".replyAfterQuote");
- editor.remove(mUuid + ".stripSignature");
- editor.remove(mUuid + ".cryptoApp"); // this is no longer set, but cleans up legacy values
- editor.remove(mUuid + ".cryptoAutoSignature");
- editor.remove(mUuid + ".cryptoAutoEncrypt");
- editor.remove(mUuid + ".cryptoApp");
- editor.remove(mUuid + ".cryptoKey");
- editor.remove(mUuid + ".cryptoSupportSignOnly");
- editor.remove(mUuid + ".enabled");
- editor.remove(mUuid + ".markMessageAsReadOnView");
- editor.remove(mUuid + ".alwaysShowCcBcc");
- editor.remove(mUuid + ".allowRemoteSearch");
- editor.remove(mUuid + ".remoteSearchFullText");
- editor.remove(mUuid + ".remoteSearchNumResults");
- editor.remove(mUuid + ".defaultQuotedTextShown");
- editor.remove(mUuid + ".displayCount");
- editor.remove(mUuid + ".inboxFolderName");
- editor.remove(mUuid + ".localStorageProvider");
- editor.remove(mUuid + ".messageFormat");
- editor.remove(mUuid + ".messageReadReceipt");
- editor.remove(mUuid + ".notifyMailCheck");
+ editor.remove(accountUuid + ".storeUri");
+ editor.remove(accountUuid + ".transportUri");
+ editor.remove(accountUuid + ".description");
+ editor.remove(accountUuid + ".name");
+ editor.remove(accountUuid + ".email");
+ editor.remove(accountUuid + ".alwaysBcc");
+ editor.remove(accountUuid + ".automaticCheckIntervalMinutes");
+ editor.remove(accountUuid + ".pushPollOnConnect");
+ editor.remove(accountUuid + ".idleRefreshMinutes");
+ editor.remove(accountUuid + ".lastAutomaticCheckTime");
+ editor.remove(accountUuid + ".latestOldMessageSeenTime");
+ editor.remove(accountUuid + ".notifyNewMail");
+ editor.remove(accountUuid + ".notifySelfNewMail");
+ editor.remove(accountUuid + ".deletePolicy");
+ editor.remove(accountUuid + ".draftsFolderName");
+ editor.remove(accountUuid + ".sentFolderName");
+ editor.remove(accountUuid + ".trashFolderName");
+ editor.remove(accountUuid + ".archiveFolderName");
+ editor.remove(accountUuid + ".spamFolderName");
+ editor.remove(accountUuid + ".autoExpandFolderName");
+ editor.remove(accountUuid + ".accountNumber");
+ editor.remove(accountUuid + ".vibrate");
+ editor.remove(accountUuid + ".vibratePattern");
+ editor.remove(accountUuid + ".vibrateTimes");
+ editor.remove(accountUuid + ".ring");
+ editor.remove(accountUuid + ".ringtone");
+ editor.remove(accountUuid + ".folderDisplayMode");
+ editor.remove(accountUuid + ".folderSyncMode");
+ editor.remove(accountUuid + ".folderPushMode");
+ editor.remove(accountUuid + ".folderTargetMode");
+ editor.remove(accountUuid + ".signatureBeforeQuotedText");
+ editor.remove(accountUuid + ".expungePolicy");
+ editor.remove(accountUuid + ".syncRemoteDeletions");
+ editor.remove(accountUuid + ".maxPushFolders");
+ editor.remove(accountUuid + ".searchableFolders");
+ editor.remove(accountUuid + ".chipColor");
+ editor.remove(accountUuid + ".led");
+ editor.remove(accountUuid + ".ledColor");
+ editor.remove(accountUuid + ".goToUnreadMessageSearch");
+ editor.remove(accountUuid + ".subscribedFoldersOnly");
+ editor.remove(accountUuid + ".maximumPolledMessageAge");
+ editor.remove(accountUuid + ".maximumAutoDownloadMessageSize");
+ editor.remove(accountUuid + ".messageFormatAuto");
+ editor.remove(accountUuid + ".quoteStyle");
+ editor.remove(accountUuid + ".quotePrefix");
+ editor.remove(accountUuid + ".sortTypeEnum");
+ editor.remove(accountUuid + ".sortAscending");
+ editor.remove(accountUuid + ".showPicturesEnum");
+ editor.remove(accountUuid + ".replyAfterQuote");
+ editor.remove(accountUuid + ".stripSignature");
+ editor.remove(accountUuid + ".cryptoApp"); // this is no longer set, but cleans up legacy values
+ editor.remove(accountUuid + ".cryptoAutoSignature");
+ editor.remove(accountUuid + ".cryptoAutoEncrypt");
+ editor.remove(accountUuid + ".cryptoApp");
+ editor.remove(accountUuid + ".cryptoKey");
+ editor.remove(accountUuid + ".cryptoSupportSignOnly");
+ editor.remove(accountUuid + ".enabled");
+ editor.remove(accountUuid + ".markMessageAsReadOnView");
+ editor.remove(accountUuid + ".alwaysShowCcBcc");
+ editor.remove(accountUuid + ".allowRemoteSearch");
+ editor.remove(accountUuid + ".remoteSearchFullText");
+ editor.remove(accountUuid + ".remoteSearchNumResults");
+ editor.remove(accountUuid + ".defaultQuotedTextShown");
+ editor.remove(accountUuid + ".displayCount");
+ editor.remove(accountUuid + ".inboxFolderName");
+ editor.remove(accountUuid + ".localStorageProvider");
+ editor.remove(accountUuid + ".messageFormat");
+ editor.remove(accountUuid + ".messageReadReceipt");
+ editor.remove(accountUuid + ".notifyMailCheck");
for (NetworkType type : NetworkType.values()) {
- editor.remove(mUuid + ".useCompression." + type.name());
+ editor.remove(accountUuid + ".useCompression." + type.name());
}
deleteIdentities(preferences.getStorage(), editor);
// TODO: Remove preference settings that may exist for individual
@@ -611,9 +612,9 @@ public class Account implements BaseAccount, StoreConfig {
String[] newUuids = new String[uuids.length];
if (moveUp) {
for (int i = 0; i < uuids.length; i++) {
- if (i > 0 && uuids[i].equals(mUuid)) {
+ if (i > 0 && uuids[i].equals(accountUuid)) {
newUuids[i] = newUuids[i-1];
- newUuids[i-1] = mUuid;
+ newUuids[i-1] = accountUuid;
}
else {
newUuids[i] = uuids[i];
@@ -622,9 +623,9 @@ public class Account implements BaseAccount, StoreConfig {
}
else {
for (int i = uuids.length - 1; i >= 0; i--) {
- if (i < uuids.length - 1 && uuids[i].equals(mUuid)) {
+ if (i < uuids.length - 1 && uuids[i].equals(accountUuid)) {
newUuids[i] = newUuids[i+1];
- newUuids[i+1] = mUuid;
+ newUuids[i+1] = accountUuid;
}
else {
newUuids[i] = uuids[i];
@@ -640,14 +641,14 @@ public class Account implements BaseAccount, StoreConfig {
public synchronized void save(Preferences preferences) {
StorageEditor editor = preferences.getStorage().edit();
- if (!preferences.getStorage().getString("accountUuids", "").contains(mUuid)) {
+ if (!preferences.getStorage().getString("accountUuids", "").contains(accountUuid)) {
/*
* When the account is first created we assign it a unique account number. The
* account number will be unique to that account for the lifetime of the account.
* So, we get all the existing account numbers, sort them ascending, loop through
* the list and check if the number is greater than 1 + the previous number. If so
* we use the previous number + 1 as the account number. This refills gaps.
- * mAccountNumber starts as -1 on a newly created account. It must be -1 for this
+ * accountNumber starts as -1 on a newly created account. It must be -1 for this
* algorithm to work.
*
* I bet there is a much smarter way to do this. Anyone like to suggest it?
@@ -659,95 +660,95 @@ public class Account implements BaseAccount, StoreConfig {
}
Arrays.sort(accountNumbers);
for (int accountNumber : accountNumbers) {
- if (accountNumber > mAccountNumber + 1) {
+ if (accountNumber > this.accountNumber + 1) {
break;
}
- mAccountNumber = accountNumber;
+ this.accountNumber = accountNumber;
}
- mAccountNumber++;
+ accountNumber++;
String accountUuids = preferences.getStorage().getString("accountUuids", "");
- accountUuids += (accountUuids.length() != 0 ? "," : "") + mUuid;
+ accountUuids += (accountUuids.length() != 0 ? "," : "") + accountUuid;
editor.putString("accountUuids", accountUuids);
}
- editor.putString(mUuid + ".storeUri", Base64.encode(mStoreUri));
- editor.putString(mUuid + ".localStorageProvider", mLocalStorageProviderId);
- editor.putString(mUuid + ".transportUri", Base64.encode(mTransportUri));
- editor.putString(mUuid + ".description", mDescription);
- editor.putString(mUuid + ".alwaysBcc", mAlwaysBcc);
- editor.putInt(mUuid + ".automaticCheckIntervalMinutes", mAutomaticCheckIntervalMinutes);
- editor.putInt(mUuid + ".idleRefreshMinutes", mIdleRefreshMinutes);
- editor.putBoolean(mUuid + ".pushPollOnConnect", mPushPollOnConnect);
- editor.putInt(mUuid + ".displayCount", mDisplayCount);
- editor.putLong(mUuid + ".latestOldMessageSeenTime", mLatestOldMessageSeenTime);
- editor.putBoolean(mUuid + ".notifyNewMail", mNotifyNewMail);
- editor.putString(mUuid + ".folderNotifyNewMailMode", mFolderNotifyNewMailMode.name());
- editor.putBoolean(mUuid + ".notifySelfNewMail", mNotifySelfNewMail);
- editor.putBoolean(mUuid + ".notifyContactsMailOnly", mNotifyContactsMailOnly);
- editor.putBoolean(mUuid + ".notifyMailCheck", mNotifySync);
- editor.putInt(mUuid + ".deletePolicy", mDeletePolicy.setting);
- editor.putString(mUuid + ".inboxFolderName", mInboxFolderName);
- editor.putString(mUuid + ".draftsFolderName", mDraftsFolderName);
- editor.putString(mUuid + ".sentFolderName", mSentFolderName);
- editor.putString(mUuid + ".trashFolderName", mTrashFolderName);
- editor.putString(mUuid + ".archiveFolderName", mArchiveFolderName);
- editor.putString(mUuid + ".spamFolderName", mSpamFolderName);
- editor.putString(mUuid + ".autoExpandFolderName", mAutoExpandFolderName);
- editor.putInt(mUuid + ".accountNumber", mAccountNumber);
- editor.putString(mUuid + ".sortTypeEnum", mSortType.name());
- editor.putBoolean(mUuid + ".sortAscending", mSortAscending.get(mSortType));
- editor.putString(mUuid + ".showPicturesEnum", mShowPictures.name());
- editor.putString(mUuid + ".folderDisplayMode", mFolderDisplayMode.name());
- editor.putString(mUuid + ".folderSyncMode", mFolderSyncMode.name());
- editor.putString(mUuid + ".folderPushMode", mFolderPushMode.name());
- editor.putString(mUuid + ".folderTargetMode", mFolderTargetMode.name());
- editor.putBoolean(mUuid + ".signatureBeforeQuotedText", this.mIsSignatureBeforeQuotedText);
- editor.putString(mUuid + ".expungePolicy", mExpungePolicy.name());
- editor.putBoolean(mUuid + ".syncRemoteDeletions", mSyncRemoteDeletions);
- editor.putInt(mUuid + ".maxPushFolders", mMaxPushFolders);
- editor.putString(mUuid + ".searchableFolders", searchableFolders.name());
- editor.putInt(mUuid + ".chipColor", mChipColor);
- editor.putBoolean(mUuid + ".goToUnreadMessageSearch", goToUnreadMessageSearch);
- editor.putBoolean(mUuid + ".subscribedFoldersOnly", subscribedFoldersOnly);
- editor.putInt(mUuid + ".maximumPolledMessageAge", maximumPolledMessageAge);
- editor.putInt(mUuid + ".maximumAutoDownloadMessageSize", maximumAutoDownloadMessageSize);
- if (MessageFormat.AUTO.equals(mMessageFormat)) {
+ editor.putString(accountUuid + ".storeUri", Base64.encode(storeUri));
+ editor.putString(accountUuid + ".localStorageProvider", localStorageProviderId);
+ editor.putString(accountUuid + ".transportUri", Base64.encode(transportUri));
+ editor.putString(accountUuid + ".description", description);
+ editor.putString(accountUuid + ".alwaysBcc", alwaysBcc);
+ editor.putInt(accountUuid + ".automaticCheckIntervalMinutes", automaticCheckIntervalMinutes);
+ editor.putInt(accountUuid + ".idleRefreshMinutes", idleRefreshMinutes);
+ editor.putBoolean(accountUuid + ".pushPollOnConnect", pushPollOnConnect);
+ editor.putInt(accountUuid + ".displayCount", displayCount);
+ editor.putLong(accountUuid + ".latestOldMessageSeenTime", latestOldMessageSeenTime);
+ editor.putBoolean(accountUuid + ".notifyNewMail", notifyNewMail);
+ editor.putString(accountUuid + ".folderNotifyNewMailMode", folderNotifyNewMailMode.name());
+ editor.putBoolean(accountUuid + ".notifySelfNewMail", notifySelfNewMail);
+ editor.putBoolean(accountUuid + ".notifyContactsMailOnly", notifyContactsMailOnly);
+ editor.putBoolean(accountUuid + ".notifyMailCheck", notifySync);
+ editor.putInt(accountUuid + ".deletePolicy", deletePolicy.setting);
+ editor.putString(accountUuid + ".inboxFolderName", inboxFolderName);
+ editor.putString(accountUuid + ".draftsFolderName", draftsFolderName);
+ editor.putString(accountUuid + ".sentFolderName", sentFolderName);
+ editor.putString(accountUuid + ".trashFolderName", trashFolderName);
+ editor.putString(accountUuid + ".archiveFolderName", archiveFolderName);
+ editor.putString(accountUuid + ".spamFolderName", spamFolderName);
+ editor.putString(accountUuid + ".autoExpandFolderName", autoExpandFolderName);
+ editor.putInt(accountUuid + ".accountNumber", accountNumber);
+ editor.putString(accountUuid + ".sortTypeEnum", sortType.name());
+ editor.putBoolean(accountUuid + ".sortAscending", sortAscending.get(sortType));
+ editor.putString(accountUuid + ".showPicturesEnum", showPictures.name());
+ editor.putString(accountUuid + ".folderDisplayMode", folderDisplayMode.name());
+ editor.putString(accountUuid + ".folderSyncMode", folderSyncMode.name());
+ editor.putString(accountUuid + ".folderPushMode", folderPushMode.name());
+ editor.putString(accountUuid + ".folderTargetMode", folderTargetMode.name());
+ editor.putBoolean(accountUuid + ".signatureBeforeQuotedText", this.isSignatureBeforeQuotedText);
+ editor.putString(accountUuid + ".expungePolicy", expungePolicy.name());
+ editor.putBoolean(accountUuid + ".syncRemoteDeletions", syncRemoteDeletions);
+ editor.putInt(accountUuid + ".maxPushFolders", maxPushFolders);
+ editor.putString(accountUuid + ".searchableFolders", searchableFolders.name());
+ editor.putInt(accountUuid + ".chipColor", chipColor);
+ editor.putBoolean(accountUuid + ".goToUnreadMessageSearch", goToUnreadMessageSearch);
+ editor.putBoolean(accountUuid + ".subscribedFoldersOnly", subscribedFoldersOnly);
+ editor.putInt(accountUuid + ".maximumPolledMessageAge", maximumPolledMessageAge);
+ editor.putInt(accountUuid + ".maximumAutoDownloadMessageSize", maximumAutoDownloadMessageSize);
+ if (MessageFormat.AUTO.equals(messageFormat)) {
// saving MessageFormat.AUTO as is to the database will cause downgrades to crash on
// startup, so we save as MessageFormat.TEXT instead with a separate flag for auto.
- editor.putString(mUuid + ".messageFormat", Account.MessageFormat.TEXT.name());
- mMessageFormatAuto = true;
+ editor.putString(accountUuid + ".messageFormat", Account.MessageFormat.TEXT.name());
+ messageFormatAuto = true;
} else {
- editor.putString(mUuid + ".messageFormat", mMessageFormat.name());
- mMessageFormatAuto = false;
+ editor.putString(accountUuid + ".messageFormat", messageFormat.name());
+ messageFormatAuto = false;
}
- editor.putBoolean(mUuid + ".messageFormatAuto", mMessageFormatAuto);
- editor.putBoolean(mUuid + ".messageReadReceipt", mMessageReadReceipt);
- editor.putString(mUuid + ".quoteStyle", mQuoteStyle.name());
- editor.putString(mUuid + ".quotePrefix", mQuotePrefix);
- editor.putBoolean(mUuid + ".defaultQuotedTextShown", mDefaultQuotedTextShown);
- editor.putBoolean(mUuid + ".replyAfterQuote", mReplyAfterQuote);
- editor.putBoolean(mUuid + ".stripSignature", mStripSignature);
- editor.putLong(mUuid + ".cryptoKey", mCryptoKey);
- editor.putBoolean(mUuid + ".allowRemoteSearch", mAllowRemoteSearch);
- editor.putBoolean(mUuid + ".remoteSearchFullText", mRemoteSearchFullText);
- editor.putInt(mUuid + ".remoteSearchNumResults", mRemoteSearchNumResults);
- editor.putBoolean(mUuid + ".enabled", mEnabled);
- editor.putBoolean(mUuid + ".markMessageAsReadOnView", mMarkMessageAsReadOnView);
- editor.putBoolean(mUuid + ".alwaysShowCcBcc", mAlwaysShowCcBcc);
+ editor.putBoolean(accountUuid + ".messageFormatAuto", messageFormatAuto);
+ editor.putBoolean(accountUuid + ".messageReadReceipt", messageReadReceipt);
+ editor.putString(accountUuid + ".quoteStyle", quoteStyle.name());
+ editor.putString(accountUuid + ".quotePrefix", quotePrefix);
+ editor.putBoolean(accountUuid + ".defaultQuotedTextShown", defaultQuotedTextShown);
+ editor.putBoolean(accountUuid + ".replyAfterQuote", replyAfterQuote);
+ editor.putBoolean(accountUuid + ".stripSignature", stripSignature);
+ editor.putLong(accountUuid + ".cryptoKey", pgpCryptoKey);
+ editor.putBoolean(accountUuid + ".allowRemoteSearch", allowRemoteSearch);
+ editor.putBoolean(accountUuid + ".remoteSearchFullText", remoteSearchFullText);
+ editor.putInt(accountUuid + ".remoteSearchNumResults", remoteSearchNumResults);
+ editor.putBoolean(accountUuid + ".enabled", isEnabled);
+ editor.putBoolean(accountUuid + ".markMessageAsReadOnView", markMessageAsReadOnView);
+ editor.putBoolean(accountUuid + ".alwaysShowCcBcc", alwaysShowCcBcc);
- editor.putBoolean(mUuid + ".vibrate", mNotificationSetting.shouldVibrate());
- editor.putInt(mUuid + ".vibratePattern", mNotificationSetting.getVibratePattern());
- editor.putInt(mUuid + ".vibrateTimes", mNotificationSetting.getVibrateTimes());
- editor.putBoolean(mUuid + ".ring", mNotificationSetting.shouldRing());
- editor.putString(mUuid + ".ringtone", mNotificationSetting.getRingtone());
- editor.putBoolean(mUuid + ".led", mNotificationSetting.isLed());
- editor.putInt(mUuid + ".ledColor", mNotificationSetting.getLedColor());
+ editor.putBoolean(accountUuid + ".vibrate", notificationSetting.shouldVibrate());
+ editor.putInt(accountUuid + ".vibratePattern", notificationSetting.getVibratePattern());
+ editor.putInt(accountUuid + ".vibrateTimes", notificationSetting.getVibrateTimes());
+ editor.putBoolean(accountUuid + ".ring", notificationSetting.shouldRing());
+ editor.putString(accountUuid + ".ringtone", notificationSetting.getRingtone());
+ editor.putBoolean(accountUuid + ".led", notificationSetting.isLed());
+ editor.putInt(accountUuid + ".ledColor", notificationSetting.getLedColor());
for (NetworkType type : NetworkType.values()) {
Boolean useCompression = compressionMap.get(type);
if (useCompression != null) {
- editor.putBoolean(mUuid + ".useCompression." + type, useCompression);
+ editor.putBoolean(accountUuid + ".useCompression." + type, useCompression);
}
}
saveIdentities(preferences.getStorage(), editor);
@@ -822,19 +823,19 @@ public class Account implements BaseAccount, StoreConfig {
public synchronized void setChipColor(int color) {
- mChipColor = color;
+ chipColor = color;
cacheChips();
}
private synchronized void cacheChips() {
- mReadColorChip = new ColorChip(mChipColor, true, ColorChip.CIRCULAR);
- mUnreadColorChip = new ColorChip(mChipColor, false, ColorChip.CIRCULAR);
- mFlaggedReadColorChip = new ColorChip(mChipColor, true, ColorChip.STAR);
- mFlaggedUnreadColorChip = new ColorChip(mChipColor, false, ColorChip.STAR);
+ readColorChip = new ColorChip(chipColor, true, ColorChip.CIRCULAR);
+ unreadColorChip = new ColorChip(chipColor, false, ColorChip.CIRCULAR);
+ flaggedReadColorChip = new ColorChip(chipColor, true, ColorChip.STAR);
+ flaggedUnreadColorChip = new ColorChip(chipColor, false, ColorChip.STAR);
}
public synchronized int getChipColor() {
- return mChipColor;
+ return chipColor;
}
@@ -843,15 +844,15 @@ public class Account implements BaseAccount, StoreConfig {
if (messageRead) {
if (messageFlagged) {
- chip = mFlaggedReadColorChip;
+ chip = flaggedReadColorChip;
} else {
- chip = mReadColorChip;
+ chip = readColorChip;
}
} else {
if (messageFlagged) {
- chip = mFlaggedUnreadColorChip;
+ chip = flaggedUnreadColorChip;
} else {
- chip = mUnreadColorChip;
+ chip = unreadColorChip;
}
}
@@ -860,33 +861,33 @@ public class Account implements BaseAccount, StoreConfig {
@Override
public String getUuid() {
- return mUuid;
+ return accountUuid;
}
public synchronized String getStoreUri() {
- return mStoreUri;
+ return storeUri;
}
public synchronized void setStoreUri(String storeUri) {
- this.mStoreUri = storeUri;
+ this.storeUri = storeUri;
}
public synchronized String getTransportUri() {
- return mTransportUri;
+ return transportUri;
}
public synchronized void setTransportUri(String transportUri) {
- this.mTransportUri = transportUri;
+ this.transportUri = transportUri;
}
@Override
public synchronized String getDescription() {
- return mDescription;
+ return description;
}
@Override
public synchronized void setDescription(String description) {
- this.mDescription = description;
+ this.description = description;
}
public synchronized String getName() {
@@ -924,36 +925,36 @@ public class Account implements BaseAccount, StoreConfig {
}
public synchronized String getAlwaysBcc() {
- return mAlwaysBcc;
+ return alwaysBcc;
}
public synchronized void setAlwaysBcc(String alwaysBcc) {
- this.mAlwaysBcc = alwaysBcc;
+ this.alwaysBcc = alwaysBcc;
}
/* Have we sent a new mail notification on this account */
public boolean isRingNotified() {
- return mRingNotified;
+ return ringNotified;
}
public void setRingNotified(boolean ringNotified) {
- mRingNotified = ringNotified;
+ this.ringNotified = ringNotified;
}
public String getLocalStorageProviderId() {
- return mLocalStorageProviderId;
+ return localStorageProviderId;
}
public void setLocalStorageProviderId(String id) {
- if (!mLocalStorageProviderId.equals(id)) {
+ if (!localStorageProviderId.equals(id)) {
boolean successful = false;
try {
switchLocalStorage(id);
successful = true;
} catch (MessagingException e) {
- Timber.e(e, "Switching local storage provider from %s to %s failed.", mLocalStorageProviderId, id);
+ Timber.e(e, "Switching local storage provider from %s to %s failed.", localStorageProviderId, id);
}
// if migration to/from SD-card failed once, it will fail again.
@@ -961,7 +962,7 @@ public class Account implements BaseAccount, StoreConfig {
return;
}
- mLocalStorageProviderId = id;
+ localStorageProviderId = id;
}
}
@@ -970,62 +971,62 @@ public class Account implements BaseAccount, StoreConfig {
* Returns -1 for never.
*/
public synchronized int getAutomaticCheckIntervalMinutes() {
- return mAutomaticCheckIntervalMinutes;
+ return automaticCheckIntervalMinutes;
}
/**
* @param automaticCheckIntervalMinutes or -1 for never.
*/
public synchronized boolean setAutomaticCheckIntervalMinutes(int automaticCheckIntervalMinutes) {
- int oldInterval = this.mAutomaticCheckIntervalMinutes;
- this.mAutomaticCheckIntervalMinutes = automaticCheckIntervalMinutes;
+ int oldInterval = this.automaticCheckIntervalMinutes;
+ this.automaticCheckIntervalMinutes = automaticCheckIntervalMinutes;
return (oldInterval != automaticCheckIntervalMinutes);
}
public synchronized int getDisplayCount() {
- return mDisplayCount;
+ return displayCount;
}
public synchronized void setDisplayCount(int displayCount) {
if (displayCount != -1) {
- this.mDisplayCount = displayCount;
+ this.displayCount = displayCount;
} else {
- this.mDisplayCount = K9.DEFAULT_VISIBLE_LIMIT;
+ this.displayCount = K9.DEFAULT_VISIBLE_LIMIT;
}
resetVisibleLimits();
}
public synchronized long getLatestOldMessageSeenTime() {
- return mLatestOldMessageSeenTime;
+ return latestOldMessageSeenTime;
}
public synchronized void setLatestOldMessageSeenTime(long latestOldMessageSeenTime) {
- this.mLatestOldMessageSeenTime = latestOldMessageSeenTime;
+ this.latestOldMessageSeenTime = latestOldMessageSeenTime;
}
public synchronized boolean isNotifyNewMail() {
- return mNotifyNewMail;
+ return notifyNewMail;
}
public synchronized void setNotifyNewMail(boolean notifyNewMail) {
- this.mNotifyNewMail = notifyNewMail;
+ this.notifyNewMail = notifyNewMail;
}
public synchronized FolderMode getFolderNotifyNewMailMode() {
- return mFolderNotifyNewMailMode;
+ return folderNotifyNewMailMode;
}
public synchronized void setFolderNotifyNewMailMode(FolderMode folderNotifyNewMailMode) {
- this.mFolderNotifyNewMailMode = folderNotifyNewMailMode;
+ this.folderNotifyNewMailMode = folderNotifyNewMailMode;
}
public synchronized DeletePolicy getDeletePolicy() {
- return mDeletePolicy;
+ return deletePolicy;
}
public synchronized void setDeletePolicy(DeletePolicy deletePolicy) {
- this.mDeletePolicy = deletePolicy;
+ this.deletePolicy = deletePolicy;
}
public boolean isSpecialFolder(String folderName) {
@@ -1040,11 +1041,11 @@ public class Account implements BaseAccount, StoreConfig {
}
public synchronized String getDraftsFolderName() {
- return mDraftsFolderName;
+ return draftsFolderName;
}
public synchronized void setDraftsFolderName(String name) {
- mDraftsFolderName = name;
+ draftsFolderName = name;
}
/**
@@ -1052,11 +1053,11 @@ public class Account implements BaseAccount, StoreConfig {
* @return true if account has a drafts folder set.
*/
public synchronized boolean hasDraftsFolder() {
- return !K9.FOLDER_NONE.equalsIgnoreCase(mDraftsFolderName);
+ return !K9.FOLDER_NONE.equalsIgnoreCase(draftsFolderName);
}
public synchronized String getSentFolderName() {
- return mSentFolderName;
+ return sentFolderName;
}
public synchronized String getErrorFolderName() {
@@ -1064,7 +1065,7 @@ public class Account implements BaseAccount, StoreConfig {
}
public synchronized void setSentFolderName(String name) {
- mSentFolderName = name;
+ sentFolderName = name;
}
/**
@@ -1072,16 +1073,16 @@ public class Account implements BaseAccount, StoreConfig {
* @return true if account has a sent folder set.
*/
public synchronized boolean hasSentFolder() {
- return !K9.FOLDER_NONE.equalsIgnoreCase(mSentFolderName);
+ return !K9.FOLDER_NONE.equalsIgnoreCase(sentFolderName);
}
public synchronized String getTrashFolderName() {
- return mTrashFolderName;
+ return trashFolderName;
}
public synchronized void setTrashFolderName(String name) {
- mTrashFolderName = name;
+ trashFolderName = name;
}
/**
@@ -1089,15 +1090,15 @@ public class Account implements BaseAccount, StoreConfig {
* @return true if account has a trash folder set.
*/
public synchronized boolean hasTrashFolder() {
- return !K9.FOLDER_NONE.equalsIgnoreCase(mTrashFolderName);
+ return !K9.FOLDER_NONE.equalsIgnoreCase(trashFolderName);
}
public synchronized String getArchiveFolderName() {
- return mArchiveFolderName;
+ return archiveFolderName;
}
public synchronized void setArchiveFolderName(String archiveFolderName) {
- mArchiveFolderName = archiveFolderName;
+ this.archiveFolderName = archiveFolderName;
}
/**
@@ -1105,15 +1106,15 @@ public class Account implements BaseAccount, StoreConfig {
* @return true if account has an archive folder set.
*/
public synchronized boolean hasArchiveFolder() {
- return !K9.FOLDER_NONE.equalsIgnoreCase(mArchiveFolderName);
+ return !K9.FOLDER_NONE.equalsIgnoreCase(archiveFolderName);
}
public synchronized String getSpamFolderName() {
- return mSpamFolderName;
+ return spamFolderName;
}
public synchronized void setSpamFolderName(String name) {
- mSpamFolderName = name;
+ spamFolderName = name;
}
/**
@@ -1121,7 +1122,7 @@ public class Account implements BaseAccount, StoreConfig {
* @return true if account has a spam folder set.
*/
public synchronized boolean hasSpamFolder() {
- return !K9.FOLDER_NONE.equalsIgnoreCase(mSpamFolderName);
+ return !K9.FOLDER_NONE.equalsIgnoreCase(spamFolderName);
}
public synchronized String getOutboxFolderName() {
@@ -1129,34 +1130,34 @@ public class Account implements BaseAccount, StoreConfig {
}
public synchronized String getAutoExpandFolderName() {
- return mAutoExpandFolderName;
+ return autoExpandFolderName;
}
public synchronized void setAutoExpandFolderName(String name) {
- mAutoExpandFolderName = name;
+ autoExpandFolderName = name;
}
public synchronized int getAccountNumber() {
- return mAccountNumber;
+ return accountNumber;
}
public synchronized FolderMode getFolderDisplayMode() {
- return mFolderDisplayMode;
+ return folderDisplayMode;
}
public synchronized boolean setFolderDisplayMode(FolderMode displayMode) {
- FolderMode oldDisplayMode = mFolderDisplayMode;
- mFolderDisplayMode = displayMode;
+ FolderMode oldDisplayMode = folderDisplayMode;
+ folderDisplayMode = displayMode;
return oldDisplayMode != displayMode;
}
public synchronized FolderMode getFolderSyncMode() {
- return mFolderSyncMode;
+ return folderSyncMode;
}
public synchronized boolean setFolderSyncMode(FolderMode syncMode) {
- FolderMode oldSyncMode = mFolderSyncMode;
- mFolderSyncMode = syncMode;
+ FolderMode oldSyncMode = folderSyncMode;
+ folderSyncMode = syncMode;
if (syncMode == FolderMode.NONE && oldSyncMode != FolderMode.NONE) {
return true;
@@ -1168,98 +1169,98 @@ public class Account implements BaseAccount, StoreConfig {
}
public synchronized FolderMode getFolderPushMode() {
- return mFolderPushMode;
+ return folderPushMode;
}
public synchronized boolean setFolderPushMode(FolderMode pushMode) {
- FolderMode oldPushMode = mFolderPushMode;
+ FolderMode oldPushMode = folderPushMode;
- mFolderPushMode = pushMode;
+ folderPushMode = pushMode;
return pushMode != oldPushMode;
}
public synchronized boolean isShowOngoing() {
- return mNotifySync;
+ return notifySync;
}
public synchronized void setShowOngoing(boolean showOngoing) {
- this.mNotifySync = showOngoing;
+ this.notifySync = showOngoing;
}
public synchronized SortType getSortType() {
- return mSortType;
+ return sortType;
}
public synchronized void setSortType(SortType sortType) {
- mSortType = sortType;
+ this.sortType = sortType;
}
public synchronized boolean isSortAscending(SortType sortType) {
- if (mSortAscending.get(sortType) == null) {
- mSortAscending.put(sortType, sortType.isDefaultAscending());
+ if (sortAscending.get(sortType) == null) {
+ sortAscending.put(sortType, sortType.isDefaultAscending());
}
- return mSortAscending.get(sortType);
+ return sortAscending.get(sortType);
}
public synchronized void setSortAscending(SortType sortType, boolean sortAscending) {
- mSortAscending.put(sortType, sortAscending);
+ this.sortAscending.put(sortType, sortAscending);
}
public synchronized ShowPictures getShowPictures() {
- return mShowPictures;
+ return showPictures;
}
public synchronized void setShowPictures(ShowPictures showPictures) {
- mShowPictures = showPictures;
+ this.showPictures = showPictures;
}
public synchronized FolderMode getFolderTargetMode() {
- return mFolderTargetMode;
+ return folderTargetMode;
}
public synchronized void setFolderTargetMode(FolderMode folderTargetMode) {
- mFolderTargetMode = folderTargetMode;
+ this.folderTargetMode = folderTargetMode;
}
public synchronized boolean isSignatureBeforeQuotedText() {
- return mIsSignatureBeforeQuotedText;
+ return isSignatureBeforeQuotedText;
}
public synchronized void setSignatureBeforeQuotedText(boolean mIsSignatureBeforeQuotedText) {
- this.mIsSignatureBeforeQuotedText = mIsSignatureBeforeQuotedText;
+ this.isSignatureBeforeQuotedText = mIsSignatureBeforeQuotedText;
}
public synchronized boolean isNotifySelfNewMail() {
- return mNotifySelfNewMail;
+ return notifySelfNewMail;
}
public synchronized void setNotifySelfNewMail(boolean notifySelfNewMail) {
- mNotifySelfNewMail = notifySelfNewMail;
+ this.notifySelfNewMail = notifySelfNewMail;
}
public synchronized boolean isNotifyContactsMailOnly() {
- return mNotifyContactsMailOnly;
+ return notifyContactsMailOnly;
}
public synchronized void setNotifyContactsMailOnly(boolean notifyContactsMailOnly) {
- this.mNotifyContactsMailOnly = notifyContactsMailOnly;
+ this.notifyContactsMailOnly = notifyContactsMailOnly;
}
public synchronized Expunge getExpungePolicy() {
- return mExpungePolicy;
+ return expungePolicy;
}
public synchronized void setExpungePolicy(Expunge expungePolicy) {
- mExpungePolicy = expungePolicy;
+ this.expungePolicy = expungePolicy;
}
public synchronized int getMaxPushFolders() {
- return mMaxPushFolders;
+ return maxPushFolders;
}
public synchronized boolean setMaxPushFolders(int maxPushFolders) {
- int oldMaxPushFolders = mMaxPushFolders;
- mMaxPushFolders = maxPushFolders;
+ int oldMaxPushFolders = this.maxPushFolders;
+ this.maxPushFolders = maxPushFolders;
return oldMaxPushFolders != maxPushFolders;
}
@@ -1281,7 +1282,7 @@ public class Account implements BaseAccount, StoreConfig {
@Override
public synchronized String toString() {
- return mDescription;
+ return description;
}
public synchronized void setCompression(NetworkType networkType, boolean useCompression) {
@@ -1300,14 +1301,14 @@ public class Account implements BaseAccount, StoreConfig {
@Override
public boolean equals(Object o) {
if (o instanceof Account) {
- return ((Account)o).mUuid.equals(mUuid);
+ return ((Account)o).accountUuid.equals(accountUuid);
}
return super.equals(o);
}
@Override
public int hashCode() {
- return mUuid.hashCode();
+ return accountUuid.hashCode();
}
private synchronized List loadIdentities(Storage storage) {
@@ -1316,12 +1317,12 @@ public class Account implements BaseAccount, StoreConfig {
boolean gotOne;
do {
gotOne = false;
- String name = storage.getString(mUuid + "." + IDENTITY_NAME_KEY + "." + ident, null);
- String email = storage.getString(mUuid + "." + IDENTITY_EMAIL_KEY + "." + ident, null);
- boolean signatureUse = storage.getBoolean(mUuid + ".signatureUse." + ident, true);
- String signature = storage.getString(mUuid + ".signature." + ident, null);
- String description = storage.getString(mUuid + "." + IDENTITY_DESCRIPTION_KEY + "." + ident, null);
- final String replyTo = storage.getString(mUuid + ".replyTo." + ident, null);
+ String name = storage.getString(accountUuid + "." + IDENTITY_NAME_KEY + "." + ident, null);
+ String email = storage.getString(accountUuid + "." + IDENTITY_EMAIL_KEY + "." + ident, null);
+ boolean signatureUse = storage.getBoolean(accountUuid + ".signatureUse." + ident, true);
+ String signature = storage.getString(accountUuid + ".signature." + ident, null);
+ String description = storage.getString(accountUuid + "." + IDENTITY_DESCRIPTION_KEY + "." + ident, null);
+ final String replyTo = storage.getString(accountUuid + ".replyTo." + ident, null);
if (email != null) {
Identity identity = new Identity();
identity.setName(name);
@@ -1337,10 +1338,10 @@ public class Account implements BaseAccount, StoreConfig {
} while (gotOne);
if (newIdentities.isEmpty()) {
- String name = storage.getString(mUuid + ".name", null);
- String email = storage.getString(mUuid + ".email", null);
- boolean signatureUse = storage.getBoolean(mUuid + ".signatureUse", true);
- String signature = storage.getString(mUuid + ".signature", null);
+ String name = storage.getString(accountUuid + ".name", null);
+ String email = storage.getString(accountUuid + ".email", null);
+ boolean signatureUse = storage.getBoolean(accountUuid + ".signatureUse", true);
+ String signature = storage.getString(accountUuid + ".signature", null);
Identity identity = new Identity();
identity.setName(name);
identity.setEmail(email);
@@ -1358,14 +1359,14 @@ public class Account implements BaseAccount, StoreConfig {
boolean gotOne;
do {
gotOne = false;
- String email = storage.getString(mUuid + "." + IDENTITY_EMAIL_KEY + "." + ident, null);
+ String email = storage.getString(accountUuid + "." + IDENTITY_EMAIL_KEY + "." + ident, null);
if (email != null) {
- editor.remove(mUuid + "." + IDENTITY_NAME_KEY + "." + ident);
- editor.remove(mUuid + "." + IDENTITY_EMAIL_KEY + "." + ident);
- editor.remove(mUuid + ".signatureUse." + ident);
- editor.remove(mUuid + ".signature." + ident);
- editor.remove(mUuid + "." + IDENTITY_DESCRIPTION_KEY + "." + ident);
- editor.remove(mUuid + ".replyTo." + ident);
+ editor.remove(accountUuid + "." + IDENTITY_NAME_KEY + "." + ident);
+ editor.remove(accountUuid + "." + IDENTITY_EMAIL_KEY + "." + ident);
+ editor.remove(accountUuid + ".signatureUse." + ident);
+ editor.remove(accountUuid + ".signature." + ident);
+ editor.remove(accountUuid + "." + IDENTITY_DESCRIPTION_KEY + "." + ident);
+ editor.remove(accountUuid + ".replyTo." + ident);
gotOne = true;
}
ident++;
@@ -1377,12 +1378,12 @@ public class Account implements BaseAccount, StoreConfig {
int ident = 0;
for (Identity identity : identities) {
- editor.putString(mUuid + "." + IDENTITY_NAME_KEY + "." + ident, identity.getName());
- editor.putString(mUuid + "." + IDENTITY_EMAIL_KEY + "." + ident, identity.getEmail());
- editor.putBoolean(mUuid + ".signatureUse." + ident, identity.getSignatureUse());
- editor.putString(mUuid + ".signature." + ident, identity.getSignature());
- editor.putString(mUuid + "." + IDENTITY_DESCRIPTION_KEY + "." + ident, identity.getDescription());
- editor.putString(mUuid + ".replyTo." + ident, identity.getReplyTo());
+ editor.putString(accountUuid + "." + IDENTITY_NAME_KEY + "." + ident, identity.getName());
+ editor.putString(accountUuid + "." + IDENTITY_EMAIL_KEY + "." + ident, identity.getEmail());
+ editor.putBoolean(accountUuid + ".signatureUse." + ident, identity.getSignatureUse());
+ editor.putString(accountUuid + ".signature." + ident, identity.getSignature());
+ editor.putString(accountUuid + "." + IDENTITY_DESCRIPTION_KEY + "." + ident, identity.getDescription());
+ editor.putString(accountUuid + ".replyTo." + ident, identity.getReplyTo());
ident++;
}
}
@@ -1438,33 +1439,33 @@ public class Account implements BaseAccount, StoreConfig {
}
public synchronized int getIdleRefreshMinutes() {
- return mIdleRefreshMinutes;
+ return idleRefreshMinutes;
}
public synchronized void setIdleRefreshMinutes(int idleRefreshMinutes) {
- mIdleRefreshMinutes = idleRefreshMinutes;
+ this.idleRefreshMinutes = idleRefreshMinutes;
}
public synchronized boolean isPushPollOnConnect() {
- return mPushPollOnConnect;
+ return pushPollOnConnect;
}
public synchronized void setPushPollOnConnect(boolean pushPollOnConnect) {
- mPushPollOnConnect = pushPollOnConnect;
+ this.pushPollOnConnect = pushPollOnConnect;
}
/**
* Are we storing out localStore on the SD-card instead of the local device
* memory?
* Only to be called during initial account-setup!
- * Side-effect: changes {@link #mLocalStorageProviderId}.
+ * Side-effect: changes {@link #localStorageProviderId}.
*
* @param newStorageProviderId
* Never null
.
* @throws MessagingException
*/
private void switchLocalStorage(final String newStorageProviderId) throws MessagingException {
- if (!mLocalStorageProviderId.equals(newStorageProviderId)) {
+ if (!localStorageProviderId.equals(newStorageProviderId)) {
getLocalStore().switchLocalStorage(newStorageProviderId);
}
}
@@ -1536,99 +1537,99 @@ public class Account implements BaseAccount, StoreConfig {
}
public MessageFormat getMessageFormat() {
- return mMessageFormat;
+ return messageFormat;
}
public void setMessageFormat(MessageFormat messageFormat) {
- this.mMessageFormat = messageFormat;
+ this.messageFormat = messageFormat;
}
public synchronized boolean isMessageReadReceiptAlways() {
- return mMessageReadReceipt;
+ return messageReadReceipt;
}
public synchronized void setMessageReadReceipt(boolean messageReadReceipt) {
- mMessageReadReceipt = messageReadReceipt;
+ this.messageReadReceipt = messageReadReceipt;
}
public QuoteStyle getQuoteStyle() {
- return mQuoteStyle;
+ return quoteStyle;
}
public void setQuoteStyle(QuoteStyle quoteStyle) {
- this.mQuoteStyle = quoteStyle;
+ this.quoteStyle = quoteStyle;
}
public synchronized String getQuotePrefix() {
- return mQuotePrefix;
+ return quotePrefix;
}
public synchronized void setQuotePrefix(String quotePrefix) {
- mQuotePrefix = quotePrefix;
+ this.quotePrefix = quotePrefix;
}
public synchronized boolean isDefaultQuotedTextShown() {
- return mDefaultQuotedTextShown;
+ return defaultQuotedTextShown;
}
public synchronized void setDefaultQuotedTextShown(boolean shown) {
- mDefaultQuotedTextShown = shown;
+ defaultQuotedTextShown = shown;
}
public synchronized boolean isReplyAfterQuote() {
- return mReplyAfterQuote;
+ return replyAfterQuote;
}
public synchronized void setReplyAfterQuote(boolean replyAfterQuote) {
- mReplyAfterQuote = replyAfterQuote;
+ this.replyAfterQuote = replyAfterQuote;
}
public synchronized boolean isStripSignature() {
- return mStripSignature;
+ return stripSignature;
}
public synchronized void setStripSignature(boolean stripSignature) {
- mStripSignature = stripSignature;
+ this.stripSignature = stripSignature;
}
public long getCryptoKey() {
- return mCryptoKey;
+ return pgpCryptoKey;
}
public void setCryptoKey(long keyId) {
- mCryptoKey = keyId;
+ pgpCryptoKey = keyId;
}
public boolean allowRemoteSearch() {
- return mAllowRemoteSearch;
+ return allowRemoteSearch;
}
public void setAllowRemoteSearch(boolean val) {
- mAllowRemoteSearch = val;
+ allowRemoteSearch = val;
}
public int getRemoteSearchNumResults() {
- return mRemoteSearchNumResults;
+ return remoteSearchNumResults;
}
public void setRemoteSearchNumResults(int val) {
- mRemoteSearchNumResults = (val >= 0 ? val : 0);
+ remoteSearchNumResults = (val >= 0 ? val : 0);
}
public String getInboxFolderName() {
- return mInboxFolderName;
+ return inboxFolderName;
}
public void setInboxFolderName(String name) {
- this.mInboxFolderName = name;
+ this.inboxFolderName = name;
}
public synchronized boolean syncRemoteDeletions() {
- return mSyncRemoteDeletions;
+ return syncRemoteDeletions;
}
public synchronized void setSyncRemoteDeletions(boolean syncRemoteDeletions) {
- mSyncRemoteDeletions = syncRemoteDeletions;
+ this.syncRemoteDeletions = syncRemoteDeletions;
}
public synchronized String getLastSelectedFolderName() {
@@ -1640,7 +1641,7 @@ public class Account implements BaseAccount, StoreConfig {
}
public synchronized NotificationSetting getNotificationSetting() {
- return mNotificationSetting;
+ return notificationSetting;
}
/**
@@ -1654,35 +1655,35 @@ public class Account implements BaseAccount, StoreConfig {
}
public synchronized boolean isEnabled() {
- return mEnabled;
+ return isEnabled;
}
public synchronized void setEnabled(boolean enabled) {
- mEnabled = enabled;
+ isEnabled = enabled;
}
public synchronized boolean isMarkMessageAsReadOnView() {
- return mMarkMessageAsReadOnView;
+ return markMessageAsReadOnView;
}
public synchronized void setMarkMessageAsReadOnView(boolean value) {
- mMarkMessageAsReadOnView = value;
+ markMessageAsReadOnView = value;
}
public synchronized boolean isAlwaysShowCcBcc() {
- return mAlwaysShowCcBcc;
+ return alwaysShowCcBcc;
}
public synchronized void setAlwaysShowCcBcc(boolean show) {
- mAlwaysShowCcBcc = show;
+ alwaysShowCcBcc = show;
}
public boolean isRemoteSearchFullText() {
return false; // Temporarily disabled
- //return mRemoteSearchFullText;
+ //return remoteSearchFullText;
}
public void setRemoteSearchFullText(boolean val) {
- mRemoteSearchFullText = val;
+ remoteSearchFullText = val;
}
/**
From dd5a0cce9825375a50bbe2ea26ae05554ec35642 Mon Sep 17 00:00:00 2001
From: Vincent Breitmoser
Date: Mon, 27 Mar 2017 11:22:53 +0200
Subject: [PATCH 2/6] rename some more fields and reduce comment spam
---
.../main/java/com/fsck/k9/BaseAccount.java | 10 +--
.../com/fsck/k9/EmailAddressValidator.java | 2 +-
.../src/main/java/com/fsck/k9/FontSizes.java | 81 -------------------
.../src/main/java/com/fsck/k9/Identity.java | 34 ++++----
4 files changed, 24 insertions(+), 103 deletions(-)
diff --git a/k9mail/src/main/java/com/fsck/k9/BaseAccount.java b/k9mail/src/main/java/com/fsck/k9/BaseAccount.java
index 2d6b643eb..f663ee5ad 100644
--- a/k9mail/src/main/java/com/fsck/k9/BaseAccount.java
+++ b/k9mail/src/main/java/com/fsck/k9/BaseAccount.java
@@ -1,9 +1,9 @@
package com.fsck.k9;
public interface BaseAccount {
- public String getEmail();
- public void setEmail(String email);
- public String getDescription();
- public void setDescription(String description);
- public String getUuid();
+ String getEmail();
+ void setEmail(String email);
+ String getDescription();
+ void setDescription(String description);
+ String getUuid();
}
diff --git a/k9mail/src/main/java/com/fsck/k9/EmailAddressValidator.java b/k9mail/src/main/java/com/fsck/k9/EmailAddressValidator.java
index 211d99220..3c98f7aaa 100644
--- a/k9mail/src/main/java/com/fsck/k9/EmailAddressValidator.java
+++ b/k9mail/src/main/java/com/fsck/k9/EmailAddressValidator.java
@@ -8,7 +8,7 @@ import java.util.regex.Pattern;
public class EmailAddressValidator implements Validator {
private static final Pattern EMAIL_ADDRESS_PATTERN = Pattern.compile(
- "[a-zA-Z0-9\\+\\.\\_\\%\\-\\+]{1,256}" +
+ "[a-zA-Z0-9\\+\\.\\_\\%\\-]{1,256}" +
"\\@" +
"[a-zA-Z0-9][a-zA-Z0-9\\-]{0,64}" +
"(" +
diff --git a/k9mail/src/main/java/com/fsck/k9/FontSizes.java b/k9mail/src/main/java/com/fsck/k9/FontSizes.java
index 189665f02..810e8f30f 100644
--- a/k9mail/src/main/java/com/fsck/k9/FontSizes.java
+++ b/k9mail/src/main/java/com/fsck/k9/FontSizes.java
@@ -13,9 +13,6 @@ import com.fsck.k9.preferences.StorageEditor;
* list, message list and in the message view.
*/
public class FontSizes {
- /*
- * Keys for the preference storage.
- */
private static final String ACCOUNT_NAME = "fontSizeAccountName";
private static final String ACCOUNT_DESCRIPTION = "fontSizeAccountDescription";
private static final String FOLDER_NAME = "fontSizeFolderName";
@@ -34,9 +31,6 @@ public class FontSizes {
private static final String MESSAGE_VIEW_CONTENT_PERCENT = "fontSizeMessageViewContentPercent";
private static final String MESSAGE_COMPOSE_INPUT = "fontSizeMessageComposeInput";
- /*
- * Values for the font sizes in SP (Scale-independent Pixels)
- */
public static final int FONT_DEFAULT = -1; // Don't force-reset the size of this setting
public static final int FONT_10SP = 10;
public static final int FONT_12SP = 12;
@@ -47,90 +41,25 @@ public class FontSizes {
public static final int LARGE = 22; // ?android:attr/textAppearanceLarge
- /**
- * Font size of account names in the account list activity.
- */
private int accountName;
-
- /**
- * Font size of account descriptions in the account list activity.
- */
private int accountDescription;
-
- /**
- * Font size of folder names in the folder list activity.
- */
private int folderName;
-
- /**
- * Font size of the folder status in the folder list activity.
- */
private int folderStatus;
- /**
- * Font size of message subjects in the message list activity.
- */
private int messageListSubject;
-
- /**
- * Font size of message senders in the message list activity.
- */
private int messageListSender;
-
- /**
- * Font size of message dates in the message list activity.
- */
private int messageListDate;
-
- /**
- * Font size of message preview in the message list activity.
- */
private int messageListPreview;
-
- /**
- * Font size of the message sender in the message view activity.
- */
private int messageViewSender;
-
- /**
- * Font size of the message receiver(s) (To) in the message view activity.
- */
private int messageViewTo;
-
- /**
- * Font size of the message receiver(s) (CC) in the message view activity.
- */
private int messageViewCC;
-
- /**
- * Font size of additional headers in the message view activity.
- */
private int messageViewAdditionalHeaders;
-
- /**
- * Font size of the message subject in the message view activity.
- */
private int messageViewSubject;
-
- /**
- * Font size of the message date and time in the message view activity.
- */
private int messageViewDate;
-
- /**
- * Font size of the message content in the message view activity, as percent from default size.
- */
private int messageViewContentPercent;
-
- /**
- * Font size for the input fields in the message compose activity.
- */
private int messageComposeInput;
- /**
- * Create a FontSizes
object with default values.
- */
public FontSizes() {
accountName = FONT_DEFAULT;
accountDescription = FONT_DEFAULT;
@@ -154,11 +83,6 @@ public class FontSizes {
messageComposeInput = MEDIUM;
}
- /**
- * Permanently save the font size settings.
- *
- * @param editor Used to save the font size settings.
- */
public void save(StorageEditor editor) {
editor.putInt(ACCOUNT_NAME, accountName);
editor.putInt(ACCOUNT_DESCRIPTION, accountDescription);
@@ -182,11 +106,6 @@ public class FontSizes {
editor.putInt(MESSAGE_COMPOSE_INPUT, messageComposeInput);
}
- /**
- * Load the font size settings from permanent storage.
- *
- * @param storage Used to load the font size settings.
- */
public void load(Storage storage) {
accountName = storage.getInt(ACCOUNT_NAME, accountName);
accountDescription = storage.getInt(ACCOUNT_DESCRIPTION, accountDescription);
diff --git a/k9mail/src/main/java/com/fsck/k9/Identity.java b/k9mail/src/main/java/com/fsck/k9/Identity.java
index 1aead56d6..cdd7de67a 100644
--- a/k9mail/src/main/java/com/fsck/k9/Identity.java
+++ b/k9mail/src/main/java/com/fsck/k9/Identity.java
@@ -4,51 +4,52 @@ import java.io.Serializable;
public class Identity implements Serializable {
private static final long serialVersionUID = -1666669071480985760L;
- private String mDescription;
- private String mName;
- private String mEmail;
- private String mSignature;
- private boolean mSignatureUse;
+
+ private String description;
+ private String name;
+ private String email;
+ private String signature;
+ private boolean signatureUse;
private String replyTo;
public synchronized String getName() {
- return mName;
+ return name;
}
public synchronized void setName(String name) {
- mName = name;
+ this.name = name;
}
public synchronized String getEmail() {
- return mEmail;
+ return email;
}
public synchronized void setEmail(String email) {
- mEmail = email;
+ this.email = email;
}
public synchronized boolean getSignatureUse() {
- return mSignatureUse;
+ return signatureUse;
}
public synchronized void setSignatureUse(boolean signatureUse) {
- mSignatureUse = signatureUse;
+ this.signatureUse = signatureUse;
}
public synchronized String getSignature() {
- return mSignature;
+ return signature;
}
public synchronized void setSignature(String signature) {
- mSignature = signature;
+ this.signature = signature;
}
public synchronized String getDescription() {
- return mDescription;
+ return description;
}
public synchronized void setDescription(String description) {
- mDescription = description;
+ this.description = description;
}
public synchronized String getReplyTo() {
@@ -61,6 +62,7 @@ public class Identity implements Serializable {
@Override
public synchronized String toString() {
- return "Account.Identity(description=" + mDescription + ", name=" + mName + ", email=" + mEmail + ", replyTo=" + replyTo + ", signature=" + mSignature;
+ return "Account.Identity(description=" + description + ", name=" + name + ", email=" + email + ", replyTo=" + replyTo + ", signature=" +
+ signature;
}
}
From 3bb3a5bdbdffbc0e3d38647e417283d6375673d1 Mon Sep 17 00:00:00 2001
From: Vincent Breitmoser
Date: Mon, 27 Mar 2017 11:25:48 +0200
Subject: [PATCH 3/6] clean up NotificationSetting
---
k9mail/src/main/java/com/fsck/k9/Account.java | 10 +--
.../java/com/fsck/k9/NotificationSetting.java | 70 +++++++------------
.../k9/activity/setup/AccountSettings.java | 10 +--
.../k9/notification/DeviceNotifications.java | 6 +-
.../fsck/k9/service/RemoteControlService.java | 2 +-
5 files changed, 41 insertions(+), 57 deletions(-)
diff --git a/k9mail/src/main/java/com/fsck/k9/Account.java b/k9mail/src/main/java/com/fsck/k9/Account.java
index 33a465a5c..af08d31fd 100644
--- a/k9mail/src/main/java/com/fsck/k9/Account.java
+++ b/k9mail/src/main/java/com/fsck/k9/Account.java
@@ -336,7 +336,7 @@ public class Account implements BaseAccount, StoreConfig {
notificationSetting.setVibrate(false);
notificationSetting.setVibratePattern(0);
notificationSetting.setVibrateTimes(5);
- notificationSetting.setRing(true);
+ notificationSetting.setRingEnabled(true);
notificationSetting.setRingtone("content://settings/system/notification_sound");
notificationSetting.setLedColor(chipColor);
@@ -444,7 +444,7 @@ public class Account implements BaseAccount, StoreConfig {
notificationSetting.setVibrate(storage.getBoolean(accountUuid + ".vibrate", false));
notificationSetting.setVibratePattern(storage.getInt(accountUuid + ".vibratePattern", 0));
notificationSetting.setVibrateTimes(storage.getInt(accountUuid + ".vibrateTimes", 5));
- notificationSetting.setRing(storage.getBoolean(accountUuid + ".ring", true));
+ notificationSetting.setRingEnabled(storage.getBoolean(accountUuid + ".ring", true));
notificationSetting.setRingtone(storage.getString(accountUuid + ".ringtone",
"content://settings/system/notification_sound"));
notificationSetting.setLed(storage.getBoolean(accountUuid + ".led", true));
@@ -737,12 +737,12 @@ public class Account implements BaseAccount, StoreConfig {
editor.putBoolean(accountUuid + ".markMessageAsReadOnView", markMessageAsReadOnView);
editor.putBoolean(accountUuid + ".alwaysShowCcBcc", alwaysShowCcBcc);
- editor.putBoolean(accountUuid + ".vibrate", notificationSetting.shouldVibrate());
+ editor.putBoolean(accountUuid + ".vibrate", notificationSetting.isVibrateEnabled());
editor.putInt(accountUuid + ".vibratePattern", notificationSetting.getVibratePattern());
editor.putInt(accountUuid + ".vibrateTimes", notificationSetting.getVibrateTimes());
- editor.putBoolean(accountUuid + ".ring", notificationSetting.shouldRing());
+ editor.putBoolean(accountUuid + ".ring", notificationSetting.isRingEnabled());
editor.putString(accountUuid + ".ringtone", notificationSetting.getRingtone());
- editor.putBoolean(accountUuid + ".led", notificationSetting.isLed());
+ editor.putBoolean(accountUuid + ".led", notificationSetting.isLedEnabled());
editor.putInt(accountUuid + ".ledColor", notificationSetting.getLedColor());
for (NetworkType type : NetworkType.values()) {
diff --git a/k9mail/src/main/java/com/fsck/k9/NotificationSetting.java b/k9mail/src/main/java/com/fsck/k9/NotificationSetting.java
index 6885ae1d3..da26424db 100644
--- a/k9mail/src/main/java/com/fsck/k9/NotificationSetting.java
+++ b/k9mail/src/main/java/com/fsck/k9/NotificationSetting.java
@@ -4,97 +4,83 @@ package com.fsck.k9;
* Describes how a notification should behave.
*/
public class NotificationSetting {
+ private boolean ringEnabled;
+ private String ringtoneUri;
- /**
- * Ring notification kill switch. Allow disabling ringtones without losing
- * ringtone selection.
- */
- private boolean mRing;
+ private boolean ledEnabled;
+ private int ledColor;
- private String mRingtoneUri;
+ private boolean vibrateEnabled;
- /**
- * LED kill switch.
- */
- private boolean mLed;
-
- private int mLedColor;
-
- /**
- * Vibration kill switch.
- */
- private boolean mVibrate;
-
- private int mVibratePattern;
-
- private int mVibrateTimes;
+ private int vibratePattern;
+ private int vibrateTimes;
/**
* Set the ringtone kill switch. Allow to disable ringtone without losing
* ringtone selection.
*
- * @param ring
+ * @param ringEnabled
* true
to allow ringtones, false
* otherwise.
*/
- public synchronized void setRing(boolean ring) {
- mRing = ring;
+ public synchronized void setRingEnabled(boolean ringEnabled) {
+ this.ringEnabled = ringEnabled;
}
/**
* @return true
if ringtone is allowed to play,
* false
otherwise.
*/
- public synchronized boolean shouldRing() {
- return mRing;
+ public synchronized boolean isRingEnabled() {
+ return ringEnabled;
}
public synchronized String getRingtone() {
- return mRingtoneUri;
+ return ringtoneUri;
}
public synchronized void setRingtone(String ringtoneUri) {
- mRingtoneUri = ringtoneUri;
+ this.ringtoneUri = ringtoneUri;
}
- public synchronized boolean isLed() {
- return mLed;
+ public synchronized boolean isLedEnabled() {
+ return ledEnabled;
}
public synchronized void setLed(final boolean led) {
- mLed = led;
+ ledEnabled = led;
}
public synchronized int getLedColor() {
- return mLedColor;
+ return ledColor;
}
public synchronized void setLedColor(int color) {
- mLedColor = color;
+ ledColor = color;
}
- public synchronized boolean shouldVibrate() {
- return mVibrate;
+ public synchronized boolean isVibrateEnabled() {
+ return vibrateEnabled;
}
public synchronized void setVibrate(boolean vibrate) {
- mVibrate = vibrate;
+ vibrateEnabled = vibrate;
}
public synchronized int getVibratePattern() {
- return mVibratePattern;
+ return vibratePattern;
}
public synchronized int getVibrateTimes() {
- return mVibrateTimes;
+ return vibrateTimes;
}
public synchronized void setVibratePattern(int pattern) {
- mVibratePattern = pattern;
+ vibratePattern = pattern;
}
public synchronized void setVibrateTimes(int times) {
- mVibrateTimes = times;
+ vibrateTimes = times;
}
@@ -108,7 +94,7 @@ public class NotificationSetting {
*/
public long[] getVibration() {
- return getVibration(mVibratePattern, mVibrateTimes);
+ return getVibration(vibratePattern, vibrateTimes);
}
public static long[] getVibration(int pattern, int times) {
@@ -149,6 +135,4 @@ public class NotificationSetting {
return repeatedPattern;
}
-
-
}
diff --git a/k9mail/src/main/java/com/fsck/k9/activity/setup/AccountSettings.java b/k9mail/src/main/java/com/fsck/k9/activity/setup/AccountSettings.java
index 30a570c0e..52f4fe9a0 100644
--- a/k9mail/src/main/java/com/fsck/k9/activity/setup/AccountSettings.java
+++ b/k9mail/src/main/java/com/fsck/k9/activity/setup/AccountSettings.java
@@ -602,11 +602,11 @@ public class AccountSettings extends K9PreferenceActivity {
// XXX: The following two lines act as a workaround for the RingtonePreference
// which does not let us set/get the value programmatically
SharedPreferences prefs = mAccountRingtone.getPreferenceManager().getSharedPreferences();
- String currentRingtone = (!mAccount.getNotificationSetting().shouldRing() ? null : mAccount.getNotificationSetting().getRingtone());
+ String currentRingtone = (!mAccount.getNotificationSetting().isRingEnabled() ? null : mAccount.getNotificationSetting().getRingtone());
prefs.edit().putString(PREFERENCE_RINGTONE, currentRingtone).commit();
mAccountVibrate = (CheckBoxPreference) findPreference(PREFERENCE_VIBRATE);
- mAccountVibrate.setChecked(mAccount.getNotificationSetting().shouldVibrate());
+ mAccountVibrate.setChecked(mAccount.getNotificationSetting().isVibrateEnabled());
mAccountVibratePattern = (ListPreference) findPreference(PREFERENCE_VIBRATE_PATTERN);
mAccountVibratePattern.setValue(String.valueOf(mAccount.getNotificationSetting().getVibratePattern()));
@@ -637,7 +637,7 @@ public class AccountSettings extends K9PreferenceActivity {
});
mAccountLed = (CheckBoxPreference) findPreference(PREFERENCE_NOTIFICATION_LED);
- mAccountLed.setChecked(mAccount.getNotificationSetting().isLed());
+ mAccountLed.setChecked(mAccount.getNotificationSetting().isLedEnabled());
mNotificationOpensUnread = (CheckBoxPreference)findPreference(PREFERENCE_NOTIFICATION_OPENS_UNREAD);
mNotificationOpensUnread.setChecked(mAccount.goToUnreadMessageSearch());
@@ -825,10 +825,10 @@ public class AccountSettings extends K9PreferenceActivity {
SharedPreferences prefs = mAccountRingtone.getPreferenceManager().getSharedPreferences();
String newRingtone = prefs.getString(PREFERENCE_RINGTONE, null);
if (newRingtone != null) {
- mAccount.getNotificationSetting().setRing(true);
+ mAccount.getNotificationSetting().setRingEnabled(true);
mAccount.getNotificationSetting().setRingtone(newRingtone);
} else {
- if (mAccount.getNotificationSetting().shouldRing()) {
+ if (mAccount.getNotificationSetting().isRingEnabled()) {
mAccount.getNotificationSetting().setRingtone(null);
}
}
diff --git a/k9mail/src/main/java/com/fsck/k9/notification/DeviceNotifications.java b/k9mail/src/main/java/com/fsck/k9/notification/DeviceNotifications.java
index 0934878c7..599dbb254 100644
--- a/k9mail/src/main/java/com/fsck/k9/notification/DeviceNotifications.java
+++ b/k9mail/src/main/java/com/fsck/k9/notification/DeviceNotifications.java
@@ -76,9 +76,9 @@ class DeviceNotifications extends BaseNotifications {
NotificationSetting notificationSetting = account.getNotificationSetting();
controller.configureNotification(
builder,
- (notificationSetting.shouldRing()) ? notificationSetting.getRingtone() : null,
- (notificationSetting.shouldVibrate()) ? notificationSetting.getVibration() : null,
- (notificationSetting.isLed()) ? notificationSetting.getLedColor() : null,
+ (notificationSetting.isRingEnabled()) ? notificationSetting.getRingtone() : null,
+ (notificationSetting.isVibrateEnabled()) ? notificationSetting.getVibration() : null,
+ (notificationSetting.isLedEnabled()) ? notificationSetting.getLedColor() : null,
NOTIFICATION_LED_BLINK_SLOW,
ringAndVibrate);
diff --git a/k9mail/src/main/java/com/fsck/k9/service/RemoteControlService.java b/k9mail/src/main/java/com/fsck/k9/service/RemoteControlService.java
index 8d57aaf4d..117cce6c0 100644
--- a/k9mail/src/main/java/com/fsck/k9/service/RemoteControlService.java
+++ b/k9mail/src/main/java/com/fsck/k9/service/RemoteControlService.java
@@ -82,7 +82,7 @@ public class RemoteControlService extends CoreService {
account.setNotifyNewMail(Boolean.parseBoolean(notificationEnabled));
}
if (ringEnabled != null) {
- account.getNotificationSetting().setRing(Boolean.parseBoolean(ringEnabled));
+ account.getNotificationSetting().setRingEnabled(Boolean.parseBoolean(ringEnabled));
}
if (vibrateEnabled != null) {
account.getNotificationSetting().setVibrate(Boolean.parseBoolean(vibrateEnabled));
From f67a5f53a6657b98a9bed06a8ff33ac8f3620192 Mon Sep 17 00:00:00 2001
From: Vincent Breitmoser
Date: Mon, 27 Mar 2017 11:31:57 +0200
Subject: [PATCH 4/6] clean up AccountSettings
---
.../k9/activity/setup/AccountSettings.java | 811 +++++++++---------
1 file changed, 406 insertions(+), 405 deletions(-)
diff --git a/k9mail/src/main/java/com/fsck/k9/activity/setup/AccountSettings.java b/k9mail/src/main/java/com/fsck/k9/activity/setup/AccountSettings.java
index 52f4fe9a0..c9a417e4e 100644
--- a/k9mail/src/main/java/com/fsck/k9/activity/setup/AccountSettings.java
+++ b/k9mail/src/main/java/com/fsck/k9/activity/setup/AccountSettings.java
@@ -22,7 +22,6 @@ import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceScreen;
import android.preference.RingtonePreference;
-import timber.log.Timber;
import android.widget.Toast;
import com.fsck.k9.Account;
@@ -45,10 +44,10 @@ import com.fsck.k9.activity.ManageIdentities;
import com.fsck.k9.crypto.OpenPgpApiHelper;
import com.fsck.k9.mail.Folder;
import com.fsck.k9.mail.Store;
-import com.fsck.k9.mailstore.LocalFolder;
import com.fsck.k9.mailstore.StorageManager;
import com.fsck.k9.service.MailService;
import org.openintents.openpgp.util.OpenPgpKeyPreference;
+import timber.log.Timber;
public class AccountSettings extends K9PreferenceActivity {
@@ -127,76 +126,77 @@ public class AccountSettings extends K9PreferenceActivity {
private static final String PREFERENCE_ALWAYS_SHOW_CC_BCC = "always_show_cc_bcc";
- private Account mAccount;
- private boolean mIsMoveCapable = false;
- private boolean mIsPushCapable = false;
- private boolean mIsExpungeCapable = false;
- private boolean mIsSeenFlagSupported = false;
+ private Account account;
+ private boolean isMoveCapable = false;
+ private boolean isPushCapable = false;
+ private boolean isExpungeCapable = false;
+ private boolean isSeenFlagSupported = false;
- private PreferenceScreen mMainScreen;
- private PreferenceScreen mComposingScreen;
+ private PreferenceScreen mainScreen;
+ private PreferenceScreen composingScreen;
- private EditTextPreference mAccountDescription;
- private CheckBoxPreference mMarkMessageAsReadOnView;
- private ListPreference mCheckFrequency;
- private ListPreference mDisplayCount;
- private ListPreference mMessageAge;
- private ListPreference mMessageSize;
- private CheckBoxPreference mAccountDefault;
- private CheckBoxPreference mAccountNotify;
- private ListPreference mAccountNotifyNewMailMode;
- private CheckBoxPreference mAccountNotifySelf;
- private CheckBoxPreference mAccountNotifyContactsMailOnly;
- private ListPreference mAccountShowPictures;
- private CheckBoxPreference mAccountNotifySync;
- private CheckBoxPreference mAccountVibrate;
- private CheckBoxPreference mAccountLed;
- private ListPreference mAccountVibratePattern;
- private ListPreference mAccountVibrateTimes;
- private RingtonePreference mAccountRingtone;
- private ListPreference mDisplayMode;
- private ListPreference mSyncMode;
- private ListPreference mPushMode;
- private ListPreference mTargetMode;
- private ListPreference mDeletePolicy;
- private ListPreference mExpungePolicy;
- private ListPreference mSearchableFolders;
- private ListPreference mAutoExpandFolder;
- private Preference mChipColor;
- private Preference mLedColor;
- private boolean mIncomingChanged = false;
- private CheckBoxPreference mNotificationOpensUnread;
- private ListPreference mMessageFormat;
- private CheckBoxPreference mMessageReadReceipt;
- private ListPreference mQuoteStyle;
- private EditTextPreference mAccountQuotePrefix;
- private CheckBoxPreference mAccountDefaultQuotedTextShown;
- private CheckBoxPreference mReplyAfterQuote;
- private CheckBoxPreference mStripSignature;
- private CheckBoxPreference mSyncRemoteDeletions;
- private CheckBoxPreference mPushPollOnConnect;
- private ListPreference mIdleRefreshPeriod;
+ private EditTextPreference accountDescription;
+ private CheckBoxPreference markMessageAsReadOnView;
+ private ListPreference checkFrequency;
+ private ListPreference displayCount;
+ private ListPreference messageAge;
+ private ListPreference messageSize;
+ private CheckBoxPreference accountDefault;
+ private CheckBoxPreference accountNotify;
+ private ListPreference accountNotifyNewMailMode;
+ private CheckBoxPreference accountNotifySelf;
+ private CheckBoxPreference accountNotifyContactsMailOnly;
+ private ListPreference accountShowPictures;
+ private CheckBoxPreference accountNotifySync;
+ private CheckBoxPreference accountVibrateEnabled;
+ private CheckBoxPreference accountLedEnabled;
+ private ListPreference accountVibratePattern;
+ private ListPreference accountVibrateTimes;
+ private RingtonePreference accountRingtone;
+ private ListPreference displayMode;
+ private ListPreference syncMode;
+ private ListPreference pushMode;
+ private ListPreference targetMode;
+ private ListPreference deletePolicy;
+ private ListPreference expungePolicy;
+ private ListPreference searchableFolders;
+ private ListPreference autoExpandFolder;
+ private Preference chipColor;
+ private Preference ledColor;
+ private boolean incomingChanged = false;
+ private CheckBoxPreference notificationOpensUnread;
+ private ListPreference messageFormat;
+ private CheckBoxPreference messageReadReceipt;
+ private ListPreference quoteStyle;
+ private EditTextPreference accountQuotePrefix;
+ private CheckBoxPreference accountDefaultQuotedTextShown;
+ private CheckBoxPreference replyAfterQuote;
+ private CheckBoxPreference stripSignature;
+ private CheckBoxPreference syncRemoteDeletions;
+ private CheckBoxPreference pushPollOnConnect;
+ private ListPreference idleRefreshPeriod;
private ListPreference mMaxPushFolders;
- private boolean mHasCrypto = false;
- private OpenPgpKeyPreference mCryptoKey;
- private CheckBoxPreference mCryptoSupportSignOnly;
+ private boolean hasPgpCrypto = false;
+ private OpenPgpKeyPreference pgpCryptoKey;
+ private CheckBoxPreference pgpSupportSignOnly;
+
+ private PreferenceScreen searchScreen;
+ private CheckBoxPreference cloudSearchEnabled;
+ private ListPreference remoteSearchNumResults;
- private PreferenceScreen mSearchScreen;
- private CheckBoxPreference mCloudSearchEnabled;
- private ListPreference mRemoteSearchNumResults;
/*
* Temporarily removed because search results aren't displayed to the user.
* So this feature is useless.
*/
//private CheckBoxPreference mRemoteSearchFullText;
- private ListPreference mLocalStorageProvider;
- private ListPreference mArchiveFolder;
- private ListPreference mDraftsFolder;
- private ListPreference mSentFolder;
- private ListPreference mSpamFolder;
- private ListPreference mTrashFolder;
- private CheckBoxPreference mAlwaysShowCcBcc;
+ private ListPreference localStorageProvider;
+ private ListPreference archiveFolder;
+ private ListPreference draftsFolder;
+ private ListPreference sentFolder;
+ private ListPreference spamFolder;
+ private ListPreference trashFolder;
+ private CheckBoxPreference alwaysShowCcBcc;
public static void actionSettings(Context context, Account account) {
@@ -210,274 +210,274 @@ public class AccountSettings extends K9PreferenceActivity {
super.onCreate(savedInstanceState);
String accountUuid = getIntent().getStringExtra(EXTRA_ACCOUNT);
- mAccount = Preferences.getPreferences(this).getAccount(accountUuid);
+ account = Preferences.getPreferences(this).getAccount(accountUuid);
try {
- final Store store = mAccount.getRemoteStore();
- mIsMoveCapable = store.isMoveCapable();
- mIsPushCapable = store.isPushCapable();
- mIsExpungeCapable = store.isExpungeCapable();
- mIsSeenFlagSupported = store.isSeenFlagSupported();
+ final Store store = account.getRemoteStore();
+ isMoveCapable = store.isMoveCapable();
+ isPushCapable = store.isPushCapable();
+ isExpungeCapable = store.isExpungeCapable();
+ isSeenFlagSupported = store.isSeenFlagSupported();
} catch (Exception e) {
Timber.e(e, "Could not get remote store");
}
addPreferencesFromResource(R.xml.account_settings_preferences);
- mMainScreen = (PreferenceScreen) findPreference(PREFERENCE_SCREEN_MAIN);
+ mainScreen = (PreferenceScreen) findPreference(PREFERENCE_SCREEN_MAIN);
- mAccountDescription = (EditTextPreference) findPreference(PREFERENCE_DESCRIPTION);
- mAccountDescription.setSummary(mAccount.getDescription());
- mAccountDescription.setText(mAccount.getDescription());
- mAccountDescription.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
+ accountDescription = (EditTextPreference) findPreference(PREFERENCE_DESCRIPTION);
+ accountDescription.setSummary(account.getDescription());
+ accountDescription.setText(account.getDescription());
+ accountDescription.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue) {
final String summary = newValue.toString();
- mAccountDescription.setSummary(summary);
- mAccountDescription.setText(summary);
+ accountDescription.setSummary(summary);
+ accountDescription.setText(summary);
return false;
}
});
- mMarkMessageAsReadOnView = (CheckBoxPreference) findPreference(PREFERENCE_MARK_MESSAGE_AS_READ_ON_VIEW);
- mMarkMessageAsReadOnView.setChecked(mAccount.isMarkMessageAsReadOnView());
+ markMessageAsReadOnView = (CheckBoxPreference) findPreference(PREFERENCE_MARK_MESSAGE_AS_READ_ON_VIEW);
+ markMessageAsReadOnView.setChecked(account.isMarkMessageAsReadOnView());
- mMessageFormat = (ListPreference) findPreference(PREFERENCE_MESSAGE_FORMAT);
- mMessageFormat.setValue(mAccount.getMessageFormat().name());
- mMessageFormat.setSummary(mMessageFormat.getEntry());
- mMessageFormat.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
+ messageFormat = (ListPreference) findPreference(PREFERENCE_MESSAGE_FORMAT);
+ messageFormat.setValue(account.getMessageFormat().name());
+ messageFormat.setSummary(messageFormat.getEntry());
+ messageFormat.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue) {
final String summary = newValue.toString();
- int index = mMessageFormat.findIndexOfValue(summary);
- mMessageFormat.setSummary(mMessageFormat.getEntries()[index]);
- mMessageFormat.setValue(summary);
+ int index = messageFormat.findIndexOfValue(summary);
+ messageFormat.setSummary(messageFormat.getEntries()[index]);
+ messageFormat.setValue(summary);
return false;
}
});
- mAlwaysShowCcBcc = (CheckBoxPreference) findPreference(PREFERENCE_ALWAYS_SHOW_CC_BCC);
- mAlwaysShowCcBcc.setChecked(mAccount.isAlwaysShowCcBcc());
+ alwaysShowCcBcc = (CheckBoxPreference) findPreference(PREFERENCE_ALWAYS_SHOW_CC_BCC);
+ alwaysShowCcBcc.setChecked(account.isAlwaysShowCcBcc());
- mMessageReadReceipt = (CheckBoxPreference) findPreference(PREFERENCE_MESSAGE_READ_RECEIPT);
- mMessageReadReceipt.setChecked(mAccount.isMessageReadReceiptAlways());
+ messageReadReceipt = (CheckBoxPreference) findPreference(PREFERENCE_MESSAGE_READ_RECEIPT);
+ messageReadReceipt.setChecked(account.isMessageReadReceiptAlways());
- mAccountQuotePrefix = (EditTextPreference) findPreference(PREFERENCE_QUOTE_PREFIX);
- mAccountQuotePrefix.setSummary(mAccount.getQuotePrefix());
- mAccountQuotePrefix.setText(mAccount.getQuotePrefix());
- mAccountQuotePrefix.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
+ accountQuotePrefix = (EditTextPreference) findPreference(PREFERENCE_QUOTE_PREFIX);
+ accountQuotePrefix.setSummary(account.getQuotePrefix());
+ accountQuotePrefix.setText(account.getQuotePrefix());
+ accountQuotePrefix.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
final String value = newValue.toString();
- mAccountQuotePrefix.setSummary(value);
- mAccountQuotePrefix.setText(value);
+ accountQuotePrefix.setSummary(value);
+ accountQuotePrefix.setText(value);
return false;
}
});
- mAccountDefaultQuotedTextShown = (CheckBoxPreference) findPreference(PREFERENCE_DEFAULT_QUOTED_TEXT_SHOWN);
- mAccountDefaultQuotedTextShown.setChecked(mAccount.isDefaultQuotedTextShown());
+ accountDefaultQuotedTextShown = (CheckBoxPreference) findPreference(PREFERENCE_DEFAULT_QUOTED_TEXT_SHOWN);
+ accountDefaultQuotedTextShown.setChecked(account.isDefaultQuotedTextShown());
- mReplyAfterQuote = (CheckBoxPreference) findPreference(PREFERENCE_REPLY_AFTER_QUOTE);
- mReplyAfterQuote.setChecked(mAccount.isReplyAfterQuote());
+ replyAfterQuote = (CheckBoxPreference) findPreference(PREFERENCE_REPLY_AFTER_QUOTE);
+ replyAfterQuote.setChecked(account.isReplyAfterQuote());
- mStripSignature = (CheckBoxPreference) findPreference(PREFERENCE_STRIP_SIGNATURE);
- mStripSignature.setChecked(mAccount.isStripSignature());
+ stripSignature = (CheckBoxPreference) findPreference(PREFERENCE_STRIP_SIGNATURE);
+ stripSignature.setChecked(account.isStripSignature());
- mComposingScreen = (PreferenceScreen) findPreference(PREFERENCE_SCREEN_COMPOSING);
+ composingScreen = (PreferenceScreen) findPreference(PREFERENCE_SCREEN_COMPOSING);
Preference.OnPreferenceChangeListener quoteStyleListener = new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
final QuoteStyle style = QuoteStyle.valueOf(newValue.toString());
- int index = mQuoteStyle.findIndexOfValue(newValue.toString());
- mQuoteStyle.setSummary(mQuoteStyle.getEntries()[index]);
+ int index = quoteStyle.findIndexOfValue(newValue.toString());
+ quoteStyle.setSummary(quoteStyle.getEntries()[index]);
if (style == QuoteStyle.PREFIX) {
- mComposingScreen.addPreference(mAccountQuotePrefix);
- mComposingScreen.addPreference(mReplyAfterQuote);
+ composingScreen.addPreference(accountQuotePrefix);
+ composingScreen.addPreference(replyAfterQuote);
} else if (style == QuoteStyle.HEADER) {
- mComposingScreen.removePreference(mAccountQuotePrefix);
- mComposingScreen.removePreference(mReplyAfterQuote);
+ composingScreen.removePreference(accountQuotePrefix);
+ composingScreen.removePreference(replyAfterQuote);
}
return true;
}
};
- mQuoteStyle = (ListPreference) findPreference(PREFERENCE_QUOTE_STYLE);
- mQuoteStyle.setValue(mAccount.getQuoteStyle().name());
- mQuoteStyle.setSummary(mQuoteStyle.getEntry());
- mQuoteStyle.setOnPreferenceChangeListener(quoteStyleListener);
+ quoteStyle = (ListPreference) findPreference(PREFERENCE_QUOTE_STYLE);
+ quoteStyle.setValue(account.getQuoteStyle().name());
+ quoteStyle.setSummary(quoteStyle.getEntry());
+ quoteStyle.setOnPreferenceChangeListener(quoteStyleListener);
// Call the onPreferenceChange() handler on startup to update the Preference dialogue based
// upon the existing quote style setting.
- quoteStyleListener.onPreferenceChange(mQuoteStyle, mAccount.getQuoteStyle().name());
+ quoteStyleListener.onPreferenceChange(quoteStyle, account.getQuoteStyle().name());
- mCheckFrequency = (ListPreference) findPreference(PREFERENCE_FREQUENCY);
- mCheckFrequency.setValue(String.valueOf(mAccount.getAutomaticCheckIntervalMinutes()));
- mCheckFrequency.setSummary(mCheckFrequency.getEntry());
- mCheckFrequency.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
+ checkFrequency = (ListPreference) findPreference(PREFERENCE_FREQUENCY);
+ checkFrequency.setValue(String.valueOf(account.getAutomaticCheckIntervalMinutes()));
+ checkFrequency.setSummary(checkFrequency.getEntry());
+ checkFrequency.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue) {
final String summary = newValue.toString();
- int index = mCheckFrequency.findIndexOfValue(summary);
- mCheckFrequency.setSummary(mCheckFrequency.getEntries()[index]);
- mCheckFrequency.setValue(summary);
+ int index = checkFrequency.findIndexOfValue(summary);
+ checkFrequency.setSummary(checkFrequency.getEntries()[index]);
+ checkFrequency.setValue(summary);
return false;
}
});
- mDisplayMode = (ListPreference) findPreference(PREFERENCE_DISPLAY_MODE);
- mDisplayMode.setValue(mAccount.getFolderDisplayMode().name());
- mDisplayMode.setSummary(mDisplayMode.getEntry());
- mDisplayMode.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
+ displayMode = (ListPreference) findPreference(PREFERENCE_DISPLAY_MODE);
+ displayMode.setValue(account.getFolderDisplayMode().name());
+ displayMode.setSummary(displayMode.getEntry());
+ displayMode.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue) {
final String summary = newValue.toString();
- int index = mDisplayMode.findIndexOfValue(summary);
- mDisplayMode.setSummary(mDisplayMode.getEntries()[index]);
- mDisplayMode.setValue(summary);
+ int index = displayMode.findIndexOfValue(summary);
+ displayMode.setSummary(displayMode.getEntries()[index]);
+ displayMode.setValue(summary);
return false;
}
});
- mSyncMode = (ListPreference) findPreference(PREFERENCE_SYNC_MODE);
- mSyncMode.setValue(mAccount.getFolderSyncMode().name());
- mSyncMode.setSummary(mSyncMode.getEntry());
- mSyncMode.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
+ syncMode = (ListPreference) findPreference(PREFERENCE_SYNC_MODE);
+ syncMode.setValue(account.getFolderSyncMode().name());
+ syncMode.setSummary(syncMode.getEntry());
+ syncMode.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue) {
final String summary = newValue.toString();
- int index = mSyncMode.findIndexOfValue(summary);
- mSyncMode.setSummary(mSyncMode.getEntries()[index]);
- mSyncMode.setValue(summary);
+ int index = syncMode.findIndexOfValue(summary);
+ syncMode.setSummary(syncMode.getEntries()[index]);
+ syncMode.setValue(summary);
return false;
}
});
- mTargetMode = (ListPreference) findPreference(PREFERENCE_TARGET_MODE);
- mTargetMode.setValue(mAccount.getFolderTargetMode().name());
- mTargetMode.setSummary(mTargetMode.getEntry());
- mTargetMode.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
+ targetMode = (ListPreference) findPreference(PREFERENCE_TARGET_MODE);
+ targetMode.setValue(account.getFolderTargetMode().name());
+ targetMode.setSummary(targetMode.getEntry());
+ targetMode.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue) {
final String summary = newValue.toString();
- int index = mTargetMode.findIndexOfValue(summary);
- mTargetMode.setSummary(mTargetMode.getEntries()[index]);
- mTargetMode.setValue(summary);
+ int index = targetMode.findIndexOfValue(summary);
+ targetMode.setSummary(targetMode.getEntries()[index]);
+ targetMode.setValue(summary);
return false;
}
});
- mDeletePolicy = (ListPreference) findPreference(PREFERENCE_DELETE_POLICY);
- if (!mIsSeenFlagSupported) {
- removeListEntry(mDeletePolicy, DeletePolicy.MARK_AS_READ.preferenceString());
+ deletePolicy = (ListPreference) findPreference(PREFERENCE_DELETE_POLICY);
+ if (!isSeenFlagSupported) {
+ removeListEntry(deletePolicy, DeletePolicy.MARK_AS_READ.preferenceString());
}
- mDeletePolicy.setValue(mAccount.getDeletePolicy().preferenceString());
- mDeletePolicy.setSummary(mDeletePolicy.getEntry());
- mDeletePolicy.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
+ deletePolicy.setValue(account.getDeletePolicy().preferenceString());
+ deletePolicy.setSummary(deletePolicy.getEntry());
+ deletePolicy.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue) {
final String summary = newValue.toString();
- int index = mDeletePolicy.findIndexOfValue(summary);
- mDeletePolicy.setSummary(mDeletePolicy.getEntries()[index]);
- mDeletePolicy.setValue(summary);
+ int index = deletePolicy.findIndexOfValue(summary);
+ deletePolicy.setSummary(deletePolicy.getEntries()[index]);
+ deletePolicy.setValue(summary);
return false;
}
});
- mExpungePolicy = (ListPreference) findPreference(PREFERENCE_EXPUNGE_POLICY);
- if (mIsExpungeCapable) {
- mExpungePolicy.setValue(mAccount.getExpungePolicy().name());
- mExpungePolicy.setSummary(mExpungePolicy.getEntry());
- mExpungePolicy.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
+ expungePolicy = (ListPreference) findPreference(PREFERENCE_EXPUNGE_POLICY);
+ if (isExpungeCapable) {
+ expungePolicy.setValue(account.getExpungePolicy().name());
+ expungePolicy.setSummary(expungePolicy.getEntry());
+ expungePolicy.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue) {
final String summary = newValue.toString();
- int index = mExpungePolicy.findIndexOfValue(summary);
- mExpungePolicy.setSummary(mExpungePolicy.getEntries()[index]);
- mExpungePolicy.setValue(summary);
+ int index = expungePolicy.findIndexOfValue(summary);
+ expungePolicy.setSummary(expungePolicy.getEntries()[index]);
+ expungePolicy.setValue(summary);
return false;
}
});
} else {
- ((PreferenceScreen) findPreference(PREFERENCE_SCREEN_INCOMING)).removePreference(mExpungePolicy);
+ ((PreferenceScreen) findPreference(PREFERENCE_SCREEN_INCOMING)).removePreference(expungePolicy);
}
- mSyncRemoteDeletions = (CheckBoxPreference) findPreference(PREFERENCE_SYNC_REMOTE_DELETIONS);
- mSyncRemoteDeletions.setChecked(mAccount.syncRemoteDeletions());
+ syncRemoteDeletions = (CheckBoxPreference) findPreference(PREFERENCE_SYNC_REMOTE_DELETIONS);
+ syncRemoteDeletions.setChecked(account.syncRemoteDeletions());
- mSearchableFolders = (ListPreference) findPreference(PREFERENCE_SEARCHABLE_FOLDERS);
- mSearchableFolders.setValue(mAccount.getSearchableFolders().name());
- mSearchableFolders.setSummary(mSearchableFolders.getEntry());
- mSearchableFolders.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
+ searchableFolders = (ListPreference) findPreference(PREFERENCE_SEARCHABLE_FOLDERS);
+ searchableFolders.setValue(account.getSearchableFolders().name());
+ searchableFolders.setSummary(searchableFolders.getEntry());
+ searchableFolders.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue) {
final String summary = newValue.toString();
- int index = mSearchableFolders.findIndexOfValue(summary);
- mSearchableFolders.setSummary(mSearchableFolders.getEntries()[index]);
- mSearchableFolders.setValue(summary);
+ int index = searchableFolders.findIndexOfValue(summary);
+ searchableFolders.setSummary(searchableFolders.getEntries()[index]);
+ searchableFolders.setValue(summary);
return false;
}
});
- mDisplayCount = (ListPreference) findPreference(PREFERENCE_DISPLAY_COUNT);
- mDisplayCount.setValue(String.valueOf(mAccount.getDisplayCount()));
- mDisplayCount.setSummary(mDisplayCount.getEntry());
- mDisplayCount.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
+ displayCount = (ListPreference) findPreference(PREFERENCE_DISPLAY_COUNT);
+ displayCount.setValue(String.valueOf(account.getDisplayCount()));
+ displayCount.setSummary(displayCount.getEntry());
+ displayCount.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue) {
final String summary = newValue.toString();
- int index = mDisplayCount.findIndexOfValue(summary);
- mDisplayCount.setSummary(mDisplayCount.getEntries()[index]);
- mDisplayCount.setValue(summary);
+ int index = displayCount.findIndexOfValue(summary);
+ displayCount.setSummary(displayCount.getEntries()[index]);
+ displayCount.setValue(summary);
return false;
}
});
- mMessageAge = (ListPreference) findPreference(PREFERENCE_MESSAGE_AGE);
+ messageAge = (ListPreference) findPreference(PREFERENCE_MESSAGE_AGE);
- if (!mAccount.isSearchByDateCapable()) {
- ((PreferenceScreen) findPreference(PREFERENCE_SCREEN_INCOMING)).removePreference(mMessageAge);
+ if (!account.isSearchByDateCapable()) {
+ ((PreferenceScreen) findPreference(PREFERENCE_SCREEN_INCOMING)).removePreference(messageAge);
} else {
- mMessageAge.setValue(String.valueOf(mAccount.getMaximumPolledMessageAge()));
- mMessageAge.setSummary(mMessageAge.getEntry());
- mMessageAge.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
+ messageAge.setValue(String.valueOf(account.getMaximumPolledMessageAge()));
+ messageAge.setSummary(messageAge.getEntry());
+ messageAge.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue) {
final String summary = newValue.toString();
- int index = mMessageAge.findIndexOfValue(summary);
- mMessageAge.setSummary(mMessageAge.getEntries()[index]);
- mMessageAge.setValue(summary);
+ int index = messageAge.findIndexOfValue(summary);
+ messageAge.setSummary(messageAge.getEntries()[index]);
+ messageAge.setValue(summary);
return false;
}
});
}
- mMessageSize = (ListPreference) findPreference(PREFERENCE_MESSAGE_SIZE);
- mMessageSize.setValue(String.valueOf(mAccount.getMaximumAutoDownloadMessageSize()));
- mMessageSize.setSummary(mMessageSize.getEntry());
- mMessageSize.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
+ messageSize = (ListPreference) findPreference(PREFERENCE_MESSAGE_SIZE);
+ messageSize.setValue(String.valueOf(account.getMaximumAutoDownloadMessageSize()));
+ messageSize.setSummary(messageSize.getEntry());
+ messageSize.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue) {
final String summary = newValue.toString();
- int index = mMessageSize.findIndexOfValue(summary);
- mMessageSize.setSummary(mMessageSize.getEntries()[index]);
- mMessageSize.setValue(summary);
+ int index = messageSize.findIndexOfValue(summary);
+ messageSize.setSummary(messageSize.getEntries()[index]);
+ messageSize.setValue(summary);
return false;
}
});
- mAccountDefault = (CheckBoxPreference) findPreference(PREFERENCE_DEFAULT);
- mAccountDefault.setChecked(
- mAccount.equals(Preferences.getPreferences(this).getDefaultAccount()));
+ accountDefault = (CheckBoxPreference) findPreference(PREFERENCE_DEFAULT);
+ accountDefault.setChecked(
+ account.equals(Preferences.getPreferences(this).getDefaultAccount()));
- mAccountShowPictures = (ListPreference) findPreference(PREFERENCE_SHOW_PICTURES);
- mAccountShowPictures.setValue("" + mAccount.getShowPictures());
- mAccountShowPictures.setSummary(mAccountShowPictures.getEntry());
- mAccountShowPictures.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
+ accountShowPictures = (ListPreference) findPreference(PREFERENCE_SHOW_PICTURES);
+ accountShowPictures.setValue("" + account.getShowPictures());
+ accountShowPictures.setSummary(accountShowPictures.getEntry());
+ accountShowPictures.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue) {
final String summary = newValue.toString();
- int index = mAccountShowPictures.findIndexOfValue(summary);
- mAccountShowPictures.setSummary(mAccountShowPictures.getEntries()[index]);
- mAccountShowPictures.setValue(summary);
+ int index = accountShowPictures.findIndexOfValue(summary);
+ accountShowPictures.setSummary(accountShowPictures.getEntries()[index]);
+ accountShowPictures.setValue(summary);
return false;
}
});
- mLocalStorageProvider = (ListPreference) findPreference(PREFERENCE_LOCAL_STORAGE_PROVIDER);
+ localStorageProvider = (ListPreference) findPreference(PREFERENCE_LOCAL_STORAGE_PROVIDER);
{
final Map providers;
providers = StorageManager.getInstance(this).getAvailableProviders();
@@ -489,14 +489,14 @@ public class AccountSettings extends K9PreferenceActivity {
providerLabels[i] = entry.getValue();
i++;
}
- mLocalStorageProvider.setEntryValues(providerIds);
- mLocalStorageProvider.setEntries(providerLabels);
- mLocalStorageProvider.setValue(mAccount.getLocalStorageProviderId());
- mLocalStorageProvider.setSummary(providers.get(mAccount.getLocalStorageProviderId()));
+ localStorageProvider.setEntryValues(providerIds);
+ localStorageProvider.setEntries(providerLabels);
+ localStorageProvider.setValue(account.getLocalStorageProviderId());
+ localStorageProvider.setSummary(providers.get(account.getLocalStorageProviderId()));
- mLocalStorageProvider.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
+ localStorageProvider.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue) {
- mLocalStorageProvider.setSummary(providers.get(newValue));
+ localStorageProvider.setSummary(providers.get(newValue));
return true;
}
});
@@ -504,11 +504,11 @@ public class AccountSettings extends K9PreferenceActivity {
// IMAP-specific preferences
- mSearchScreen = (PreferenceScreen) findPreference(PREFERENCE_SCREEN_SEARCH);
+ searchScreen = (PreferenceScreen) findPreference(PREFERENCE_SCREEN_SEARCH);
- mCloudSearchEnabled = (CheckBoxPreference) findPreference(PREFERENCE_CLOUD_SEARCH_ENABLED);
- mRemoteSearchNumResults = (ListPreference) findPreference(PREFERENCE_REMOTE_SEARCH_NUM_RESULTS);
- mRemoteSearchNumResults.setOnPreferenceChangeListener(
+ cloudSearchEnabled = (CheckBoxPreference) findPreference(PREFERENCE_CLOUD_SEARCH_ENABLED);
+ remoteSearchNumResults = (ListPreference) findPreference(PREFERENCE_REMOTE_SEARCH_NUM_RESULTS);
+ remoteSearchNumResults.setOnPreferenceChangeListener(
new OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference pref, Object newVal) {
updateRemoteSearchLimit((String)newVal);
@@ -518,31 +518,31 @@ public class AccountSettings extends K9PreferenceActivity {
);
//mRemoteSearchFullText = (CheckBoxPreference) findPreference(PREFERENCE_REMOTE_SEARCH_FULL_TEXT);
- mPushPollOnConnect = (CheckBoxPreference) findPreference(PREFERENCE_PUSH_POLL_ON_CONNECT);
- mIdleRefreshPeriod = (ListPreference) findPreference(PREFERENCE_IDLE_REFRESH_PERIOD);
+ pushPollOnConnect = (CheckBoxPreference) findPreference(PREFERENCE_PUSH_POLL_ON_CONNECT);
+ idleRefreshPeriod = (ListPreference) findPreference(PREFERENCE_IDLE_REFRESH_PERIOD);
mMaxPushFolders = (ListPreference) findPreference(PREFERENCE_MAX_PUSH_FOLDERS);
- if (mIsPushCapable) {
- mPushPollOnConnect.setChecked(mAccount.isPushPollOnConnect());
+ if (isPushCapable) {
+ pushPollOnConnect.setChecked(account.isPushPollOnConnect());
- mCloudSearchEnabled.setChecked(mAccount.allowRemoteSearch());
- String searchNumResults = Integer.toString(mAccount.getRemoteSearchNumResults());
- mRemoteSearchNumResults.setValue(searchNumResults);
+ cloudSearchEnabled.setChecked(account.allowRemoteSearch());
+ String searchNumResults = Integer.toString(account.getRemoteSearchNumResults());
+ remoteSearchNumResults.setValue(searchNumResults);
updateRemoteSearchLimit(searchNumResults);
- //mRemoteSearchFullText.setChecked(mAccount.isRemoteSearchFullText());
+ //mRemoteSearchFullText.setChecked(account.isRemoteSearchFullText());
- mIdleRefreshPeriod.setValue(String.valueOf(mAccount.getIdleRefreshMinutes()));
- mIdleRefreshPeriod.setSummary(mIdleRefreshPeriod.getEntry());
- mIdleRefreshPeriod.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
+ idleRefreshPeriod.setValue(String.valueOf(account.getIdleRefreshMinutes()));
+ idleRefreshPeriod.setSummary(idleRefreshPeriod.getEntry());
+ idleRefreshPeriod.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue) {
final String summary = newValue.toString();
- int index = mIdleRefreshPeriod.findIndexOfValue(summary);
- mIdleRefreshPeriod.setSummary(mIdleRefreshPeriod.getEntries()[index]);
- mIdleRefreshPeriod.setValue(summary);
+ int index = idleRefreshPeriod.findIndexOfValue(summary);
+ idleRefreshPeriod.setSummary(idleRefreshPeriod.getEntries()[index]);
+ idleRefreshPeriod.setValue(summary);
return false;
}
});
- mMaxPushFolders.setValue(String.valueOf(mAccount.getMaxPushFolders()));
+ mMaxPushFolders.setValue(String.valueOf(account.getMaxPushFolders()));
mMaxPushFolders.setSummary(mMaxPushFolders.getEntry());
mMaxPushFolders.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue) {
@@ -553,107 +553,107 @@ public class AccountSettings extends K9PreferenceActivity {
return false;
}
});
- mPushMode = (ListPreference) findPreference(PREFERENCE_PUSH_MODE);
- mPushMode.setValue(mAccount.getFolderPushMode().name());
- mPushMode.setSummary(mPushMode.getEntry());
- mPushMode.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
+ pushMode = (ListPreference) findPreference(PREFERENCE_PUSH_MODE);
+ pushMode.setValue(account.getFolderPushMode().name());
+ pushMode.setSummary(pushMode.getEntry());
+ pushMode.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue) {
final String summary = newValue.toString();
- int index = mPushMode.findIndexOfValue(summary);
- mPushMode.setSummary(mPushMode.getEntries()[index]);
- mPushMode.setValue(summary);
+ int index = pushMode.findIndexOfValue(summary);
+ pushMode.setSummary(pushMode.getEntries()[index]);
+ pushMode.setValue(summary);
return false;
}
});
} else {
PreferenceScreen incomingPrefs = (PreferenceScreen) findPreference(PREFERENCE_SCREEN_INCOMING);
- incomingPrefs.removePreference((PreferenceScreen) findPreference(PREFERENCE_SCREEN_PUSH_ADVANCED));
- incomingPrefs.removePreference((ListPreference) findPreference(PREFERENCE_PUSH_MODE));
- mMainScreen.removePreference(mSearchScreen);
+ incomingPrefs.removePreference(findPreference(PREFERENCE_SCREEN_PUSH_ADVANCED));
+ incomingPrefs.removePreference(findPreference(PREFERENCE_PUSH_MODE));
+ mainScreen.removePreference(searchScreen);
}
- mAccountNotify = (CheckBoxPreference) findPreference(PREFERENCE_NOTIFY);
- mAccountNotify.setChecked(mAccount.isNotifyNewMail());
+ accountNotify = (CheckBoxPreference) findPreference(PREFERENCE_NOTIFY);
+ accountNotify.setChecked(account.isNotifyNewMail());
- mAccountNotifyNewMailMode = (ListPreference) findPreference(PREFERENCE_NOTIFY_NEW_MAIL_MODE);
- mAccountNotifyNewMailMode.setValue(mAccount.getFolderNotifyNewMailMode().name());
- mAccountNotifyNewMailMode.setSummary(mAccountNotifyNewMailMode.getEntry());
- mAccountNotifyNewMailMode.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
+ accountNotifyNewMailMode = (ListPreference) findPreference(PREFERENCE_NOTIFY_NEW_MAIL_MODE);
+ accountNotifyNewMailMode.setValue(account.getFolderNotifyNewMailMode().name());
+ accountNotifyNewMailMode.setSummary(accountNotifyNewMailMode.getEntry());
+ accountNotifyNewMailMode.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue) {
final String summary = newValue.toString();
- int index = mAccountNotifyNewMailMode.findIndexOfValue(summary);
- mAccountNotifyNewMailMode.setSummary(mAccountNotifyNewMailMode.getEntries()[index]);
- mAccountNotifyNewMailMode.setValue(summary);
+ int index = accountNotifyNewMailMode.findIndexOfValue(summary);
+ accountNotifyNewMailMode.setSummary(accountNotifyNewMailMode.getEntries()[index]);
+ accountNotifyNewMailMode.setValue(summary);
return false;
}
});
- mAccountNotifySelf = (CheckBoxPreference) findPreference(PREFERENCE_NOTIFY_SELF);
- mAccountNotifySelf.setChecked(mAccount.isNotifySelfNewMail());
+ accountNotifySelf = (CheckBoxPreference) findPreference(PREFERENCE_NOTIFY_SELF);
+ accountNotifySelf.setChecked(account.isNotifySelfNewMail());
- mAccountNotifyContactsMailOnly = (CheckBoxPreference) findPreference(PREFERENCE_NOTIFY_CONTACTS_MAIL_ONLY);
- mAccountNotifyContactsMailOnly.setChecked(mAccount.isNotifyContactsMailOnly());
+ accountNotifyContactsMailOnly = (CheckBoxPreference) findPreference(PREFERENCE_NOTIFY_CONTACTS_MAIL_ONLY);
+ accountNotifyContactsMailOnly.setChecked(account.isNotifyContactsMailOnly());
- mAccountNotifySync = (CheckBoxPreference) findPreference(PREFERENCE_NOTIFY_SYNC);
- mAccountNotifySync.setChecked(mAccount.isShowOngoing());
+ accountNotifySync = (CheckBoxPreference) findPreference(PREFERENCE_NOTIFY_SYNC);
+ accountNotifySync.setChecked(account.isShowOngoing());
- mAccountRingtone = (RingtonePreference) findPreference(PREFERENCE_RINGTONE);
+ accountRingtone = (RingtonePreference) findPreference(PREFERENCE_RINGTONE);
// XXX: The following two lines act as a workaround for the RingtonePreference
// which does not let us set/get the value programmatically
- SharedPreferences prefs = mAccountRingtone.getPreferenceManager().getSharedPreferences();
- String currentRingtone = (!mAccount.getNotificationSetting().isRingEnabled() ? null : mAccount.getNotificationSetting().getRingtone());
+ SharedPreferences prefs = accountRingtone.getPreferenceManager().getSharedPreferences();
+ String currentRingtone = (!account.getNotificationSetting().isRingEnabled() ? null : account.getNotificationSetting().getRingtone());
prefs.edit().putString(PREFERENCE_RINGTONE, currentRingtone).commit();
- mAccountVibrate = (CheckBoxPreference) findPreference(PREFERENCE_VIBRATE);
- mAccountVibrate.setChecked(mAccount.getNotificationSetting().isVibrateEnabled());
+ accountVibrateEnabled = (CheckBoxPreference) findPreference(PREFERENCE_VIBRATE);
+ accountVibrateEnabled.setChecked(account.getNotificationSetting().isVibrateEnabled());
- mAccountVibratePattern = (ListPreference) findPreference(PREFERENCE_VIBRATE_PATTERN);
- mAccountVibratePattern.setValue(String.valueOf(mAccount.getNotificationSetting().getVibratePattern()));
- mAccountVibratePattern.setSummary(mAccountVibratePattern.getEntry());
- mAccountVibratePattern.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
+ accountVibratePattern = (ListPreference) findPreference(PREFERENCE_VIBRATE_PATTERN);
+ accountVibratePattern.setValue(String.valueOf(account.getNotificationSetting().getVibratePattern()));
+ accountVibratePattern.setSummary(accountVibratePattern.getEntry());
+ accountVibratePattern.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue) {
final String summary = newValue.toString();
- int index = mAccountVibratePattern.findIndexOfValue(summary);
- mAccountVibratePattern.setSummary(mAccountVibratePattern.getEntries()[index]);
- mAccountVibratePattern.setValue(summary);
+ int index = accountVibratePattern.findIndexOfValue(summary);
+ accountVibratePattern.setSummary(accountVibratePattern.getEntries()[index]);
+ accountVibratePattern.setValue(summary);
doVibrateTest(preference);
return false;
}
});
- mAccountVibrateTimes = (ListPreference) findPreference(PREFERENCE_VIBRATE_TIMES);
- mAccountVibrateTimes.setValue(String.valueOf(mAccount.getNotificationSetting().getVibrateTimes()));
- mAccountVibrateTimes.setSummary(String.valueOf(mAccount.getNotificationSetting().getVibrateTimes()));
- mAccountVibrateTimes.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
+ accountVibrateTimes = (ListPreference) findPreference(PREFERENCE_VIBRATE_TIMES);
+ accountVibrateTimes.setValue(String.valueOf(account.getNotificationSetting().getVibrateTimes()));
+ accountVibrateTimes.setSummary(String.valueOf(account.getNotificationSetting().getVibrateTimes()));
+ accountVibrateTimes.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
final String value = newValue.toString();
- mAccountVibrateTimes.setSummary(value);
- mAccountVibrateTimes.setValue(value);
+ accountVibrateTimes.setSummary(value);
+ accountVibrateTimes.setValue(value);
doVibrateTest(preference);
return false;
}
});
- mAccountLed = (CheckBoxPreference) findPreference(PREFERENCE_NOTIFICATION_LED);
- mAccountLed.setChecked(mAccount.getNotificationSetting().isLedEnabled());
+ accountLedEnabled = (CheckBoxPreference) findPreference(PREFERENCE_NOTIFICATION_LED);
+ accountLedEnabled.setChecked(account.getNotificationSetting().isLedEnabled());
- mNotificationOpensUnread = (CheckBoxPreference)findPreference(PREFERENCE_NOTIFICATION_OPENS_UNREAD);
- mNotificationOpensUnread.setChecked(mAccount.goToUnreadMessageSearch());
+ notificationOpensUnread = (CheckBoxPreference) findPreference(PREFERENCE_NOTIFICATION_OPENS_UNREAD);
+ notificationOpensUnread.setChecked(account.goToUnreadMessageSearch());
new PopulateFolderPrefsTask().execute();
- mChipColor = findPreference(PREFERENCE_CHIP_COLOR);
- mChipColor.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
+ chipColor = findPreference(PREFERENCE_CHIP_COLOR);
+ chipColor.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
public boolean onPreferenceClick(Preference preference) {
onChooseChipColor();
return false;
}
});
- mLedColor = findPreference(PREFERENCE_LED_COLOR);
- mLedColor.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
+ ledColor = findPreference(PREFERENCE_LED_COLOR);
+ ledColor.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
public boolean onPreferenceClick(Preference preference) {
onChooseLedColor();
return false;
@@ -679,7 +679,7 @@ public class AccountSettings extends K9PreferenceActivity {
findPreference(PREFERENCE_INCOMING).setOnPreferenceClickListener(
new Preference.OnPreferenceClickListener() {
public boolean onPreferenceClick(Preference preference) {
- mIncomingChanged = true;
+ incomingChanged = true;
onIncomingSettings();
return true;
}
@@ -693,19 +693,19 @@ public class AccountSettings extends K9PreferenceActivity {
}
});
- mHasCrypto = K9.isOpenPgpProviderConfigured();
+ hasPgpCrypto = K9.isOpenPgpProviderConfigured();
PreferenceScreen cryptoMenu = (PreferenceScreen) findPreference(PREFERENCE_CRYPTO);
- if (mHasCrypto) {
- mCryptoKey = (OpenPgpKeyPreference) findPreference(PREFERENCE_CRYPTO_KEY);
+ if (hasPgpCrypto) {
+ pgpCryptoKey = (OpenPgpKeyPreference) findPreference(PREFERENCE_CRYPTO_KEY);
- mCryptoKey.setValue(mAccount.getCryptoKey());
- mCryptoKey.setOpenPgpProvider(K9.getOpenPgpProvider());
+ pgpCryptoKey.setValue(account.getCryptoKey());
+ pgpCryptoKey.setOpenPgpProvider(K9.getOpenPgpProvider());
// TODO: other identities?
- mCryptoKey.setDefaultUserId(OpenPgpApiHelper.buildUserId(mAccount.getIdentity(0)));
- mCryptoKey.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
+ pgpCryptoKey.setDefaultUserId(OpenPgpApiHelper.buildUserId(account.getIdentity(0)));
+ pgpCryptoKey.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue) {
long value = (Long) newValue;
- mCryptoKey.setValue(value);
+ pgpCryptoKey.setValue(value);
return false;
}
});
@@ -749,98 +749,98 @@ public class AccountSettings extends K9PreferenceActivity {
}
private void saveSettings() {
- if (mAccountDefault.isChecked()) {
- Preferences.getPreferences(this).setDefaultAccount(mAccount);
+ if (accountDefault.isChecked()) {
+ Preferences.getPreferences(this).setDefaultAccount(account);
}
- mAccount.setDescription(mAccountDescription.getText());
- mAccount.setMarkMessageAsReadOnView(mMarkMessageAsReadOnView.isChecked());
- mAccount.setNotifyNewMail(mAccountNotify.isChecked());
- mAccount.setFolderNotifyNewMailMode(FolderMode.valueOf(mAccountNotifyNewMailMode.getValue()));
- mAccount.setNotifySelfNewMail(mAccountNotifySelf.isChecked());
- mAccount.setNotifyContactsMailOnly(mAccountNotifyContactsMailOnly.isChecked());
- mAccount.setShowOngoing(mAccountNotifySync.isChecked());
- mAccount.setDisplayCount(Integer.parseInt(mDisplayCount.getValue()));
- mAccount.setMaximumAutoDownloadMessageSize(Integer.parseInt(mMessageSize.getValue()));
- if (mAccount.isSearchByDateCapable()) {
- mAccount.setMaximumPolledMessageAge(Integer.parseInt(mMessageAge.getValue()));
+ account.setDescription(accountDescription.getText());
+ account.setMarkMessageAsReadOnView(markMessageAsReadOnView.isChecked());
+ account.setNotifyNewMail(accountNotify.isChecked());
+ account.setFolderNotifyNewMailMode(FolderMode.valueOf(accountNotifyNewMailMode.getValue()));
+ account.setNotifySelfNewMail(accountNotifySelf.isChecked());
+ account.setNotifyContactsMailOnly(accountNotifyContactsMailOnly.isChecked());
+ account.setShowOngoing(accountNotifySync.isChecked());
+ account.setDisplayCount(Integer.parseInt(displayCount.getValue()));
+ account.setMaximumAutoDownloadMessageSize(Integer.parseInt(messageSize.getValue()));
+ if (account.isSearchByDateCapable()) {
+ account.setMaximumPolledMessageAge(Integer.parseInt(messageAge.getValue()));
}
- mAccount.getNotificationSetting().setVibrate(mAccountVibrate.isChecked());
- mAccount.getNotificationSetting().setVibratePattern(Integer.parseInt(mAccountVibratePattern.getValue()));
- mAccount.getNotificationSetting().setVibrateTimes(Integer.parseInt(mAccountVibrateTimes.getValue()));
- mAccount.getNotificationSetting().setLed(mAccountLed.isChecked());
- mAccount.setGoToUnreadMessageSearch(mNotificationOpensUnread.isChecked());
- mAccount.setFolderTargetMode(FolderMode.valueOf(mTargetMode.getValue()));
- mAccount.setDeletePolicy(DeletePolicy.fromInt(Integer.parseInt(mDeletePolicy.getValue())));
- if (mIsExpungeCapable) {
- mAccount.setExpungePolicy(Expunge.valueOf(mExpungePolicy.getValue()));
+ account.getNotificationSetting().setVibrate(accountVibrateEnabled.isChecked());
+ account.getNotificationSetting().setVibratePattern(Integer.parseInt(accountVibratePattern.getValue()));
+ account.getNotificationSetting().setVibrateTimes(Integer.parseInt(accountVibrateTimes.getValue()));
+ account.getNotificationSetting().setLed(accountLedEnabled.isChecked());
+ account.setGoToUnreadMessageSearch(notificationOpensUnread.isChecked());
+ account.setFolderTargetMode(FolderMode.valueOf(targetMode.getValue()));
+ account.setDeletePolicy(DeletePolicy.fromInt(Integer.parseInt(deletePolicy.getValue())));
+ if (isExpungeCapable) {
+ account.setExpungePolicy(Expunge.valueOf(expungePolicy.getValue()));
}
- mAccount.setSyncRemoteDeletions(mSyncRemoteDeletions.isChecked());
- mAccount.setSearchableFolders(Searchable.valueOf(mSearchableFolders.getValue()));
- mAccount.setMessageFormat(MessageFormat.valueOf(mMessageFormat.getValue()));
- mAccount.setAlwaysShowCcBcc(mAlwaysShowCcBcc.isChecked());
- mAccount.setMessageReadReceipt(mMessageReadReceipt.isChecked());
- mAccount.setQuoteStyle(QuoteStyle.valueOf(mQuoteStyle.getValue()));
- mAccount.setQuotePrefix(mAccountQuotePrefix.getText());
- mAccount.setDefaultQuotedTextShown(mAccountDefaultQuotedTextShown.isChecked());
- mAccount.setReplyAfterQuote(mReplyAfterQuote.isChecked());
- mAccount.setStripSignature(mStripSignature.isChecked());
- mAccount.setLocalStorageProviderId(mLocalStorageProvider.getValue());
- if (mHasCrypto) {
- mAccount.setCryptoKey(mCryptoKey.getValue());
+ account.setSyncRemoteDeletions(syncRemoteDeletions.isChecked());
+ account.setSearchableFolders(Searchable.valueOf(searchableFolders.getValue()));
+ account.setMessageFormat(MessageFormat.valueOf(messageFormat.getValue()));
+ account.setAlwaysShowCcBcc(alwaysShowCcBcc.isChecked());
+ account.setMessageReadReceipt(messageReadReceipt.isChecked());
+ account.setQuoteStyle(QuoteStyle.valueOf(quoteStyle.getValue()));
+ account.setQuotePrefix(accountQuotePrefix.getText());
+ account.setDefaultQuotedTextShown(accountDefaultQuotedTextShown.isChecked());
+ account.setReplyAfterQuote(replyAfterQuote.isChecked());
+ account.setStripSignature(stripSignature.isChecked());
+ account.setLocalStorageProviderId(localStorageProvider.getValue());
+ if (hasPgpCrypto) {
+ account.setCryptoKey(pgpCryptoKey.getValue());
} else {
- mAccount.setCryptoKey(Account.NO_OPENPGP_KEY);
+ account.setCryptoKey(Account.NO_OPENPGP_KEY);
}
// In webdav account we use the exact folder name also for inbox,
// since it varies because of internationalization
- if (mAccount.getStoreUri().startsWith("webdav"))
- mAccount.setAutoExpandFolderName(mAutoExpandFolder.getValue());
+ if (account.getStoreUri().startsWith("webdav"))
+ account.setAutoExpandFolderName(autoExpandFolder.getValue());
else
- mAccount.setAutoExpandFolderName(reverseTranslateFolder(mAutoExpandFolder.getValue()));
+ account.setAutoExpandFolderName(reverseTranslateFolder(autoExpandFolder.getValue()));
- if (mIsMoveCapable) {
- mAccount.setArchiveFolderName(mArchiveFolder.getValue());
- mAccount.setDraftsFolderName(mDraftsFolder.getValue());
- mAccount.setSentFolderName(mSentFolder.getValue());
- mAccount.setSpamFolderName(mSpamFolder.getValue());
- mAccount.setTrashFolderName(mTrashFolder.getValue());
+ if (isMoveCapable) {
+ account.setArchiveFolderName(archiveFolder.getValue());
+ account.setDraftsFolderName(draftsFolder.getValue());
+ account.setSentFolderName(sentFolder.getValue());
+ account.setSpamFolderName(spamFolder.getValue());
+ account.setTrashFolderName(trashFolder.getValue());
}
//IMAP stuff
- if (mIsPushCapable) {
- mAccount.setPushPollOnConnect(mPushPollOnConnect.isChecked());
- mAccount.setIdleRefreshMinutes(Integer.parseInt(mIdleRefreshPeriod.getValue()));
- mAccount.setMaxPushFolders(Integer.parseInt(mMaxPushFolders.getValue()));
- mAccount.setAllowRemoteSearch(mCloudSearchEnabled.isChecked());
- mAccount.setRemoteSearchNumResults(Integer.parseInt(mRemoteSearchNumResults.getValue()));
- //mAccount.setRemoteSearchFullText(mRemoteSearchFullText.isChecked());
+ if (isPushCapable) {
+ account.setPushPollOnConnect(pushPollOnConnect.isChecked());
+ account.setIdleRefreshMinutes(Integer.parseInt(idleRefreshPeriod.getValue()));
+ account.setMaxPushFolders(Integer.parseInt(mMaxPushFolders.getValue()));
+ account.setAllowRemoteSearch(cloudSearchEnabled.isChecked());
+ account.setRemoteSearchNumResults(Integer.parseInt(remoteSearchNumResults.getValue()));
+ //account.setRemoteSearchFullText(mRemoteSearchFullText.isChecked());
}
- boolean needsRefresh = mAccount.setAutomaticCheckIntervalMinutes(Integer.parseInt(mCheckFrequency.getValue()));
- needsRefresh |= mAccount.setFolderSyncMode(FolderMode.valueOf(mSyncMode.getValue()));
+ boolean needsRefresh = account.setAutomaticCheckIntervalMinutes(Integer.parseInt(checkFrequency.getValue()));
+ needsRefresh |= account.setFolderSyncMode(FolderMode.valueOf(syncMode.getValue()));
- boolean displayModeChanged = mAccount.setFolderDisplayMode(FolderMode.valueOf(mDisplayMode.getValue()));
+ boolean displayModeChanged = account.setFolderDisplayMode(FolderMode.valueOf(displayMode.getValue()));
- SharedPreferences prefs = mAccountRingtone.getPreferenceManager().getSharedPreferences();
+ SharedPreferences prefs = accountRingtone.getPreferenceManager().getSharedPreferences();
String newRingtone = prefs.getString(PREFERENCE_RINGTONE, null);
if (newRingtone != null) {
- mAccount.getNotificationSetting().setRingEnabled(true);
- mAccount.getNotificationSetting().setRingtone(newRingtone);
+ account.getNotificationSetting().setRingEnabled(true);
+ account.getNotificationSetting().setRingtone(newRingtone);
} else {
- if (mAccount.getNotificationSetting().isRingEnabled()) {
- mAccount.getNotificationSetting().setRingtone(null);
+ if (account.getNotificationSetting().isRingEnabled()) {
+ account.getNotificationSetting().setRingtone(null);
}
}
- mAccount.setShowPictures(ShowPictures.valueOf(mAccountShowPictures.getValue()));
+ account.setShowPictures(ShowPictures.valueOf(accountShowPictures.getValue()));
//IMAP specific stuff
- if (mIsPushCapable) {
- boolean needsPushRestart = mAccount.setFolderPushMode(FolderMode.valueOf(mPushMode.getValue()));
- if (mAccount.getFolderPushMode() != FolderMode.NONE) {
+ if (isPushCapable) {
+ boolean needsPushRestart = account.setFolderPushMode(FolderMode.valueOf(pushMode.getValue()));
+ if (account.getFolderPushMode() != FolderMode.NONE) {
needsPushRestart |= displayModeChanged;
- needsPushRestart |= mIncomingChanged;
+ needsPushRestart |= incomingChanged;
}
if (needsRefresh && needsPushRestart) {
@@ -852,18 +852,18 @@ public class AccountSettings extends K9PreferenceActivity {
}
}
// TODO: refresh folder list here
- mAccount.save(Preferences.getPreferences(this));
+ account.save(Preferences.getPreferences(this));
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
- if (mCryptoKey != null && mCryptoKey.handleOnActivityResult(requestCode, resultCode, data)) {
+ if (pgpCryptoKey != null && pgpCryptoKey.handleOnActivityResult(requestCode, resultCode, data)) {
return;
}
if (resultCode == RESULT_OK) {
switch (requestCode) {
case SELECT_AUTO_EXPAND_FOLDER:
- mAutoExpandFolder.setSummary(translateFolder(data.getStringExtra(ChooseFolder.EXTRA_NEW_FOLDER)));
+ autoExpandFolder.setSummary(translateFolder(data.getStringExtra(ChooseFolder.EXTRA_NEW_FOLDER)));
break;
}
}
@@ -877,21 +877,21 @@ public class AccountSettings extends K9PreferenceActivity {
}
private void onCompositionSettings() {
- AccountSetupComposition.actionEditCompositionSettings(this, mAccount);
+ AccountSetupComposition.actionEditCompositionSettings(this, account);
}
private void onManageIdentities() {
Intent intent = new Intent(this, ManageIdentities.class);
- intent.putExtra(ChooseIdentity.EXTRA_ACCOUNT, mAccount.getUuid());
+ intent.putExtra(ChooseIdentity.EXTRA_ACCOUNT, account.getUuid());
startActivityForResult(intent, ACTIVITY_MANAGE_IDENTITIES);
}
private void onIncomingSettings() {
- AccountSetupIncoming.actionEditIncomingSettings(this, mAccount);
+ AccountSetupIncoming.actionEditIncomingSettings(this, account);
}
private void onOutgoingSettings() {
- AccountSetupOutgoing.actionEditOutgoingSettings(this, mAccount);
+ AccountSetupOutgoing.actionEditOutgoingSettings(this, account);
}
public void onChooseChipColor() {
@@ -912,10 +912,10 @@ public class AccountSettings extends K9PreferenceActivity {
dialog = new ColorPickerDialog(this,
new ColorPickerDialog.OnColorChangedListener() {
public void colorChanged(int color) {
- mAccount.setChipColor(color);
+ account.setChipColor(color);
}
},
- mAccount.getChipColor());
+ account.getChipColor());
break;
}
@@ -923,10 +923,10 @@ public class AccountSettings extends K9PreferenceActivity {
dialog = new ColorPickerDialog(this,
new ColorPickerDialog.OnColorChangedListener() {
public void colorChanged(int color) {
- mAccount.getNotificationSetting().setLedColor(color);
+ account.getNotificationSetting().setLedColor(color);
}
},
- mAccount.getNotificationSetting().getLedColor());
+ account.getNotificationSetting().getLedColor());
break;
}
@@ -940,12 +940,12 @@ public class AccountSettings extends K9PreferenceActivity {
switch (id) {
case DIALOG_COLOR_PICKER_ACCOUNT: {
ColorPickerDialog colorPicker = (ColorPickerDialog) dialog;
- colorPicker.setColor(mAccount.getChipColor());
+ colorPicker.setColor(account.getChipColor());
break;
}
case DIALOG_COLOR_PICKER_LED: {
ColorPickerDialog colorPicker = (ColorPickerDialog) dialog;
- colorPicker.setColor(mAccount.getNotificationSetting().getLedColor());
+ colorPicker.setColor(account.getNotificationSetting().getLedColor());
break;
}
}
@@ -953,9 +953,9 @@ public class AccountSettings extends K9PreferenceActivity {
public void onChooseAutoExpandFolder() {
Intent selectIntent = new Intent(this, ChooseFolder.class);
- selectIntent.putExtra(ChooseFolder.EXTRA_ACCOUNT, mAccount.getUuid());
+ selectIntent.putExtra(ChooseFolder.EXTRA_ACCOUNT, account.getUuid());
- selectIntent.putExtra(ChooseFolder.EXTRA_CUR_FOLDER, mAutoExpandFolder.getSummary());
+ selectIntent.putExtra(ChooseFolder.EXTRA_CUR_FOLDER, autoExpandFolder.getSummary());
selectIntent.putExtra(ChooseFolder.EXTRA_SHOW_CURRENT, "yes");
selectIntent.putExtra(ChooseFolder.EXTRA_SHOW_FOLDER_NONE, "yes");
selectIntent.putExtra(ChooseFolder.EXTRA_SHOW_DISPLAYABLE_ONLY, "yes");
@@ -963,7 +963,7 @@ public class AccountSettings extends K9PreferenceActivity {
}
private String translateFolder(String in) {
- if (mAccount.getInboxFolderName().equalsIgnoreCase(in)) {
+ if (account.getInboxFolderName().equalsIgnoreCase(in)) {
return getString(R.string.special_mailbox_name_inbox);
} else {
return in;
@@ -972,7 +972,7 @@ public class AccountSettings extends K9PreferenceActivity {
private String reverseTranslateFolder(String in) {
if (getString(R.string.special_mailbox_name_inbox).equals(in)) {
- return mAccount.getInboxFolderName();
+ return account.getInboxFolderName();
} else {
return in;
}
@@ -982,8 +982,8 @@ public class AccountSettings extends K9PreferenceActivity {
// Do the vibration to show the user what it's like.
Vibrator vibrate = (Vibrator)preference.getContext().getSystemService(Context.VIBRATOR_SERVICE);
vibrate.vibrate(NotificationSetting.getVibration(
- Integer.parseInt(mAccountVibratePattern.getValue()),
- Integer.parseInt(mAccountVibrateTimes.getValue())), -1);
+ Integer.parseInt(accountVibratePattern.getValue()),
+ Integer.parseInt(accountVibrateTimes.getValue())), -1);
}
/**
@@ -996,19 +996,20 @@ public class AccountSettings extends K9PreferenceActivity {
maxResults = getString(R.string.account_settings_remote_search_num_results_entries_all);
}
- mRemoteSearchNumResults.setSummary(String.format(getString(R.string.account_settings_remote_search_num_summary), maxResults));
+ remoteSearchNumResults
+ .setSummary(String.format(getString(R.string.account_settings_remote_search_num_summary), maxResults));
}
}
private class PopulateFolderPrefsTask extends AsyncTask {
- List extends Folder > folders = new LinkedList();
+ List extends Folder > folders = new LinkedList<>();
String[] allFolderValues;
String[] allFolderLabels;
@Override
protected Void doInBackground(Void... params) {
try {
- folders = mAccount.getLocalStore().getPersonalNamespaces(false);
+ folders = account.getLocalStore().getPersonalNamespaces(false);
} catch (Exception e) {
/// this can't be checked in
}
@@ -1018,7 +1019,7 @@ public class AccountSettings extends K9PreferenceActivity {
Iterator extends Folder > iter = folders.iterator();
while (iter.hasNext()) {
Folder folder = iter.next();
- if (mAccount.getOutboxFolderName().equals(folder.getName())) {
+ if (account.getOutboxFolderName().equals(folder.getName())) {
iter.remove();
}
}
@@ -1040,45 +1041,45 @@ public class AccountSettings extends K9PreferenceActivity {
@Override
protected void onPreExecute() {
- mAutoExpandFolder = (ListPreference)findPreference(PREFERENCE_AUTO_EXPAND_FOLDER);
- mAutoExpandFolder.setEnabled(false);
- mArchiveFolder = (ListPreference)findPreference(PREFERENCE_ARCHIVE_FOLDER);
- mArchiveFolder.setEnabled(false);
- mDraftsFolder = (ListPreference)findPreference(PREFERENCE_DRAFTS_FOLDER);
- mDraftsFolder.setEnabled(false);
- mSentFolder = (ListPreference)findPreference(PREFERENCE_SENT_FOLDER);
- mSentFolder.setEnabled(false);
- mSpamFolder = (ListPreference)findPreference(PREFERENCE_SPAM_FOLDER);
- mSpamFolder.setEnabled(false);
- mTrashFolder = (ListPreference)findPreference(PREFERENCE_TRASH_FOLDER);
- mTrashFolder.setEnabled(false);
+ autoExpandFolder = (ListPreference) findPreference(PREFERENCE_AUTO_EXPAND_FOLDER);
+ autoExpandFolder.setEnabled(false);
+ archiveFolder = (ListPreference) findPreference(PREFERENCE_ARCHIVE_FOLDER);
+ archiveFolder.setEnabled(false);
+ draftsFolder = (ListPreference) findPreference(PREFERENCE_DRAFTS_FOLDER);
+ draftsFolder.setEnabled(false);
+ sentFolder = (ListPreference) findPreference(PREFERENCE_SENT_FOLDER);
+ sentFolder.setEnabled(false);
+ spamFolder = (ListPreference) findPreference(PREFERENCE_SPAM_FOLDER);
+ spamFolder.setEnabled(false);
+ trashFolder = (ListPreference) findPreference(PREFERENCE_TRASH_FOLDER);
+ trashFolder.setEnabled(false);
- if (!mIsMoveCapable) {
+ if (!isMoveCapable) {
PreferenceScreen foldersCategory =
(PreferenceScreen) findPreference(PREFERENCE_CATEGORY_FOLDERS);
- foldersCategory.removePreference(mArchiveFolder);
- foldersCategory.removePreference(mSpamFolder);
- foldersCategory.removePreference(mDraftsFolder);
- foldersCategory.removePreference(mSentFolder);
- foldersCategory.removePreference(mTrashFolder);
+ foldersCategory.removePreference(archiveFolder);
+ foldersCategory.removePreference(spamFolder);
+ foldersCategory.removePreference(draftsFolder);
+ foldersCategory.removePreference(sentFolder);
+ foldersCategory.removePreference(trashFolder);
}
}
@Override
protected void onPostExecute(Void res) {
- initListPreference(mAutoExpandFolder, mAccount.getAutoExpandFolderName(), allFolderLabels, allFolderValues);
- mAutoExpandFolder.setEnabled(true);
- if (mIsMoveCapable) {
- initListPreference(mArchiveFolder, mAccount.getArchiveFolderName(), allFolderLabels, allFolderValues);
- initListPreference(mDraftsFolder, mAccount.getDraftsFolderName(), allFolderLabels, allFolderValues);
- initListPreference(mSentFolder, mAccount.getSentFolderName(), allFolderLabels, allFolderValues);
- initListPreference(mSpamFolder, mAccount.getSpamFolderName(), allFolderLabels, allFolderValues);
- initListPreference(mTrashFolder, mAccount.getTrashFolderName(), allFolderLabels, allFolderValues);
- mArchiveFolder.setEnabled(true);
- mSpamFolder.setEnabled(true);
- mDraftsFolder.setEnabled(true);
- mSentFolder.setEnabled(true);
- mTrashFolder.setEnabled(true);
+ initListPreference(autoExpandFolder, account.getAutoExpandFolderName(), allFolderLabels, allFolderValues);
+ autoExpandFolder.setEnabled(true);
+ if (isMoveCapable) {
+ initListPreference(archiveFolder, account.getArchiveFolderName(), allFolderLabels, allFolderValues);
+ initListPreference(draftsFolder, account.getDraftsFolderName(), allFolderLabels, allFolderValues);
+ initListPreference(sentFolder, account.getSentFolderName(), allFolderLabels, allFolderValues);
+ initListPreference(spamFolder, account.getSpamFolderName(), allFolderLabels, allFolderValues);
+ initListPreference(trashFolder, account.getTrashFolderName(), allFolderLabels, allFolderValues);
+ archiveFolder.setEnabled(true);
+ spamFolder.setEnabled(true);
+ draftsFolder.setEnabled(true);
+ sentFolder.setEnabled(true);
+ trashFolder.setEnabled(true);
}
}
}
From 910ee757983d0e3fe92bca8dcd557f2fe75adb7c Mon Sep 17 00:00:00 2001
From: Vincent Breitmoser
Date: Mon, 27 Mar 2017 11:38:55 +0200
Subject: [PATCH 5/6] clean up Preferences
---
.../main/java/com/fsck/k9/Preferences.java | 31 +++++++++----------
1 file changed, 15 insertions(+), 16 deletions(-)
diff --git a/k9mail/src/main/java/com/fsck/k9/Preferences.java b/k9mail/src/main/java/com/fsck/k9/Preferences.java
index 57a4bb229..c7f02fc2e 100644
--- a/k9mail/src/main/java/com/fsck/k9/Preferences.java
+++ b/k9mail/src/main/java/com/fsck/k9/Preferences.java
@@ -31,26 +31,26 @@ public class Preferences {
}
- private Storage mStorage;
+ private Storage storage;
private Map accounts = null;
private List accountsInOrder = null;
private Account newAccount;
- private Context mContext;
+ private Context context;
private Preferences(Context context) {
- mStorage = Storage.getStorage(context);
- mContext = context;
- if (mStorage.isEmpty()) {
+ storage = Storage.getStorage(context);
+ this.context = context;
+ if (storage.isEmpty()) {
Timber.i("Preferences storage is zero-size, importing from Android-style preferences");
- StorageEditor editor = mStorage.edit();
+ StorageEditor editor = storage.edit();
editor.copy(context.getSharedPreferences("AndroidMail.Main", Context.MODE_PRIVATE));
editor.commit();
}
}
public synchronized void loadAccounts() {
- accounts = new HashMap();
- accountsInOrder = new LinkedList();
+ accounts = new HashMap<>();
+ accountsInOrder = new LinkedList<>();
String accountUuids = getStorage().getString("accountUuids", null);
if ((accountUuids != null) && (accountUuids.length() != 0)) {
String[] uuids = accountUuids.split(",");
@@ -80,7 +80,7 @@ public class Preferences {
loadAccounts();
}
- return Collections.unmodifiableList(new ArrayList(accountsInOrder));
+ return Collections.unmodifiableList(new ArrayList<>(accountsInOrder));
}
/**
@@ -91,9 +91,9 @@ public class Preferences {
*/
public synchronized Collection getAvailableAccounts() {
List allAccounts = getAccounts();
- Collection retval = new ArrayList(accounts.size());
+ Collection retval = new ArrayList<>(accounts.size());
for (Account account : allAccounts) {
- if (account.isEnabled() && account.isAvailable(mContext)) {
+ if (account.isEnabled() && account.isAvailable(context)) {
retval.add(account);
}
}
@@ -105,13 +105,12 @@ public class Preferences {
if (accounts == null) {
loadAccounts();
}
- Account account = accounts.get(uuid);
- return account;
+ return accounts.get(uuid);
}
public synchronized Account newAccount() {
- newAccount = new Account(mContext);
+ newAccount = new Account(context);
accounts.put(newAccount.getUuid(), newAccount);
accountsInOrder.add(newAccount);
@@ -165,10 +164,10 @@ public class Preferences {
}
public Storage getStorage() {
- return mStorage;
+ return storage;
}
- public static > T getEnumStringPref(Storage storage, String key, T defaultEnum) {
+ static > T getEnumStringPref(Storage storage, String key, T defaultEnum) {
String stringPref = storage.getString(key, null);
if (stringPref == null) {
From b1edd02c08817f6c9f5f7137288a96a0e1f7d059 Mon Sep 17 00:00:00 2001
From: Vincent Breitmoser
Date: Mon, 27 Mar 2017 11:43:18 +0200
Subject: [PATCH 6/6] clean up Throttle
---
.../src/main/java/com/fsck/k9/Throttle.java | 123 +++++++-----------
1 file changed, 46 insertions(+), 77 deletions(-)
diff --git a/k9mail/src/main/java/com/fsck/k9/Throttle.java b/k9mail/src/main/java/com/fsck/k9/Throttle.java
index d18d57fb9..31be4942c 100644
--- a/k9mail/src/main/java/com/fsck/k9/Throttle.java
+++ b/k9mail/src/main/java/com/fsck/k9/Throttle.java
@@ -29,50 +29,31 @@ import timber.log.Timber;
* This class used to "throttle" a flow of events.
*
* When {@link #onEvent()} is called, it calls the callback in a certain timeout later.
- * Initially {@link #mMinTimeout} is used as the timeout, but if it gets multiple {@link #onEvent}
- * calls in a certain amount of time, it extends the timeout, until it reaches {@link #mMaxTimeout}.
+ * Initially {@link #minTimeout} is used as the timeout, but if it gets multiple {@link #onEvent}
+ * calls in a certain amount of time, it extends the timeout, until it reaches {@link #maxTimeout}.
*
* This class is primarily used to throttle content changed events.
*/
public class Throttle {
- public static final boolean DEBUG = false; // Don't submit with true
-
- public static final int DEFAULT_MIN_TIMEOUT = 150;
- public static final int DEFAULT_MAX_TIMEOUT = 2500;
- /* package */ static final int TIMEOUT_EXTEND_INTERVAL = 500;
+ private static final int TIMEOUT_EXTEND_INTERVAL = 500;
private static Timer TIMER = new Timer();
- private final Clock mClock;
- private final Timer mTimer;
+ private final Clock clock;
+ private final Timer timer;
- /** Name of the instance. Only for logging. */
- private final String mName;
+ private final String name;
+ private final Handler handler;
+ private final Runnable callback;
- /** Handler for UI thread. */
- private final Handler mHandler;
-
- /** Callback to be called */
- private final Runnable mCallback;
-
- /** Minimum (default) timeout, in milliseconds. */
- private final int mMinTimeout;
-
- /** Max timeout, in milliseconds. */
- private final int mMaxTimeout;
-
- /** Current timeout, in milliseconds. */
- private int mTimeout;
+ private final int minTimeout;
+ private final int maxTimeout;
+ private int currentTimeout;
/** When {@link #onEvent()} was last called. */
- private long mLastEventTime;
+ private long lastEventTime;
- private MyTimerTask mRunningTimerTask;
-
- /** Constructor with default timeout */
- public Throttle(String name, Runnable callback, Handler handler) {
- this(name, callback, handler, DEFAULT_MIN_TIMEOUT, DEFAULT_MAX_TIMEOUT);
- }
+ private MyTimerTask runningTimerTask;
/** Constructor that takes custom timeout */
public Throttle(String name, Runnable callback, Handler handler,int minTimeout,
@@ -81,64 +62,60 @@ public class Throttle {
}
/** Constructor for tests */
- /* package */ Throttle(String name, Runnable callback, Handler handler,int minTimeout,
+ private Throttle(String name, Runnable callback, Handler handler, int minTimeout,
int maxTimeout, Clock clock, Timer timer) {
if (maxTimeout < minTimeout) {
throw new IllegalArgumentException();
}
- mName = name;
- mCallback = callback;
- mClock = clock;
- mTimer = timer;
- mHandler = handler;
- mMinTimeout = minTimeout;
- mMaxTimeout = maxTimeout;
- mTimeout = mMinTimeout;
- }
-
- private void debugLog(String message) {
- Timber.d("Throttle: [%s] %s", mName, message);
+ this.name = name;
+ this.callback = callback;
+ this.clock = clock;
+ this.timer = timer;
+ this.handler = handler;
+ this.minTimeout = minTimeout;
+ this.maxTimeout = maxTimeout;
+ currentTimeout = this.minTimeout;
}
private boolean isCallbackScheduled() {
- return mRunningTimerTask != null;
+ return runningTimerTask != null;
}
public void cancelScheduledCallback() {
- if (mRunningTimerTask != null) {
- if (DEBUG) debugLog("Canceling scheduled callback");
- mRunningTimerTask.cancel();
- mRunningTimerTask = null;
+ if (runningTimerTask != null) {
+ Timber.d("Throttle: [%s] %s", name, "Canceling scheduled callback");
+ runningTimerTask.cancel();
+ runningTimerTask = null;
}
}
- /* package */ void updateTimeout() {
- final long now = mClock.getTime();
- if ((now - mLastEventTime) <= TIMEOUT_EXTEND_INTERVAL) {
- mTimeout *= 2;
- if (mTimeout >= mMaxTimeout) {
- mTimeout = mMaxTimeout;
+ private void updateTimeout() {
+ final long now = clock.getTime();
+ if ((now - lastEventTime) <= TIMEOUT_EXTEND_INTERVAL) {
+ currentTimeout *= 2;
+ if (currentTimeout >= maxTimeout) {
+ currentTimeout = maxTimeout;
}
- if (DEBUG) debugLog("Timeout extended " + mTimeout);
+ Timber.d("Throttle: [%s] %s", name, "Timeout extended " + currentTimeout);
} else {
- mTimeout = mMinTimeout;
- if (DEBUG) debugLog("Timeout reset to " + mTimeout);
+ currentTimeout = minTimeout;
+ Timber.d("Throttle: [%s] %s", name, "Timeout reset to " + currentTimeout);
}
- mLastEventTime = now;
+ lastEventTime = now;
}
public void onEvent() {
- if (DEBUG) debugLog("onEvent");
+ Timber.d("Throttle: [%s] %s", name, "onEvent");
updateTimeout();
if (isCallbackScheduled()) {
- if (DEBUG) debugLog(" callback already scheduled");
+ Timber.d("Throttle: [%s] %s", name, " callback already scheduled");
} else {
- if (DEBUG) debugLog(" scheduling callback");
- mRunningTimerTask = new MyTimerTask();
- mTimer.schedule(mRunningTimerTask, mTimeout);
+ Timber.d("Throttle: [%s] %s", name, " scheduling callback");
+ runningTimerTask = new MyTimerTask();
+ timer.schedule(runningTimerTask, currentTimeout);
}
}
@@ -150,7 +127,7 @@ public class Throttle {
@Override
public void run() {
- mHandler.post(new HandlerRunnable());
+ handler.post(new HandlerRunnable());
}
@Override
@@ -162,20 +139,12 @@ public class Throttle {
private class HandlerRunnable implements Runnable {
@Override
public void run() {
- mRunningTimerTask = null;
+ runningTimerTask = null;
if (!mCanceled) { // This check has to be done on the UI thread.
- if (DEBUG) debugLog("Kicking callback");
- mCallback.run();
+ Timber.d("Throttle: [%s] %s", name, "Kicking callback");
+ callback.run();
}
}
}
}
-
- /* package */ int getTimeoutForTest() {
- return mTimeout;
- }
-
- /* package */ long getLastEventTimeForTest() {
- return mLastEventTime;
- }
}