mirror of
https://github.com/moparisthebest/k-9
synced 2024-12-12 02:42:18 -05:00
Make collections immutable
This commit is contained in:
parent
0920b0c14d
commit
060d21db3e
@ -18,75 +18,73 @@ public class AccountSettings {
|
|||||||
public static final Map<String, SettingsDescription> SETTINGS;
|
public static final Map<String, SettingsDescription> SETTINGS;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
SETTINGS = new LinkedHashMap<String, SettingsDescription>();
|
Map<String, SettingsDescription> s = new LinkedHashMap<String, SettingsDescription>();
|
||||||
|
|
||||||
SETTINGS.put("archiveFolderName", new StringSetting("Archive"));
|
s.put("archiveFolderName", new StringSetting("Archive"));
|
||||||
SETTINGS.put("autoExpandFolderName", new StringSetting("INBOX"));
|
s.put("autoExpandFolderName", new StringSetting("INBOX"));
|
||||||
SETTINGS.put("automaticCheckIntervalMinutes",
|
s.put("automaticCheckIntervalMinutes",
|
||||||
new IntegerResourceSetting(-1, R.array.account_settings_check_frequency_values));
|
new IntegerResourceSetting(-1, R.array.account_settings_check_frequency_values));
|
||||||
SETTINGS.put("chipColor", new ColorSetting(0xFF0000FF));
|
s.put("chipColor", new ColorSetting(0xFF0000FF));
|
||||||
SETTINGS.put("cryptoApp", new StringSetting(Apg.NAME));
|
s.put("cryptoApp", new StringSetting(Apg.NAME));
|
||||||
SETTINGS.put("cryptoAutoSignature", new BooleanSetting(false));
|
s.put("cryptoAutoSignature", new BooleanSetting(false));
|
||||||
SETTINGS.put("deletePolicy", new DeletePolicySetting(Account.DELETE_POLICY_NEVER));
|
s.put("deletePolicy", new DeletePolicySetting(Account.DELETE_POLICY_NEVER));
|
||||||
SETTINGS.put("displayCount", new IntegerResourceSetting(K9.DEFAULT_VISIBLE_LIMIT,
|
s.put("displayCount", new IntegerResourceSetting(K9.DEFAULT_VISIBLE_LIMIT,
|
||||||
R.array.account_settings_display_count_values));
|
R.array.account_settings_display_count_values));
|
||||||
SETTINGS.put("draftsFolderName", new StringSetting("Drafts"));
|
s.put("draftsFolderName", new StringSetting("Drafts"));
|
||||||
SETTINGS.put("enableMoveButtons", new BooleanSetting(false));
|
s.put("enableMoveButtons", new BooleanSetting(false));
|
||||||
SETTINGS.put("expungePolicy", new StringResourceSetting(Account.EXPUNGE_IMMEDIATELY,
|
s.put("expungePolicy", new StringResourceSetting(Account.EXPUNGE_IMMEDIATELY,
|
||||||
R.array.account_setup_expunge_policy_values));
|
R.array.account_setup_expunge_policy_values));
|
||||||
SETTINGS.put("folderDisplayMode",
|
s.put("folderDisplayMode", new EnumSetting(FolderMode.class, FolderMode.NOT_SECOND_CLASS));
|
||||||
new EnumSetting(FolderMode.class, FolderMode.NOT_SECOND_CLASS));
|
s.put("folderPushMode", new EnumSetting(FolderMode.class, FolderMode.FIRST_CLASS));
|
||||||
SETTINGS.put("folderPushMode", new EnumSetting(FolderMode.class, FolderMode.FIRST_CLASS));
|
s.put("folderSyncMode", new EnumSetting(FolderMode.class, FolderMode.FIRST_CLASS));
|
||||||
SETTINGS.put("folderSyncMode", new EnumSetting(FolderMode.class, FolderMode.FIRST_CLASS));
|
s.put("folderTargetMode", new EnumSetting(FolderMode.class, FolderMode.NOT_SECOND_CLASS));
|
||||||
SETTINGS.put("folderTargetMode",
|
s.put("goToUnreadMessageSearch", new BooleanSetting(false));
|
||||||
new EnumSetting(FolderMode.class, FolderMode.NOT_SECOND_CLASS));
|
s.put("hideButtonsEnum", new EnumSetting(ScrollButtons.class, ScrollButtons.NEVER));
|
||||||
SETTINGS.put("goToUnreadMessageSearch", new BooleanSetting(false));
|
s.put("hideMoveButtonsEnum", new EnumSetting(ScrollButtons.class, ScrollButtons.NEVER));
|
||||||
SETTINGS.put("hideButtonsEnum", new EnumSetting(ScrollButtons.class, ScrollButtons.NEVER));
|
s.put("idleRefreshMinutes", new IntegerResourceSetting(24,
|
||||||
SETTINGS.put("hideMoveButtonsEnum",
|
|
||||||
new EnumSetting(ScrollButtons.class, ScrollButtons.NEVER));
|
|
||||||
SETTINGS.put("idleRefreshMinutes", new IntegerResourceSetting(24,
|
|
||||||
R.array.idle_refresh_period_values));
|
R.array.idle_refresh_period_values));
|
||||||
SETTINGS.put("led", new BooleanSetting(true));
|
s.put("led", new BooleanSetting(true));
|
||||||
SETTINGS.put("ledColor", new ColorSetting(0xFF0000FF));
|
s.put("ledColor", new ColorSetting(0xFF0000FF));
|
||||||
SETTINGS.put("localStorageProvider", new StorageProviderSetting());
|
s.put("localStorageProvider", new StorageProviderSetting());
|
||||||
SETTINGS.put("maxPushFolders", new IntegerRangeSetting(0, 100, 10));
|
s.put("maxPushFolders", new IntegerRangeSetting(0, 100, 10));
|
||||||
SETTINGS.put("maximumAutoDownloadMessageSize", new IntegerResourceSetting(32768,
|
s.put("maximumAutoDownloadMessageSize", new IntegerResourceSetting(32768,
|
||||||
R.array.account_settings_autodownload_message_size_values));
|
R.array.account_settings_autodownload_message_size_values));
|
||||||
SETTINGS.put("maximumPolledMessageAge", new IntegerResourceSetting(-1,
|
s.put("maximumPolledMessageAge", new IntegerResourceSetting(-1,
|
||||||
R.array.account_settings_message_age_values));
|
R.array.account_settings_message_age_values));
|
||||||
SETTINGS.put("messageFormat",
|
s.put("messageFormat",
|
||||||
new EnumSetting(Account.MessageFormat.class, Account.DEFAULT_MESSAGE_FORMAT));
|
new EnumSetting(Account.MessageFormat.class, Account.DEFAULT_MESSAGE_FORMAT));
|
||||||
SETTINGS.put("notificationUnreadCount", new BooleanSetting(true));
|
s.put("notificationUnreadCount", new BooleanSetting(true));
|
||||||
SETTINGS.put("notifyMailCheck", new BooleanSetting(false));
|
s.put("notifyMailCheck", new BooleanSetting(false));
|
||||||
SETTINGS.put("notifyNewMail", new BooleanSetting(false));
|
s.put("notifyNewMail", new BooleanSetting(false));
|
||||||
SETTINGS.put("notifySelfNewMail", new BooleanSetting(true));
|
s.put("notifySelfNewMail", new BooleanSetting(true));
|
||||||
SETTINGS.put("pushPollOnConnect", new BooleanSetting(true));
|
s.put("pushPollOnConnect", new BooleanSetting(true));
|
||||||
SETTINGS.put("quotePrefix", new StringSetting(Account.DEFAULT_QUOTE_PREFIX));
|
s.put("quotePrefix", new StringSetting(Account.DEFAULT_QUOTE_PREFIX));
|
||||||
SETTINGS.put("quoteStyle",
|
s.put("quoteStyle",
|
||||||
new EnumSetting(Account.QuoteStyle.class, Account.DEFAULT_QUOTE_STYLE));
|
new EnumSetting(Account.QuoteStyle.class, Account.DEFAULT_QUOTE_STYLE));
|
||||||
SETTINGS.put("replyAfterQuote", new BooleanSetting(Account.DEFAULT_REPLY_AFTER_QUOTE));
|
s.put("replyAfterQuote", new BooleanSetting(Account.DEFAULT_REPLY_AFTER_QUOTE));
|
||||||
SETTINGS.put("ring", new BooleanSetting(true));
|
s.put("ring", new BooleanSetting(true));
|
||||||
SETTINGS.put("ringtone",
|
s.put("ringtone", new RingtoneSetting("content://settings/system/notification_sound"));
|
||||||
new RingtoneSetting("content://settings/system/notification_sound"));
|
s.put("saveAllHeaders", new BooleanSetting(true));
|
||||||
SETTINGS.put("saveAllHeaders", new BooleanSetting(true));
|
s.put("searchableFolders",
|
||||||
SETTINGS.put("searchableFolders",
|
|
||||||
new EnumSetting(Account.Searchable.class, Account.Searchable.ALL));
|
new EnumSetting(Account.Searchable.class, Account.Searchable.ALL));
|
||||||
SETTINGS.put("sentFolderName", new StringSetting("Sent"));
|
s.put("sentFolderName", new StringSetting("Sent"));
|
||||||
SETTINGS.put("showPicturesEnum",
|
s.put("showPicturesEnum",
|
||||||
new EnumSetting(Account.ShowPictures.class, Account.ShowPictures.NEVER));
|
new EnumSetting(Account.ShowPictures.class, Account.ShowPictures.NEVER));
|
||||||
SETTINGS.put("signatureBeforeQuotedText", new BooleanSetting(false));
|
s.put("signatureBeforeQuotedText", new BooleanSetting(false));
|
||||||
SETTINGS.put("spamFolderName", new StringSetting("Spam"));
|
s.put("spamFolderName", new StringSetting("Spam"));
|
||||||
SETTINGS.put("subscribedFoldersOnly", new BooleanSetting(false));
|
s.put("subscribedFoldersOnly", new BooleanSetting(false));
|
||||||
SETTINGS.put("syncRemoteDeletions", new BooleanSetting(true));
|
s.put("syncRemoteDeletions", new BooleanSetting(true));
|
||||||
SETTINGS.put("trashFolderName", new StringSetting("Trash"));
|
s.put("trashFolderName", new StringSetting("Trash"));
|
||||||
SETTINGS.put("useCompression.MOBILE", new BooleanSetting(true));
|
s.put("useCompression.MOBILE", new BooleanSetting(true));
|
||||||
SETTINGS.put("useCompression.OTHER", new BooleanSetting(true));
|
s.put("useCompression.OTHER", new BooleanSetting(true));
|
||||||
SETTINGS.put("useCompression.WIFI", new BooleanSetting(true));
|
s.put("useCompression.WIFI", new BooleanSetting(true));
|
||||||
SETTINGS.put("vibrate", new BooleanSetting(false));
|
s.put("vibrate", new BooleanSetting(false));
|
||||||
SETTINGS.put("vibratePattern", new IntegerResourceSetting(0,
|
s.put("vibratePattern", new IntegerResourceSetting(0,
|
||||||
R.array.account_settings_vibrate_pattern_values));
|
R.array.account_settings_vibrate_pattern_values));
|
||||||
SETTINGS.put("vibrateTimes", new IntegerResourceSetting(5,
|
s.put("vibrateTimes", new IntegerResourceSetting(5,
|
||||||
R.array.account_settings_vibrate_times_label));
|
R.array.account_settings_vibrate_times_label));
|
||||||
|
|
||||||
|
SETTINGS = Collections.unmodifiableMap(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Map<String, String> validate(Map<String, String> importedSettings,
|
public static Map<String, String> validate(Map<String, String> importedSettings,
|
||||||
|
@ -16,60 +16,61 @@ public class GlobalSettings {
|
|||||||
public static final Map<String, SettingsDescription> SETTINGS;
|
public static final Map<String, SettingsDescription> SETTINGS;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
SETTINGS = new LinkedHashMap<String, SettingsDescription>();
|
Map<String, SettingsDescription> s = new LinkedHashMap<String, SettingsDescription>();
|
||||||
|
|
||||||
SETTINGS.put("animations", new BooleanSetting(false));
|
s.put("animations", new BooleanSetting(false));
|
||||||
SETTINGS.put("backgroundOperations",
|
s.put("backgroundOperations",
|
||||||
new EnumSetting(K9.BACKGROUND_OPS.class, K9.BACKGROUND_OPS.WHEN_CHECKED));
|
new EnumSetting(K9.BACKGROUND_OPS.class, K9.BACKGROUND_OPS.WHEN_CHECKED));
|
||||||
SETTINGS.put("changeRegisteredNameColor", new BooleanSetting(false));
|
s.put("changeRegisteredNameColor", new BooleanSetting(false));
|
||||||
SETTINGS.put("compactLayouts", new BooleanSetting(false));
|
s.put("compactLayouts", new BooleanSetting(false));
|
||||||
SETTINGS.put("confirmDelete", new BooleanSetting(false));
|
s.put("confirmDelete", new BooleanSetting(false));
|
||||||
SETTINGS.put("countSearchMessages", new BooleanSetting(false));
|
s.put("countSearchMessages", new BooleanSetting(false));
|
||||||
SETTINGS.put("dateFormat", new DateFormatSetting(DateFormatter.DEFAULT_FORMAT));
|
s.put("dateFormat", new DateFormatSetting(DateFormatter.DEFAULT_FORMAT));
|
||||||
SETTINGS.put("enableDebugLogging", new BooleanSetting(false));
|
s.put("enableDebugLogging", new BooleanSetting(false));
|
||||||
SETTINGS.put("enableSensitiveLogging", new BooleanSetting(false));
|
s.put("enableSensitiveLogging", new BooleanSetting(false));
|
||||||
SETTINGS.put("fontSizeAccountDescription", new FontSizeSetting(FontSizes.SMALL));
|
s.put("fontSizeAccountDescription", new FontSizeSetting(FontSizes.SMALL));
|
||||||
SETTINGS.put("fontSizeAccountName", new FontSizeSetting(FontSizes.MEDIUM));
|
s.put("fontSizeAccountName", new FontSizeSetting(FontSizes.MEDIUM));
|
||||||
SETTINGS.put("fontSizeFolderName", new FontSizeSetting(FontSizes.LARGE));
|
s.put("fontSizeFolderName", new FontSizeSetting(FontSizes.LARGE));
|
||||||
SETTINGS.put("fontSizeFolderStatus", new FontSizeSetting(FontSizes.SMALL));
|
s.put("fontSizeFolderStatus", new FontSizeSetting(FontSizes.SMALL));
|
||||||
SETTINGS.put("fontSizeMessageListDate", new FontSizeSetting(FontSizes.SMALL));
|
s.put("fontSizeMessageListDate", new FontSizeSetting(FontSizes.SMALL));
|
||||||
SETTINGS.put("fontSizeMessageListPreview", new FontSizeSetting(FontSizes.SMALL));
|
s.put("fontSizeMessageListPreview", new FontSizeSetting(FontSizes.SMALL));
|
||||||
SETTINGS.put("fontSizeMessageListSender", new FontSizeSetting(FontSizes.SMALL));
|
s.put("fontSizeMessageListSender", new FontSizeSetting(FontSizes.SMALL));
|
||||||
SETTINGS.put("fontSizeMessageListSubject", new FontSizeSetting(FontSizes.FONT_16DIP));
|
s.put("fontSizeMessageListSubject", new FontSizeSetting(FontSizes.FONT_16DIP));
|
||||||
SETTINGS.put("fontSizeMessageViewAdditionalHeaders",
|
s.put("fontSizeMessageViewAdditionalHeaders", new FontSizeSetting(FontSizes.FONT_12DIP));
|
||||||
new FontSizeSetting(FontSizes.FONT_12DIP));
|
s.put("fontSizeMessageViewCC", new FontSizeSetting(FontSizes.FONT_12DIP));
|
||||||
SETTINGS.put("fontSizeMessageViewCC", new FontSizeSetting(FontSizes.FONT_12DIP));
|
s.put("fontSizeMessageViewContent", new WebFontSizeSetting(3));
|
||||||
SETTINGS.put("fontSizeMessageViewContent", new WebFontSizeSetting(3));
|
s.put("fontSizeMessageViewDate", new FontSizeSetting(FontSizes.FONT_10DIP));
|
||||||
SETTINGS.put("fontSizeMessageViewDate", new FontSizeSetting(FontSizes.FONT_10DIP));
|
s.put("fontSizeMessageViewSender", new FontSizeSetting(FontSizes.SMALL));
|
||||||
SETTINGS.put("fontSizeMessageViewSender", new FontSizeSetting(FontSizes.SMALL));
|
s.put("fontSizeMessageViewSubject", new FontSizeSetting(FontSizes.FONT_12DIP));
|
||||||
SETTINGS.put("fontSizeMessageViewSubject", new FontSizeSetting(FontSizes.FONT_12DIP));
|
s.put("fontSizeMessageViewTime", new FontSizeSetting(FontSizes.FONT_10DIP));
|
||||||
SETTINGS.put("fontSizeMessageViewTime", new FontSizeSetting(FontSizes.FONT_10DIP));
|
s.put("fontSizeMessageViewTo", new FontSizeSetting(FontSizes.FONT_12DIP));
|
||||||
SETTINGS.put("fontSizeMessageViewTo", new FontSizeSetting(FontSizes.FONT_12DIP));
|
s.put("gesturesEnabled", new BooleanSetting(true));
|
||||||
SETTINGS.put("gesturesEnabled", new BooleanSetting(true));
|
s.put("hideSpecialAccounts", new BooleanSetting(false));
|
||||||
SETTINGS.put("hideSpecialAccounts", new BooleanSetting(false));
|
s.put("keyguardPrivacy", new BooleanSetting(false));
|
||||||
SETTINGS.put("keyguardPrivacy", new BooleanSetting(false));
|
s.put("language", new LanguageSetting());
|
||||||
SETTINGS.put("language", new LanguageSetting());
|
s.put("manageBack", new BooleanSetting(false));
|
||||||
SETTINGS.put("manageBack", new BooleanSetting(false));
|
s.put("measureAccounts", new BooleanSetting(true));
|
||||||
SETTINGS.put("measureAccounts", new BooleanSetting(true));
|
s.put("messageListCheckboxes", new BooleanSetting(false));
|
||||||
SETTINGS.put("messageListCheckboxes", new BooleanSetting(false));
|
s.put("messageListPreviewLines", new IntegerRangeSetting(1, 100, 2));
|
||||||
SETTINGS.put("messageListPreviewLines", new IntegerRangeSetting(1, 100, 2));
|
s.put("messageListStars", new BooleanSetting(true));
|
||||||
SETTINGS.put("messageListStars", new BooleanSetting(true));
|
s.put("messageListTouchable", new BooleanSetting(false));
|
||||||
SETTINGS.put("messageListTouchable", new BooleanSetting(false));
|
s.put("messageViewFixedWidthFont", new BooleanSetting(false));
|
||||||
SETTINGS.put("messageViewFixedWidthFont", new BooleanSetting(false));
|
s.put("messageViewReturnToList", new BooleanSetting(false));
|
||||||
SETTINGS.put("messageViewReturnToList", new BooleanSetting(false));
|
s.put("mobileOptimizedLayout", new BooleanSetting(false));
|
||||||
SETTINGS.put("mobileOptimizedLayout", new BooleanSetting(false));
|
s.put("quietTimeEnabled", new BooleanSetting(false));
|
||||||
SETTINGS.put("quietTimeEnabled", new BooleanSetting(false));
|
s.put("quietTimeEnds", new TimeSetting("7:00"));
|
||||||
SETTINGS.put("quietTimeEnds", new TimeSetting("7:00"));
|
s.put("quietTimeStarts", new TimeSetting("21:00"));
|
||||||
SETTINGS.put("quietTimeStarts", new TimeSetting("21:00"));
|
s.put("registeredNameColor", new ColorSetting(0xFF00008F));
|
||||||
SETTINGS.put("registeredNameColor", new ColorSetting(0xFF00008F));
|
s.put("showContactName", new BooleanSetting(false));
|
||||||
SETTINGS.put("showContactName", new BooleanSetting(false));
|
s.put("showCorrespondentNames", new BooleanSetting(true));
|
||||||
SETTINGS.put("showCorrespondentNames", new BooleanSetting(true));
|
s.put("startIntegratedInbox", new BooleanSetting(false));
|
||||||
SETTINGS.put("startIntegratedInbox", new BooleanSetting(false));
|
s.put("theme", new ThemeSetting(android.R.style.Theme_Light));
|
||||||
SETTINGS.put("theme", new ThemeSetting(android.R.style.Theme_Light));
|
s.put("useGalleryBugWorkaround", new GalleryBugWorkaroundSetting());
|
||||||
SETTINGS.put("useGalleryBugWorkaround", new GalleryBugWorkaroundSetting());
|
s.put("useVolumeKeysForListNavigation", new BooleanSetting(false));
|
||||||
SETTINGS.put("useVolumeKeysForListNavigation", new BooleanSetting(false));
|
s.put("useVolumeKeysForNavigation", new BooleanSetting(false));
|
||||||
SETTINGS.put("useVolumeKeysForNavigation", new BooleanSetting(false));
|
s.put("zoomControlsEnabled", new BooleanSetting(false));
|
||||||
SETTINGS.put("zoomControlsEnabled", new BooleanSetting(false));
|
|
||||||
|
SETTINGS = Collections.unmodifiableMap(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Map<String, String> validate(Map<String, String> importedSettings) {
|
public static Map<String, String> validate(Map<String, String> importedSettings) {
|
||||||
|
Loading…
Reference in New Issue
Block a user