diff --git a/app/core/src/main/java/com/fsck/k9/Account.kt b/app/core/src/main/java/com/fsck/k9/Account.kt index 7f155d5cf534145c89feb6d5f56db91d21140298..0f0b5c5437553cd18be7e46c4a1ab395705af66a 100644 --- a/app/core/src/main/java/com/fsck/k9/Account.kt +++ b/app/core/src/main/java/com/fsck/k9/Account.kt @@ -209,7 +209,11 @@ class Account(override val uuid: String) : BaseAccount { @get:Synchronized @set:Synchronized - var showPictures = ShowPictures.NEVER + var showPictures = ShowPictures.ALWAYS + + @get:Synchronized + @set:Synchronized + var isShowPictureOptionLoadedCorrectly = false @get:Synchronized @set:Synchronized diff --git a/app/core/src/main/java/com/fsck/k9/AccountPreferenceSerializer.kt b/app/core/src/main/java/com/fsck/k9/AccountPreferenceSerializer.kt index 83db324da051fd360ad873afc8791f32ea0332e6..2483fbeb9b76e2f4ebcc06aedef76975a0513a74 100644 --- a/app/core/src/main/java/com/fsck/k9/AccountPreferenceSerializer.kt +++ b/app/core/src/main/java/com/fsck/k9/AccountPreferenceSerializer.kt @@ -132,7 +132,8 @@ class AccountPreferenceSerializer( setSortAscending(sortType, storage.getBoolean("$accountUuid.sortAscending", false)) - showPictures = getEnumStringPref(storage, "$accountUuid.showPicturesEnum", ShowPictures.NEVER) + showPictures = getEnumStringPref(storage, "$accountUuid.showPicturesEnum", ShowPictures.ALWAYS) + isShowPictureOptionLoadedCorrectly = storage.getBoolean("$accountUuid.isShowPictureOptionLoadedCorrectly", false) updateNotificationSettings { NotificationSettings( @@ -283,6 +284,7 @@ class AccountPreferenceSerializer( editor.putString("$accountUuid.sortTypeEnum", sortType.name) editor.putBoolean("$accountUuid.sortAscending", isSortAscending(sortType)) editor.putString("$accountUuid.showPicturesEnum", showPictures.name) + editor.putBoolean("$accountUuid.isShowPictureOptionLoadedCorrectly", isShowPictureOptionLoadedCorrectly) editor.putString("$accountUuid.folderDisplayMode", folderDisplayMode.name) editor.putString("$accountUuid.folderSyncMode", folderSyncMode.name) editor.putString("$accountUuid.folderPushMode", folderPushMode.name) @@ -553,7 +555,8 @@ class AccountPreferenceSerializer( folderTargetMode = FolderMode.NOT_SECOND_CLASS sortType = DEFAULT_SORT_TYPE setSortAscending(DEFAULT_SORT_TYPE, DEFAULT_SORT_ASCENDING) - showPictures = ShowPictures.NEVER + showPictures = ShowPictures.ALWAYS + isShowPictureOptionLoadedCorrectly = true isSignatureBeforeQuotedText = false expungePolicy = Expunge.EXPUNGE_IMMEDIATELY importedAutoExpandFolder = null diff --git a/app/core/src/main/java/com/fsck/k9/preferences/AccountSettingsDescriptions.java b/app/core/src/main/java/com/fsck/k9/preferences/AccountSettingsDescriptions.java index 519b014da488fe1601e7f9285f9955be146f9c06..1971a5f63c0046d8b11fe5e9199c3d0a13263ab5 100644 --- a/app/core/src/main/java/com/fsck/k9/preferences/AccountSettingsDescriptions.java +++ b/app/core/src/main/java/com/fsck/k9/preferences/AccountSettingsDescriptions.java @@ -184,7 +184,7 @@ public class AccountSettingsDescriptions { new V(9, new BooleanSetting(Account.DEFAULT_SORT_ASCENDING)) )); s.put("showPicturesEnum", Settings.versions( - new V(1, new EnumSetting<>(ShowPictures.class, ShowPictures.NEVER)) + new V(1, new EnumSetting<>(ShowPictures.class, ShowPictures.ALWAYS)) )); s.put("signatureBeforeQuotedText", Settings.versions( new V(1, new BooleanSetting(false)) diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt b/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt index d82501ae9f4c5e0e106710789a24ed86418d900a..6d80249594bd8e2a9000beb9d5245f2c73e3b47d 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt @@ -174,6 +174,8 @@ open class MessageList : return } + accounts.forEach(this::refreshShowPictureOption) + if (useSplitView()) { setLayout(R.layout.split_message_list) } else { @@ -1700,6 +1702,19 @@ open class MessageList : } } + /* + * We want to show pictures by default. + * For already setup accounts, we need to first check isShowPictureOptionLoadedCorrectly pref value for account, by default it is false. + * If it is false, update {@code account.showPictures = ShowPictures.ALWAYS} + * else ignore + */ + private fun refreshShowPictureOption(account: Account) { + if (!account.isShowPictureOptionLoadedCorrectly) { + account.showPictures = Account.ShowPictures.ALWAYS + account.isShowPictureOptionLoadedCorrectly = true + preferences.saveAccount(account) + } + } companion object : KoinComponent { private const val EXTRA_SEARCH = "search_bytes"