1
0
mirror of https://github.com/moparisthebest/k-9 synced 2025-01-14 07:08:00 -05:00

Merge branch 'master' into pgp_mime_preparations

This commit is contained in:
cketti 2015-02-17 00:56:42 +01:00
commit 9659bee8c5
24 changed files with 224 additions and 216 deletions

View File

@ -53,6 +53,7 @@ android {
} }
debug { debug {
applicationIdSuffix ".debug"
testCoverageEnabled rootProject.testCoverage testCoverageEnabled rootProject.testCoverage
} }
} }

View File

@ -29,36 +29,36 @@
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<permission <permission
android:name="com.fsck.k9.permission.READ_ATTACHMENT" android:name="${applicationId}.permission.READ_ATTACHMENT"
android:description="@string/read_attachment_desc" android:description="@string/read_attachment_desc"
android:label="@string/read_attachment_label" android:label="@string/read_attachment_label"
android:permissionGroup="android.permission-group.MESSAGES" android:permissionGroup="android.permission-group.MESSAGES"
android:protectionLevel="dangerous"/> android:protectionLevel="dangerous"/>
<uses-permission android:name="com.fsck.k9.permission.READ_ATTACHMENT"/> <uses-permission android:name="${applicationId}.permission.READ_ATTACHMENT"/>
<permission <permission
android:name="com.fsck.k9.permission.REMOTE_CONTROL" android:name="${applicationId}.permission.REMOTE_CONTROL"
android:description="@string/remote_control_desc" android:description="@string/remote_control_desc"
android:label="@string/remote_control_label" android:label="@string/remote_control_label"
android:permissionGroup="android.permission-group.MESSAGES" android:permissionGroup="android.permission-group.MESSAGES"
android:protectionLevel="dangerous"/> android:protectionLevel="dangerous"/>
<uses-permission android:name="com.fsck.k9.permission.REMOTE_CONTROL"/> <uses-permission android:name="${applicationId}.permission.REMOTE_CONTROL"/>
<permission <permission
android:name="com.fsck.k9.permission.READ_MESSAGES" android:name="${applicationId}.permission.READ_MESSAGES"
android:description="@string/read_messages_desc" android:description="@string/read_messages_desc"
android:label="@string/read_messages_label" android:label="@string/read_messages_label"
android:permissionGroup="android.permission-group.MESSAGES" android:permissionGroup="android.permission-group.MESSAGES"
android:protectionLevel="dangerous"/> android:protectionLevel="dangerous"/>
<uses-permission android:name="com.fsck.k9.permission.READ_MESSAGES"/> <uses-permission android:name="${applicationId}.permission.READ_MESSAGES"/>
<permission <permission
android:name="com.fsck.k9.permission.DELETE_MESSAGES" android:name="${applicationId}.permission.DELETE_MESSAGES"
android:description="@string/delete_messages_desc" android:description="@string/delete_messages_desc"
android:label="@string/delete_messages_label" android:label="@string/delete_messages_label"
android:permissionGroup="android.permission-group.MESSAGES" android:permissionGroup="android.permission-group.MESSAGES"
android:protectionLevel="dangerous"/> android:protectionLevel="dangerous"/>
<uses-permission android:name="com.fsck.k9.permission.DELETE_MESSAGES"/> <uses-permission android:name="${applicationId}.permission.DELETE_MESSAGES"/>
<application <application
@ -70,7 +70,7 @@
<meta-data <meta-data
android:name="android.app.default_searchable" android:name="android.app.default_searchable"
android:value=".activity.Search"/> android:value="com.fsck.k9.activity.Search"/>
<activity <activity
android:name=".activity.Accounts" android:name=".activity.Accounts"
@ -98,7 +98,7 @@
android:configChanges="locale" android:configChanges="locale"
android:excludeFromRecents="true" android:excludeFromRecents="true"
android:label="@string/prefs_title" android:label="@string/prefs_title"
android:taskAffinity="com.fsck.k9.activity.setup.Prefs"/> android:taskAffinity="${applicationId}.activity.setup.Prefs"/>
<activity <activity
android:name=".activity.setup.WelcomeMessage" android:name=".activity.setup.WelcomeMessage"
@ -315,12 +315,12 @@
<receiver <receiver
android:name=".service.RemoteControlReceiver" android:name=".service.RemoteControlReceiver"
android:enabled="true" android:enabled="true"
android:permission="com.fsck.k9.permission.REMOTE_CONTROL"> android:permission="${applicationId}.permission.REMOTE_CONTROL">
<intent-filter> <intent-filter>
<action android:name="com.fsck.k9.K9RemoteControl.set"/> <action android:name="${applicationId}.K9RemoteControl.set"/>
</intent-filter> </intent-filter>
<intent-filter> <intent-filter>
<action android:name="com.fsck.k9.K9RemoteControl.requestAccounts"/> <action android:name="${applicationId}.K9RemoteControl.requestAccounts"/>
</intent-filter> </intent-filter>
</receiver> </receiver>
@ -383,7 +383,7 @@
<service <service
android:name=".service.RemoteControlService" android:name=".service.RemoteControlService"
android:enabled="true" android:enabled="true"
android:permission="com.fsck.k9.permission.REMOTE_CONTROL"/> android:permission="${applicationId}.permission.REMOTE_CONTROL"/>
<service <service
android:name=".service.SleepService" android:name=".service.SleepService"
@ -395,24 +395,24 @@
<provider <provider
android:name=".provider.AttachmentProvider" android:name=".provider.AttachmentProvider"
android:authorities="com.fsck.k9.attachmentprovider" android:authorities="${applicationId}.attachmentprovider"
android:exported="true" android:exported="true"
android:grantUriPermissions="true" android:grantUriPermissions="true"
android:multiprocess="true" android:multiprocess="true"
android:readPermission="com.fsck.k9.permission.READ_ATTACHMENT"/> android:readPermission="${applicationId}.permission.READ_ATTACHMENT"/>
<provider <provider
android:name=".provider.MessageProvider" android:name=".provider.MessageProvider"
android:authorities="com.fsck.k9.messageprovider" android:authorities="${applicationId}.messageprovider"
android:exported="true" android:exported="true"
android:grantUriPermissions="true" android:grantUriPermissions="true"
android:multiprocess="true" android:multiprocess="true"
android:readPermission="com.fsck.k9.permission.READ_MESSAGES" android:readPermission="${applicationId}.permission.READ_MESSAGES"
android:writePermission="com.fsck.k9.permission.DELETE_MESSAGES"/> android:writePermission="${applicationId}.permission.DELETE_MESSAGES"/>
<provider <provider
android:name=".provider.EmailProvider" android:name=".provider.EmailProvider"
android:authorities="com.fsck.k9.provider.email" android:authorities="${applicationId}.provider.email"
android:exported="false"/> android:exported="false"/>
<provider <provider

View File

@ -47,6 +47,8 @@ import com.fsck.k9.mail.ssl.LocalKeyStore;
import com.fsck.k9.view.ColorChip; import com.fsck.k9.view.ColorChip;
import com.larswerkman.colorpicker.ColorPicker; import com.larswerkman.colorpicker.ColorPicker;
import static com.fsck.k9.Preferences.getEnumStringPref;
/** /**
* Account stores all of the settings for a single account defined by the user. It is able to save * Account stores all of the settings for a single account defined by the user. It is able to save
* and delete itself given a Preferences to work with. Each account is defined by a UUID. * and delete itself given a Preferences to work with. Each account is defined by a UUID.
@ -62,19 +64,43 @@ public class Account implements BaseAccount, StoreConfig {
*/ */
public static final String OUTBOX = "K9MAIL_INTERNAL_OUTBOX"; public static final String OUTBOX = "K9MAIL_INTERNAL_OUTBOX";
public static final String EXPUNGE_IMMEDIATELY = "EXPUNGE_IMMEDIATELY"; public enum Expunge {
public static final String EXPUNGE_MANUALLY = "EXPUNGE_MANUALLY"; EXPUNGE_IMMEDIATELY,
public static final String EXPUNGE_ON_POLL = "EXPUNGE_ON_POLL"; EXPUNGE_MANUALLY,
EXPUNGE_ON_POLL
}
public static final int DELETE_POLICY_NEVER = 0; public enum DeletePolicy {
public static final int DELETE_POLICY_7DAYS = 1; NEVER(0),
public static final int DELETE_POLICY_ON_DELETE = 2; SEVEN_DAYS(1),
public static final int DELETE_POLICY_MARK_AS_READ = 3; ON_DELETE(2),
MARK_AS_READ(3);
public static final String TYPE_WIFI = "WIFI"; public final int setting;
public static final String TYPE_MOBILE = "MOBILE";
public static final String TYPE_OTHER = "OTHER"; DeletePolicy(int setting) {
private static final String[] networkTypes = { TYPE_WIFI, TYPE_MOBILE, TYPE_OTHER }; this.setting = setting;
}
public String preferenceString() {
return Integer.toString(setting);
}
public static DeletePolicy fromInt(int initialSetting) {
for (DeletePolicy policy: values()) {
if (policy.setting == initialSetting) {
return policy;
}
}
throw new IllegalArgumentException("DeletePolicy " + initialSetting + " unknown");
}
}
public enum NetworkType {
WIFI,
MOBILE,
OTHER
}
public static final MessageFormat DEFAULT_MESSAGE_FORMAT = MessageFormat.HTML; public static final MessageFormat DEFAULT_MESSAGE_FORMAT = MessageFormat.HTML;
public static final boolean DEFAULT_MESSAGE_FORMAT_AUTO = false; public static final boolean DEFAULT_MESSAGE_FORMAT_AUTO = false;
@ -138,16 +164,7 @@ public class Account implements BaseAccount, StoreConfig {
public static final boolean DEFAULT_SORT_ASCENDING = false; public static final boolean DEFAULT_SORT_ASCENDING = false;
public static final String NO_OPENPGP_PROVIDER = ""; public static final String NO_OPENPGP_PROVIDER = "";
private DeletePolicy mDeletePolicy = DeletePolicy.NEVER;
/**
* <pre>
* 0 - Never (DELETE_POLICY_NEVER)
* 1 - After 7 days (DELETE_POLICY_7DAYS)
* 2 - When I delete from inbox (DELETE_POLICY_ON_DELETE)
* 3 - Mark as read (DELETE_POLICY_MARK_AS_READ)
* </pre>
*/
private int mDeletePolicy;
private final String mUuid; private final String mUuid;
private String mStoreUri; private String mStoreUri;
@ -186,11 +203,11 @@ public class Account implements BaseAccount, StoreConfig {
private Map<SortType, Boolean> mSortAscending = new HashMap<SortType, Boolean>(); private Map<SortType, Boolean> mSortAscending = new HashMap<SortType, Boolean>();
private ShowPictures mShowPictures; private ShowPictures mShowPictures;
private boolean mIsSignatureBeforeQuotedText; private boolean mIsSignatureBeforeQuotedText;
private String mExpungePolicy = EXPUNGE_IMMEDIATELY; private Expunge mExpungePolicy = Expunge.EXPUNGE_IMMEDIATELY;
private int mMaxPushFolders; private int mMaxPushFolders;
private int mIdleRefreshMinutes; private int mIdleRefreshMinutes;
private boolean goToUnreadMessageSearch; private boolean goToUnreadMessageSearch;
private final Map<String, Boolean> compressionMap = new ConcurrentHashMap<String, Boolean>(); private final Map<NetworkType, Boolean> compressionMap = new ConcurrentHashMap<NetworkType, Boolean>();
private Searchable searchableFolders; private Searchable searchableFolders;
private boolean subscribedFoldersOnly; private boolean subscribedFoldersOnly;
private int maximumPolledMessageAge; private int maximumPolledMessageAge;
@ -283,7 +300,7 @@ public class Account implements BaseAccount, StoreConfig {
mSortAscending.put(DEFAULT_SORT_TYPE, DEFAULT_SORT_ASCENDING); mSortAscending.put(DEFAULT_SORT_TYPE, DEFAULT_SORT_ASCENDING);
mShowPictures = ShowPictures.NEVER; mShowPictures = ShowPictures.NEVER;
mIsSignatureBeforeQuotedText = false; mIsSignatureBeforeQuotedText = false;
mExpungePolicy = EXPUNGE_IMMEDIATELY; mExpungePolicy = Expunge.EXPUNGE_IMMEDIATELY;
mAutoExpandFolderName = INBOX; mAutoExpandFolderName = INBOX;
mInboxFolderName = INBOX; mInboxFolderName = INBOX;
mMaxPushFolders = 10; mMaxPushFolders = 10;
@ -379,22 +396,18 @@ public class Account implements BaseAccount, StoreConfig {
mLastAutomaticCheckTime = prefs.getLong(mUuid + ".lastAutomaticCheckTime", 0); mLastAutomaticCheckTime = prefs.getLong(mUuid + ".lastAutomaticCheckTime", 0);
mLatestOldMessageSeenTime = prefs.getLong(mUuid + ".latestOldMessageSeenTime", 0); mLatestOldMessageSeenTime = prefs.getLong(mUuid + ".latestOldMessageSeenTime", 0);
mNotifyNewMail = prefs.getBoolean(mUuid + ".notifyNewMail", false); mNotifyNewMail = prefs.getBoolean(mUuid + ".notifyNewMail", false);
try {
mFolderNotifyNewMailMode = FolderMode.valueOf(prefs.getString(mUuid + ".folderNotifyNewMailMode", mFolderNotifyNewMailMode = getEnumStringPref(prefs, mUuid + ".folderNotifyNewMailMode", FolderMode.ALL);
FolderMode.ALL.name()));
} catch (Exception e) {
mFolderNotifyNewMailMode = FolderMode.ALL;
}
mNotifySelfNewMail = prefs.getBoolean(mUuid + ".notifySelfNewMail", true); mNotifySelfNewMail = prefs.getBoolean(mUuid + ".notifySelfNewMail", true);
mNotifySync = prefs.getBoolean(mUuid + ".notifyMailCheck", false); mNotifySync = prefs.getBoolean(mUuid + ".notifyMailCheck", false);
mDeletePolicy = prefs.getInt(mUuid + ".deletePolicy", 0); mDeletePolicy = DeletePolicy.fromInt(prefs.getInt(mUuid + ".deletePolicy", DeletePolicy.NEVER.setting));
mInboxFolderName = prefs.getString(mUuid + ".inboxFolderName", INBOX); mInboxFolderName = prefs.getString(mUuid + ".inboxFolderName", INBOX);
mDraftsFolderName = prefs.getString(mUuid + ".draftsFolderName", "Drafts"); mDraftsFolderName = prefs.getString(mUuid + ".draftsFolderName", "Drafts");
mSentFolderName = prefs.getString(mUuid + ".sentFolderName", "Sent"); mSentFolderName = prefs.getString(mUuid + ".sentFolderName", "Sent");
mTrashFolderName = prefs.getString(mUuid + ".trashFolderName", "Trash"); mTrashFolderName = prefs.getString(mUuid + ".trashFolderName", "Trash");
mArchiveFolderName = prefs.getString(mUuid + ".archiveFolderName", "Archive"); mArchiveFolderName = prefs.getString(mUuid + ".archiveFolderName", "Archive");
mSpamFolderName = prefs.getString(mUuid + ".spamFolderName", "Spam"); mSpamFolderName = prefs.getString(mUuid + ".spamFolderName", "Spam");
mExpungePolicy = prefs.getString(mUuid + ".expungePolicy", EXPUNGE_IMMEDIATELY); mExpungePolicy = getEnumStringPref(prefs, mUuid + ".expungePolicy", Expunge.EXPUNGE_IMMEDIATELY);
mSyncRemoteDeletions = prefs.getBoolean(mUuid + ".syncRemoteDeletions", true); mSyncRemoteDeletions = prefs.getBoolean(mUuid + ".syncRemoteDeletions", true);
mMaxPushFolders = prefs.getInt(mUuid + ".maxPushFolders", 10); mMaxPushFolders = prefs.getInt(mUuid + ".maxPushFolders", 10);
@ -402,18 +415,18 @@ public class Account implements BaseAccount, StoreConfig {
subscribedFoldersOnly = prefs.getBoolean(mUuid + ".subscribedFoldersOnly", false); subscribedFoldersOnly = prefs.getBoolean(mUuid + ".subscribedFoldersOnly", false);
maximumPolledMessageAge = prefs.getInt(mUuid + ".maximumPolledMessageAge", -1); maximumPolledMessageAge = prefs.getInt(mUuid + ".maximumPolledMessageAge", -1);
maximumAutoDownloadMessageSize = prefs.getInt(mUuid + ".maximumAutoDownloadMessageSize", 32768); maximumAutoDownloadMessageSize = prefs.getInt(mUuid + ".maximumAutoDownloadMessageSize", 32768);
mMessageFormat = MessageFormat.valueOf(prefs.getString(mUuid + ".messageFormat", DEFAULT_MESSAGE_FORMAT.name())); mMessageFormat = getEnumStringPref(prefs, mUuid + ".messageFormat", DEFAULT_MESSAGE_FORMAT);
mMessageFormatAuto = prefs.getBoolean(mUuid + ".messageFormatAuto", DEFAULT_MESSAGE_FORMAT_AUTO); mMessageFormatAuto = prefs.getBoolean(mUuid + ".messageFormatAuto", DEFAULT_MESSAGE_FORMAT_AUTO);
if (mMessageFormatAuto && mMessageFormat == MessageFormat.TEXT) { if (mMessageFormatAuto && mMessageFormat == MessageFormat.TEXT) {
mMessageFormat = MessageFormat.AUTO; mMessageFormat = MessageFormat.AUTO;
} }
mMessageReadReceipt = prefs.getBoolean(mUuid + ".messageReadReceipt", DEFAULT_MESSAGE_READ_RECEIPT); mMessageReadReceipt = prefs.getBoolean(mUuid + ".messageReadReceipt", DEFAULT_MESSAGE_READ_RECEIPT);
mQuoteStyle = QuoteStyle.valueOf(prefs.getString(mUuid + ".quoteStyle", DEFAULT_QUOTE_STYLE.name())); mQuoteStyle = getEnumStringPref(prefs, mUuid + ".quoteStyle", DEFAULT_QUOTE_STYLE);
mQuotePrefix = prefs.getString(mUuid + ".quotePrefix", DEFAULT_QUOTE_PREFIX); mQuotePrefix = prefs.getString(mUuid + ".quotePrefix", DEFAULT_QUOTE_PREFIX);
mDefaultQuotedTextShown = prefs.getBoolean(mUuid + ".defaultQuotedTextShown", DEFAULT_QUOTED_TEXT_SHOWN); mDefaultQuotedTextShown = prefs.getBoolean(mUuid + ".defaultQuotedTextShown", DEFAULT_QUOTED_TEXT_SHOWN);
mReplyAfterQuote = prefs.getBoolean(mUuid + ".replyAfterQuote", DEFAULT_REPLY_AFTER_QUOTE); mReplyAfterQuote = prefs.getBoolean(mUuid + ".replyAfterQuote", DEFAULT_REPLY_AFTER_QUOTE);
mStripSignature = prefs.getBoolean(mUuid + ".stripSignature", DEFAULT_STRIP_SIGNATURE); mStripSignature = prefs.getBoolean(mUuid + ".stripSignature", DEFAULT_STRIP_SIGNATURE);
for (String type : networkTypes) { for (NetworkType type : NetworkType.values()) {
Boolean useCompression = prefs.getBoolean(mUuid + ".useCompression." + type, Boolean useCompression = prefs.getBoolean(mUuid + ".useCompression." + type,
true); true);
compressionMap.put(type, useCompression); compressionMap.put(type, useCompression);
@ -425,21 +438,11 @@ public class Account implements BaseAccount, StoreConfig {
mChipColor = prefs.getInt(mUuid + ".chipColor", ColorPicker.getRandomColor()); mChipColor = prefs.getInt(mUuid + ".chipColor", ColorPicker.getRandomColor());
try { mSortType = getEnumStringPref(prefs, mUuid + ".sortTypeEnum", SortType.SORT_DATE);
mSortType = SortType.valueOf(prefs.getString(mUuid + ".sortTypeEnum",
SortType.SORT_DATE.name()));
} catch (Exception e) {
mSortType = SortType.SORT_DATE;
}
mSortAscending.put(mSortType, prefs.getBoolean(mUuid + ".sortAscending", false)); mSortAscending.put(mSortType, prefs.getBoolean(mUuid + ".sortAscending", false));
try { mShowPictures = getEnumStringPref(prefs, mUuid + ".showPicturesEnum", ShowPictures.NEVER);
mShowPictures = ShowPictures.valueOf(prefs.getString(mUuid + ".showPicturesEnum",
ShowPictures.NEVER.name()));
} catch (Exception e) {
mShowPictures = ShowPictures.NEVER;
}
mNotificationSetting.setVibrate(prefs.getBoolean(mUuid + ".vibrate", false)); mNotificationSetting.setVibrate(prefs.getBoolean(mUuid + ".vibrate", false));
mNotificationSetting.setVibratePattern(prefs.getInt(mUuid + ".vibratePattern", 0)); mNotificationSetting.setVibratePattern(prefs.getInt(mUuid + ".vibratePattern", 0));
@ -450,40 +453,15 @@ public class Account implements BaseAccount, StoreConfig {
mNotificationSetting.setLed(prefs.getBoolean(mUuid + ".led", true)); mNotificationSetting.setLed(prefs.getBoolean(mUuid + ".led", true));
mNotificationSetting.setLedColor(prefs.getInt(mUuid + ".ledColor", mChipColor)); mNotificationSetting.setLedColor(prefs.getInt(mUuid + ".ledColor", mChipColor));
try { mFolderDisplayMode = getEnumStringPref(prefs, mUuid + ".folderDisplayMode", FolderMode.NOT_SECOND_CLASS);
mFolderDisplayMode = FolderMode.valueOf(prefs.getString(mUuid + ".folderDisplayMode",
FolderMode.NOT_SECOND_CLASS.name()));
} catch (Exception e) {
mFolderDisplayMode = FolderMode.NOT_SECOND_CLASS;
}
try { mFolderSyncMode = getEnumStringPref(prefs, mUuid + ".folderSyncMode", FolderMode.FIRST_CLASS);
mFolderSyncMode = FolderMode.valueOf(prefs.getString(mUuid + ".folderSyncMode",
FolderMode.FIRST_CLASS.name()));
} catch (Exception e) {
mFolderSyncMode = FolderMode.FIRST_CLASS;
}
try { mFolderPushMode = getEnumStringPref(prefs, mUuid + ".folderPushMode", FolderMode.FIRST_CLASS);
mFolderPushMode = FolderMode.valueOf(prefs.getString(mUuid + ".folderPushMode",
FolderMode.FIRST_CLASS.name()));
} catch (Exception e) {
mFolderPushMode = FolderMode.FIRST_CLASS;
}
try { mFolderTargetMode = getEnumStringPref(prefs, mUuid + ".folderTargetMode", FolderMode.NOT_SECOND_CLASS);
mFolderTargetMode = FolderMode.valueOf(prefs.getString(mUuid + ".folderTargetMode",
FolderMode.NOT_SECOND_CLASS.name()));
} catch (Exception e) {
mFolderTargetMode = FolderMode.NOT_SECOND_CLASS;
}
try { searchableFolders = getEnumStringPref(prefs, mUuid + ".searchableFolders", Searchable.ALL);
searchableFolders = Searchable.valueOf(prefs.getString(mUuid + ".searchableFolders",
Searchable.ALL.name()));
} catch (Exception e) {
searchableFolders = Searchable.ALL;
}
mIsSignatureBeforeQuotedText = prefs.getBoolean(mUuid + ".signatureBeforeQuotedText", false); mIsSignatureBeforeQuotedText = prefs.getBoolean(mUuid + ".signatureBeforeQuotedText", false);
identities = loadIdentities(prefs); identities = loadIdentities(prefs);
@ -591,8 +569,8 @@ public class Account implements BaseAccount, StoreConfig {
editor.remove(mUuid + ".messageFormat"); editor.remove(mUuid + ".messageFormat");
editor.remove(mUuid + ".messageReadReceipt"); editor.remove(mUuid + ".messageReadReceipt");
editor.remove(mUuid + ".notifyMailCheck"); editor.remove(mUuid + ".notifyMailCheck");
for (String type : networkTypes) { for (NetworkType type : NetworkType.values()) {
editor.remove(mUuid + ".useCompression." + type); editor.remove(mUuid + ".useCompression." + type.name());
} }
deleteIdentities(preferences.getPreferences(), editor); deleteIdentities(preferences.getPreferences(), editor);
// TODO: Remove preference settings that may exist for individual // TODO: Remove preference settings that may exist for individual
@ -707,7 +685,7 @@ public class Account implements BaseAccount, StoreConfig {
editor.putString(mUuid + ".folderNotifyNewMailMode", mFolderNotifyNewMailMode.name()); editor.putString(mUuid + ".folderNotifyNewMailMode", mFolderNotifyNewMailMode.name());
editor.putBoolean(mUuid + ".notifySelfNewMail", mNotifySelfNewMail); editor.putBoolean(mUuid + ".notifySelfNewMail", mNotifySelfNewMail);
editor.putBoolean(mUuid + ".notifyMailCheck", mNotifySync); editor.putBoolean(mUuid + ".notifyMailCheck", mNotifySync);
editor.putInt(mUuid + ".deletePolicy", mDeletePolicy); editor.putInt(mUuid + ".deletePolicy", mDeletePolicy.setting);
editor.putString(mUuid + ".inboxFolderName", mInboxFolderName); editor.putString(mUuid + ".inboxFolderName", mInboxFolderName);
editor.putString(mUuid + ".draftsFolderName", mDraftsFolderName); editor.putString(mUuid + ".draftsFolderName", mDraftsFolderName);
editor.putString(mUuid + ".sentFolderName", mSentFolderName); editor.putString(mUuid + ".sentFolderName", mSentFolderName);
@ -724,7 +702,7 @@ public class Account implements BaseAccount, StoreConfig {
editor.putString(mUuid + ".folderPushMode", mFolderPushMode.name()); editor.putString(mUuid + ".folderPushMode", mFolderPushMode.name());
editor.putString(mUuid + ".folderTargetMode", mFolderTargetMode.name()); editor.putString(mUuid + ".folderTargetMode", mFolderTargetMode.name());
editor.putBoolean(mUuid + ".signatureBeforeQuotedText", this.mIsSignatureBeforeQuotedText); editor.putBoolean(mUuid + ".signatureBeforeQuotedText", this.mIsSignatureBeforeQuotedText);
editor.putString(mUuid + ".expungePolicy", mExpungePolicy); editor.putString(mUuid + ".expungePolicy", mExpungePolicy.name());
editor.putBoolean(mUuid + ".syncRemoteDeletions", mSyncRemoteDeletions); editor.putBoolean(mUuid + ".syncRemoteDeletions", mSyncRemoteDeletions);
editor.putInt(mUuid + ".maxPushFolders", mMaxPushFolders); editor.putInt(mUuid + ".maxPushFolders", mMaxPushFolders);
editor.putString(mUuid + ".searchableFolders", searchableFolders.name()); editor.putString(mUuid + ".searchableFolders", searchableFolders.name());
@ -765,7 +743,7 @@ public class Account implements BaseAccount, StoreConfig {
editor.putBoolean(mUuid + ".led", mNotificationSetting.isLed()); editor.putBoolean(mUuid + ".led", mNotificationSetting.isLed());
editor.putInt(mUuid + ".ledColor", mNotificationSetting.getLedColor()); editor.putInt(mUuid + ".ledColor", mNotificationSetting.getLedColor());
for (String type : networkTypes) { for (NetworkType type : NetworkType.values()) {
Boolean useCompression = compressionMap.get(type); Boolean useCompression = compressionMap.get(type);
if (useCompression != null) { if (useCompression != null) {
editor.putBoolean(mUuid + ".useCompression." + type, useCompression); editor.putBoolean(mUuid + ".useCompression." + type, useCompression);
@ -1056,11 +1034,11 @@ public class Account implements BaseAccount, StoreConfig {
this.mFolderNotifyNewMailMode = folderNotifyNewMailMode; this.mFolderNotifyNewMailMode = folderNotifyNewMailMode;
} }
public synchronized int getDeletePolicy() { public synchronized DeletePolicy getDeletePolicy() {
return mDeletePolicy; return mDeletePolicy;
} }
public synchronized void setDeletePolicy(int deletePolicy) { public synchronized void setDeletePolicy(DeletePolicy deletePolicy) {
this.mDeletePolicy = deletePolicy; this.mDeletePolicy = deletePolicy;
} }
@ -1273,11 +1251,11 @@ public class Account implements BaseAccount, StoreConfig {
mNotifySelfNewMail = notifySelfNewMail; mNotifySelfNewMail = notifySelfNewMail;
} }
public synchronized String getExpungePolicy() { public synchronized Expunge getExpungePolicy() {
return mExpungePolicy; return mExpungePolicy;
} }
public synchronized void setExpungePolicy(String expungePolicy) { public synchronized void setExpungePolicy(Expunge expungePolicy) {
mExpungePolicy = expungePolicy; mExpungePolicy = expungePolicy;
} }
@ -1312,11 +1290,11 @@ public class Account implements BaseAccount, StoreConfig {
return mDescription; return mDescription;
} }
public synchronized void setCompression(String networkType, boolean useCompression) { public synchronized void setCompression(NetworkType networkType, boolean useCompression) {
compressionMap.put(networkType, useCompression); compressionMap.put(networkType, useCompression);
} }
public synchronized boolean useCompression(String networkType) { public synchronized boolean useCompression(NetworkType networkType) {
Boolean useCompression = compressionMap.get(networkType); Boolean useCompression = compressionMap.get(networkType);
if (useCompression == null) { if (useCompression == null) {
return true; return true;
@ -1326,13 +1304,13 @@ public class Account implements BaseAccount, StoreConfig {
} }
public boolean useCompression(int type) { public boolean useCompression(int type) {
String networkType = TYPE_OTHER; NetworkType networkType = NetworkType.OTHER;
switch (type) { switch (type) {
case ConnectivityManager.TYPE_MOBILE: case ConnectivityManager.TYPE_MOBILE:
networkType = TYPE_MOBILE; networkType = NetworkType.MOBILE;
break; break;
case ConnectivityManager.TYPE_WIFI: case ConnectivityManager.TYPE_WIFI:
networkType = TYPE_WIFI; networkType = NetworkType.WIFI;
break; break;
} }
return useCompression(networkType); return useCompression(networkType);

View File

@ -339,18 +339,18 @@ public class K9 extends Application {
public static class Intents { public static class Intents {
public static class EmailReceived { public static class EmailReceived {
public static final String ACTION_EMAIL_RECEIVED = "com.fsck.k9.intent.action.EMAIL_RECEIVED"; public static final String ACTION_EMAIL_RECEIVED = BuildConfig.APPLICATION_ID + ".intent.action.EMAIL_RECEIVED";
public static final String ACTION_EMAIL_DELETED = "com.fsck.k9.intent.action.EMAIL_DELETED"; public static final String ACTION_EMAIL_DELETED = BuildConfig.APPLICATION_ID + ".intent.action.EMAIL_DELETED";
public static final String ACTION_REFRESH_OBSERVER = "com.fsck.k9.intent.action.REFRESH_OBSERVER"; public static final String ACTION_REFRESH_OBSERVER = BuildConfig.APPLICATION_ID + ".intent.action.REFRESH_OBSERVER";
public static final String EXTRA_ACCOUNT = "com.fsck.k9.intent.extra.ACCOUNT"; public static final String EXTRA_ACCOUNT = BuildConfig.APPLICATION_ID + ".intent.extra.ACCOUNT";
public static final String EXTRA_FOLDER = "com.fsck.k9.intent.extra.FOLDER"; public static final String EXTRA_FOLDER = BuildConfig.APPLICATION_ID + ".intent.extra.FOLDER";
public static final String EXTRA_SENT_DATE = "com.fsck.k9.intent.extra.SENT_DATE"; public static final String EXTRA_SENT_DATE = BuildConfig.APPLICATION_ID + ".intent.extra.SENT_DATE";
public static final String EXTRA_FROM = "com.fsck.k9.intent.extra.FROM"; public static final String EXTRA_FROM = BuildConfig.APPLICATION_ID + ".intent.extra.FROM";
public static final String EXTRA_TO = "com.fsck.k9.intent.extra.TO"; public static final String EXTRA_TO = BuildConfig.APPLICATION_ID + ".intent.extra.TO";
public static final String EXTRA_CC = "com.fsck.k9.intent.extra.CC"; public static final String EXTRA_CC = BuildConfig.APPLICATION_ID + ".intent.extra.CC";
public static final String EXTRA_BCC = "com.fsck.k9.intent.extra.BCC"; public static final String EXTRA_BCC = BuildConfig.APPLICATION_ID + ".intent.extra.BCC";
public static final String EXTRA_SUBJECT = "com.fsck.k9.intent.extra.SUBJECT"; public static final String EXTRA_SUBJECT = BuildConfig.APPLICATION_ID + ".intent.extra.SUBJECT";
public static final String EXTRA_FROM_SELF = "com.fsck.k9.intent.extra.FROM_SELF"; public static final String EXTRA_FROM_SELF = BuildConfig.APPLICATION_ID + ".intent.extra.FROM_SELF";
} }
public static class Share { public static class Share {
@ -359,7 +359,7 @@ public class K9 extends Application {
* because of different semantics (String array vs. string with comma separated * because of different semantics (String array vs. string with comma separated
* email addresses) * email addresses)
*/ */
public static final String EXTRA_FROM = "com.fsck.k9.intent.extra.SENDER"; public static final String EXTRA_FROM = BuildConfig.APPLICATION_ID + ".intent.extra.SENDER";
} }
} }

View File

@ -70,6 +70,7 @@ public class Preferences {
/** /**
* Returns an array of the accounts on the system. If no accounts are * Returns an array of the accounts on the system. If no accounts are
* registered the method returns an empty array. * registered the method returns an empty array.
*
* @return all accounts * @return all accounts
*/ */
public synchronized List<Account> getAccounts() { public synchronized List<Account> getAccounts() {
@ -83,6 +84,7 @@ public class Preferences {
/** /**
* Returns an array of the accounts on the system. If no accounts are * Returns an array of the accounts on the system. If no accounts are
* registered the method returns an empty array. * registered the method returns an empty array.
*
* @return all accounts with {@link Account#isAvailable(Context)} * @return all accounts with {@link Account#isAvailable(Context)}
*/ */
public synchronized Collection<Account> getAvailableAccounts() { public synchronized Collection<Account> getAvailableAccounts() {
@ -164,4 +166,21 @@ public class Preferences {
public SharedPreferences getPreferences() { public SharedPreferences getPreferences() {
return mStorage; return mStorage;
} }
public static <T extends Enum<T>> T getEnumStringPref(SharedPreferences prefs, String key, T defaultEnum) {
String stringPref = prefs.getString(key, null);
if (stringPref == null) {
return defaultEnum;
} else {
try {
return Enum.valueOf(defaultEnum.getDeclaringClass(), stringPref);
} catch (IllegalArgumentException ex) {
Log.w(K9.LOG_TAG, "Unable to convert preference key [" + key +
"] value [" + stringPref + "] to enum of type " + defaultEnum.getDeclaringClass(), ex);
return defaultEnum;
}
}
}
} }

View File

@ -1,7 +1,6 @@
package com.fsck.k9.activity; package com.fsck.k9.activity;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import android.os.AsyncTask; import android.os.AsyncTask;

View File

@ -17,7 +17,6 @@ import com.fsck.k9.R;
public class ManageIdentities extends ChooseIdentity { public class ManageIdentities extends ChooseIdentity {
private boolean mIdentitiesChanged = false; private boolean mIdentitiesChanged = false;
public static final String EXTRA_IDENTITIES = "com.fsck.k9.EditIdentity_identities";
private static final int ACTIVITY_EDIT_IDENTITY = 1; private static final int ACTIVITY_EDIT_IDENTITY = 1;

View File

@ -23,8 +23,13 @@ import android.preference.RingtonePreference;
import android.util.Log; import android.util.Log;
import com.fsck.k9.Account; import com.fsck.k9.Account;
import com.fsck.k9.Account.DeletePolicy;
import com.fsck.k9.Account.Expunge;
import com.fsck.k9.Account.FolderMode; import com.fsck.k9.Account.FolderMode;
import com.fsck.k9.Account.MessageFormat;
import com.fsck.k9.Account.QuoteStyle; import com.fsck.k9.Account.QuoteStyle;
import com.fsck.k9.Account.Searchable;
import com.fsck.k9.Account.ShowPictures;
import com.fsck.k9.K9; import com.fsck.k9.K9;
import com.fsck.k9.NotificationSetting; import com.fsck.k9.NotificationSetting;
import com.fsck.k9.Preferences; import com.fsck.k9.Preferences;
@ -353,9 +358,9 @@ public class AccountSettings extends K9PreferenceActivity {
mDeletePolicy = (ListPreference) findPreference(PREFERENCE_DELETE_POLICY); mDeletePolicy = (ListPreference) findPreference(PREFERENCE_DELETE_POLICY);
if (!mIsSeenFlagSupported) { if (!mIsSeenFlagSupported) {
removeListEntry(mDeletePolicy, Integer.toString(Account.DELETE_POLICY_MARK_AS_READ)); removeListEntry(mDeletePolicy, DeletePolicy.MARK_AS_READ.preferenceString());
} }
mDeletePolicy.setValue(Integer.toString(mAccount.getDeletePolicy())); mDeletePolicy.setValue(mAccount.getDeletePolicy().preferenceString());
mDeletePolicy.setSummary(mDeletePolicy.getEntry()); mDeletePolicy.setSummary(mDeletePolicy.getEntry());
mDeletePolicy.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { mDeletePolicy.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue) { public boolean onPreferenceChange(Preference preference, Object newValue) {
@ -370,7 +375,7 @@ public class AccountSettings extends K9PreferenceActivity {
mExpungePolicy = (ListPreference) findPreference(PREFERENCE_EXPUNGE_POLICY); mExpungePolicy = (ListPreference) findPreference(PREFERENCE_EXPUNGE_POLICY);
if (mIsExpungeCapable) { if (mIsExpungeCapable) {
mExpungePolicy.setValue(mAccount.getExpungePolicy()); mExpungePolicy.setValue(mAccount.getExpungePolicy().name());
mExpungePolicy.setSummary(mExpungePolicy.getEntry()); mExpungePolicy.setSummary(mExpungePolicy.getEntry());
mExpungePolicy.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { mExpungePolicy.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue) { public boolean onPreferenceChange(Preference preference, Object newValue) {
@ -729,7 +734,7 @@ public class AccountSettings extends K9PreferenceActivity {
mAccount.setDescription(mAccountDescription.getText()); mAccount.setDescription(mAccountDescription.getText());
mAccount.setMarkMessageAsReadOnView(mMarkMessageAsReadOnView.isChecked()); mAccount.setMarkMessageAsReadOnView(mMarkMessageAsReadOnView.isChecked());
mAccount.setNotifyNewMail(mAccountNotify.isChecked()); mAccount.setNotifyNewMail(mAccountNotify.isChecked());
mAccount.setFolderNotifyNewMailMode(Account.FolderMode.valueOf(mAccountNotifyNewMailMode.getValue())); mAccount.setFolderNotifyNewMailMode(FolderMode.valueOf(mAccountNotifyNewMailMode.getValue()));
mAccount.setNotifySelfNewMail(mAccountNotifySelf.isChecked()); mAccount.setNotifySelfNewMail(mAccountNotifySelf.isChecked());
mAccount.setShowOngoing(mAccountNotifySync.isChecked()); mAccount.setShowOngoing(mAccountNotifySync.isChecked());
mAccount.setDisplayCount(Integer.parseInt(mDisplayCount.getValue())); mAccount.setDisplayCount(Integer.parseInt(mDisplayCount.getValue()));
@ -742,14 +747,14 @@ public class AccountSettings extends K9PreferenceActivity {
mAccount.getNotificationSetting().setVibrateTimes(Integer.parseInt(mAccountVibrateTimes.getValue())); mAccount.getNotificationSetting().setVibrateTimes(Integer.parseInt(mAccountVibrateTimes.getValue()));
mAccount.getNotificationSetting().setLed(mAccountLed.isChecked()); mAccount.getNotificationSetting().setLed(mAccountLed.isChecked());
mAccount.setGoToUnreadMessageSearch(mNotificationOpensUnread.isChecked()); mAccount.setGoToUnreadMessageSearch(mNotificationOpensUnread.isChecked());
mAccount.setFolderTargetMode(Account.FolderMode.valueOf(mTargetMode.getValue())); mAccount.setFolderTargetMode(FolderMode.valueOf(mTargetMode.getValue()));
mAccount.setDeletePolicy(Integer.parseInt(mDeletePolicy.getValue())); mAccount.setDeletePolicy(DeletePolicy.fromInt(Integer.parseInt(mDeletePolicy.getValue())));
if (mIsExpungeCapable) { if (mIsExpungeCapable) {
mAccount.setExpungePolicy(mExpungePolicy.getValue()); mAccount.setExpungePolicy(Expunge.valueOf(mExpungePolicy.getValue()));
} }
mAccount.setSyncRemoteDeletions(mSyncRemoteDeletions.isChecked()); mAccount.setSyncRemoteDeletions(mSyncRemoteDeletions.isChecked());
mAccount.setSearchableFolders(Account.Searchable.valueOf(mSearchableFolders.getValue())); mAccount.setSearchableFolders(Searchable.valueOf(mSearchableFolders.getValue()));
mAccount.setMessageFormat(Account.MessageFormat.valueOf(mMessageFormat.getValue())); mAccount.setMessageFormat(MessageFormat.valueOf(mMessageFormat.getValue()));
mAccount.setAlwaysShowCcBcc(mAlwaysShowCcBcc.isChecked()); mAccount.setAlwaysShowCcBcc(mAlwaysShowCcBcc.isChecked());
mAccount.setMessageReadReceipt(mMessageReadReceipt.isChecked()); mAccount.setMessageReadReceipt(mMessageReadReceipt.isChecked());
mAccount.setQuoteStyle(QuoteStyle.valueOf(mQuoteStyle.getValue())); mAccount.setQuoteStyle(QuoteStyle.valueOf(mQuoteStyle.getValue()));
@ -788,9 +793,9 @@ public class AccountSettings extends K9PreferenceActivity {
} }
boolean needsRefresh = mAccount.setAutomaticCheckIntervalMinutes(Integer.parseInt(mCheckFrequency.getValue())); boolean needsRefresh = mAccount.setAutomaticCheckIntervalMinutes(Integer.parseInt(mCheckFrequency.getValue()));
needsRefresh |= mAccount.setFolderSyncMode(Account.FolderMode.valueOf(mSyncMode.getValue())); needsRefresh |= mAccount.setFolderSyncMode(FolderMode.valueOf(mSyncMode.getValue()));
boolean displayModeChanged = mAccount.setFolderDisplayMode(Account.FolderMode.valueOf(mDisplayMode.getValue())); boolean displayModeChanged = mAccount.setFolderDisplayMode(FolderMode.valueOf(mDisplayMode.getValue()));
SharedPreferences prefs = mAccountRingtone.getPreferenceManager().getSharedPreferences(); SharedPreferences prefs = mAccountRingtone.getPreferenceManager().getSharedPreferences();
String newRingtone = prefs.getString(PREFERENCE_RINGTONE, null); String newRingtone = prefs.getString(PREFERENCE_RINGTONE, null);
@ -803,11 +808,11 @@ public class AccountSettings extends K9PreferenceActivity {
} }
} }
mAccount.setShowPictures(Account.ShowPictures.valueOf(mAccountShowPictures.getValue())); mAccount.setShowPictures(ShowPictures.valueOf(mAccountShowPictures.getValue()));
//IMAP specific stuff //IMAP specific stuff
if (mIsPushCapable) { if (mIsPushCapable) {
boolean needsPushRestart = mAccount.setFolderPushMode(Account.FolderMode.valueOf(mPushMode.getValue())); boolean needsPushRestart = mAccount.setFolderPushMode(FolderMode.valueOf(mPushMode.getValue()));
if (mAccount.getFolderPushMode() != FolderMode.NONE) { if (mAccount.getFolderPushMode() != FolderMode.NONE) {
needsPushRestart |= displayModeChanged; needsPushRestart |= displayModeChanged;
needsPushRestart |= mIncomingChanged; needsPushRestart |= mIncomingChanged;

View File

@ -7,7 +7,6 @@ import android.os.Bundle;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast; import android.widget.Toast;
import com.fsck.k9.Account; import com.fsck.k9.Account;
import com.fsck.k9.K9; import com.fsck.k9.K9;
@ -41,9 +40,9 @@ public class AccountSetupAccountType extends K9Activity implements OnClickListen
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.account_setup_account_type); setContentView(R.layout.account_setup_account_type);
((Button)findViewById(R.id.pop)).setOnClickListener(this); findViewById(R.id.pop).setOnClickListener(this);
((Button)findViewById(R.id.imap)).setOnClickListener(this); findViewById(R.id.imap).setOnClickListener(this);
((Button)findViewById(R.id.webdav)).setOnClickListener(this); findViewById(R.id.webdav).setOnClickListener(this);
String accountUuid = getIntent().getStringExtra(EXTRA_ACCOUNT); String accountUuid = getIntent().getStringExtra(EXTRA_ACCOUNT);
mAccount = Preferences.getPreferences(this).getAccount(accountUuid); mAccount = Preferences.getPreferences(this).getAccount(accountUuid);

View File

@ -27,6 +27,7 @@ import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.EditText; import android.widget.EditText;
import com.fsck.k9.Account; import com.fsck.k9.Account;
import com.fsck.k9.Account.DeletePolicy;
import com.fsck.k9.EmailAddressValidator; import com.fsck.k9.EmailAddressValidator;
import com.fsck.k9.K9; import com.fsck.k9.K9;
import com.fsck.k9.Preferences; import com.fsck.k9.Preferences;
@ -331,9 +332,9 @@ public class AccountSetupBasics extends K9Activity
} }
mAccount.setSentFolderName(getString(R.string.special_mailbox_name_sent)); mAccount.setSentFolderName(getString(R.string.special_mailbox_name_sent));
if (incomingUri.toString().startsWith("imap")) { if (incomingUri.toString().startsWith("imap")) {
mAccount.setDeletePolicy(Account.DELETE_POLICY_ON_DELETE); mAccount.setDeletePolicy(DeletePolicy.ON_DELETE);
} else if (incomingUri.toString().startsWith("pop3")) { } else if (incomingUri.toString().startsWith("pop3")) {
mAccount.setDeletePolicy(Account.DELETE_POLICY_NEVER); mAccount.setDeletePolicy(DeletePolicy.NEVER);
} }
// Check incoming here. Then check outgoing in onActivityResult() // Check incoming here. Then check outgoing in onActivityResult()
AccountSetupCheckSettings.actionCheckSettings(this, mAccount, CheckDirection.INCOMING); AccountSetupCheckSettings.actionCheckSettings(this, mAccount, CheckDirection.INCOMING);

View File

@ -16,7 +16,9 @@ import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.CompoundButton.OnCheckedChangeListener;
import com.fsck.k9.*; import com.fsck.k9.*;
import com.fsck.k9.Account.DeletePolicy;
import com.fsck.k9.Account.FolderMode; import com.fsck.k9.Account.FolderMode;
import com.fsck.k9.Account.NetworkType;
import com.fsck.k9.activity.K9Activity; import com.fsck.k9.activity.K9Activity;
import com.fsck.k9.activity.setup.AccountSetupCheckSettings.CheckDirection; import com.fsck.k9.activity.setup.AccountSetupCheckSettings.CheckDirection;
import com.fsck.k9.helper.Utility; import com.fsck.k9.helper.Utility;
@ -200,7 +202,7 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
findViewById(R.id.compression_section).setVisibility(View.GONE); findViewById(R.id.compression_section).setVisibility(View.GONE);
findViewById(R.id.compression_label).setVisibility(View.GONE); findViewById(R.id.compression_label).setVisibility(View.GONE);
mSubscribedFoldersOnly.setVisibility(View.GONE); mSubscribedFoldersOnly.setVisibility(View.GONE);
mAccount.setDeletePolicy(Account.DELETE_POLICY_NEVER); mAccount.setDeletePolicy(DeletePolicy.NEVER);
} else if (ImapStore.STORE_TYPE.equals(settings.type)) { } else if (ImapStore.STORE_TYPE.equals(settings.type)) {
serverLabelView.setText(R.string.account_setup_incoming_imap_server_label); serverLabelView.setText(R.string.account_setup_incoming_imap_server_label);
mDefaultPort = IMAP_PORT; mDefaultPort = IMAP_PORT;
@ -217,7 +219,7 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
findViewById(R.id.webdav_mailbox_alias_section).setVisibility(View.GONE); findViewById(R.id.webdav_mailbox_alias_section).setVisibility(View.GONE);
findViewById(R.id.webdav_owa_path_section).setVisibility(View.GONE); findViewById(R.id.webdav_owa_path_section).setVisibility(View.GONE);
findViewById(R.id.webdav_auth_path_section).setVisibility(View.GONE); findViewById(R.id.webdav_auth_path_section).setVisibility(View.GONE);
mAccount.setDeletePolicy(Account.DELETE_POLICY_ON_DELETE); mAccount.setDeletePolicy(DeletePolicy.ON_DELETE);
if (!Intent.ACTION_EDIT.equals(getIntent().getAction())) { if (!Intent.ACTION_EDIT.equals(getIntent().getAction())) {
findViewById(R.id.imap_folder_setup_section).setVisibility(View.GONE); findViewById(R.id.imap_folder_setup_section).setVisibility(View.GONE);
@ -251,7 +253,7 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
if (webDavSettings.mailboxPath != null) { if (webDavSettings.mailboxPath != null) {
mWebdavMailboxPathView.setText(webDavSettings.mailboxPath); mWebdavMailboxPathView.setText(webDavSettings.mailboxPath);
} }
mAccount.setDeletePolicy(Account.DELETE_POLICY_ON_DELETE); mAccount.setDeletePolicy(DeletePolicy.ON_DELETE);
} else { } else {
throw new Exception("Unknown account type: " + mAccount.getStoreUri()); throw new Exception("Unknown account type: " + mAccount.getStoreUri());
} }
@ -280,9 +282,9 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
updateAuthPlainTextFromSecurityType(settings.connectionSecurity); updateAuthPlainTextFromSecurityType(settings.connectionSecurity);
mCompressionMobile.setChecked(mAccount.useCompression(Account.TYPE_MOBILE)); mCompressionMobile.setChecked(mAccount.useCompression(NetworkType.MOBILE));
mCompressionWifi.setChecked(mAccount.useCompression(Account.TYPE_WIFI)); mCompressionWifi.setChecked(mAccount.useCompression(NetworkType.WIFI));
mCompressionOther.setChecked(mAccount.useCompression(Account.TYPE_OTHER)); mCompressionOther.setChecked(mAccount.useCompression(NetworkType.OTHER));
if (settings.host != null) { if (settings.host != null) {
mServerView.setText(settings.host); mServerView.setText(settings.host);
@ -607,9 +609,9 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
mAccount.setStoreUri(RemoteStore.createStoreUri(settings)); mAccount.setStoreUri(RemoteStore.createStoreUri(settings));
mAccount.setCompression(Account.TYPE_MOBILE, mCompressionMobile.isChecked()); mAccount.setCompression(NetworkType.MOBILE, mCompressionMobile.isChecked());
mAccount.setCompression(Account.TYPE_WIFI, mCompressionWifi.isChecked()); mAccount.setCompression(NetworkType.WIFI, mCompressionWifi.isChecked());
mAccount.setCompression(Account.TYPE_OTHER, mCompressionOther.isChecked()); mAccount.setCompression(NetworkType.OTHER, mCompressionOther.isChecked());
mAccount.setSubscribedFoldersOnly(mSubscribedFoldersOnly.isChecked()); mAccount.setSubscribedFoldersOnly(mSubscribedFoldersOnly.isChecked());
AccountSetupCheckSettings.actionCheckSettings(this, mAccount, CheckDirection.INCOMING); AccountSetupCheckSettings.actionCheckSettings(this, mAccount, CheckDirection.INCOMING);

View File

@ -33,8 +33,8 @@ public class WelcomeMessage extends K9Activity implements OnClickListener{
welcome.setText(HtmlConverter.htmlToSpanned(getString(R.string.accounts_welcome))); welcome.setText(HtmlConverter.htmlToSpanned(getString(R.string.accounts_welcome)));
welcome.setMovementMethod(LinkMovementMethod.getInstance()); welcome.setMovementMethod(LinkMovementMethod.getInstance());
((Button) findViewById(R.id.next)).setOnClickListener(this); findViewById(R.id.next).setOnClickListener(this);
((Button) findViewById(R.id.import_settings)).setOnClickListener(this); findViewById(R.id.import_settings).setOnClickListener(this);
} }
@Override @Override

View File

@ -42,6 +42,8 @@ import android.text.style.TextAppearanceSpan;
import android.util.Log; import android.util.Log;
import com.fsck.k9.Account; import com.fsck.k9.Account;
import com.fsck.k9.Account.DeletePolicy;
import com.fsck.k9.Account.Expunge;
import com.fsck.k9.AccountStats; import com.fsck.k9.AccountStats;
import com.fsck.k9.K9; import com.fsck.k9.K9;
import com.fsck.k9.K9.NotificationHideSubject; import com.fsck.k9.K9.NotificationHideSubject;
@ -1007,7 +1009,7 @@ public class MessagingController implements Runnable {
Log.v(K9.LOG_TAG, "SYNC: About to open remote folder " + folder); Log.v(K9.LOG_TAG, "SYNC: About to open remote folder " + folder);
remoteFolder.open(Folder.OPEN_MODE_RW); remoteFolder.open(Folder.OPEN_MODE_RW);
if (Account.EXPUNGE_ON_POLL.equals(account.getExpungePolicy())) { if (Expunge.EXPUNGE_ON_POLL == account.getExpungePolicy()) {
if (K9.DEBUG) if (K9.DEBUG)
Log.d(K9.LOG_TAG, "SYNC: Expunging folder " + account.getDescription() + ":" + folder); Log.d(K9.LOG_TAG, "SYNC: Expunging folder " + account.getDescription() + ":" + folder);
remoteFolder.expunge(); remoteFolder.expunge();
@ -2124,7 +2126,7 @@ public class MessagingController implements Runnable {
} }
if (remoteDate != null) { if (remoteDate != null) {
remoteMessage.setFlag(Flag.DELETED, true); remoteMessage.setFlag(Flag.DELETED, true);
if (Account.EXPUNGE_IMMEDIATELY.equals(account.getExpungePolicy())) { if (Expunge.EXPUNGE_IMMEDIATELY == account.getExpungePolicy()) {
remoteFolder.expunge(); remoteFolder.expunge();
} }
} }
@ -2301,7 +2303,7 @@ public class MessagingController implements Runnable {
remoteUidMap = remoteSrcFolder.moveMessages(messages, remoteDestFolder); remoteUidMap = remoteSrcFolder.moveMessages(messages, remoteDestFolder);
} }
} }
if (!isCopy && Account.EXPUNGE_IMMEDIATELY.equals(account.getExpungePolicy())) { if (!isCopy && Expunge.EXPUNGE_IMMEDIATELY == account.getExpungePolicy()) {
if (K9.DEBUG) if (K9.DEBUG)
Log.i(K9.LOG_TAG, "processingPendingMoveOrCopy expunging folder " + account.getDescription() + ":" + srcFolder); Log.i(K9.LOG_TAG, "processingPendingMoveOrCopy expunging folder " + account.getDescription() + ":" + srcFolder);
@ -4060,14 +4062,14 @@ public class MessagingController implements Runnable {
queuePendingCommand(account, command); queuePendingCommand(account, command);
} }
processPendingCommands(account); processPendingCommands(account);
} else if (account.getDeletePolicy() == Account.DELETE_POLICY_ON_DELETE) { } else if (account.getDeletePolicy() == DeletePolicy.ON_DELETE) {
if (folder.equals(account.getTrashFolderName())) { if (folder.equals(account.getTrashFolderName())) {
queueSetFlag(account, folder, Boolean.toString(true), Flag.DELETED.toString(), uids); queueSetFlag(account, folder, Boolean.toString(true), Flag.DELETED.toString(), uids);
} else { } else {
queueMoveOrCopy(account, folder, account.getTrashFolderName(), false, uids, uidMap); queueMoveOrCopy(account, folder, account.getTrashFolderName(), false, uids, uidMap);
} }
processPendingCommands(account); processPendingCommands(account);
} else if (account.getDeletePolicy() == Account.DELETE_POLICY_MARK_AS_READ) { } else if (account.getDeletePolicy() == DeletePolicy.MARK_AS_READ) {
queueSetFlag(account, folder, Boolean.toString(true), Flag.SEEN.toString(), uids); queueSetFlag(account, folder, Boolean.toString(true), Flag.SEEN.toString(), uids);
processPendingCommands(account); processPendingCommands(account);
} else { } else {
@ -4105,7 +4107,7 @@ public class MessagingController implements Runnable {
if (remoteFolder.exists()) { if (remoteFolder.exists()) {
remoteFolder.open(Folder.OPEN_MODE_RW); remoteFolder.open(Folder.OPEN_MODE_RW);
remoteFolder.setFlags(Collections.singleton(Flag.DELETED), true); remoteFolder.setFlags(Collections.singleton(Flag.DELETED), true);
if (Account.EXPUNGE_IMMEDIATELY.equals(account.getExpungePolicy())) { if (Expunge.EXPUNGE_IMMEDIATELY == account.getExpungePolicy()) {
remoteFolder.expunge(); remoteFolder.expunge();
} }

View File

@ -2072,7 +2072,7 @@ public class MessageListFragment extends Fragment implements OnItemClickListener
} }
if (holder.from != null ) { if (holder.from != null ) {
holder.from.setTypeface(null, maybeBoldTypeface); holder.from.setTypeface(holder.from.getTypeface(), maybeBoldTypeface);
if (mSenderAboveSubject) { if (mSenderAboveSubject) {
holder.from.setCompoundDrawablesWithIntrinsicBounds( holder.from.setCompoundDrawablesWithIntrinsicBounds(
statusHolder, // left statusHolder, // left
@ -2095,7 +2095,7 @@ public class MessageListFragment extends Fragment implements OnItemClickListener
null); // bottom null); // bottom
} }
holder.subject.setTypeface(null, maybeBoldTypeface); holder.subject.setTypeface(holder.subject.getTypeface(), maybeBoldTypeface);
holder.subject.setText(subject); holder.subject.setText(subject);
} }

View File

@ -9,10 +9,16 @@ import java.util.TreeMap;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import com.fsck.k9.Account; import com.fsck.k9.Account;
import com.fsck.k9.Account.DeletePolicy;
import com.fsck.k9.Account.Expunge;
import com.fsck.k9.Account.FolderMode;
import com.fsck.k9.Account.MessageFormat;
import com.fsck.k9.Account.QuoteStyle;
import com.fsck.k9.Account.Searchable;
import com.fsck.k9.Account.ShowPictures;
import com.fsck.k9.Account.SortType; import com.fsck.k9.Account.SortType;
import com.fsck.k9.K9; import com.fsck.k9.K9;
import com.fsck.k9.R; import com.fsck.k9.R;
import com.fsck.k9.Account.FolderMode;
import com.fsck.k9.mailstore.StorageManager; import com.fsck.k9.mailstore.StorageManager;
import com.fsck.k9.preferences.Settings.*; import com.fsck.k9.preferences.Settings.*;
@ -56,7 +62,7 @@ public class AccountSettings {
new V(1, new BooleanSetting(Account.DEFAULT_QUOTED_TEXT_SHOWN)) new V(1, new BooleanSetting(Account.DEFAULT_QUOTED_TEXT_SHOWN))
)); ));
s.put("deletePolicy", Settings.versions( s.put("deletePolicy", Settings.versions(
new V(1, new DeletePolicySetting(Account.DELETE_POLICY_NEVER)) new V(1, new DeletePolicySetting(DeletePolicy.NEVER))
)); ));
s.put("displayCount", Settings.versions( s.put("displayCount", Settings.versions(
new V(1, new IntegerResourceSetting(K9.DEFAULT_VISIBLE_LIMIT, new V(1, new IntegerResourceSetting(K9.DEFAULT_VISIBLE_LIMIT,
@ -66,7 +72,7 @@ public class AccountSettings {
new V(1, new StringSetting("Drafts")) new V(1, new StringSetting("Drafts"))
)); ));
s.put("expungePolicy", Settings.versions( s.put("expungePolicy", Settings.versions(
new V(1, new StringResourceSetting(Account.EXPUNGE_IMMEDIATELY, new V(1, new StringResourceSetting(Expunge.EXPUNGE_IMMEDIATELY.name(),
R.array.account_setup_expunge_policy_values)) R.array.account_setup_expunge_policy_values))
)); ));
s.put("folderDisplayMode", Settings.versions( s.put("folderDisplayMode", Settings.versions(
@ -114,8 +120,8 @@ public class AccountSettings {
R.array.account_settings_message_age_values)) R.array.account_settings_message_age_values))
)); ));
s.put("messageFormat", Settings.versions( s.put("messageFormat", Settings.versions(
new V(1, new EnumSetting<Account.MessageFormat>( new V(1, new EnumSetting<MessageFormat>(
Account.MessageFormat.class, Account.DEFAULT_MESSAGE_FORMAT)) MessageFormat.class, Account.DEFAULT_MESSAGE_FORMAT))
)); ));
s.put("messageFormatAuto", Settings.versions( s.put("messageFormatAuto", Settings.versions(
new V(2, new BooleanSetting(Account.DEFAULT_MESSAGE_FORMAT_AUTO)) new V(2, new BooleanSetting(Account.DEFAULT_MESSAGE_FORMAT_AUTO))
@ -142,8 +148,8 @@ public class AccountSettings {
new V(1, new StringSetting(Account.DEFAULT_QUOTE_PREFIX)) new V(1, new StringSetting(Account.DEFAULT_QUOTE_PREFIX))
)); ));
s.put("quoteStyle", Settings.versions( s.put("quoteStyle", Settings.versions(
new V(1, new EnumSetting<Account.QuoteStyle>( new V(1, new EnumSetting<QuoteStyle>(
Account.QuoteStyle.class, Account.DEFAULT_QUOTE_STYLE)) QuoteStyle.class, Account.DEFAULT_QUOTE_STYLE))
)); ));
s.put("replyAfterQuote", Settings.versions( s.put("replyAfterQuote", Settings.versions(
new V(1, new BooleanSetting(Account.DEFAULT_REPLY_AFTER_QUOTE)) new V(1, new BooleanSetting(Account.DEFAULT_REPLY_AFTER_QUOTE))
@ -155,8 +161,8 @@ public class AccountSettings {
new V(1, new RingtoneSetting("content://settings/system/notification_sound")) new V(1, new RingtoneSetting("content://settings/system/notification_sound"))
)); ));
s.put("searchableFolders", Settings.versions( s.put("searchableFolders", Settings.versions(
new V(1, new EnumSetting<Account.Searchable>( new V(1, new EnumSetting<Searchable>(
Account.Searchable.class, Account.Searchable.ALL)) Searchable.class, Searchable.ALL))
)); ));
s.put("sentFolderName", Settings.versions( s.put("sentFolderName", Settings.versions(
new V(1, new StringSetting("Sent")) new V(1, new StringSetting("Sent"))
@ -168,8 +174,8 @@ public class AccountSettings {
new V(9, new BooleanSetting(Account.DEFAULT_SORT_ASCENDING)) new V(9, new BooleanSetting(Account.DEFAULT_SORT_ASCENDING))
)); ));
s.put("showPicturesEnum", Settings.versions( s.put("showPicturesEnum", Settings.versions(
new V(1, new EnumSetting<Account.ShowPictures>( new V(1, new EnumSetting<ShowPictures>(
Account.ShowPictures.class, Account.ShowPictures.NEVER)) ShowPictures.class, ShowPictures.NEVER))
)); ));
s.put("signatureBeforeQuotedText", Settings.versions( s.put("signatureBeforeQuotedText", Settings.versions(
new V(1, new BooleanSetting(false)) new V(1, new BooleanSetting(false))
@ -363,18 +369,15 @@ public class AccountSettings {
} }
} }
/**
* The delete policy setting.
*/
public static class DeletePolicySetting extends PseudoEnumSetting<Integer> { public static class DeletePolicySetting extends PseudoEnumSetting<Integer> {
private Map<Integer, String> mMapping; private Map<Integer, String> mMapping;
public DeletePolicySetting(int defaultValue) { public DeletePolicySetting(DeletePolicy defaultValue) {
super(defaultValue); super(defaultValue);
Map<Integer, String> mapping = new HashMap<Integer, String>(); Map<Integer, String> mapping = new HashMap<Integer, String>();
mapping.put(Account.DELETE_POLICY_NEVER, "NEVER"); mapping.put(DeletePolicy.NEVER.setting, "NEVER");
mapping.put(Account.DELETE_POLICY_ON_DELETE, "DELETE"); mapping.put(DeletePolicy.ON_DELETE.setting, "DELETE");
mapping.put(Account.DELETE_POLICY_MARK_AS_READ, "MARK_AS_READ"); mapping.put(DeletePolicy.MARK_AS_READ.setting, "MARK_AS_READ");
mMapping = Collections.unmodifiableMap(mapping); mMapping = Collections.unmodifiableMap(mapping);
} }

View File

@ -15,6 +15,7 @@ import android.os.ParcelFileDescriptor;
import android.util.Log; import android.util.Log;
import com.fsck.k9.Account; import com.fsck.k9.Account;
import com.fsck.k9.BuildConfig;
import com.fsck.k9.K9; import com.fsck.k9.K9;
import com.fsck.k9.Preferences; import com.fsck.k9.Preferences;
import com.fsck.k9.mail.MessagingException; import com.fsck.k9.mail.MessagingException;
@ -28,7 +29,8 @@ import org.openintents.openpgp.util.ParcelFileDescriptorUtil;
* A simple ContentProvider that allows file access to attachments. * A simple ContentProvider that allows file access to attachments.
*/ */
public class AttachmentProvider extends ContentProvider { public class AttachmentProvider extends ContentProvider {
public static final Uri CONTENT_URI = Uri.parse("content://com.fsck.k9.attachmentprovider"); private static final String AUTHORITY = BuildConfig.APPLICATION_ID + ".attachmentprovider";
public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY);
private static final String[] DEFAULT_PROJECTION = new String[] { private static final String[] DEFAULT_PROJECTION = new String[] {
AttachmentProviderColumns._ID, AttachmentProviderColumns._ID,

View File

@ -6,6 +6,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import com.fsck.k9.Account; import com.fsck.k9.Account;
import com.fsck.k9.BuildConfig;
import com.fsck.k9.Preferences; import com.fsck.k9.Preferences;
import com.fsck.k9.cache.EmailProviderCacheCursor; import com.fsck.k9.cache.EmailProviderCacheCursor;
import com.fsck.k9.helper.Utility; import com.fsck.k9.helper.Utility;
@ -43,7 +44,7 @@ import android.text.TextUtils;
public class EmailProvider extends ContentProvider { public class EmailProvider extends ContentProvider {
private static final UriMatcher sUriMatcher = new UriMatcher(UriMatcher.NO_MATCH); private static final UriMatcher sUriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
public static final String AUTHORITY = "com.fsck.k9.provider.email"; public static final String AUTHORITY = BuildConfig.APPLICATION_ID +".provider.email";
public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY); public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY);

View File

@ -21,6 +21,7 @@ import android.util.Log;
import com.fsck.k9.Account; import com.fsck.k9.Account;
import com.fsck.k9.AccountStats; import com.fsck.k9.AccountStats;
import com.fsck.k9.BuildConfig;
import com.fsck.k9.K9; import com.fsck.k9.K9;
import com.fsck.k9.Preferences; import com.fsck.k9.Preferences;
import com.fsck.k9.activity.FolderInfoHolder; import com.fsck.k9.activity.FolderInfoHolder;
@ -940,7 +941,7 @@ public class MessageProvider extends ContentProvider {
} }
} }
public static final String AUTHORITY = "com.fsck.k9.messageprovider"; public static final String AUTHORITY = BuildConfig.APPLICATION_ID + ".messageprovider";
public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY); public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY);

View File

@ -5,6 +5,8 @@ import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import com.fsck.k9.BuildConfig;
/** /**
* Utillity definitions for Android applications to control the behavior of K-9 Mail. All such applications must declare the following permission: * Utillity definitions for Android applications to control the behavior of K-9 Mail. All such applications must declare the following permission:
* <uses-permission android:name="com.fsck.k9.permission.REMOTE_CONTROL"/> * <uses-permission android:name="com.fsck.k9.permission.REMOTE_CONTROL"/>
@ -24,14 +26,14 @@ public class K9RemoteControl {
* Permission that every application sending a broadcast to K-9 for Remote Control purposes should send on every broadcast. * Permission that every application sending a broadcast to K-9 for Remote Control purposes should send on every broadcast.
* Prevent other applications from intercepting the broadcasts. * Prevent other applications from intercepting the broadcasts.
*/ */
public final static String K9_REMOTE_CONTROL_PERMISSION = "com.fsck.k9.permission.REMOTE_CONTROL"; public final static String K9_REMOTE_CONTROL_PERMISSION = BuildConfig.APPLICATION_ID + ".permission.REMOTE_CONTROL";
/** /**
* {@link Intent} Action to be sent to K-9 using {@link ContextWrapper.sendOrderedBroadcast} in order to fetch the list of configured Accounts. * {@link Intent} Action to be sent to K-9 using {@link ContextWrapper.sendOrderedBroadcast} in order to fetch the list of configured Accounts.
* The responseData will contain two String[] with keys K9_ACCOUNT_UUIDS and K9_ACCOUNT_DESCRIPTIONS * The responseData will contain two String[] with keys K9_ACCOUNT_UUIDS and K9_ACCOUNT_DESCRIPTIONS
*/ */
public final static String K9_REQUEST_ACCOUNTS = "com.fsck.k9.K9RemoteControl.requestAccounts"; public final static String K9_REQUEST_ACCOUNTS = BuildConfig.APPLICATION_ID + ".K9RemoteControl.requestAccounts";
public final static String K9_ACCOUNT_UUIDS = "com.fsck.k9.K9RemoteControl.accountUuids"; public final static String K9_ACCOUNT_UUIDS = BuildConfig.APPLICATION_ID + ".K9RemoteControl.accountUuids";
public final static String K9_ACCOUNT_DESCRIPTIONS = "com.fsck.k9.K9RemoteControl.accountDescriptions"; public final static String K9_ACCOUNT_DESCRIPTIONS = BuildConfig.APPLICATION_ID + ".K9RemoteControl.accountDescriptions";
/** /**
* The {@link {@link Intent}} Action to set in order to cause K-9 to check mail. (Not yet implemented) * The {@link {@link Intent}} Action to set in order to cause K-9 to check mail. (Not yet implemented)
@ -41,17 +43,17 @@ public class K9RemoteControl {
/** /**
* The {@link {@link Intent}} Action to set when remotely changing K-9 Mail settings * The {@link {@link Intent}} Action to set when remotely changing K-9 Mail settings
*/ */
public final static String K9_SET = "com.fsck.k9.K9RemoteControl.set"; public final static String K9_SET = BuildConfig.APPLICATION_ID + ".K9RemoteControl.set";
/** /**
* The key of the {@link Intent} Extra to set to hold the UUID of a single Account's settings to change. Used only if K9_ALL_ACCOUNTS * The key of the {@link Intent} Extra to set to hold the UUID of a single Account's settings to change. Used only if K9_ALL_ACCOUNTS
* is absent or false. * is absent or false.
*/ */
public final static String K9_ACCOUNT_UUID = "com.fsck.k9.K9RemoteControl.accountUuid"; public final static String K9_ACCOUNT_UUID = BuildConfig.APPLICATION_ID + ".K9RemoteControl.accountUuid";
/** /**
* The key of the {@link Intent} Extra to set to control if the settings will apply to all Accounts, or to the one * The key of the {@link Intent} Extra to set to control if the settings will apply to all Accounts, or to the one
* specified with K9_ACCOUNT_UUID * specified with K9_ACCOUNT_UUID
*/ */
public final static String K9_ALL_ACCOUNTS = "com.fsck.k9.K9RemoteControl.allAccounts"; public final static String K9_ALL_ACCOUNTS = BuildConfig.APPLICATION_ID + ".K9RemoteControl.allAccounts";
public final static String K9_ENABLED = "true"; public final static String K9_ENABLED = "true";
public final static String K9_DISABLED = "false"; public final static String K9_DISABLED = "false";
@ -60,17 +62,17 @@ public class K9RemoteControl {
* Key for the {@link Intent} Extra for controlling whether notifications will be generated for new unread mail. * Key for the {@link Intent} Extra for controlling whether notifications will be generated for new unread mail.
* Acceptable values are K9_ENABLED and K9_DISABLED * Acceptable values are K9_ENABLED and K9_DISABLED
*/ */
public final static String K9_NOTIFICATION_ENABLED = "com.fsck.k9.K9RemoteControl.notificationEnabled"; public final static String K9_NOTIFICATION_ENABLED = BuildConfig.APPLICATION_ID + ".K9RemoteControl.notificationEnabled";
/* /*
* Key for the {@link Intent} Extra for controlling whether K-9 will sound the ringtone for new unread mail. * Key for the {@link Intent} Extra for controlling whether K-9 will sound the ringtone for new unread mail.
* Acceptable values are K9_ENABLED and K9_DISABLED * Acceptable values are K9_ENABLED and K9_DISABLED
*/ */
public final static String K9_RING_ENABLED = "com.fsck.k9.K9RemoteControl.ringEnabled"; public final static String K9_RING_ENABLED = BuildConfig.APPLICATION_ID + ".K9RemoteControl.ringEnabled";
/* /*
* Key for the {@link Intent} Extra for controlling whether K-9 will activate the vibrator for new unread mail. * Key for the {@link Intent} Extra for controlling whether K-9 will activate the vibrator for new unread mail.
* Acceptable values are K9_ENABLED and K9_DISABLED * Acceptable values are K9_ENABLED and K9_DISABLED
*/ */
public final static String K9_VIBRATE_ENABLED = "com.fsck.k9.K9RemoteControl.vibrateEnabled"; public final static String K9_VIBRATE_ENABLED = BuildConfig.APPLICATION_ID + ".K9RemoteControl.vibrateEnabled";
public final static String K9_FOLDERS_NONE = "NONE"; public final static String K9_FOLDERS_NONE = "NONE";
public final static String K9_FOLDERS_ALL = "ALL"; public final static String K9_FOLDERS_ALL = "ALL";
@ -82,27 +84,27 @@ public class K9RemoteControl {
* Acceptable values are K9_FOLDERS_ALL, K9_FOLDERS_FIRST_CLASS, K9_FOLDERS_FIRST_AND_SECOND_CLASS, * Acceptable values are K9_FOLDERS_ALL, K9_FOLDERS_FIRST_CLASS, K9_FOLDERS_FIRST_AND_SECOND_CLASS,
* K9_FOLDERS_NOT_SECOND_CLASS, K9_FOLDERS_NONE * K9_FOLDERS_NOT_SECOND_CLASS, K9_FOLDERS_NONE
*/ */
public final static String K9_PUSH_CLASSES = "com.fsck.k9.K9RemoteControl.pushClasses"; public final static String K9_PUSH_CLASSES = BuildConfig.APPLICATION_ID + ".K9RemoteControl.pushClasses";
/** /**
* Key for the {@link Intent} Extra to set for controlling which folders to be synchronized with Poll. * Key for the {@link Intent} Extra to set for controlling which folders to be synchronized with Poll.
* Acceptable values are K9_FOLDERS_ALL, K9_FOLDERS_FIRST_CLASS, K9_FOLDERS_FIRST_AND_SECOND_CLASS, * Acceptable values are K9_FOLDERS_ALL, K9_FOLDERS_FIRST_CLASS, K9_FOLDERS_FIRST_AND_SECOND_CLASS,
* K9_FOLDERS_NOT_SECOND_CLASS, K9_FOLDERS_NONE * K9_FOLDERS_NOT_SECOND_CLASS, K9_FOLDERS_NONE
*/ */
public final static String K9_POLL_CLASSES = "com.fsck.k9.K9RemoteControl.pollClasses"; public final static String K9_POLL_CLASSES = BuildConfig.APPLICATION_ID + ".K9RemoteControl.pollClasses";
public final static String[] K9_POLL_FREQUENCIES = { "-1", "1", "5", "10", "15", "30", "60", "120", "180", "360", "720", "1440"}; public final static String[] K9_POLL_FREQUENCIES = { "-1", "1", "5", "10", "15", "30", "60", "120", "180", "360", "720", "1440"};
/** /**
* Key for the {@link Intent} Extra to set with the desired poll frequency. The value is a String representing a number of minutes. * Key for the {@link Intent} Extra to set with the desired poll frequency. The value is a String representing a number of minutes.
* Acceptable values are available in K9_POLL_FREQUENCIES * Acceptable values are available in K9_POLL_FREQUENCIES
*/ */
public final static String K9_POLL_FREQUENCY = "com.fsck.k9.K9RemoteControl.pollFrequency"; public final static String K9_POLL_FREQUENCY = BuildConfig.APPLICATION_ID + ".K9RemoteControl.pollFrequency";
/** /**
* Key for the {@link Intent} Extra to set for controlling K-9's global "Background sync" setting. * Key for the {@link Intent} Extra to set for controlling K-9's global "Background sync" setting.
* Acceptable values are K9_BACKGROUND_OPERATIONS_ALWAYS, K9_BACKGROUND_OPERATIONS_NEVER * Acceptable values are K9_BACKGROUND_OPERATIONS_ALWAYS, K9_BACKGROUND_OPERATIONS_NEVER
* K9_BACKGROUND_OPERATIONS_WHEN_CHECKED_AUTO_SYNC * K9_BACKGROUND_OPERATIONS_WHEN_CHECKED_AUTO_SYNC
*/ */
public final static String K9_BACKGROUND_OPERATIONS = "com.fsck.k9.K9RemoteControl.backgroundOperations"; public final static String K9_BACKGROUND_OPERATIONS = BuildConfig.APPLICATION_ID + ".K9RemoteControl.backgroundOperations";
public final static String K9_BACKGROUND_OPERATIONS_ALWAYS = "ALWAYS"; public final static String K9_BACKGROUND_OPERATIONS_ALWAYS = "ALWAYS";
public final static String K9_BACKGROUND_OPERATIONS_NEVER = "NEVER"; public final static String K9_BACKGROUND_OPERATIONS_NEVER = "NEVER";
public final static String K9_BACKGROUND_OPERATIONS_WHEN_CHECKED_AUTO_SYNC = "WHEN_CHECKED_AUTO_SYNC"; public final static String K9_BACKGROUND_OPERATIONS_WHEN_CHECKED_AUTO_SYNC = "WHEN_CHECKED_AUTO_SYNC";
@ -111,7 +113,7 @@ public class K9RemoteControl {
* Key for the {@link Intent} Extra to set for controlling which display theme K-9 will use. Acceptable values are * Key for the {@link Intent} Extra to set for controlling which display theme K-9 will use. Acceptable values are
* K9_THEME_LIGHT, K9_THEME_DARK * K9_THEME_LIGHT, K9_THEME_DARK
*/ */
public final static String K9_THEME = "com.fsck.k9.K9RemoteControl.theme"; public final static String K9_THEME = BuildConfig.APPLICATION_ID + ".K9RemoteControl.theme";
public final static String K9_THEME_LIGHT = "LIGHT"; public final static String K9_THEME_LIGHT = "LIGHT";
public final static String K9_THEME_DARK = "DARK"; public final static String K9_THEME_DARK = "DARK";

View File

@ -163,8 +163,7 @@ public class MailService extends CoreService {
} }
private void cancel() { private void cancel() {
Intent i = new Intent(); Intent i = new Intent(this, MailService.class);
i.setClassName(getApplication().getPackageName(), "com.fsck.k9.service.MailService");
i.setAction(ACTION_CHECK_MAIL); i.setAction(ACTION_CHECK_MAIL);
BootReceiver.cancelIntent(this, i); BootReceiver.cancelIntent(this, i);
} }
@ -304,8 +303,7 @@ public class MailService extends CoreService {
Log.e(K9.LOG_TAG, "Exception while logging", e); Log.e(K9.LOG_TAG, "Exception while logging", e);
} }
Intent i = new Intent(); Intent i = new Intent(this, MailService.class);
i.setClassName(getApplication().getPackageName(), "com.fsck.k9.service.MailService");
i.setAction(ACTION_CHECK_MAIL); i.setAction(ACTION_CHECK_MAIL);
BootReceiver.scheduleIntent(MailService.this, nextTime, i); BootReceiver.scheduleIntent(MailService.this, nextTime, i);
} }
@ -410,8 +408,7 @@ public class MailService extends CoreService {
long nextTime = System.currentTimeMillis() + minInterval; long nextTime = System.currentTimeMillis() + minInterval;
if (K9.DEBUG) if (K9.DEBUG)
Log.d(K9.LOG_TAG, "Next pusher refresh scheduled for " + new Date(nextTime)); Log.d(K9.LOG_TAG, "Next pusher refresh scheduled for " + new Date(nextTime));
Intent i = new Intent(); Intent i = new Intent(this, MailService.class);
i.setClassName(getApplication().getPackageName(), "com.fsck.k9.service.MailService");
i.setAction(ACTION_REFRESH_PUSHERS); i.setAction(ACTION_REFRESH_PUSHERS);
BootReceiver.scheduleIntent(MailService.this, nextTime, i); BootReceiver.scheduleIntent(MailService.this, nextTime, i);
} }

View File

@ -134,15 +134,13 @@ public class RemoteControlService extends CoreService {
editor.commit(); editor.commit();
if (needsReschedule) { if (needsReschedule) {
Intent i = new Intent(); Intent i = new Intent(RemoteControlService.this, RemoteControlService.class);
i.setClassName(getApplication().getPackageName(), "com.fsck.k9.service.RemoteControlService");
i.setAction(RESCHEDULE_ACTION); i.setAction(RESCHEDULE_ACTION);
long nextTime = System.currentTimeMillis() + 10000; long nextTime = System.currentTimeMillis() + 10000;
BootReceiver.scheduleIntent(RemoteControlService.this, nextTime, i); BootReceiver.scheduleIntent(RemoteControlService.this, nextTime, i);
} }
if (needsPushRestart) { if (needsPushRestart) {
Intent i = new Intent(); Intent i = new Intent(RemoteControlService.this, RemoteControlService.class);
i.setClassName(getApplication().getPackageName(), "com.fsck.k9.service.RemoteControlService");
i.setAction(PUSH_RESTART_ACTION); i.setAction(PUSH_RESTART_ACTION);
long nextTime = System.currentTimeMillis() + 10000; long nextTime = System.currentTimeMillis() + 10000;
BootReceiver.scheduleIntent(RemoteControlService.this, nextTime, i); BootReceiver.scheduleIntent(RemoteControlService.this, nextTime, i);

View File

@ -31,8 +31,7 @@ public class SleepService extends CoreService {
sleepDatum.reacquireLatch = new CountDownLatch(1); sleepDatum.reacquireLatch = new CountDownLatch(1);
sleepData.put(id, sleepDatum); sleepData.put(id, sleepDatum);
Intent i = new Intent(); Intent i = new Intent(context, SleepService.class);
i.setClassName(context.getPackageName(), "com.fsck.k9.service.SleepService");
i.putExtra(LATCH_ID, id); i.putExtra(LATCH_ID, id);
i.setAction(ALARM_FIRED + "." + id); i.setAction(ALARM_FIRED + "." + id);
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();

View File

@ -17,7 +17,7 @@
android:id="@+id/manual_setup" android:id="@+id/manual_setup"
style="?android:attr/buttonBarButtonStyle" style="?android:attr/buttonBarButtonStyle"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:background="@drawable/selectable_item_background" android:background="@drawable/selectable_item_background"
android:text="@string/account_setup_basics_manual_setup_action" /> android:text="@string/account_setup_basics_manual_setup_action" />
@ -26,7 +26,7 @@
android:id="@+id/next" android:id="@+id/next"
style="?android:attr/buttonBarButtonStyle" style="?android:attr/buttonBarButtonStyle"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:background="@drawable/selectable_item_background" android:background="@drawable/selectable_item_background"
android:text="@string/next_action" /> android:text="@string/next_action" />

View File

@ -17,7 +17,7 @@
android:id="@+id/import_settings" android:id="@+id/import_settings"
style="?android:attr/buttonBarButtonStyle" style="?android:attr/buttonBarButtonStyle"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:background="@drawable/selectable_item_background" android:background="@drawable/selectable_item_background"
android:text="@string/settings_import" /> android:text="@string/settings_import" />
@ -26,7 +26,7 @@
android:id="@+id/next" android:id="@+id/next"
style="?android:attr/buttonBarButtonStyle" style="?android:attr/buttonBarButtonStyle"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:background="@drawable/selectable_item_background" android:background="@drawable/selectable_item_background"
android:text="@string/next_action" /> android:text="@string/next_action" />