Loading app/core/src/main/java/com/fsck/k9/K9.kt +3 −3 Original line number Diff line number Diff line Loading @@ -227,7 +227,7 @@ object K9 : EarlyInit { var isUseVolumeKeysForListNavigation = false @JvmStatic var isHideSpecialAccounts = false var isShowUnifiedInbox = true @JvmStatic var isAutoFitWidth: Boolean = false Loading Loading @@ -338,7 +338,7 @@ object K9 : EarlyInit { isShowAnimations = storage.getBoolean("animations", true) isUseVolumeKeysForNavigation = storage.getBoolean("useVolumeKeysForNavigation", false) isUseVolumeKeysForListNavigation = storage.getBoolean("useVolumeKeysForListNavigation", false) isHideSpecialAccounts = storage.getBoolean("hideSpecialAccounts", false) isShowUnifiedInbox = storage.getBoolean("showUnifiedInbox", true) isMessageListSenderAboveSubject = storage.getBoolean("messageListSenderAboveSubject", false) isShowMessageListStars = storage.getBoolean("messageListStars", true) messageListPreviewLines = storage.getInt("messageListPreviewLines", 2) Loading Loading @@ -424,7 +424,7 @@ object K9 : EarlyInit { editor.putString("quietTimeEnds", quietTimeEnds) editor.putBoolean("messageListSenderAboveSubject", isMessageListSenderAboveSubject) editor.putBoolean("hideSpecialAccounts", isHideSpecialAccounts) editor.putBoolean("showUnifiedInbox", isShowUnifiedInbox) editor.putBoolean("messageListStars", isShowMessageListStars) editor.putInt("messageListPreviewLines", messageListPreviewLines) editor.putBoolean("showCorrespondentNames", isShowCorrespondentNames) Loading app/core/src/main/java/com/fsck/k9/preferences/GeneralSettingsDescriptions.java +25 −1 Original line number Diff line number Diff line Loading @@ -129,7 +129,8 @@ public class GeneralSettingsDescriptions { new V(1, new FontSizeSetting(FontSizes.FONT_DEFAULT)) )); s.put("hideSpecialAccounts", Settings.versions( new V(1, new BooleanSetting(false)) new V(1, new BooleanSetting(false)), new V(69, null) )); s.put("keyguardPrivacy", Settings.versions( new V(1, new BooleanSetting(false)), Loading Loading @@ -171,6 +172,9 @@ public class GeneralSettingsDescriptions { s.put("showCorrespondentNames", Settings.versions( new V(1, new BooleanSetting(true)) )); s.put("showUnifiedInbox", Settings.versions( new V(69, new BooleanSetting(true)) )); s.put("sortTypeEnum", Settings.versions( new V(10, new EnumSetting<>(SortType.class, Account.DEFAULT_SORT_TYPE)) )); Loading Loading @@ -284,6 +288,7 @@ public class GeneralSettingsDescriptions { u.put(24, new SettingsUpgraderV24()); u.put(31, new SettingsUpgraderV31()); u.put(58, new SettingsUpgraderV58()); u.put(69, new SettingsUpgraderV69()); UPGRADERS = Collections.unmodifiableMap(u); } Loading Loading @@ -418,6 +423,25 @@ public class GeneralSettingsDescriptions { } } /** * Upgrades the settings from version 68 to 69. * * <p> * Renames {@code hideSpecialAccounts} to {@code showUnifiedInbox}. * </p> */ private static class SettingsUpgraderV69 implements SettingsUpgrader { @Override public Set<String> upgrade(Map<String, Object> settings) { Boolean hideSpecialAccounts = (Boolean) settings.get("hideSpecialAccounts"); boolean showUnifiedInbox = hideSpecialAccounts == null || !hideSpecialAccounts; settings.put("showUnifiedInbox", showUnifiedInbox); return new HashSet<>(Collections.singleton("hideSpecialAccounts")); } } private static class LanguageSetting extends PseudoEnumSetting<String> { private final Context context = DI.get(Context.class); private final Map<String, String> mapping; Loading app/core/src/main/java/com/fsck/k9/preferences/Settings.java +1 −1 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ public class Settings { * * @see SettingsExporter */ public static final int VERSION = 68; public static final int VERSION = 69; static Map<String, Object> validate(int version, Map<String, TreeMap<Integer, SettingsDescription>> settings, Map<String, String> importedSettings, boolean useDefaultValues) { Loading app/storage/src/main/java/com/fsck/k9/preferences/K9StoragePersister.java +1 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ import timber.log.Timber; public class K9StoragePersister implements StoragePersister { private static final int DB_VERSION = 12; private static final int DB_VERSION = 13; private static final String DB_NAME = "preferences_storage"; private final Context context; Loading app/storage/src/main/java/com/fsck/k9/preferences/migrations/StorageMigrationTo13.kt 0 → 100644 +18 −0 Original line number Diff line number Diff line package com.fsck.k9.preferences.migrations import android.database.sqlite.SQLiteDatabase /** * Rename `hideSpecialAccounts` to `showUnifiedInbox` (and invert value). */ class StorageMigrationTo13( private val db: SQLiteDatabase, private val migrationsHelper: StorageMigrationsHelper ) { fun renameHideSpecialAccounts() { val hideSpecialAccounts = migrationsHelper.readValue(db, "hideSpecialAccounts")?.toBoolean() ?: false val showUnifiedInbox = !hideSpecialAccounts migrationsHelper.insertValue(db, "showUnifiedInbox", showUnifiedInbox.toString()) migrationsHelper.writeValue(db, "hideSpecialAccounts", null) } } Loading
app/core/src/main/java/com/fsck/k9/K9.kt +3 −3 Original line number Diff line number Diff line Loading @@ -227,7 +227,7 @@ object K9 : EarlyInit { var isUseVolumeKeysForListNavigation = false @JvmStatic var isHideSpecialAccounts = false var isShowUnifiedInbox = true @JvmStatic var isAutoFitWidth: Boolean = false Loading Loading @@ -338,7 +338,7 @@ object K9 : EarlyInit { isShowAnimations = storage.getBoolean("animations", true) isUseVolumeKeysForNavigation = storage.getBoolean("useVolumeKeysForNavigation", false) isUseVolumeKeysForListNavigation = storage.getBoolean("useVolumeKeysForListNavigation", false) isHideSpecialAccounts = storage.getBoolean("hideSpecialAccounts", false) isShowUnifiedInbox = storage.getBoolean("showUnifiedInbox", true) isMessageListSenderAboveSubject = storage.getBoolean("messageListSenderAboveSubject", false) isShowMessageListStars = storage.getBoolean("messageListStars", true) messageListPreviewLines = storage.getInt("messageListPreviewLines", 2) Loading Loading @@ -424,7 +424,7 @@ object K9 : EarlyInit { editor.putString("quietTimeEnds", quietTimeEnds) editor.putBoolean("messageListSenderAboveSubject", isMessageListSenderAboveSubject) editor.putBoolean("hideSpecialAccounts", isHideSpecialAccounts) editor.putBoolean("showUnifiedInbox", isShowUnifiedInbox) editor.putBoolean("messageListStars", isShowMessageListStars) editor.putInt("messageListPreviewLines", messageListPreviewLines) editor.putBoolean("showCorrespondentNames", isShowCorrespondentNames) Loading
app/core/src/main/java/com/fsck/k9/preferences/GeneralSettingsDescriptions.java +25 −1 Original line number Diff line number Diff line Loading @@ -129,7 +129,8 @@ public class GeneralSettingsDescriptions { new V(1, new FontSizeSetting(FontSizes.FONT_DEFAULT)) )); s.put("hideSpecialAccounts", Settings.versions( new V(1, new BooleanSetting(false)) new V(1, new BooleanSetting(false)), new V(69, null) )); s.put("keyguardPrivacy", Settings.versions( new V(1, new BooleanSetting(false)), Loading Loading @@ -171,6 +172,9 @@ public class GeneralSettingsDescriptions { s.put("showCorrespondentNames", Settings.versions( new V(1, new BooleanSetting(true)) )); s.put("showUnifiedInbox", Settings.versions( new V(69, new BooleanSetting(true)) )); s.put("sortTypeEnum", Settings.versions( new V(10, new EnumSetting<>(SortType.class, Account.DEFAULT_SORT_TYPE)) )); Loading Loading @@ -284,6 +288,7 @@ public class GeneralSettingsDescriptions { u.put(24, new SettingsUpgraderV24()); u.put(31, new SettingsUpgraderV31()); u.put(58, new SettingsUpgraderV58()); u.put(69, new SettingsUpgraderV69()); UPGRADERS = Collections.unmodifiableMap(u); } Loading Loading @@ -418,6 +423,25 @@ public class GeneralSettingsDescriptions { } } /** * Upgrades the settings from version 68 to 69. * * <p> * Renames {@code hideSpecialAccounts} to {@code showUnifiedInbox}. * </p> */ private static class SettingsUpgraderV69 implements SettingsUpgrader { @Override public Set<String> upgrade(Map<String, Object> settings) { Boolean hideSpecialAccounts = (Boolean) settings.get("hideSpecialAccounts"); boolean showUnifiedInbox = hideSpecialAccounts == null || !hideSpecialAccounts; settings.put("showUnifiedInbox", showUnifiedInbox); return new HashSet<>(Collections.singleton("hideSpecialAccounts")); } } private static class LanguageSetting extends PseudoEnumSetting<String> { private final Context context = DI.get(Context.class); private final Map<String, String> mapping; Loading
app/core/src/main/java/com/fsck/k9/preferences/Settings.java +1 −1 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ public class Settings { * * @see SettingsExporter */ public static final int VERSION = 68; public static final int VERSION = 69; static Map<String, Object> validate(int version, Map<String, TreeMap<Integer, SettingsDescription>> settings, Map<String, String> importedSettings, boolean useDefaultValues) { Loading
app/storage/src/main/java/com/fsck/k9/preferences/K9StoragePersister.java +1 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ import timber.log.Timber; public class K9StoragePersister implements StoragePersister { private static final int DB_VERSION = 12; private static final int DB_VERSION = 13; private static final String DB_NAME = "preferences_storage"; private final Context context; Loading
app/storage/src/main/java/com/fsck/k9/preferences/migrations/StorageMigrationTo13.kt 0 → 100644 +18 −0 Original line number Diff line number Diff line package com.fsck.k9.preferences.migrations import android.database.sqlite.SQLiteDatabase /** * Rename `hideSpecialAccounts` to `showUnifiedInbox` (and invert value). */ class StorageMigrationTo13( private val db: SQLiteDatabase, private val migrationsHelper: StorageMigrationsHelper ) { fun renameHideSpecialAccounts() { val hideSpecialAccounts = migrationsHelper.readValue(db, "hideSpecialAccounts")?.toBoolean() ?: false val showUnifiedInbox = !hideSpecialAccounts migrationsHelper.insertValue(db, "showUnifiedInbox", showUnifiedInbox.toString()) migrationsHelper.writeValue(db, "hideSpecialAccounts", null) } }