mirror of https://github.com/tasks/tasks
Add built-in Snoozed filter
parent
a5e0a06762
commit
3d9835a162
@ -0,0 +1,51 @@
|
||||
package org.tasks.filters;
|
||||
|
||||
import static org.tasks.data.Alarm.TYPE_SNOOZE;
|
||||
|
||||
import android.os.Parcel;
|
||||
|
||||
import com.todoroo.andlib.sql.Criterion;
|
||||
import com.todoroo.andlib.sql.Join;
|
||||
import com.todoroo.andlib.sql.QueryTemplate;
|
||||
import com.todoroo.astrid.api.Filter;
|
||||
import com.todoroo.astrid.data.Task;
|
||||
|
||||
import org.tasks.data.Alarm;
|
||||
|
||||
public class SnoozedFilter extends Filter {
|
||||
|
||||
public static final Creator<SnoozedFilter> CREATOR =
|
||||
new Creator<SnoozedFilter>() {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public SnoozedFilter createFromParcel(Parcel source) {
|
||||
SnoozedFilter item = new SnoozedFilter();
|
||||
item.readFromParcel(source);
|
||||
return item;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public SnoozedFilter[] newArray(int size) {
|
||||
return new SnoozedFilter[size];
|
||||
}
|
||||
};
|
||||
|
||||
public SnoozedFilter(String listingTitle) {
|
||||
super(listingTitle, getQueryTemplate());
|
||||
}
|
||||
|
||||
private SnoozedFilter() {}
|
||||
|
||||
private static QueryTemplate getQueryTemplate() {
|
||||
return new QueryTemplate()
|
||||
.join(Join.inner(Alarm.TABLE, Task.ID.eq(Alarm.TASK)))
|
||||
.where(Criterion.and(Task.DELETION_DATE.lte(0), Alarm.TYPE.eq(TYPE_SNOOZE)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsHiddenTasks() {
|
||||
return false;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue