redefine running state and support alarmMethod "both"
This commit is contained in:
parent
524e59330d
commit
aad1feb6fe
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue