From d1f84fc3568f31c4736e22308bef62a9798e92a9 Mon Sep 17 00:00:00 2001 From: Monopatis Dimitris Date: Tue, 24 Jul 2012 18:56:40 +0300 Subject: [PATCH 01/22] fix some spelling errors --- res/values-el/strings.xml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/res/values-el/strings.xml b/res/values-el/strings.xml index 50ef50ee6..3a11c7cc0 100644 --- a/res/values-el/strings.xml +++ b/res/values-el/strings.xml @@ -189,7 +189,7 @@ http://k9mail.googlecode.com/ b Ο λογαριασμός \'%s\' συμπυκνώθηκε από - %s σε %s + %s σε %s Συμπύκνωση λογαριασμού \'%s\' Καθαρισμός λογαριασμού \'%s\' @@ -493,7 +493,7 @@ http://k9mail.googlecode.com/ 1000 μηνύματα Όλα τα μηνύματα - Αδύνατη η αντογραφή ή μετακίνηση μηνύματος που δεν έχει συγχρονιστεί με τον εξυπηρέτη + Αδύνατη η αντιγραφή ή μετακίνηση μηνύματος που δεν έχει συγχρονιστεί με τον εξυπηρέτη Οι ρυθμίσεις δεν μπόρεσαν να ολοκληρωθούν Εσφαλμένο όνομα χρήστη ή συνθηματικό.\n(%s) @@ -533,7 +533,7 @@ http://k9mail.googlecode.com/ Παράθεση αρχικού μηνύματος στην απάντηση Το αρχικό μήνυμα να είναι μέσα στην απάντηση. - Απάντηση μετα την παράθεση του κειμένου + Απάντηση μετά την παράθεση του κειμένου Το αρχικό μήνυμα να εμφανίζεται πάνω από την απάντηση. Να μην τοποθετείται υπογραφή στην παράθεση @@ -542,10 +542,10 @@ http://k9mail.googlecode.com/ Τύπος κειμένου μηνύματος Απλό κείμενο (αφαιρούνται εικόνες και μορφοποίηση) HTML (διατηρούνται εικόνες και μορφοποίηση) - Αυτόματα (απλό κείμεο εκτός αν απαντά σε μήνυμα HTML) + Αυτόματα (απλό κείμενο εκτός αν απαντά σε μήνυμα HTML) Απόδειξη ανάγνωσης - Πάντοτε να απιτείται απόδειξη ανάγνωσης + Πάντοτε να απαιτείται απόδειξη ανάγνωσης Μορφή παράθεσης για απάντηση Πρόθεση (όπως στο Gmail, Pine) @@ -610,7 +610,7 @@ http://k9mail.googlecode.com/ Τους τελευταίους 6 μήνες Το τελευταίο έτος - Φάκελοι που προβάλονται + Φάκελοι που προβάλλονται Όλοι Μόνο φάκελοι 1ου επιπέδου Φάκελοι 1ου και 2ου επιπέδου @@ -682,7 +682,7 @@ http://k9mail.googlecode.com/ Αναβοσβήσιμο λυχνίας Αναβοσβήσιμο LED όταν φτάνει μήνυμα - Επιλογές σύνθεσης μηνυμάτος + Επιλογές σύνθεσης μηνύματος Εξ ορισμού σύνθεση Ορισμός εξ ορισμού Αποστολέα, Ιδιωτικής κοινοποίησης και υπογραφής @@ -780,7 +780,7 @@ http://k9mail.googlecode.com/ Del (ή D) - Διαγραφή\u000AR - Απάντηση\u000AA - Απάντηση σε όλους\u000AC - Σύνθεση\u000AF - Προώθηση\u000aM - Μετακίνηση\u000AY - Αντιγραφή\u000AG - Αστέρι\u000AO - Ταξινόμηση\u000AI - Σειρά ταξινόμησης\u000AQ - - Επστροφή στους φακέλους\u000AS - Επιλογή/Αποεπιλογή + - Επιστροφή στους φακέλους\u000AS - Επιλογή/Αποεπιλογή 1 - Προβολή φακλέλων πρώτου επιπέδου\u000A @@ -802,7 +802,7 @@ http://k9mail.googlecode.com/ Πριν το κείμενο παράθεσης Μετά το κείμενο παράθεσης Σκοτεινό - Ανοικτόχρωμο + Ανοιχτόχρωμο Προβολή Γενικές Αποσφαλμάτωση @@ -846,7 +846,7 @@ http://k9mail.googlecode.com/ Μετακίνηση στην Αρχειοθέτηση Μετακίνηση στα Σκουπίδια Μετακίνηση - ΑντιγραφήCopy selected + Αντιγραφή επιλεγμένων Αστέρι Απλή επιλογή Επιλογή όλων @@ -1105,4 +1105,4 @@ http://k9mail.googlecode.com/ - + \ No newline at end of file From f3e74d53218802047d26d8c39f72f169a182d285 Mon Sep 17 00:00:00 2001 From: cketti Date: Wed, 1 Aug 2012 23:44:40 +0200 Subject: [PATCH 02/22] Added support for "show in top group" to ChooseFolder --- src/com/fsck/k9/activity/ChooseFolder.java | 45 ++++++++++++---------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/src/com/fsck/k9/activity/ChooseFolder.java b/src/com/fsck/k9/activity/ChooseFolder.java index a5b8568fe..a5aa71849 100644 --- a/src/com/fsck/k9/activity/ChooseFolder.java +++ b/src/com/fsck/k9/activity/ChooseFolder.java @@ -296,7 +296,9 @@ public class ChooseFolder extends K9ListActivity { } Account.FolderMode aMode = mMode; Preferences prefs = Preferences.getPreferences(getApplication().getApplicationContext()); - ArrayList localFolders = new ArrayList(); + + List newFolders = new ArrayList(); + List topFolders = new ArrayList(); for (Folder folder : folders) { String name = folder.getName(); @@ -325,33 +327,34 @@ public class ChooseFolder extends K9ListActivity { folder.getName(), me); } - localFolders.add(folder.getName()); - + if (folder.isInTopGroup()) { + topFolders.add(name); + } else { + newFolders.add(name); + } } + final Comparator comparator = new Comparator() { + @Override + public int compare(String s1, String s2) { + int ret = s1.compareToIgnoreCase(s2); + return (ret != 0) ? ret : s1.compareTo(s2); + } + }; + + Collections.sort(topFolders, comparator); + Collections.sort(newFolders, comparator); + + List localFolders = new ArrayList(newFolders.size() + + topFolders.size() + ((mShowOptionNone) ? 1 : 0)); + if (mShowOptionNone) { localFolders.add(K9.FOLDER_NONE); } - Collections.sort(localFolders, new Comparator() { - @Override - public int compare(String aName, String bName) { - if (K9.FOLDER_NONE.equalsIgnoreCase(aName)) { - return -1; - } - if (K9.FOLDER_NONE.equalsIgnoreCase(bName)) { - return 1; - } - if (mAccount.getInboxFolderName().equalsIgnoreCase(aName)) { - return -1; - } - if (mAccount.getInboxFolderName().equalsIgnoreCase(bName)) { - return 1; - } + localFolders.addAll(topFolders); + localFolders.addAll(newFolders); - return aName.compareToIgnoreCase(bName); - } - }); int selectedFolder = -1; /* From 4028505d69d539d663115d4baa01b56a59a6a70c Mon Sep 17 00:00:00 2001 From: Bernhard Redl Date: Thu, 2 Aug 2012 01:41:40 +0200 Subject: [PATCH 03/22] Extended setting to hide subject in notification area (never, when locked, always) Fixed issue 2595 --- res/values-de/strings.xml | 15 +++++++-- res/values/strings.xml | 17 ++++++++-- res/xml/global_preferences.xml | 11 ++++--- src/com/fsck/k9/K9.java | 26 +++++++++++----- src/com/fsck/k9/activity/setup/Prefs.java | 12 ++++--- .../k9/controller/MessagingController.java | 5 ++- .../fsck/k9/preferences/GlobalSettings.java | 31 ++++++++++++++++++- src/com/fsck/k9/preferences/Settings.java | 2 +- 8 files changed, 94 insertions(+), 25 deletions(-) diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml index 71626f7ea..71c0a0ffa 100644 --- a/res/values-de/strings.xml +++ b/res/values-de/strings.xml @@ -323,8 +323,19 @@ http://k9mail.googlecode.com/. Alle als gelesen markieren Senden - Vertrauliche Benachrichtigung - Der Betreff der Nachricht wird nicht in der Benachrichtigungszeile angezeigt + Betreff in Benachrichtigungen verbergen + Verbergen des Betreffes in Benachrichtigungen + + Niemals verbergen + Nur, wenn Gerät gesperrt ist + Immer verbergen + + + + NEVER + WHEN_LOCKED + ALWAYS + Gruppenoperationen-Schaltflächen Zeige folgende Schaltflächen in der Nachrichtenliste an diff --git a/res/values/strings.xml b/res/values/strings.xml index 9e638588a..e07422dc5 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -326,9 +326,20 @@ http://k9mail.googlecode.com/ Mark all as read Send - Lock-screen notifications - Don\'t display message subject in notification bar when system is locked - + Hide subject in notifications + When to hide the subject in the notification bar. + + Never + When phone is locked + Always + + + + NEVER + WHEN_LOCKED + ALWAYS + + Batch buttons Configure message list batch buttons Mark read/unread diff --git a/res/xml/global_preferences.xml b/res/xml/global_preferences.xml index 2c7556f31..4cc455767 100644 --- a/res/xml/global_preferences.xml +++ b/res/xml/global_preferences.xml @@ -348,11 +348,14 @@ android:title="@string/privacy_preferences" android:key="privacy_preferences"> - + android:key="notification_hide_subject" + android:defaultValue="NEVER" + android:entries="@array/global_settings_notification_hide_subject_mode" + android:entryValues="@array/global_settings_notification_hide_subject_mode_values" + android:title="@string/global_settings_notification_hide_subject_mode_title" + android:summary="@string/global_settings_notification_hide_subject_mode_summary"/> diff --git a/src/com/fsck/k9/K9.java b/src/com/fsck/k9/K9.java index 991e62cfd..d3a7d238e 100644 --- a/src/com/fsck/k9/K9.java +++ b/src/com/fsck/k9/K9.java @@ -155,7 +155,17 @@ public class K9 extends Application { private static boolean mConfirmDeleteStarred = false; private static boolean mConfirmSpam = false; private static boolean mConfirmMarkAllAsRead = true; - private static boolean mKeyguardPrivacy = false; + private static NotificationHideSubject mNotificationHideSubject = NotificationHideSubject.NEVER; + /** + * controls when to show the subject + * in the notification area + * -> Global Settings -> Privacy -> Notification + */ + public enum NotificationHideSubject { + ALWAYS, + WHEN_LOCKED, + NEVER + } private static boolean mMessageListStars = true; private static boolean mMessageListCheckboxes = false; @@ -465,7 +475,7 @@ public class K9 extends Application { editor.putString("sortTypeEnum", mSortType.name()); editor.putBoolean("sortAscending", mSortAscending.get(mSortType)); - editor.putBoolean("keyguardPrivacy", mKeyguardPrivacy); + editor.putString("notificationHideSubjectMode", mNotificationHideSubject.toString()); editor.putBoolean("compactLayouts", compactLayouts); editor.putString("attachmentdefaultpath", mAttachmentDefaultPath); @@ -629,8 +639,8 @@ public class K9 extends Application { boolean sortAscending = sprefs.getBoolean("sortAscending", Account.DEFAULT_SORT_ASCENDING); mSortAscending.put(mSortType, sortAscending); - mKeyguardPrivacy = sprefs.getBoolean("keyguardPrivacy", false); - + mNotificationHideSubject = NotificationHideSubject.valueOf(sprefs.getString("notificationHideSubjectMode", NotificationHideSubject.NEVER.toString())); + compactLayouts = sprefs.getBoolean("compactLayouts", false); mAttachmentDefaultPath = sprefs.getString("attachmentdefaultpath", Environment.getExternalStorageDirectory().toString()); fontSizes.load(sprefs); @@ -1050,12 +1060,12 @@ public class K9 extends Application { /** * @return Whether privacy rules should be applied when system is locked */ - public static boolean keyguardPrivacy() { - return mKeyguardPrivacy; + public static NotificationHideSubject getNotificationHideSubjectMode() { + return mNotificationHideSubject; } - public static void setKeyguardPrivacy(final boolean state) { - mKeyguardPrivacy = state; + public static void setNotificationHideSubjectMode(final NotificationHideSubject mode) { + mNotificationHideSubject = mode; } public static boolean useCompactLayouts() { diff --git a/src/com/fsck/k9/activity/setup/Prefs.java b/src/com/fsck/k9/activity/setup/Prefs.java index d23eb84b9..31167a26c 100644 --- a/src/com/fsck/k9/activity/setup/Prefs.java +++ b/src/com/fsck/k9/activity/setup/Prefs.java @@ -21,6 +21,7 @@ import android.widget.Toast; import com.fsck.k9.Account; import com.fsck.k9.K9; +import com.fsck.k9.K9.NotificationHideSubject; import com.fsck.k9.Preferences; import com.fsck.k9.R; import com.fsck.k9.activity.Accounts; @@ -56,7 +57,7 @@ public class Prefs extends K9PreferenceActivity { private static final String PREFERENCE_MANAGE_BACK = "manage_back"; private static final String PREFERENCE_START_INTEGRATED_INBOX = "start_integrated_inbox"; private static final String PREFERENCE_CONFIRM_ACTIONS = "confirm_actions"; - private static final String PREFERENCE_PRIVACY_MODE = "privacy_mode"; + private static final String PREFERENCE_NOTIFICATION_HIDE_SUBJECT = "notification_hide_subject"; private static final String PREFERENCE_MEASURE_ACCOUNTS = "measure_accounts"; private static final String PREFERENCE_COUNT_SEARCH = "count_search"; private static final String PREFERENCE_HIDE_SPECIAL_ACCOUNTS = "hide_special_accounts"; @@ -101,7 +102,7 @@ public class Prefs extends K9PreferenceActivity { private CheckBoxPreference mManageBack; private CheckBoxPreference mStartIntegratedInbox; private CheckBoxListPreference mConfirmActions; - private CheckBoxPreference mPrivacyMode; + private ListPreference mNotificationHideSubjectMode; private CheckBoxPreference mMeasureAccounts; private CheckBoxPreference mCountSearch; private CheckBoxPreference mHideSpecialAccounts; @@ -216,8 +217,8 @@ public class Prefs extends K9PreferenceActivity { K9.confirmMarkAllAsRead() }); - mPrivacyMode = (CheckBoxPreference) findPreference(PREFERENCE_PRIVACY_MODE); - mPrivacyMode.setChecked(K9.keyguardPrivacy()); + mNotificationHideSubjectMode = (ListPreference) findPreference(PREFERENCE_NOTIFICATION_HIDE_SUBJECT); + mNotificationHideSubjectMode.setValue(K9.getNotificationHideSubjectMode().toString()); mMeasureAccounts = (CheckBoxPreference)findPreference(PREFERENCE_MEASURE_ACCOUNTS); mMeasureAccounts.setChecked(K9.measureAccounts()); @@ -426,7 +427,8 @@ public class Prefs extends K9PreferenceActivity { K9.setConfirmDeleteStarred(mConfirmActions.getCheckedItems()[1]); K9.setConfirmSpam(mConfirmActions.getCheckedItems()[2]); K9.setConfirmMarkAllAsRead(mConfirmActions.getCheckedItems()[3]); - K9.setKeyguardPrivacy(mPrivacyMode.isChecked()); + K9.setNotificationHideSubjectMode(NotificationHideSubject.valueOf(mNotificationHideSubjectMode.getValue())); + K9.setMeasureAccounts(mMeasureAccounts.isChecked()); K9.setCountSearchMessages(mCountSearch.isChecked()); K9.setHideSpecialAccounts(mHideSpecialAccounts.isChecked()); diff --git a/src/com/fsck/k9/controller/MessagingController.java b/src/com/fsck/k9/controller/MessagingController.java index 8819b3d13..ffc8037e8 100644 --- a/src/com/fsck/k9/controller/MessagingController.java +++ b/src/com/fsck/k9/controller/MessagingController.java @@ -30,6 +30,7 @@ import android.util.Log; import com.fsck.k9.Account; import com.fsck.k9.AccountStats; import com.fsck.k9.K9; +import com.fsck.k9.K9.NotificationHideSubject; import com.fsck.k9.NotificationSetting; import com.fsck.k9.Preferences; import com.fsck.k9.R; @@ -4175,8 +4176,10 @@ public class MessagingController implements Runnable { // If privacy mode active and keyguard active // OR + // GlobalPreference is ALWAYS hide subject + // OR // If we could not set a per-message notification, revert to a default message - if ((K9.keyguardPrivacy() && keyguardService.inKeyguardRestrictedInputMode()) || messageNotice.length() == 0) { + if ((K9.getNotificationHideSubjectMode() == NotificationHideSubject.WHEN_LOCKED && keyguardService.inKeyguardRestrictedInputMode()) || (K9.getNotificationHideSubjectMode() == NotificationHideSubject.ALWAYS) || messageNotice.length() == 0) { messageNotice = new StringBuilder(context.getString(R.string.notification_new_title)); } diff --git a/src/com/fsck/k9/preferences/GlobalSettings.java b/src/com/fsck/k9/preferences/GlobalSettings.java index ebdf120d0..21e0ac9d3 100644 --- a/src/com/fsck/k9/preferences/GlobalSettings.java +++ b/src/com/fsck/k9/preferences/GlobalSettings.java @@ -2,8 +2,10 @@ package com.fsck.k9.preferences; import java.io.File; import java.text.SimpleDateFormat; +import java.util.Arrays; import java.util.Collections; import java.util.HashMap; +import java.util.HashSet; import java.util.LinkedHashMap; import java.util.Map; import java.util.Set; @@ -15,6 +17,7 @@ import android.os.Environment; import com.fsck.k9.Account; import com.fsck.k9.FontSizes; import com.fsck.k9.K9; +import com.fsck.k9.K9.NotificationHideSubject; import com.fsck.k9.R; import com.fsck.k9.Account.SortType; import com.fsck.k9.helper.DateFormatter; @@ -131,7 +134,8 @@ public class GlobalSettings { new V(1, new BooleanSetting(false)) )); s.put("keyguardPrivacy", Settings.versions( - new V(1, new BooleanSetting(false)) + new V(1, new BooleanSetting(false)), + new V(12, null) )); s.put("language", Settings.versions( new V(1, new LanguageSetting()) @@ -227,10 +231,14 @@ public class GlobalSettings { s.put("batchButtonsUnselect", Settings.versions( new V(8, new BooleanSetting(true)) )); + s.put("notificationHideSubjectMode", Settings.versions( + new V(12, new EnumSetting(NotificationHideSubject.class, NotificationHideSubject.NEVER)) + )); SETTINGS = Collections.unmodifiableMap(s); Map u = new HashMap(); + u.put(12, new SettingsUpgraderv12()); UPGRADERS = Collections.unmodifiableMap(u); } @@ -257,6 +265,27 @@ public class GlobalSettings { return result; } + /** + * Upgrades the settings from 11 -> 12 + * get the value from keyguardPrivacy + * and map it to the new enum based options + */ + public static class SettingsUpgraderv12 implements SettingsUpgrader { + + @Override + public Set upgrade(Map settings) { + Boolean keyguardPrivacy = (Boolean) settings.get("keyguardPrivacy"); + if (keyguardPrivacy != null && keyguardPrivacy) { + // current setting: only show subject when unlocked + settings.put("hideSubjectMode", NotificationHideSubject.WHEN_LOCKED); + } else { + // always show subject [old default] + settings.put("hideSubjectMode", NotificationHideSubject.NEVER); + } + return new HashSet(Arrays.asList("hideSubjectMode")); + } + } + /** * The gallery bug work-around setting. * diff --git a/src/com/fsck/k9/preferences/Settings.java b/src/com/fsck/k9/preferences/Settings.java index fb5d21834..135e31ee5 100644 --- a/src/com/fsck/k9/preferences/Settings.java +++ b/src/com/fsck/k9/preferences/Settings.java @@ -35,7 +35,7 @@ public class Settings { * * @see SettingsExporter */ - public static final int VERSION = 11; + public static final int VERSION = 12; public static Map validate(int version, Map> settings, From cd37ae16e1b7c083fc6b8345c220b1d8104f27e8 Mon Sep 17 00:00:00 2001 From: cketti Date: Thu, 2 Aug 2012 02:20:33 +0200 Subject: [PATCH 04/22] Fixed setting names in SettingsUpgrader for version 12 --- src/com/fsck/k9/preferences/GlobalSettings.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/com/fsck/k9/preferences/GlobalSettings.java b/src/com/fsck/k9/preferences/GlobalSettings.java index 21e0ac9d3..57fc7ad07 100644 --- a/src/com/fsck/k9/preferences/GlobalSettings.java +++ b/src/com/fsck/k9/preferences/GlobalSettings.java @@ -277,12 +277,12 @@ public class GlobalSettings { Boolean keyguardPrivacy = (Boolean) settings.get("keyguardPrivacy"); if (keyguardPrivacy != null && keyguardPrivacy) { // current setting: only show subject when unlocked - settings.put("hideSubjectMode", NotificationHideSubject.WHEN_LOCKED); + settings.put("notificationHideSubjectMode", NotificationHideSubject.WHEN_LOCKED); } else { // always show subject [old default] - settings.put("hideSubjectMode", NotificationHideSubject.NEVER); + settings.put("notificationHideSubjectMode", NotificationHideSubject.NEVER); } - return new HashSet(Arrays.asList("hideSubjectMode")); + return new HashSet(Arrays.asList("keyguardPrivacy")); } } From 8c11ec18a93de5665073cb9feb21a2e87437fbfe Mon Sep 17 00:00:00 2001 From: cketti Date: Thu, 2 Aug 2012 02:31:54 +0200 Subject: [PATCH 05/22] Code style/documentation cleanup (no functional changes) --- res/values-de/strings.xml | 18 ++++--------- res/values/arrays.xml | 12 +++++++++ res/values/strings.xml | 20 +++++--------- res/xml/global_preferences.xml | 8 +++--- src/com/fsck/k9/K9.java | 27 +++++++++---------- src/com/fsck/k9/activity/setup/Prefs.java | 8 +++--- .../k9/controller/MessagingController.java | 5 +++- .../fsck/k9/preferences/GlobalSettings.java | 26 +++++++++--------- 8 files changed, 62 insertions(+), 62 deletions(-) diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml index 71c0a0ffa..36971437c 100644 --- a/res/values-de/strings.xml +++ b/res/values-de/strings.xml @@ -323,19 +323,11 @@ http://k9mail.googlecode.com/. Alle als gelesen markieren Senden - Betreff in Benachrichtigungen verbergen - Verbergen des Betreffes in Benachrichtigungen - - Niemals verbergen - Nur, wenn Gerät gesperrt ist - Immer verbergen - - - - NEVER - WHEN_LOCKED - ALWAYS - + Betreff in Benachrichtigungen verbergen + Verbergen des Betreffes in Benachrichtigungen + Niemals + Wenn der Bildschirm gesperrt ist + Immer Gruppenoperationen-Schaltflächen Zeige folgende Schaltflächen in der Nachrichtenliste an diff --git a/res/values/arrays.xml b/res/values/arrays.xml index 6538086d5..4f42c4ca9 100644 --- a/res/values/arrays.xml +++ b/res/values/arrays.xml @@ -667,4 +667,16 @@ AUTO + + @string/global_settings_notification_hide_subject_never + @string/global_settings_notification_hide_subject_when_locked + @string/global_settings_notification_hide_subject_always + + + + NEVER + WHEN_LOCKED + ALWAYS + + diff --git a/res/values/strings.xml b/res/values/strings.xml index e07422dc5..a41a21b90 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -326,20 +326,12 @@ http://k9mail.googlecode.com/ Mark all as read Send - Hide subject in notifications - When to hide the subject in the notification bar. - - Never - When phone is locked - Always - - - - NEVER - WHEN_LOCKED - ALWAYS - - + Hide subject in notifications + When to hide the subject in the notification bar. + Never + When phone is locked + Always + Batch buttons Configure message list batch buttons Mark read/unread diff --git a/res/xml/global_preferences.xml b/res/xml/global_preferences.xml index 4cc455767..7b30b20d8 100644 --- a/res/xml/global_preferences.xml +++ b/res/xml/global_preferences.xml @@ -352,10 +352,10 @@ android:persistent="false" android:key="notification_hide_subject" android:defaultValue="NEVER" - android:entries="@array/global_settings_notification_hide_subject_mode" - android:entryValues="@array/global_settings_notification_hide_subject_mode_values" - android:title="@string/global_settings_notification_hide_subject_mode_title" - android:summary="@string/global_settings_notification_hide_subject_mode_summary"/> + android:entries="@array/global_settings_notification_hide_subject_entries" + android:entryValues="@array/global_settings_notification_hide_subject_values" + android:title="@string/global_settings_notification_hide_subject_title" + android:summary="@string/global_settings_notification_hide_subject_summary"/> diff --git a/src/com/fsck/k9/K9.java b/src/com/fsck/k9/K9.java index d3a7d238e..799b6d96d 100644 --- a/src/com/fsck/k9/K9.java +++ b/src/com/fsck/k9/K9.java @@ -155,11 +155,11 @@ public class K9 extends Application { private static boolean mConfirmDeleteStarred = false; private static boolean mConfirmSpam = false; private static boolean mConfirmMarkAllAsRead = true; - private static NotificationHideSubject mNotificationHideSubject = NotificationHideSubject.NEVER; + + private static NotificationHideSubject sNotificationHideSubject = NotificationHideSubject.NEVER; + /** - * controls when to show the subject - * in the notification area - * -> Global Settings -> Privacy -> Notification + * Controls when to hide the subject in the notification area. */ public enum NotificationHideSubject { ALWAYS, @@ -475,7 +475,7 @@ public class K9 extends Application { editor.putString("sortTypeEnum", mSortType.name()); editor.putBoolean("sortAscending", mSortAscending.get(mSortType)); - editor.putString("notificationHideSubjectMode", mNotificationHideSubject.toString()); + editor.putString("notificationHideSubject", sNotificationHideSubject.toString()); editor.putBoolean("compactLayouts", compactLayouts); editor.putString("attachmentdefaultpath", mAttachmentDefaultPath); @@ -639,8 +639,10 @@ public class K9 extends Application { boolean sortAscending = sprefs.getBoolean("sortAscending", Account.DEFAULT_SORT_ASCENDING); mSortAscending.put(mSortType, sortAscending); - mNotificationHideSubject = NotificationHideSubject.valueOf(sprefs.getString("notificationHideSubjectMode", NotificationHideSubject.NEVER.toString())); - + String notificationHideSubject = sprefs.getString("notificationHideSubject", + NotificationHideSubject.NEVER.toString()); + sNotificationHideSubject = NotificationHideSubject.valueOf(notificationHideSubject); + compactLayouts = sprefs.getBoolean("compactLayouts", false); mAttachmentDefaultPath = sprefs.getString("attachmentdefaultpath", Environment.getExternalStorageDirectory().toString()); fontSizes.load(sprefs); @@ -1057,15 +1059,12 @@ public class K9 extends Application { mConfirmMarkAllAsRead = confirm; } - /** - * @return Whether privacy rules should be applied when system is locked - */ - public static NotificationHideSubject getNotificationHideSubjectMode() { - return mNotificationHideSubject; + public static NotificationHideSubject getNotificationHideSubject() { + return sNotificationHideSubject; } - public static void setNotificationHideSubjectMode(final NotificationHideSubject mode) { - mNotificationHideSubject = mode; + public static void setNotificationHideSubject(final NotificationHideSubject mode) { + sNotificationHideSubject = mode; } public static boolean useCompactLayouts() { diff --git a/src/com/fsck/k9/activity/setup/Prefs.java b/src/com/fsck/k9/activity/setup/Prefs.java index 31167a26c..bf054aaf0 100644 --- a/src/com/fsck/k9/activity/setup/Prefs.java +++ b/src/com/fsck/k9/activity/setup/Prefs.java @@ -102,7 +102,7 @@ public class Prefs extends K9PreferenceActivity { private CheckBoxPreference mManageBack; private CheckBoxPreference mStartIntegratedInbox; private CheckBoxListPreference mConfirmActions; - private ListPreference mNotificationHideSubjectMode; + private ListPreference mNotificationHideSubject; private CheckBoxPreference mMeasureAccounts; private CheckBoxPreference mCountSearch; private CheckBoxPreference mHideSpecialAccounts; @@ -217,8 +217,8 @@ public class Prefs extends K9PreferenceActivity { K9.confirmMarkAllAsRead() }); - mNotificationHideSubjectMode = (ListPreference) findPreference(PREFERENCE_NOTIFICATION_HIDE_SUBJECT); - mNotificationHideSubjectMode.setValue(K9.getNotificationHideSubjectMode().toString()); + mNotificationHideSubject = (ListPreference) findPreference(PREFERENCE_NOTIFICATION_HIDE_SUBJECT); + mNotificationHideSubject.setValue(K9.getNotificationHideSubject().toString()); mMeasureAccounts = (CheckBoxPreference)findPreference(PREFERENCE_MEASURE_ACCOUNTS); mMeasureAccounts.setChecked(K9.measureAccounts()); @@ -427,7 +427,7 @@ public class Prefs extends K9PreferenceActivity { K9.setConfirmDeleteStarred(mConfirmActions.getCheckedItems()[1]); K9.setConfirmSpam(mConfirmActions.getCheckedItems()[2]); K9.setConfirmMarkAllAsRead(mConfirmActions.getCheckedItems()[3]); - K9.setNotificationHideSubjectMode(NotificationHideSubject.valueOf(mNotificationHideSubjectMode.getValue())); + K9.setNotificationHideSubject(NotificationHideSubject.valueOf(mNotificationHideSubject.getValue())); K9.setMeasureAccounts(mMeasureAccounts.isChecked()); K9.setCountSearchMessages(mCountSearch.isChecked()); diff --git a/src/com/fsck/k9/controller/MessagingController.java b/src/com/fsck/k9/controller/MessagingController.java index ffc8037e8..4715019e8 100644 --- a/src/com/fsck/k9/controller/MessagingController.java +++ b/src/com/fsck/k9/controller/MessagingController.java @@ -4179,7 +4179,10 @@ public class MessagingController implements Runnable { // GlobalPreference is ALWAYS hide subject // OR // If we could not set a per-message notification, revert to a default message - if ((K9.getNotificationHideSubjectMode() == NotificationHideSubject.WHEN_LOCKED && keyguardService.inKeyguardRestrictedInputMode()) || (K9.getNotificationHideSubjectMode() == NotificationHideSubject.ALWAYS) || messageNotice.length() == 0) { + if ((K9.getNotificationHideSubject() == NotificationHideSubject.WHEN_LOCKED && + keyguardService.inKeyguardRestrictedInputMode()) || + (K9.getNotificationHideSubject() == NotificationHideSubject.ALWAYS) || + messageNotice.length() == 0) { messageNotice = new StringBuilder(context.getString(R.string.notification_new_title)); } diff --git a/src/com/fsck/k9/preferences/GlobalSettings.java b/src/com/fsck/k9/preferences/GlobalSettings.java index 57fc7ad07..fb8d909bf 100644 --- a/src/com/fsck/k9/preferences/GlobalSettings.java +++ b/src/com/fsck/k9/preferences/GlobalSettings.java @@ -50,7 +50,7 @@ public class GlobalSettings { )); s.put("compactLayouts", Settings.versions( new V(1, new BooleanSetting(false)) - )); + )); s.put("confirmDelete", Settings.versions( new V(1, new BooleanSetting(false)) )); @@ -231,14 +231,16 @@ public class GlobalSettings { s.put("batchButtonsUnselect", Settings.versions( new V(8, new BooleanSetting(true)) )); - s.put("notificationHideSubjectMode", Settings.versions( - new V(12, new EnumSetting(NotificationHideSubject.class, NotificationHideSubject.NEVER)) - )); + s.put("notificationHideSubject", Settings.versions( + new V(12, new EnumSetting(NotificationHideSubject.class, + NotificationHideSubject.NEVER)) + )); SETTINGS = Collections.unmodifiableMap(s); Map u = new HashMap(); - u.put(12, new SettingsUpgraderv12()); + u.put(12, new SettingsUpgraderV12()); + UPGRADERS = Collections.unmodifiableMap(u); } @@ -266,21 +268,21 @@ public class GlobalSettings { } /** - * Upgrades the settings from 11 -> 12 - * get the value from keyguardPrivacy - * and map it to the new enum based options + * Upgrades the settings from version 11 to 12 + * + * Map the 'keyguardPrivacy' value to the new NotificationHideSubject enum. */ - public static class SettingsUpgraderv12 implements SettingsUpgrader { + public static class SettingsUpgraderV12 implements SettingsUpgrader { @Override public Set upgrade(Map settings) { Boolean keyguardPrivacy = (Boolean) settings.get("keyguardPrivacy"); - if (keyguardPrivacy != null && keyguardPrivacy) { + if (keyguardPrivacy != null && keyguardPrivacy.booleanValue()) { // current setting: only show subject when unlocked - settings.put("notificationHideSubjectMode", NotificationHideSubject.WHEN_LOCKED); + settings.put("notificationHideSubject", NotificationHideSubject.WHEN_LOCKED); } else { // always show subject [old default] - settings.put("notificationHideSubjectMode", NotificationHideSubject.NEVER); + settings.put("notificationHideSubject", NotificationHideSubject.NEVER); } return new HashSet(Arrays.asList("keyguardPrivacy")); } From 3e6d161c18fbc92664a04bff1c8bcb026bb89095 Mon Sep 17 00:00:00 2001 From: cketti Date: Thu, 2 Aug 2012 02:43:10 +0200 Subject: [PATCH 06/22] Show current value for the 'notification_hide_subject' ListPreference --- res/values-de/strings.xml | 1 - res/values/strings.xml | 1 - res/xml/global_preferences.xml | 4 +--- src/com/fsck/k9/activity/setup/Prefs.java | 4 ++-- 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml index 36971437c..c0f735642 100644 --- a/res/values-de/strings.xml +++ b/res/values-de/strings.xml @@ -324,7 +324,6 @@ http://k9mail.googlecode.com/. Senden Betreff in Benachrichtigungen verbergen - Verbergen des Betreffes in Benachrichtigungen Niemals Wenn der Bildschirm gesperrt ist Immer diff --git a/res/values/strings.xml b/res/values/strings.xml index a41a21b90..88a74e120 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -327,7 +327,6 @@ http://k9mail.googlecode.com/ Send Hide subject in notifications - When to hide the subject in the notification bar. Never When phone is locked Always diff --git a/res/xml/global_preferences.xml b/res/xml/global_preferences.xml index 7b30b20d8..9c634b378 100644 --- a/res/xml/global_preferences.xml +++ b/res/xml/global_preferences.xml @@ -351,11 +351,9 @@ + android:title="@string/global_settings_notification_hide_subject_title"/> diff --git a/src/com/fsck/k9/activity/setup/Prefs.java b/src/com/fsck/k9/activity/setup/Prefs.java index bf054aaf0..dbac3f1b3 100644 --- a/src/com/fsck/k9/activity/setup/Prefs.java +++ b/src/com/fsck/k9/activity/setup/Prefs.java @@ -217,8 +217,8 @@ public class Prefs extends K9PreferenceActivity { K9.confirmMarkAllAsRead() }); - mNotificationHideSubject = (ListPreference) findPreference(PREFERENCE_NOTIFICATION_HIDE_SUBJECT); - mNotificationHideSubject.setValue(K9.getNotificationHideSubject().toString()); + mNotificationHideSubject = setupListPreference(PREFERENCE_NOTIFICATION_HIDE_SUBJECT, + K9.getNotificationHideSubject().toString()); mMeasureAccounts = (CheckBoxPreference)findPreference(PREFERENCE_MEASURE_ACCOUNTS); mMeasureAccounts.setChecked(K9.measureAccounts()); From 592ed3ef38ae211af9e9b23a63a55f66ccb983f5 Mon Sep 17 00:00:00 2001 From: cketti Date: Thu, 2 Aug 2012 03:09:26 +0200 Subject: [PATCH 07/22] 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()); From 91d404350f8667b914d28a29a61fc02e3ef2610e Mon Sep 17 00:00:00 2001 From: Andrew Chen Date: Thu, 2 Aug 2012 13:39:46 -0700 Subject: [PATCH 08/22] IntelliJ IDEA: Use libs instead of direct jars; add ipr file. Switch to project libraries instead of direct module jar dependencies so that we can bind source jars. Add the IntelliJ IDEA ipr project file in preparation for submodules. --- k9mail.iml | 70 +------- k9mail.ipr | 456 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 460 insertions(+), 66 deletions(-) create mode 100644 k9mail.ipr diff --git a/k9mail.iml b/k9mail.iml index dca3d1438..89b53c252 100644 --- a/k9mail.iml +++ b/k9mail.iml @@ -24,6 +24,8 @@