Merge pull request #1545 from tkterris/now-due-date

Add "now" option for due date filter
pull/1584/head
Alex Baker 3 years ago committed by GitHub
commit adacf99290
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -111,7 +111,8 @@ class TaskCreator @Inject constructor(
when (key) {
Tag.KEY -> tags.add(value as String)
GoogleTask.KEY, CaldavTask.KEY, Place.KEY -> task.putTransitory(key, value)
DUE_DATE.name -> value.substitute()?.toLongOrNull()?.let { task.dueDate = it }
DUE_DATE.name -> value.substitute()?.toLongOrNull()?.let { task.dueDate =
createDueDate(Task.URGENCY_SPECIFIC_DAY, it) }
IMPORTANCE.name -> value.substitute()?.toIntOrNull()?.let { task.priority = it }
HIDE_UNTIL.name ->
value.substitute()?.toLongOrNull()?.let { task.hideUntil = it.startOfDay() }

@ -61,7 +61,7 @@ class NewFilterDialog : DialogFragment() {
val list = ArrayList<CriterionInstance>()
when (title) {
R.string.filter_overdue ->
list.add(newMultiSelect(provider.dueDateFilter, 1, TYPE_INTERSECT))
list.add(newMultiSelect(provider.dueDateFilter, 7, TYPE_INTERSECT))
R.string.filter_today_only -> {
list.add(newMultiSelect(provider.dueDateFilter, 1, TYPE_SUBTRACT))
list.add(newMultiSelect(provider.dueDateFilter, 2, TYPE_INTERSECT))

@ -179,7 +179,8 @@ class FilterCriteriaProvider @Inject constructor(
PermaSql.VALUE_EOD_TOMORROW,
PermaSql.VALUE_EOD_DAY_AFTER,
PermaSql.VALUE_EOD_NEXT_WEEK,
PermaSql.VALUE_EOD_NEXT_MONTH)
PermaSql.VALUE_EOD_NEXT_MONTH,
PermaSql.VALUE_NOW)
val values: MutableMap<String?, Any> = HashMap()
values[Task.DUE_DATE.name] = "?"
return MultipleSelectCriterion(
@ -191,7 +192,13 @@ class FilterCriteriaProvider @Inject constructor(
and(
activeAndVisible(),
or(field("?").eq(0), Task.DUE_DATE.gt(0)),
Task.DUE_DATE.lte("?")))
// find tasks that have due dates before the specified
// date, or all-day tasks that have due dates before
// EOD today if the specified date is NOW
or(Task.DUE_DATE.lte("?"),
and(field("${Task.DUE_DATE} / 1000 % 60").eq(0),
field("?").eq(field("${PermaSql.VALUE_NOW}")),
Task.DUE_DATE.lte("${PermaSql.VALUE_EOD}")))))
.toString(),
values,
r.getStringArray(R.array.CFC_dueBefore_entries),
@ -208,7 +215,8 @@ class FilterCriteriaProvider @Inject constructor(
PermaSql.VALUE_EOD_TOMORROW,
PermaSql.VALUE_EOD_DAY_AFTER,
PermaSql.VALUE_EOD_NEXT_WEEK,
PermaSql.VALUE_EOD_NEXT_MONTH)
PermaSql.VALUE_EOD_NEXT_MONTH,
PermaSql.VALUE_NOW)
val values: MutableMap<String?, Any> = HashMap()
values[Task.HIDE_UNTIL.name] = "?"
return MultipleSelectCriterion(

@ -106,6 +106,7 @@
<item>@string/day_after_tomorrow</item>
<item>@string/next_week</item>
<item>@string/next_month</item>
<item>@string/now</item>
</string-array>
<string-array name="CFC_startBefore_entries">
@ -116,6 +117,7 @@
<item>@string/day_after_tomorrow</item>
<item>@string/next_week</item>
<item>@string/next_month</item>
<item>@string/now</item>
</string-array>
<string-array name="TEA_reminder_random">

@ -287,6 +287,7 @@ File %1$s contained %2$s.\n\n
<item quantity="one">1 task</item>
<item quantity="other">%d tasks</item>
</plurals>
<string name="now">Now</string>
<string name="today">Today</string>
<string name="today_lowercase">today</string>
<string name="tomorrow">Tomorrow</string>

Loading…
Cancel
Save