From 6293161863376f97a8a11781d6a1846dd921fb7d Mon Sep 17 00:00:00 2001 From: Tim Su Date: Thu, 8 Jan 2009 21:02:25 +0000 Subject: [PATCH] More cosmetic changes: added option to colorize task list, bigger bubbles, and some changes to the label titles. --- AndroidManifest.xml | 6 +- res/layout/task_list_row.xml | 2 +- res/values/colors.xml | 4 ++ res/values/strings.xml | 12 +++- res/xml/preferences.xml | 72 +++++++++++-------- .../astrid/activities/TaskListAdapter.java | 2 +- .../timsu/astrid/data/enums/Importance.java | 28 ++++++-- .../astrid/data/task/AbstractTaskModel.java | 5 +- .../astrid/data/task/TaskModelForList.java | 5 +- .../astrid/data/task/TaskModelForView.java | 5 -- .../timsu/astrid/utilities/Preferences.java | 11 +++ 11 files changed, 104 insertions(+), 48 deletions(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index acc79e462..ae66f9404 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -1,13 +1,13 @@ + android:versionCode="45" + android:versionName="1.11.1"> + android:value="45" /> diff --git a/res/layout/task_list_row.xml b/res/layout/task_list_row.xml index f2129ac56..e642a639c 100644 --- a/res/layout/task_list_row.xml +++ b/res/layout/task_list_row.xml @@ -85,6 +85,6 @@ android:gravity="center_vertical" android:layout_width="26px" android:layout_height="fill_parent" - android:paddingLeft="6dip"/> + android:paddingLeft="12dip"/> \ No newline at end of file diff --git a/res/values/colors.xml b/res/values/colors.xml index 87711472e..646685d50 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -23,6 +23,10 @@ #FFFB6666 #FFFFFFFF #ff777777 + #ffFF8281 + #ffF7F1BD + #ff597AFF + #ffB4B4B4 #FFFB6666 #ffF0E89E diff --git a/res/values/strings.xml b/res/values/strings.xml index d83045c2c..26719ddb2 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -226,7 +226,9 @@ If you don\'t want to see the new task right after you complete the old one, you notification_ringtone font_size deadline_time + colorize + Notifications Quiet Hours Start Starting hour when Astrid should be quiet (e.g. 22) Quiet Hours End @@ -235,8 +237,14 @@ If you don\'t want to see the new task right after you complete the old one, you If checked, Astrid will try a bit harder to get your attention Notification Ringtone Choose how Astrid alerts you! + + Appearance Task List Font Font on the main listing page (i.e. 22) - Default Deadline Time - # of days from now to set new deadlines (i.e. 7) + Colorize Task List + Different colors for different priorities + + Other + Default Deadlines + # of days from now to set new deadlines diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml index 17b0e4c52..092749769 100644 --- a/res/xml/preferences.xml +++ b/res/xml/preferences.xml @@ -1,32 +1,48 @@ - - - - - - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/com/timsu/astrid/activities/TaskListAdapter.java b/src/com/timsu/astrid/activities/TaskListAdapter.java index 8f5146202..bf4073bbc 100644 --- a/src/com/timsu/astrid/activities/TaskListAdapter.java +++ b/src/com/timsu/astrid/activities/TaskListAdapter.java @@ -280,7 +280,7 @@ public class TaskListAdapter extends ArrayAdapter { progress.setButtonDrawable(R.drawable.btn_check0); } else { name.setBackgroundDrawable(null); - name.setTextColor(r.getColor(task.getTaskColorResource())); + name.setTextColor(r.getColor(task.getTaskColorResource(getContext()))); if(task.getProgressPercentage() >= 75) progress.setButtonDrawable(R.drawable.btn_check75); diff --git a/src/com/timsu/astrid/data/enums/Importance.java b/src/com/timsu/astrid/data/enums/Importance.java index 924a3d38c..ddfbdd162 100644 --- a/src/com/timsu/astrid/data/enums/Importance.java +++ b/src/com/timsu/astrid/data/enums/Importance.java @@ -24,22 +24,36 @@ import com.timsu.astrid.R; public enum Importance { // MOST IMPORTANT - LEVEL_1(R.string.importance_1, R.color.importance_1, R.drawable.bullet_red), - LEVEL_2(R.string.importance_2, R.color.importance_2, R.drawable.bullet_orange), - LEVEL_3(R.string.importance_3, R.color.importance_3, R.drawable.bullet_blue), - LEVEL_4(R.string.importance_4, R.color.importance_4, R.drawable.bullet_white), + LEVEL_1(R.string.importance_1, + R.color.importance_1, + R.color.task_list_importance_1, + R.drawable.bubble_red), + LEVEL_2(R.string.importance_2, + R.color.importance_2, + R.color.task_list_importance_2, + R.drawable.bubble_yellow), + LEVEL_3(R.string.importance_3, + R.color.importance_3, + R.color.task_list_importance_3, + R.drawable.bubble_blue), + LEVEL_4(R.string.importance_4, + R.color.importance_4, + R.color.task_list_importance_4, + R.drawable.bubble_gray), // LEAST IMPORTANT ; int label; int color; + int taskListColor; int icon; public static final Importance DEFAULT = LEVEL_3; - private Importance(int label, int color, int icon) { + private Importance(int label, int color, int taskListColor, int icon) { this.label = label; this.color = color; + this.taskListColor = taskListColor; this.icon = icon; } @@ -51,6 +65,10 @@ public enum Importance { return color; } + public int getTaskListColor() { + return taskListColor; + } + public int getIconResource() { return icon; } diff --git a/src/com/timsu/astrid/data/task/AbstractTaskModel.java b/src/com/timsu/astrid/data/task/AbstractTaskModel.java index 6f08f0156..b2e37eb81 100644 --- a/src/com/timsu/astrid/data/task/AbstractTaskModel.java +++ b/src/com/timsu/astrid/data/task/AbstractTaskModel.java @@ -33,6 +33,7 @@ import com.timsu.astrid.data.AbstractController; import com.timsu.astrid.data.AbstractModel; import com.timsu.astrid.data.enums.Importance; import com.timsu.astrid.data.enums.RepeatInterval; +import com.timsu.astrid.utilities.Preferences; /** Abstract model of a task. Subclasses implement the getters and setters @@ -187,10 +188,12 @@ public abstract class AbstractTaskModel extends AbstractModel { // --- utility methods /** Gets task color. Requires definiteDueDate and importance */ - protected int getTaskColorResource() { + protected int getTaskColorResource(Context context) { if(getDefiniteDueDate() != null && getDefiniteDueDate().getTime() < System.currentTimeMillis()) { return R.color.task_list_overdue; + } else if(Preferences.isColorize(context)) { + return getImportance().getTaskListColor(); } else { return R.color.task_list_normal; } diff --git a/src/com/timsu/astrid/data/task/TaskModelForList.java b/src/com/timsu/astrid/data/task/TaskModelForList.java index f3aaa5e83..2d0e4cf30 100644 --- a/src/com/timsu/astrid/data/task/TaskModelForList.java +++ b/src/com/timsu/astrid/data/task/TaskModelForList.java @@ -26,6 +26,7 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; +import android.content.Context; import android.database.Cursor; import com.timsu.astrid.data.AbstractController; @@ -140,8 +141,8 @@ public class TaskModelForList extends AbstractTaskModel { } @Override - public int getTaskColorResource() { - return super.getTaskColorResource(); + public int getTaskColorResource(Context context) { + return super.getTaskColorResource(context); } @Override diff --git a/src/com/timsu/astrid/data/task/TaskModelForView.java b/src/com/timsu/astrid/data/task/TaskModelForView.java index ee627cd8d..d4f35d089 100644 --- a/src/com/timsu/astrid/data/task/TaskModelForView.java +++ b/src/com/timsu/astrid/data/task/TaskModelForView.java @@ -64,11 +64,6 @@ public class TaskModelForView extends AbstractTaskModel { return super.isTaskCompleted(); } - @Override - public int getTaskColorResource() { - return super.getTaskColorResource(); - } - @Override public int getProgressPercentage() { return super.getProgressPercentage(); diff --git a/src/com/timsu/astrid/utilities/Preferences.java b/src/com/timsu/astrid/utilities/Preferences.java index 4620db6d2..4b34b0a2b 100644 --- a/src/com/timsu/astrid/utilities/Preferences.java +++ b/src/com/timsu/astrid/utilities/Preferences.java @@ -17,6 +17,7 @@ public class Preferences { // default values private static final boolean DEFAULT_PERSISTENCE_MODE = true; + private static final boolean DEFAULT_COLORIZE = false; /** Set preference defaults, if unset. called at startup */ public static void setPreferenceDefaults(Context context) { @@ -34,6 +35,9 @@ public class Preferences { if(!prefs.contains(r.getString(R.string.p_deadlineTime))) { editor.putString(r.getString(R.string.p_deadlineTime), "7"); } + if(!prefs.contains(r.getString(R.string.p_colorize))) { + editor.putBoolean(r.getString(R.string.p_colorize), DEFAULT_COLORIZE); + } editor.commit(); } @@ -101,6 +105,13 @@ public class Preferences { return getIntegerValue(context, R.string.p_deadlineTime); } + /** Get perstence mode setting */ + public static boolean isColorize(Context context) { + Resources r = context.getResources(); + return getPrefs(context).getBoolean(r.getString( + R.string.p_colorize), DEFAULT_COLORIZE); + } + // --- helper methods private static SharedPreferences getPrefs(Context context) {