From ade7846578184e35326dd33c9d997217ac32bb8b Mon Sep 17 00:00:00 2001 From: Tim Su Date: Mon, 23 Feb 2009 06:21:57 +0000 Subject: [PATCH] Another enum bites the dust. NotificationIconSet. --- res/values/arrays.xml | 2 ++ src/com/timsu/astrid/utilities/Notifications.java | 8 ++++---- src/com/timsu/astrid/utilities/Preferences.java | 12 +++++------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/res/values/arrays.xml b/res/values/arrays.xml index 634ea3331..24933a8d4 100644 --- a/res/values/arrays.xml +++ b/res/values/arrays.xml @@ -52,12 +52,14 @@ Time to shorten your todo list! + Pink Boring Astrid + 0 1 diff --git a/src/com/timsu/astrid/utilities/Notifications.java b/src/com/timsu/astrid/utilities/Notifications.java index 1e248232b..d52767b5c 100644 --- a/src/com/timsu/astrid/utilities/Notifications.java +++ b/src/com/timsu/astrid/utilities/Notifications.java @@ -404,10 +404,10 @@ public class Notifications extends BroadcastReceiver { String appName = r.getString(R.string.app_name); int icon; switch(Preferences.getNotificationIconTheme(context)) { - case PINK: + case Preferences.ICON_SET_PINK: icon = R.drawable.notif_pink_alarm; break; - case BORING: + case Preferences.ICON_SET_BORING: icon = R.drawable.notif_boring_alarm; break; default: @@ -481,10 +481,10 @@ public class Notifications extends BroadcastReceiver { // create notification object int icon; switch(Preferences.getNotificationIconTheme(context)) { - case PINK: + case Preferences.ICON_SET_PINK: icon = R.drawable.notif_pink_working; break; - case BORING: + case Preferences.ICON_SET_BORING: icon = R.drawable.notif_boring_working; break; default: diff --git a/src/com/timsu/astrid/utilities/Preferences.java b/src/com/timsu/astrid/utilities/Preferences.java index 2fc44c447..a2bf8a469 100644 --- a/src/com/timsu/astrid/utilities/Preferences.java +++ b/src/com/timsu/astrid/utilities/Preferences.java @@ -22,11 +22,9 @@ public class Preferences { private static final String P_SYNC_LAST_SYNC = "lastsync"; // pref values - public enum NotificationIconTheme { - PINK, - BORING, - ASTRID - } + public static final int ICON_SET_PINK = 0; + public static final int ICON_SET_BORING = 1; + public static final int ICON_SET_ASTRID = 2; // default values private static final boolean DEFAULT_PERSISTENCE_MODE = true; @@ -129,11 +127,11 @@ public class Preferences { } /** returns hour at which quiet hours start, or null if not set */ - public static NotificationIconTheme getNotificationIconTheme(Context context) { + public static int getNotificationIconTheme(Context context) { Integer index = getIntegerValue(context, R.string.p_notif_icon); if(index == null) index = 0; - return NotificationIconTheme.values()[index]; + return index; } /** Get notification ring tone, or null if not set */