1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-30 13:12:25 -05:00

Code style/documentation cleanup (no functional changes)

This commit is contained in:
cketti 2012-08-02 02:31:54 +02:00
parent cd37ae16e1
commit 8c11ec18a9
8 changed files with 62 additions and 62 deletions

View File

@ -323,19 +323,11 @@ http://k9mail.googlecode.com/.
<string name="global_settings_confirm_action_mark_all_as_read">Alle als gelesen markieren</string>
<string name="global_settings_confirm_action_send">Senden</string>
<string name="global_settings_notification_hide_subject_mode_title">Betreff in Benachrichtigungen verbergen</string>
<string name="global_settings_notification_hide_subject_mode_summary">Verbergen des Betreffes in Benachrichtigungen</string>
<string-array name="global_settings_notification_hide_subject_mode">
<item name="1">Niemals verbergen</item>
<item name="2">Nur, wenn Gerät gesperrt ist</item>
<item name="3">Immer verbergen</item>
</string-array>
<string-array name="global_settings_notification_hide_subject_mode_values">
<item name="1">NEVER</item>
<item name="2">WHEN_LOCKED</item>
<item name="3">ALWAYS</item>
</string-array>
<string name="global_settings_notification_hide_subject_title">Betreff in Benachrichtigungen verbergen</string>
<string name="global_settings_notification_hide_subject_summary">Verbergen des Betreffes in Benachrichtigungen</string>
<string name="global_settings_notification_hide_subject_never">Niemals</string>
<string name="global_settings_notification_hide_subject_when_locked">Wenn der Bildschirm gesperrt ist</string>
<string name="global_settings_notification_hide_subject_always">Immer</string>
<string name="global_settings_batch_buttons">Gruppenoperationen-Schaltflächen</string>
<string name="global_settings_batch_buttons_summary">Zeige folgende Schaltflächen in der Nachrichtenliste an</string>

View File

@ -667,4 +667,16 @@
<item>AUTO</item>
</string-array>
<string-array name="global_settings_notification_hide_subject_entries">
<item name="1">@string/global_settings_notification_hide_subject_never</item>
<item name="2">@string/global_settings_notification_hide_subject_when_locked</item>
<item name="3">@string/global_settings_notification_hide_subject_always</item>
</string-array>
<string-array name="global_settings_notification_hide_subject_values">
<item name="1">NEVER</item>
<item name="2">WHEN_LOCKED</item>
<item name="3">ALWAYS</item>
</string-array>
</resources>

View File

@ -326,19 +326,11 @@ http://k9mail.googlecode.com/
<string name="global_settings_confirm_action_mark_all_as_read">Mark all as read</string>
<string name="global_settings_confirm_action_send">Send</string>
<string name="global_settings_notification_hide_subject_mode_title">Hide subject in notifications</string>
<string name="global_settings_notification_hide_subject_mode_summary">When to hide the subject in the notification bar.</string>
<string-array name="global_settings_notification_hide_subject_mode">
<item name="1">Never</item>
<item name="2">When phone is locked</item>
<item name="3">Always</item>
</string-array>
<string-array name="global_settings_notification_hide_subject_mode_values">
<item name="1">NEVER</item>
<item name="2">WHEN_LOCKED</item>
<item name="3">ALWAYS</item>
</string-array>
<string name="global_settings_notification_hide_subject_title">Hide subject in notifications</string>
<string name="global_settings_notification_hide_subject_summary">When to hide the subject in the notification bar.</string>
<string name="global_settings_notification_hide_subject_never">Never</string>
<string name="global_settings_notification_hide_subject_when_locked">When phone is locked</string>
<string name="global_settings_notification_hide_subject_always">Always</string>
<string name="global_settings_batch_buttons">Batch buttons</string>
<string name="global_settings_batch_buttons_summary">Configure message list batch buttons</string>

View File

@ -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"/>
</PreferenceScreen>

View File

@ -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,7 +639,9 @@ 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());
@ -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() {

View File

@ -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());

View File

@ -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));
}

View File

@ -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<Integer, SettingsUpgrader> u = new HashMap<Integer, SettingsUpgrader>();
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<String> upgrade(Map<String, Object> 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<String>(Arrays.asList("keyguardPrivacy"));
}