From dc478b0950ec2ebf9f6b00213e9890bc92282a35 Mon Sep 17 00:00:00 2001 From: Alex Baker Date: Thu, 4 Dec 2014 11:56:58 -0600 Subject: [PATCH] Remove duplicate method --- .../com/todoroo/astrid/core/CoreFilterExposer.java | 4 ++-- .../com/todoroo/astrid/core/CustomFilterActivity.java | 10 +++++----- src/main/java/com/todoroo/astrid/dao/TaskDao.java | 9 +-------- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/todoroo/astrid/core/CoreFilterExposer.java b/src/main/java/com/todoroo/astrid/core/CoreFilterExposer.java index a39d0fa01..ab3d67bef 100644 --- a/src/main/java/com/todoroo/astrid/core/CoreFilterExposer.java +++ b/src/main/java/com/todoroo/astrid/core/CoreFilterExposer.java @@ -66,7 +66,7 @@ public final class CoreFilterExposer extends InjectingBroadcastReceiver implemen public static Filter buildInboxFilter(Resources r) { return new Filter(r.getString(R.string.BFE_Active), r.getString(R.string.BFE_Active), 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.and(MetadataCriteria.withKey(TaskToTagMetadata.KEY), 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, todayTitle, new QueryTemplate().where( - Criterion.and(TaskCriteria.activeVisibleMine(), + Criterion.and(TaskCriteria.activeAndVisible(), Task.DUE_DATE.gt(0), Task.DUE_DATE.lte(PermaSql.VALUE_EOD))), todayValues); diff --git a/src/main/java/com/todoroo/astrid/core/CustomFilterActivity.java b/src/main/java/com/todoroo/astrid/core/CustomFilterActivity.java index a5b2778d8..ab1d71b57 100644 --- a/src/main/java/com/todoroo/astrid/core/CustomFilterActivity.java +++ b/src/main/java/com/todoroo/astrid/core/CustomFilterActivity.java @@ -216,7 +216,7 @@ public class CustomFilterActivity extends InjectingActionBarActivity { getString(R.string.CFC_dueBefore_text), Query.select(Task.ID).from(Task.TABLE).where( Criterion.and( - TaskCriteria.activeVisibleMine(), + TaskCriteria.activeAndVisible(), Criterion.or( Field.field("?").eq(0), Task.DUE_DATE.gt(0)), @@ -244,7 +244,7 @@ public class CustomFilterActivity extends InjectingActionBarActivity { IDENTIFIER_IMPORTANCE, getString(R.string.CFC_importance_text), Query.select(Task.ID).from(Task.TABLE).where( - Criterion.and(TaskCriteria.activeVisibleMine(), + Criterion.and(TaskCriteria.activeAndVisible(), Task.IMPORTANCE.lte("?"))).toString(), values, entries, entryValues, ((BitmapDrawable)r.getDrawable(R.drawable.tango_warning)).getBitmap(), @@ -260,7 +260,7 @@ public class CustomFilterActivity extends InjectingActionBarActivity { IDENTIFIER_TITLE, getString(R.string.CFC_title_contains_text), Query.select(Task.ID).from(Task.TABLE).where( - Criterion.and(TaskCriteria.activeVisibleMine(), + Criterion.and(TaskCriteria.activeAndVisible(), Task.TITLE.like("%?%"))).toString(), getString(R.string.CFC_title_contains_name), "", ((BitmapDrawable)r.getDrawable(R.drawable.tango_alpha)).getBitmap(), @@ -411,7 +411,7 @@ public class CustomFilterActivity extends InjectingActionBarActivity { // special code for all tasks universe if(instance.criterion.sql == null) { - sql.append(TaskCriteria.activeVisibleMine()).append(' '); + sql.append(TaskCriteria.activeAndVisible()).append(' '); } else { String subSql = instance.criterion.sql.replace("?", UnaryCriterion.sanitize(value)); sql.append(Task.ID).append(" IN (").append(subSql).append(") "); @@ -473,7 +473,7 @@ public class CustomFilterActivity extends InjectingActionBarActivity { // special code for all tasks universe if(instance.criterion.sql == null) { - sql.append(TaskCriteria.activeVisibleMine()).append(' '); + sql.append(TaskCriteria.activeAndVisible()).append(' '); } else { String subSql = instance.criterion.sql.replace("?", UnaryCriterion.sanitize(value)); subSql = PermaSql.replacePlaceholders(subSql); diff --git a/src/main/java/com/todoroo/astrid/dao/TaskDao.java b/src/main/java/com/todoroo/astrid/dao/TaskDao.java index 95c06d767..d6e762f65 100644 --- a/src/main/java/com/todoroo/astrid/dao/TaskDao.java +++ b/src/main/java/com/todoroo/astrid/dao/TaskDao.java @@ -80,14 +80,7 @@ public class TaskDao extends RemoteModelDao { /** @return tasks that have not yet been completed or deleted */ public static Criterion activeAndVisible() { - 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), + return Criterion.and(Task.COMPLETION_DATE.eq(0), Task.DELETION_DATE.eq(0), Task.HIDE_UNTIL.lt(Functions.now())); }