Show past deadline fields in red

pull/321/head
Alex Baker 10 years ago
parent 3822791c14
commit 351c6696b5

@ -27,7 +27,7 @@ android {
buildToolsVersion "22.0.1" buildToolsVersion "22.0.1"
defaultConfig { defaultConfig {
versionCode 368 versionCode 369
versionName "4.7.13" versionName "4.7.13"
minSdkVersion 7 minSdkVersion 7
targetSdkVersion 22 targetSdkVersion 22

@ -13,12 +13,12 @@ import org.tasks.R;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Arrays; import java.util.Arrays;
import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.Locale; import java.util.Locale;
import static org.tasks.date.DateTimeUtils.currentTimeMillis; import static org.tasks.date.DateTimeUtils.currentTimeMillis;
import static org.tasks.date.DateTimeUtils.newDate; import static org.tasks.date.DateTimeUtils.newDate;
import static org.tasks.date.DateTimeUtils.newDateTime;
public class DateUtilities { public class DateUtilities {
@ -226,14 +226,8 @@ public class DateUtilities {
return d.getDate() == new DateTime(d).dayOfMonth().getMaximumValue(); return d.getDate() == new DateTime(d).dayOfMonth().getMaximumValue();
} }
private static final Calendar calendar = Calendar.getInstance();
public static long getStartOfDay(long time) { public static long getStartOfDay(long time) {
calendar.setTimeInMillis(time); return newDateTime(time).withMillisOfDay(0).getMillis();
calendar.set(Calendar.HOUR, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
return calendar.getTimeInMillis();
} }
static long clearTime(Date date) { static long clearTime(Date date) {

@ -150,7 +150,7 @@ public class WidgetUpdateService extends InjectingService {
if (showDueDates) { if (showDueDates) {
dueDateFormatter.formatDueDate(row, task, textColor); dueDateFormatter.formatDueDate(row, task, textColor);
} else if(task.hasDueDate() && task.isOverdue()) { } else if(task.hasDueDate() && task.isOverdue()) {
textColor = r.getColor(R.color.task_list_overdue); textColor = r.getColor(R.color.overdue);
} }
row.setTextViewText(R.id.text, textContent); row.setTextViewText(R.id.text, textContent);

@ -32,6 +32,8 @@ import static com.todoroo.andlib.utility.AndroidUtilities.atLeastHoneycomb;
import static java.util.Arrays.asList; import static java.util.Arrays.asList;
import static org.tasks.date.DateTimeUtils.newDate; import static org.tasks.date.DateTimeUtils.newDate;
import static org.tasks.date.DateTimeUtils.newDateTime; import static org.tasks.date.DateTimeUtils.newDateTime;
import static org.tasks.preferences.ResourceResolver.getData;
import static org.tasks.preferences.ResourceResolver.getResource;
public class DeadlineControlSet extends TaskEditControlSetBase { public class DeadlineControlSet extends TaskEditControlSetBase {
@ -169,9 +171,30 @@ public class DeadlineControlSet extends TaskEditControlSetBase {
TextView tv = (TextView) LayoutInflater.from(activity).inflate(android.R.layout.simple_spinner_item, parent, false); TextView tv = (TextView) LayoutInflater.from(activity).inflate(android.R.layout.simple_spinner_item, parent, false);
tv.setText(dueDateOptions.get(selectedItemPosition)); tv.setText(dueDateOptions.get(selectedItemPosition));
if (atLeastHoneycomb()) { if (atLeastHoneycomb()) {
dueDateSpinner.setAlpha(date == 0 ? 0.5f : 1f); if (date == 0) {
dueDateSpinner.setAlpha(0.5f);
dueDateSpinner.setBackgroundResource(getResource(activity, R.attr.textfield_underline));
} else {
dueDateSpinner.setAlpha(1.0f);
if (date < newDateTime().withMillisOfDay(0).getMillis()) {
dueDateSpinner.setBackground(activity.getResources().getDrawable(R.drawable.textfield_underline_red, activity.getTheme()));
tv.setTextColor(activity.getResources().getColor(R.color.overdue));
} else {
dueDateSpinner.setBackgroundResource(getResource(activity, R.attr.textfield_underline));
tv.setTextColor(themeColor);
}
}
} else { } else {
tv.setTextColor(date == 0 ? unsetColor : themeColor); if (date == 0) {
dueDateSpinner.setBackgroundResource(getResource(activity, R.attr.textfield_underline));
tv.setTextColor(unsetColor);
} else if (date < newDateTime().withMillisOfDay(0).getMillis()) {
dueDateSpinner.setBackground(activity.getResources().getDrawable(R.drawable.textfield_underline_red, activity.getTheme()));
tv.setTextColor(activity.getResources().getColor(R.color.overdue));
} else {
dueDateSpinner.setBackgroundResource(getResource(activity, R.attr.textfield_underline));
tv.setTextColor(themeColor);
}
} }
return tv; return tv;
} }
@ -208,6 +231,33 @@ public class DeadlineControlSet extends TaskEditControlSetBase {
} }
TextView tv = (TextView) LayoutInflater.from(activity).inflate(android.R.layout.simple_spinner_item, parent, false); TextView tv = (TextView) LayoutInflater.from(activity).inflate(android.R.layout.simple_spinner_item, parent, false);
tv.setText(dueTimeOptions.get(selectedItemPosition)); tv.setText(dueTimeOptions.get(selectedItemPosition));
if (atLeastHoneycomb()) {
if (time == -1) {
dueTimeSpinner.setAlpha(0.5f);
dueTimeSpinner.setBackgroundResource(getResource(activity, R.attr.textfield_underline));
} else {
dueTimeSpinner.setAlpha(1.0f);
if (newDateTime(date).withMillisOfDay(time).isBeforeNow()) {
dueTimeSpinner.setBackground(activity.getResources().getDrawable(R.drawable.textfield_underline_red, activity.getTheme()));
tv.setTextColor(activity.getResources().getColor(R.color.overdue));
} else {
dueTimeSpinner.setBackgroundResource(getResource(activity, R.attr.textfield_underline));
tv.setTextColor(themeColor);
}
}
} else {
if (time == -1) {
dueTimeSpinner.setBackgroundResource(getResource(activity, R.attr.textfield_underline));
tv.setTextColor(unsetColor);
} else if (newDateTime(date).withMillisOfDay(time).isBeforeNow()) {
dueTimeSpinner.setBackground(activity.getResources().getDrawable(R.drawable.textfield_underline_red, activity.getTheme()));
tv.setTextColor(activity.getResources().getColor(R.color.overdue));
} else {
dueTimeSpinner.setBackgroundResource(getResource(activity, R.attr.textfield_underline));
tv.setTextColor(themeColor);
}
}
if (atLeastHoneycomb()) { if (atLeastHoneycomb()) {
dueTimeSpinner.setAlpha(time == -1 ? 0.5f : 1.0f); dueTimeSpinner.setAlpha(time == -1 ? 0.5f : 1.0f);
} else { } else {

@ -36,7 +36,7 @@ public class DueDateFormatter {
row.setTextViewText(R.id.dueDate, task.isCompleted() row.setTextViewText(R.id.dueDate, task.isCompleted()
? resources.getString(R.string.TAd_completed, formatDate(task.getCompletionDate())) ? resources.getString(R.string.TAd_completed, formatDate(task.getCompletionDate()))
: formatDate(task.getDueDate())); : formatDate(task.getDueDate()));
row.setTextColor(R.id.dueDate, task.isOverdue() ? resources.getColor(R.color.task_list_overdue) : textColor); row.setTextColor(R.id.dueDate, task.isOverdue() ? resources.getColor(R.color.overdue) : textColor);
} else { } else {
row.setViewVisibility(R.id.dueDate, View.GONE); row.setViewVisibility(R.id.dueDate, View.GONE);
} }

@ -156,7 +156,7 @@ public class ScrollableViewsFactory implements RemoteViewsService.RemoteViewsFac
if (showDueDates) { if (showDueDates) {
dueDateFormatter.formatDueDate(row, task, textColor); dueDateFormatter.formatDueDate(row, task, textColor);
} else if (task.hasDueDate() && task.isOverdue()) { } else if (task.hasDueDate() && task.isOverdue()) {
textColor = r.getColor(R.color.task_list_overdue); textColor = r.getColor(R.color.overdue);
} }
row.setTextViewText(R.id.text, textContent); row.setTextViewText(R.id.text, textContent);

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 191 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 B

@ -57,7 +57,7 @@
android:layout_marginRight="10dip" android:layout_marginRight="10dip"
android:layout_marginBottom="10dip" android:layout_marginBottom="10dip"
android:textColor="@android:color/white" android:textColor="@android:color/white"
android:background="@color/red_theme_color" android:background="@color/overdue"
android:textSize="24sp" android:textSize="24sp"
android:gravity="center" android:gravity="center"
android:text="@string/audio_stop_recording"/> android:text="@string/audio_stop_recording"/>

@ -17,7 +17,6 @@
<attr name="asTextColorHint" format="color" /> <attr name="asTextColorHint" format="color" />
<attr name="asDetailsColor" format="color" /> <attr name="asDetailsColor" format="color" />
<attr name="asDueDateColor" format="color" /> <attr name="asDueDateColor" format="color" />
<attr name="asDueDateOverdueColor" format="color" />
<attr name="asDueDateCompletedColor" format="color" /> <attr name="asDueDateCompletedColor" format="color" />
<attr name="asSeparatorBackground" format="color" /> <attr name="asSeparatorBackground" format="color" />
<attr name="asToolbarSeparator" format="color" /> <attr name="asToolbarSeparator" format="color" />

@ -8,15 +8,10 @@
<color name="primary">#607d8b</color> <color name="primary">#607d8b</color>
<color name="primary_dark">#4d646f</color> <color name="primary_dark">#4d646f</color>
<color name="task_list_overdue">#FFFB6666</color> <color name="overdue">#ffff5555</color>
<color name="task_list_done">#ff777777</color> <color name="task_list_done">#ff777777</color>
<color name="task_edit_deadline_gray">#888888</color> <color name="task_edit_deadline_gray">#888888</color>
<color name="red_theme_color">#d90000</color>
<color name="dark_blue_theme_color">#1f78b4</color>
<color name="reminder_background">#262626</color>
<color name="task_edit_selected">#385487</color>
<color name="widget_text_color_light">#535353</color> <color name="widget_text_color_light">#535353</color>
<color name="widget_text_color_dark">#ffffff</color> <color name="widget_text_color_dark">#ffffff</color>
<color name="widget_header_dark">#000000</color> <color name="widget_header_dark">#000000</color>
@ -45,5 +40,9 @@
<color name="snackbar_undo">#f4b400</color> <color name="snackbar_undo">#f4b400</color>
<!-- deprecated -->
<color name="dark_blue_theme_color">#1f78b4</color>
<color name="reminder_background">#262626</color>
</resources> </resources>

@ -81,7 +81,7 @@
</style> </style>
<style name="TextAppearance.TAd_ItemDueDate_Overdue" parent="TextAppearance.TAd_ItemDueDate"> <style name="TextAppearance.TAd_ItemDueDate_Overdue" parent="TextAppearance.TAd_ItemDueDate">
<item name="android:textColor">?attr/asDueDateOverdueColor</item> <item name="android:textColor">@color/overdue</item>
</style> </style>
<style name="TextAppearance.TAd_ItemDueDate_Completed" parent="TextAppearance.TAd_ItemDueDate"> <style name="TextAppearance.TAd_ItemDueDate_Completed" parent="TextAppearance.TAd_ItemDueDate">

@ -50,7 +50,6 @@
<item name="ic_action_cloud">@drawable/ic_cloud_queue_white_24dp</item> <item name="ic_action_cloud">@drawable/ic_cloud_queue_white_24dp</item>
<item name="ic_action_new_tag">@drawable/ic_add_white_24dp</item> <item name="ic_action_new_tag">@drawable/ic_add_white_24dp</item>
<item name="asDueDateOverdueColor">#ee5555</item>
<item name="asEditTextBackground">@null</item> <item name="asEditTextBackground">@null</item>
<item name="windowActionModeOverlay">true</item> <item name="windowActionModeOverlay">true</item>

@ -12,7 +12,6 @@
<item name="popup_theme">@style/ThemeOverlay.AppCompat.Light</item> <item name="popup_theme">@style/ThemeOverlay.AppCompat.Light</item>
<item name="android:windowBackground">@android:color/white</item> <item name="android:windowBackground">@android:color/white</item>
<item name="asDueDateOverdueColor">#ee5555</item>
<item name="asEditTextBackground">@null</item> <item name="asEditTextBackground">@null</item>
<item name="windowActionModeOverlay">true</item> <item name="windowActionModeOverlay">true</item>

Loading…
Cancel
Save