diff --git a/astrid/res/drawable/button_plus.png b/astrid/res/drawable/button_plus.png index 00670f174..82bc521b7 100644 Binary files a/astrid/res/drawable/button_plus.png and b/astrid/res/drawable/button_plus.png differ diff --git a/astrid/res/drawable/widget_body_legacy.xml b/astrid/res/drawable/widget_body_legacy.xml new file mode 100644 index 000000000..75d56cf02 --- /dev/null +++ b/astrid/res/drawable/widget_body_legacy.xml @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file diff --git a/astrid/res/drawable/widget_header_legacy.xml b/astrid/res/drawable/widget_header_legacy.xml new file mode 100644 index 000000000..acd36dd40 --- /dev/null +++ b/astrid/res/drawable/widget_header_legacy.xml @@ -0,0 +1,12 @@ + + + + + \ No newline at end of file diff --git a/astrid/res/values/colors.xml b/astrid/res/values/colors.xml index 29d486624..ab82f46ed 100644 --- a/astrid/res/values/colors.xml +++ b/astrid/res/values/colors.xml @@ -39,7 +39,9 @@ #dd000000 #ddffffff #dd000000 - + #fc1c2334 + #fc243455 + #fc1c1c1c diff --git a/astrid/res/values/keys.xml b/astrid/res/values/keys.xml index 66950b745..a52911368 100644 --- a/astrid/res/values/keys.xml +++ b/astrid/res/values/keys.xml @@ -189,6 +189,7 @@ black transparent transparent-white + legacy-widget diff --git a/astrid/res/values/strings-core.xml b/astrid/res/values/strings-core.xml index a4d93c57c..2ec17c321 100644 --- a/astrid/res/values/strings-core.xml +++ b/astrid/res/values/strings-core.xml @@ -561,6 +561,7 @@ Night Transparent (White Text) Transparent (Black Text) + Old Style diff --git a/astrid/src/com/todoroo/astrid/service/ThemeService.java b/astrid/src/com/todoroo/astrid/service/ThemeService.java index 993557f36..127b1d5f1 100644 --- a/astrid/src/com/todoroo/astrid/service/ThemeService.java +++ b/astrid/src/com/todoroo/astrid/service/ThemeService.java @@ -9,6 +9,7 @@ import com.timsu.astrid.R; import com.todoroo.andlib.service.ContextManager; import com.todoroo.andlib.utility.AndroidUtilities; import com.todoroo.andlib.utility.Preferences; +import com.todoroo.astrid.widget.TasksWidget; @SuppressWarnings("nls") public class ThemeService { @@ -20,6 +21,7 @@ public class ThemeService { public static final String THEME_TRANSPARENT_WHITE = "transparent-white"; public static final String THEME_WIDGET_SAME_AS_APP = "same-as-app"; + public static final String THEME_WIDGET_LEGACY = "legacy-widget"; public static final int FLAG_FORCE_DARK = 1; public static final int FLAG_FORCE_LIGHT = 2; @@ -44,6 +46,8 @@ public class ThemeService { String preference = Preferences.getStringValue(R.string.p_theme_widget); if (TextUtils.isEmpty(preference) || THEME_WIDGET_SAME_AS_APP.equals(preference)) return getTheme(); + else if (THEME_WIDGET_LEGACY.equals(preference)) + return TasksWidget.THEME_LEGACY; else return getStyleForSetting(preference); } diff --git a/astrid/src/com/todoroo/astrid/widget/TasksWidget.java b/astrid/src/com/todoroo/astrid/widget/TasksWidget.java index 71195cb39..5ca753f8f 100644 --- a/astrid/src/com/todoroo/astrid/widget/TasksWidget.java +++ b/astrid/src/com/todoroo/astrid/widget/TasksWidget.java @@ -45,6 +45,8 @@ import com.todoroo.astrid.utility.Constants; public class TasksWidget extends AppWidgetProvider { + public static final int THEME_LEGACY = -1; + static { AstridDependencyInjector.initialize(); } @@ -174,15 +176,18 @@ public class TasksWidget extends AppWidgetProvider { task.readFromCursor(cursor); String textContent = ""; - int textColor = context.getResources() + Resources r = context.getResources(); + int textColor = r .getColor(isDarkTheme() ? R.color.widget_text_color_dark : R.color.widget_text_color_light); + if (isLegacyTheme()) + textColor = r.getColor(android.R.color.white); textContent = task.getValue(Task.TITLE); if(task.isCompleted()) - textColor = context.getResources().getColor(R.color.task_list_done); + textColor = r.getColor(R.color.task_list_done); else if(task.hasDueDate() && task.getValue(Task.DUE_DATE) < DateUtilities.now()) - textColor = context.getResources().getColor(R.color.task_list_overdue); + textColor = r.getColor(R.color.task_list_overdue); RemoteViews row = new RemoteViews(Constants.PACKAGE, R.layout.widget_row); @@ -192,7 +197,9 @@ public class TasksWidget extends AppWidgetProvider { views.addView(R.id.taskbody, row); RemoteViews separator = new RemoteViews(Constants.PACKAGE, R.layout.widget_separator); - views.addView(R.id.taskbody, separator); + boolean isLastRow = (i == cursor.getCount() - 1) || (i == numberOfTasks - 1); + if (!isLastRow) + views.addView(R.id.taskbody, separator); } for (; i < numberOfTasks; i++) { RemoteViews row = new RemoteViews(Constants.PACKAGE, R.layout.widget_row); @@ -260,6 +267,11 @@ public class TasksWidget extends AppWidgetProvider { return (theme == R.style.Theme || theme == R.style.Theme_Transparent); } + private boolean isLegacyTheme() { + int theme = ThemeService.getWidgetTheme(); + return theme == THEME_LEGACY; + } + @SuppressWarnings("nls") private void applyThemeToWidget(RemoteViews views) { int theme = ThemeService.getWidgetTheme(); @@ -269,6 +281,16 @@ public class TasksWidget extends AppWidgetProvider { int bodyColor; int buttonDrawable; int separatorColor; + + if (isLegacyTheme()) { + views.setInt(R.id.widget_header, "setBackgroundResource", R.drawable.widget_header_legacy); + views.setInt(R.id.taskbody, "setBackgroundResource", R.drawable.widget_body_legacy); + views.setTextColor(R.id.widget_title, r.getColor(android.R.color.white)); + views.setInt(R.id.widget_button, "setImageResource", R.drawable.button_plus); + views.setViewVisibility(R.id.widget_header_separator, View.GONE); + return; + } + if (isDarkTheme()) { headerColor = r.getColor(R.color.widget_header_dark); titleColor = r.getColor(R.color.widget_text_color_dark);