Remove duplicate method

pull/253/head
Alex Baker 10 years ago
parent e82de847fd
commit dc478b0950

@ -66,7 +66,7 @@ public final class CoreFilterExposer extends InjectingBroadcastReceiver implemen
public static Filter buildInboxFilter(Resources r) { public static Filter buildInboxFilter(Resources r) {
return new Filter(r.getString(R.string.BFE_Active), r.getString(R.string.BFE_Active), return new Filter(r.getString(R.string.BFE_Active), r.getString(R.string.BFE_Active),
new QueryTemplate().where( new QueryTemplate().where(
Criterion.and(TaskCriteria.activeVisibleMine(), Criterion.and(TaskCriteria.activeAndVisible(),
Criterion.not(Task.ID.in(Query.select(Metadata.TASK).from(Metadata.TABLE).where( Criterion.not(Task.ID.in(Query.select(Metadata.TASK).from(Metadata.TABLE).where(
Criterion.and(MetadataCriteria.withKey(TaskToTagMetadata.KEY), Criterion.and(MetadataCriteria.withKey(TaskToTagMetadata.KEY),
TaskToTagMetadata.TAG_NAME.like("x_%", "x"))))))), //$NON-NLS-1$ //$NON-NLS-2$ TaskToTagMetadata.TAG_NAME.like("x_%", "x"))))))), //$NON-NLS-1$ //$NON-NLS-2$
@ -80,7 +80,7 @@ public final class CoreFilterExposer extends InjectingBroadcastReceiver implemen
return new Filter(todayTitle, return new Filter(todayTitle,
todayTitle, todayTitle,
new QueryTemplate().where( new QueryTemplate().where(
Criterion.and(TaskCriteria.activeVisibleMine(), Criterion.and(TaskCriteria.activeAndVisible(),
Task.DUE_DATE.gt(0), Task.DUE_DATE.gt(0),
Task.DUE_DATE.lte(PermaSql.VALUE_EOD))), Task.DUE_DATE.lte(PermaSql.VALUE_EOD))),
todayValues); todayValues);

@ -216,7 +216,7 @@ public class CustomFilterActivity extends InjectingActionBarActivity {
getString(R.string.CFC_dueBefore_text), getString(R.string.CFC_dueBefore_text),
Query.select(Task.ID).from(Task.TABLE).where( Query.select(Task.ID).from(Task.TABLE).where(
Criterion.and( Criterion.and(
TaskCriteria.activeVisibleMine(), TaskCriteria.activeAndVisible(),
Criterion.or( Criterion.or(
Field.field("?").eq(0), Field.field("?").eq(0),
Task.DUE_DATE.gt(0)), Task.DUE_DATE.gt(0)),
@ -244,7 +244,7 @@ public class CustomFilterActivity extends InjectingActionBarActivity {
IDENTIFIER_IMPORTANCE, IDENTIFIER_IMPORTANCE,
getString(R.string.CFC_importance_text), getString(R.string.CFC_importance_text),
Query.select(Task.ID).from(Task.TABLE).where( Query.select(Task.ID).from(Task.TABLE).where(
Criterion.and(TaskCriteria.activeVisibleMine(), Criterion.and(TaskCriteria.activeAndVisible(),
Task.IMPORTANCE.lte("?"))).toString(), Task.IMPORTANCE.lte("?"))).toString(),
values, entries, values, entries,
entryValues, ((BitmapDrawable)r.getDrawable(R.drawable.tango_warning)).getBitmap(), entryValues, ((BitmapDrawable)r.getDrawable(R.drawable.tango_warning)).getBitmap(),
@ -260,7 +260,7 @@ public class CustomFilterActivity extends InjectingActionBarActivity {
IDENTIFIER_TITLE, IDENTIFIER_TITLE,
getString(R.string.CFC_title_contains_text), getString(R.string.CFC_title_contains_text),
Query.select(Task.ID).from(Task.TABLE).where( Query.select(Task.ID).from(Task.TABLE).where(
Criterion.and(TaskCriteria.activeVisibleMine(), Criterion.and(TaskCriteria.activeAndVisible(),
Task.TITLE.like("%?%"))).toString(), Task.TITLE.like("%?%"))).toString(),
getString(R.string.CFC_title_contains_name), "", getString(R.string.CFC_title_contains_name), "",
((BitmapDrawable)r.getDrawable(R.drawable.tango_alpha)).getBitmap(), ((BitmapDrawable)r.getDrawable(R.drawable.tango_alpha)).getBitmap(),
@ -411,7 +411,7 @@ public class CustomFilterActivity extends InjectingActionBarActivity {
// special code for all tasks universe // special code for all tasks universe
if(instance.criterion.sql == null) { if(instance.criterion.sql == null) {
sql.append(TaskCriteria.activeVisibleMine()).append(' '); sql.append(TaskCriteria.activeAndVisible()).append(' ');
} else { } else {
String subSql = instance.criterion.sql.replace("?", UnaryCriterion.sanitize(value)); String subSql = instance.criterion.sql.replace("?", UnaryCriterion.sanitize(value));
sql.append(Task.ID).append(" IN (").append(subSql).append(") "); sql.append(Task.ID).append(" IN (").append(subSql).append(") ");
@ -473,7 +473,7 @@ public class CustomFilterActivity extends InjectingActionBarActivity {
// special code for all tasks universe // special code for all tasks universe
if(instance.criterion.sql == null) { if(instance.criterion.sql == null) {
sql.append(TaskCriteria.activeVisibleMine()).append(' '); sql.append(TaskCriteria.activeAndVisible()).append(' ');
} else { } else {
String subSql = instance.criterion.sql.replace("?", UnaryCriterion.sanitize(value)); String subSql = instance.criterion.sql.replace("?", UnaryCriterion.sanitize(value));
subSql = PermaSql.replacePlaceholders(subSql); subSql = PermaSql.replacePlaceholders(subSql);

@ -80,14 +80,7 @@ public class TaskDao extends RemoteModelDao<Task> {
/** @return tasks that have not yet been completed or deleted */ /** @return tasks that have not yet been completed or deleted */
public static Criterion activeAndVisible() { public static Criterion activeAndVisible() {
return Criterion.and(Task.COMPLETION_DATE.eq(0), return Criterion.and(Task.COMPLETION_DATE.eq(0),
Task.DELETION_DATE.eq(0),
Task.HIDE_UNTIL.lt(Functions.now()));
}
/** @return tasks that have not yet been completed or deleted and are assigned to me */
public static Criterion activeVisibleMine() {
return Criterion.and(Task.COMPLETION_DATE.eq(0),
Task.DELETION_DATE.eq(0), Task.DELETION_DATE.eq(0),
Task.HIDE_UNTIL.lt(Functions.now())); Task.HIDE_UNTIL.lt(Functions.now()));
} }

Loading…
Cancel
Save