Remove most properties varargs

pull/618/head
Alex Baker 7 years ago
parent e70686068d
commit 3740e67455

@ -65,7 +65,7 @@ public class MetadataDaoTests extends DatabaseTestCase {
assertEquals(1, metadataDao.toList(Query.select(Metadata.ID)).size()); assertEquals(1, metadataDao.toList(Query.select(Metadata.ID)).size());
long happyId = metadata.getId(); long happyId = metadata.getId();
assertNotSame(Metadata.NO_ID, happyId); assertNotSame(Metadata.NO_ID, happyId);
metadata = metadataDao.fetch(happyId, KEYS); metadata = metadataDao.fetch(happyId);
assertEquals("happy", metadata.getKey()); assertEquals("happy", metadata.getKey());
// create "sad" // create "sad"
@ -83,9 +83,9 @@ public class MetadataDaoTests extends DatabaseTestCase {
assertEquals(2, metadataDao.toList(Query.select(Metadata.ID)).size()); assertEquals(2, metadataDao.toList(Query.select(Metadata.ID)).size());
// check state // check state
metadata = metadataDao.fetch(happyId, KEYS); metadata = metadataDao.fetch(happyId);
assertEquals("happy", metadata.getKey()); assertEquals("happy", metadata.getKey());
metadata = metadataDao.fetch(sadId, KEYS); metadata = metadataDao.fetch(sadId);
assertEquals("melancholy", metadata.getKey()); assertEquals("melancholy", metadata.getKey());
// delete sad // delete sad

@ -52,7 +52,7 @@ public class TaskDaoTests extends DatabaseTestCase {
assertEquals(1, taskDao.toList(Query.select(IDS)).size()); assertEquals(1, taskDao.toList(Query.select(IDS)).size());
long happyId = task.getId(); long happyId = task.getId();
assertNotSame(Task.NO_ID, happyId); assertNotSame(Task.NO_ID, happyId);
task = taskDao.fetch(happyId, TITLES); task = taskDao.fetch(happyId);
assertEquals("happy", task.getTitle()); assertEquals("happy", task.getTitle());
// create task "sad" // create task "sad"
@ -69,9 +69,9 @@ public class TaskDaoTests extends DatabaseTestCase {
assertEquals(2, taskDao.toList(Query.select(IDS)).size()); assertEquals(2, taskDao.toList(Query.select(IDS)).size());
// check state // check state
task = taskDao.fetch(happyId, TITLES); task = taskDao.fetch(happyId);
assertEquals("happy", task.getTitle()); assertEquals("happy", task.getTitle());
task = taskDao.fetch(sadId,TITLES); task = taskDao.fetch(sadId);
assertEquals("melancholy", task.getTitle()); assertEquals("melancholy", task.getTitle());
} }
@ -166,7 +166,7 @@ public class TaskDaoTests extends DatabaseTestCase {
public void testInvalidIndex() { public void testInvalidIndex() {
assertEquals(0, taskDao.toList(Query.select(IDS)).size()); assertEquals(0, taskDao.toList(Query.select(IDS)).size());
assertNull(taskDao.fetch(1, IDS)); assertNull(taskDao.fetch(1));
assertFalse(taskDao.delete(1)); assertFalse(taskDao.delete(1));

@ -48,8 +48,7 @@ public class TaskTest extends InjectingTestCase {
public void testReadTaskFromDb() { public void testReadTaskFromDb() {
Task task = new Task(); Task task = new Task();
taskDao.save(task); taskDao.save(task);
Property[] properties = asQueryProperties(Task.TABLE, task.getDatabaseValues()); final Task fromDb = taskDao.fetch(task.getId());
final Task fromDb = taskDao.fetch(task.getId(), properties);
compareRemoteModel(task, fromDb); compareRemoteModel(task, fromDb);
} }

@ -146,7 +146,7 @@ class OrderedMetadataListFragmentHelper {
final ArrayList<Long> chained = new ArrayList<>(); final ArrayList<Long> chained = new ArrayList<>();
final int parentIndent = item.getValue(GtasksMetadata.INDENT); final int parentIndent = item.getValue(GtasksMetadata.INDENT);
updater.applyToChildren(list, itemId, node -> { updater.applyToChildren(list, itemId, node -> {
Task childTask = taskDao.fetch(node.taskId, Task.RECURRENCE); Task childTask = taskDao.fetch(node.taskId);
if(!TextUtils.isEmpty(childTask.getRecurrence())) { if(!TextUtils.isEmpty(childTask.getRecurrence())) {
Metadata metadata = updater.getTaskMetadata(node.taskId); Metadata metadata = updater.getTaskMetadata(node.taskId);
metadata.setValue(GtasksMetadata.INDENT, parentIndent); metadata.setValue(GtasksMetadata.INDENT, parentIndent);

@ -214,7 +214,7 @@ public class GtasksSyncService {
final AtomicLong parentToMatch = new AtomicLong(gtasksMetadata.getValue(GtasksMetadata.PARENT_TASK)); final AtomicLong parentToMatch = new AtomicLong(gtasksMetadata.getValue(GtasksMetadata.PARENT_TASK));
final AtomicReference<String> sibling = new AtomicReference<>(); final AtomicReference<String> sibling = new AtomicReference<>();
GtasksTaskListUpdater.OrderedListIterator iterator = (taskId, metadata) -> { GtasksTaskListUpdater.OrderedListIterator iterator = (taskId, metadata) -> {
Task t = taskDao.fetch(taskId, Task.TITLE, Task.DELETION_DATE); Task t = taskDao.fetch(taskId);
if (t == null || t.isDeleted()) { if (t == null || t.isDeleted()) {
return; return;
} }

@ -383,7 +383,7 @@ public class GoogleTaskSyncAdapter extends InjectingAbstractThreadedSyncAdapter
// merge astrid dates with google dates // merge astrid dates with google dates
if(task.task.isSaved()) { if(task.task.isSaved()) {
Task local = taskDao.fetch(task.task.getId(), Task.PROPERTIES); Task local = taskDao.fetch(task.task.getId());
if (local == null) { if (local == null) {
task.task.clearValue(Task.ID); task.task.clearValue(Task.ID);
task.task.clearValue(Task.UUID); task.task.clearValue(Task.UUID);

@ -64,7 +64,7 @@ public class GeofenceTransitionsIntentService extends InjectingJobIntentService
private void triggerNotification(com.google.android.gms.location.Geofence triggeringGeofence) { private void triggerNotification(com.google.android.gms.location.Geofence triggeringGeofence) {
String requestId = triggeringGeofence.getRequestId(); String requestId = triggeringGeofence.getRequestId();
try { try {
Metadata fetch = metadataDao.fetch(Long.parseLong(requestId), Metadata.TASK, GeofenceFields.PLACE, GeofenceFields.LATITUDE, GeofenceFields.LONGITUDE, GeofenceFields.RADIUS); Metadata fetch = metadataDao.fetch(Long.parseLong(requestId));
Geofence geofence = new Geofence(fetch); Geofence geofence = new Geofence(fetch);
notifier.triggerTaskNotification(geofence.getTaskId(), ReminderService.TYPE_ALARM); notifier.triggerTaskNotification(geofence.getTaskId(), ReminderService.TYPE_ALARM);
} catch(Exception e) { } catch(Exception e) {

@ -417,7 +417,7 @@ public class TaskListActivity extends InjectingAppCompatActivity implements
Task model = null; Task model = null;
if (taskId> -1L) { if (taskId> -1L) {
model = taskDao.fetch(taskId, Task.PROPERTIES); model = taskDao.fetch(taskId);
} }
// not found by id or was never passed an id // not found by id or was never passed an id

@ -265,7 +265,7 @@ public class TasksXmlImporter {
String uuid = metadata.getValue(Metadata.VALUE2); String uuid = metadata.getValue(Metadata.VALUE2);
long deletionDate = metadata.getDeletionDate(); long deletionDate = metadata.getDeletionDate();
// UUID is uniquely for every TagData, so we don't need to test the name // UUID is uniquely for every TagData, so we don't need to test the name
TagData tagData = tagDataDao.getByUuid(uuid, TagData.ID); TagData tagData = tagDataDao.getByUuid(uuid);
//If you sync with Google tasks it adds some Google task metadata. //If you sync with Google tasks it adds some Google task metadata.
//For this metadata we don't create a list! //For this metadata we don't create a list!
if(key.equals(TaskToTagMetadata.KEY) && tagData == null && deletionDate == 0) { if(key.equals(TaskToTagMetadata.KEY) && tagData == null && deletionDate == 0) {

@ -36,10 +36,6 @@ public class MetadataDao {
dao = new DatabaseDao<>(database, Metadata.class); dao = new DatabaseDao<>(database, Metadata.class);
} }
public List<Metadata> query(Query query) {
return dao.toList(query);
}
public Metadata getFirst(Query query) { public Metadata getFirst(Query query) {
return dao.getFirst(query); return dao.getFirst(query);
} }
@ -78,8 +74,8 @@ public class MetadataDao {
dao.saveExisting(metadata); dao.saveExisting(metadata);
} }
public Metadata fetch(long id, Property<?>... properties) { public Metadata fetch(long id) {
return dao.fetch(id, properties); return dao.fetch(id, Metadata.PROPERTIES);
} }
// --- SQL clause generators // --- SQL clause generators

@ -5,13 +5,10 @@
*/ */
package com.todoroo.astrid.dao; package com.todoroo.astrid.dao;
import com.todoroo.andlib.data.Callback;
import com.todoroo.andlib.data.Property;
import com.todoroo.andlib.sql.Criterion; import com.todoroo.andlib.sql.Criterion;
import com.todoroo.andlib.sql.Functions; import com.todoroo.andlib.sql.Functions;
import com.todoroo.andlib.sql.Order; import com.todoroo.andlib.sql.Order;
import com.todoroo.andlib.sql.Query; import com.todoroo.andlib.sql.Query;
import com.todoroo.astrid.data.RemoteModel;
import com.todoroo.astrid.data.TagData; import com.todoroo.astrid.data.TagData;
import org.tasks.injection.ApplicationScope; import org.tasks.injection.ApplicationScope;
@ -35,8 +32,8 @@ public class TagDataDao {
dao = new RemoteModelDao<>(database, TagData.class); dao = new RemoteModelDao<>(database, TagData.class);
} }
public TagData getTagByName(String name, Property<?>... properties) { public TagData getTagByName(String name) {
return dao.getFirst(Query.select(properties).where(TagData.NAME.eqCaseInsensitive(name))); return dao.getFirst(Query.select(TagData.PROPERTIES).where(TagData.NAME.eqCaseInsensitive(name)));
} }
public List<TagData> allTags() { public List<TagData> allTags() {
@ -47,11 +44,7 @@ public class TagDataDao {
} }
public TagData getByUuid(String uuid) { public TagData getByUuid(String uuid) {
return getByUuid(uuid, TagData.PROPERTIES); return dao.getFirst(Query.select(TagData.PROPERTIES).where(TagData.UUID.eq(uuid)));
}
public TagData getByUuid(String uuid, Property<?>... properties) {
return dao.getFirst(Query.select(properties).where(TagData.UUID.eq(uuid)));
} }
public List<TagData> tagDataOrderedByName() { public List<TagData> tagDataOrderedByName() {

@ -5,7 +5,6 @@
*/ */
package com.todoroo.astrid.dao; package com.todoroo.astrid.dao;
import com.todoroo.andlib.data.Property;
import com.todoroo.andlib.sql.Criterion; import com.todoroo.andlib.sql.Criterion;
import com.todoroo.andlib.sql.Query; import com.todoroo.andlib.sql.Query;
import com.todoroo.astrid.data.TaskAttachment; import com.todoroo.astrid.data.TaskAttachment;
@ -24,15 +23,15 @@ public class TaskAttachmentDao {
} }
public boolean taskHasAttachments(String taskUuid) { public boolean taskHasAttachments(String taskUuid) {
return dao.count(byUuid(taskUuid, TaskAttachment.TASK_UUID).limit(1)) > 0; return dao.count(byUuid(taskUuid).limit(1)) > 0;
} }
public List<TaskAttachment> getAttachments(String taskUuid) { public List<TaskAttachment> getAttachments(String taskUuid) {
return dao.toList(byUuid(taskUuid, TaskAttachment.PROPERTIES)); return dao.toList(byUuid(taskUuid));
} }
private static Query byUuid(String taskUuid, Property<?>... properties) { private static Query byUuid(String taskUuid) {
return Query.select(properties).where( return Query.select(TaskAttachment.PROPERTIES).where(
Criterion.and(TaskAttachment.TASK_UUID.eq(taskUuid), Criterion.and(TaskAttachment.TASK_UUID.eq(taskUuid),
TaskAttachment.DELETED_AT.eq(0)) TaskAttachment.DELETED_AT.eq(0))
); );

@ -83,10 +83,6 @@ public class TaskDao {
return dao.fetch(id, Task.PROPERTIES); return dao.fetch(id, Task.PROPERTIES);
} }
public Task fetch(long id, Property<?>... properties) {
return dao.fetch(id, properties);
}
public int count(Filter filter) { public int count(Filter filter) {
String query = PermaSql.replacePlaceholders(filter.getSqlQuery()); String query = PermaSql.replacePlaceholders(filter.getSqlQuery());
return count(Query.select(Task.ID).withQueryTemplate(query)); return count(Query.select(Task.ID).withQueryTemplate(query));
@ -397,17 +393,9 @@ public class TaskDao {
} }
public TodorooCursor<Task> fetchFiltered(String queryTemplate, Property<?>... properties) { public TodorooCursor<Task> fetchFiltered(String queryTemplate, Property<?>... properties) {
return query(fetchFilteredQuery(queryTemplate, properties)); return query(queryTemplate == null
} ? Query.selectDistinct(properties)
: Query.select(properties).withQueryTemplate(PermaSql.replacePlaceholders(queryTemplate)));
private Query fetchFilteredQuery(String queryTemplate, Property<?>... properties) {
if (queryTemplate == null) {
return Query.selectDistinct(properties);
}
String sql = PermaSql.replacePlaceholders(queryTemplate);
return Query.select(properties).withQueryTemplate(sql);
} }
} }

@ -5,7 +5,6 @@
*/ */
package com.todoroo.astrid.dao; package com.todoroo.astrid.dao;
import com.todoroo.andlib.data.Property;
import com.todoroo.andlib.sql.Criterion; import com.todoroo.andlib.sql.Criterion;
import com.todoroo.andlib.sql.Query; import com.todoroo.andlib.sql.Query;
import com.todoroo.astrid.data.TagData; import com.todoroo.astrid.data.TagData;
@ -27,8 +26,8 @@ public class TaskListMetadataDao {
dao = new RemoteModelDao<>(database, TaskListMetadata.class); dao = new RemoteModelDao<>(database, TaskListMetadata.class);
} }
public TaskListMetadata fetchByTagId(String tagUuid, Property<?>... properties) { public TaskListMetadata fetchByTagId(String tagUuid) {
return dao.getFirst(Query.select(properties).where(Criterion.or(TaskListMetadata.TAG_UUID.eq(tagUuid), return dao.getFirst(Query.select(TaskListMetadata.PROPERTIES).where(Criterion.or(TaskListMetadata.TAG_UUID.eq(tagUuid),
TaskListMetadata.FILTER.eq(tagUuid)))); TaskListMetadata.FILTER.eq(tagUuid))));
} }

@ -56,7 +56,7 @@ public class GCalHelper {
if (!TextUtils.isEmpty(task.getCalendarURI())) { if (!TextUtils.isEmpty(task.getCalendarURI())) {
uri = task.getCalendarURI(); uri = task.getCalendarURI();
} else { } else {
task = taskDao.fetch(task.getId(), Task.CALENDAR_URI); task = taskDao.fetch(task.getId());
if(task == null) { if(task == null) {
return null; return null;
} }

@ -85,7 +85,7 @@ public final class ReminderService {
if(taskDao != null) { if(taskDao != null) {
for(Property<?> property : NOTIFICATION_PROPERTIES) { for(Property<?> property : NOTIFICATION_PROPERTIES) {
if(!task.containsValue(property)) { if(!task.containsValue(property)) {
task = taskDao.fetch(taskId, NOTIFICATION_PROPERTIES); task = taskDao.fetch(taskId);
if(task == null) { if(task == null) {
return; return;
} }

@ -142,7 +142,7 @@ public class TaskCreator {
} }
private void createLink(Task task, String tagName) { private void createLink(Task task, String tagName) {
TagData tagData = tagDataDao.getTagByName(tagName, TagData.NAME, TagData.UUID); TagData tagData = tagDataDao.getTagByName(tagName);
if (tagData == null) { if (tagData == null) {
tagData = new TagData(); tagData = new TagData();
tagData.setName(tagName); tagData.setName(tagName);

@ -38,7 +38,7 @@ public class TaskDuplicator {
public List<Task> duplicate(List<Task> tasks) { public List<Task> duplicate(List<Task> tasks) {
List<Task> result = new ArrayList<>(); List<Task> result = new ArrayList<>();
for (Task task : tasks) { for (Task task : tasks) {
result.add(clone(taskDao.fetch(task.getId(), Task.PROPERTIES), true)); result.add(clone(taskDao.fetch(task.getId()), true));
} }
localBroadcastManager.broadcastRefresh(); localBroadcastManager.broadcastRefresh();
return result; return result;

@ -63,14 +63,14 @@ public class SubtasksHelper {
if (filter instanceof GtasksFilter) { if (filter instanceof GtasksFilter) {
query = GtasksFilter.toManualOrder(query); query = GtasksFilter.toManualOrder(query);
} else { } else {
TagData tagData = tagDataDao.getTagByName(filter.listingTitle, TagData.UUID, TagData.TAG_ORDERING); TagData tagData = tagDataDao.getTagByName(filter.listingTitle);
TaskListMetadata tlm = null; TaskListMetadata tlm = null;
if (tagData != null) { if (tagData != null) {
tlm = taskListMetadataDao.fetchByTagId(tagData.getUuid(), TaskListMetadata.TASK_IDS); tlm = taskListMetadataDao.fetchByTagId(tagData.getUuid());
} else if (BuiltInFilterExposer.isInbox(context, filter)) { } else if (BuiltInFilterExposer.isInbox(context, filter)) {
tlm = taskListMetadataDao.fetchByTagId(TaskListMetadata.FILTER_ID_ALL, TaskListMetadata.TASK_IDS); tlm = taskListMetadataDao.fetchByTagId(TaskListMetadata.FILTER_ID_ALL);
} else if (BuiltInFilterExposer.isTodayFilter(context, filter)) { } else if (BuiltInFilterExposer.isTodayFilter(context, filter)) {
tlm = taskListMetadataDao.fetchByTagId(TaskListMetadata.FILTER_ID_TODAY, TaskListMetadata.TASK_IDS); tlm = taskListMetadataDao.fetchByTagId(TaskListMetadata.FILTER_ID_TODAY);
} }
query = query.replaceAll("ORDER BY .*", ""); query = query.replaceAll("ORDER BY .*", "");

@ -75,7 +75,7 @@ public class SubtasksListFragment extends TaskListFragment {
if (TextUtils.isEmpty(filterId)) { if (TextUtils.isEmpty(filterId)) {
return null; return null;
} }
TaskListMetadata taskListMetadata = taskListMetadataDao.fetchByTagId(filterId, TaskListMetadata.PROPERTIES); TaskListMetadata taskListMetadata = taskListMetadataDao.fetchByTagId(filterId);
if (taskListMetadata == null) { if (taskListMetadata == null) {
String defaultOrder = preferences.getStringValue(prefId); String defaultOrder = preferences.getStringValue(prefId);
if (TextUtils.isEmpty(defaultOrder)) { if (TextUtils.isEmpty(defaultOrder)) {

@ -49,7 +49,7 @@ public class SubtasksTagListFragment extends TagListFragment {
@Override @Override
public void setTaskAdapter() { public void setTaskAdapter() {
String tdId = tagData.getUuid(); String tdId = tagData.getUuid();
TaskListMetadata taskListMetadata = taskListMetadataDao.fetchByTagId(tagData.getUuid(), TaskListMetadata.PROPERTIES); TaskListMetadata taskListMetadata = taskListMetadataDao.fetchByTagId(tagData.getUuid());
if (taskListMetadata == null && !RemoteModel.isUuidEmpty(tdId)) { if (taskListMetadata == null && !RemoteModel.isUuidEmpty(tdId)) {
taskListMetadata = new TaskListMetadata(); taskListMetadata = new TaskListMetadata();
taskListMetadata.setTagUUID(tdId); taskListMetadata.setTagUUID(tdId);

@ -70,7 +70,7 @@ public final class TagService {
MetadataCriteria.withKey(TaskToTagMetadata.KEY))). MetadataCriteria.withKey(TaskToTagMetadata.KEY))).
orderBy(order).groupBy(TaskToTagMetadata.TAG_NAME); orderBy(order).groupBy(TaskToTagMetadata.TAG_NAME);
final List<TagData> array = new ArrayList<>(); final List<TagData> array = new ArrayList<>();
for (Metadata metadata : metadataDao.query(query)) { for (Metadata metadata : metadataDao.toList(query)) {
TagData tag = tagFromUUID(metadata.getValue(TaskToTagMetadata.TAG_UUID)); TagData tag = tagFromUUID(metadata.getValue(TaskToTagMetadata.TAG_UUID));
if (tag != null) { if (tag != null) {
array.add(tag); array.add(tag);
@ -80,7 +80,7 @@ public final class TagService {
} }
public TagData tagFromUUID(String uuid) { public TagData tagFromUUID(String uuid) {
return tagDataDao.getByUuid(uuid, TagData.PROPERTIES); return tagDataDao.getByUuid(uuid);
} }
public List<TagData> getTagDataForTask(String uuid) { public List<TagData> getTagDataForTask(String uuid) {
@ -109,7 +109,7 @@ public final class TagService {
MetadataCriteria.byTask(taskId))) MetadataCriteria.byTask(taskId)))
.orderBy(Order.asc(Functions.upper(TaskToTagMetadata.TAG_NAME))); .orderBy(Order.asc(Functions.upper(TaskToTagMetadata.TAG_NAME)));
final ArrayList<String> tagNames = new ArrayList<>(); final ArrayList<String> tagNames = new ArrayList<>();
for (Metadata entry : metadataDao.query(query)) { for (Metadata entry : metadataDao.toList(query)) {
tagNames.add(entry.getValue(TaskToTagMetadata.TAG_NAME)); tagNames.add(entry.getValue(TaskToTagMetadata.TAG_NAME));
} }
return tagNames; return tagNames;
@ -142,7 +142,7 @@ public final class TagService {
return tagMetadata.getValue(TaskToTagMetadata.TAG_NAME); return tagMetadata.getValue(TaskToTagMetadata.TAG_NAME);
} }
TagData tagData = tagDataDao.getTagByName(tag, TagData.NAME); TagData tagData = tagDataDao.getTagByName(tag);
if (tagData != null) { if (tagData != null) {
return tagData.getName(); return tagData.getName();
} }

@ -249,7 +249,7 @@ public final class TagsControlSet extends TaskEditControlFragment {
if (Strings.isNullOrEmpty(text)) { if (Strings.isNullOrEmpty(text)) {
continue; continue;
} }
TagData tagByName = tagDataDao.getTagByName(text, TagData.PROPERTIES); TagData tagByName = tagDataDao.getTagByName(text);
if (tagByName != null) { if (tagByName != null) {
if (!isSelected(tags, text)) { if (!isSelected(tags, text)) {
setTagSelected(tagByName); setTagSelected(tagByName);

@ -71,7 +71,7 @@ public class TimerPlugin {
// if this call comes from tasklist, then we need to fill in the gaps to handle this correctly // if this call comes from tasklist, then we need to fill in the gaps to handle this correctly
// this is needed just for stopping a task // this is needed just for stopping a task
if (!task.containsNonNullValue(Task.TIMER_START)) { if (!task.containsNonNullValue(Task.TIMER_START)) {
task = taskDao.fetch(task.getId(), Task.ID, Task.TIMER_START, Task.ELAPSED_SECONDS); task = taskDao.fetch(task.getId());
} }
if (task == null) { if (task == null) {
return; return;

@ -170,7 +170,7 @@ public class TagSettingsActivity extends ThemedInjectingAppCompatActivity implem
} }
private boolean clashes(String newName) { private boolean clashes(String newName) {
TagData existing = tagDataDao.getTagByName(newName, TagData.PROPERTIES); TagData existing = tagDataDao.getTagByName(newName);
return existing != null && tagData.getId() != existing.getId(); return existing != null && tagData.getId() != existing.getId();
} }

@ -64,7 +64,7 @@ public class CalendarEventProvider {
public boolean deleteEvent(Task task) { public boolean deleteEvent(Task task) {
if (!task.containsNonNullValue(Task.CALENDAR_URI)) { if (!task.containsNonNullValue(Task.CALENDAR_URI)) {
task = taskDao.fetch(task.getId(), Task.CALENDAR_URI); task = taskDao.fetch(task.getId());
if(task == null) { if(task == null) {
return false; return false;
} }

@ -27,7 +27,7 @@ public class CompleteTaskReceiver extends InjectingBroadcastReceiver {
long taskId = intent.getLongExtra(TASK_ID, 0); long taskId = intent.getLongExtra(TASK_ID, 0);
boolean flipState = intent.getBooleanExtra(TOGGLE_STATE, false); boolean flipState = intent.getBooleanExtra(TOGGLE_STATE, false);
Timber.i("Completing %s", taskId); Timber.i("Completing %s", taskId);
Task task = taskDao.fetch(taskId, Task.ID, Task.COMPLETION_DATE); Task task = taskDao.fetch(taskId);
if (task != null) { if (task != null) {
taskDao.setComplete(task, !flipState || !task.isCompleted()); taskDao.setComplete(task, !flipState || !task.isCompleted());
} else { } else {

@ -353,7 +353,7 @@ class ViewHolder extends MultiSelectorBindingHolder {
} }
private void showEditNotesDialog(final Task task) { private void showEditNotesDialog(final Task task) {
Task t = taskDao.fetch(task.getId(), Task.NOTES); Task t = taskDao.fetch(task.getId());
if (t == null || !t.hasNotes()) { if (t == null || !t.hasNotes()) {
return; return;
} }

Loading…
Cancel
Save