redefine running state and support alarmMethod "both"

This commit is contained in:
hlq07 2018-06-20 15:04:01 +08:00
parent 524e59330d
commit aad1feb6fe
2 changed files with 7 additions and 5 deletions

View File

@ -473,7 +473,8 @@ public class TodoItemUtil {
public static boolean isNeedNextAlarm(@NotNull TodoItem item, @NotNull Calendar nextAlarm) {
String alarmMethod = item.getStringProperty(ALARM_METHOD);
if (Objects.equals("dialog", alarmMethod) || Objects.equals("area", alarmMethod)) {
if (Objects.equals("dialog", alarmMethod) || Objects.equals("area", alarmMethod)
|| Objects.equals("both", alarmMethod)) {
return !nextAlarm.after(item.getBgn());
} else {
return false;
@ -494,7 +495,8 @@ public class TodoItemUtil {
}
public static boolean isRunning(@NotNull TodoItem item) {
return !isBeforeStart(item) && !isEnded(item);
Calendar now = CalendarUtil.roundToMinute(Calendar.getInstance());
return isIntersectedDuring(item, now, now);
}
}

View File

@ -82,12 +82,12 @@ public class ShowTodoItemDetailStrategy extends VBox {
private static String getFinishInfo(@NotNull TodoItem item) {
if (TodoItemUtil.isFinished(item)) {
return "finish";
} else if (TodoItemUtil.isRunning(item)) {
return "running";
} else if (TodoItemUtil.isBeforeStart(item)) {
return "not start";
} else if (TodoItemUtil.isEnded(item)) {
return "overdue";
} else {
return "running";
return "overdue";
}
}