From 592ed3ef38ae211af9e9b23a63a55f66ccb983f5 Mon Sep 17 00:00:00 2001 From: cketti Date: Thu, 2 Aug 2012 03:09:26 +0200 Subject: [PATCH] Upgrade from "keyguardPrivacy" to "notificationHideSubject" Make sure existing installations aren't reset to the default value when the new setting can't be found. --- src/com/fsck/k9/K9.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/com/fsck/k9/K9.java b/src/com/fsck/k9/K9.java index 799b6d96d..eab538ecd 100644 --- a/src/com/fsck/k9/K9.java +++ b/src/com/fsck/k9/K9.java @@ -639,9 +639,15 @@ public class K9 extends Application { boolean sortAscending = sprefs.getBoolean("sortAscending", Account.DEFAULT_SORT_ASCENDING); mSortAscending.put(mSortType, sortAscending); - String notificationHideSubject = sprefs.getString("notificationHideSubject", - NotificationHideSubject.NEVER.toString()); - sNotificationHideSubject = NotificationHideSubject.valueOf(notificationHideSubject); + String notificationHideSubject = sprefs.getString("notificationHideSubject", null); + if (notificationHideSubject == null) { + // If the "notificationHideSubject" setting couldn't be found, the app was probably + // updated. Look for the old "keyguardPrivacy" setting and map it to the new enum. + sNotificationHideSubject = (sprefs.getBoolean("keyguardPrivacy", false)) ? + NotificationHideSubject.WHEN_LOCKED : NotificationHideSubject.NEVER; + } else { + sNotificationHideSubject = NotificationHideSubject.valueOf(notificationHideSubject); + } compactLayouts = sprefs.getBoolean("compactLayouts", false); mAttachmentDefaultPath = sprefs.getString("attachmentdefaultpath", Environment.getExternalStorageDirectory().toString());