From 2dd5482bdf2ed9c30e9cda2e1e2eac99177a121f Mon Sep 17 00:00:00 2001 From: Tim Su Date: Fri, 2 Mar 2012 17:57:20 -0800 Subject: [PATCH] Don't always save task modification date when you drag and drop --- .../astrid/subtasks/OrderedListUpdater.java | 18 +++++------------- .../astrid/subtasks/SubtasksUpdater.java | 2 +- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/astrid/plugin-src/com/todoroo/astrid/subtasks/OrderedListUpdater.java b/astrid/plugin-src/com/todoroo/astrid/subtasks/OrderedListUpdater.java index 1527c3e4b..37a8aa99f 100644 --- a/astrid/plugin-src/com/todoroo/astrid/subtasks/OrderedListUpdater.java +++ b/astrid/plugin-src/com/todoroo/astrid/subtasks/OrderedListUpdater.java @@ -9,7 +9,6 @@ import java.util.concurrent.atomic.AtomicReference; import com.todoroo.andlib.data.Property.IntegerProperty; import com.todoroo.andlib.data.Property.LongProperty; import com.todoroo.andlib.service.DependencyInjectionService; -import com.todoroo.andlib.utility.DateUtilities; import com.todoroo.astrid.api.Filter; import com.todoroo.astrid.core.PluginServices; import com.todoroo.astrid.data.Metadata; @@ -113,7 +112,7 @@ abstract public class OrderedListUpdater { else metadata.setValue(parentProperty(), newParent); } - saveAndUpdateModifiedDate(metadata, taskId); + saveAndUpdateModifiedDate(metadata); } } else if(targetTaskIndent.get() > -1) { // found first task that is not beneath target @@ -121,7 +120,7 @@ abstract public class OrderedListUpdater { targetTaskIndent.set(-1); else { metadata.setValue(indentProperty(), indent + delta); - saveAndUpdateModifiedDate(metadata, taskId); + saveAndUpdateModifiedDate(metadata); } } else { previousIndent.set(indent); @@ -129,7 +128,7 @@ abstract public class OrderedListUpdater { } if(!metadata.isSaved()) - saveAndUpdateModifiedDate(metadata, taskId); + saveAndUpdateModifiedDate(metadata); } }); @@ -241,7 +240,7 @@ abstract public class OrderedListUpdater { parentChanged = true; metadata.setValue(parentProperty(), node.parent.taskId); } - saveAndUpdateModifiedDate(metadata, node.taskId); + saveAndUpdateModifiedDate(metadata); if(parentChanged) onMovedOrIndented(metadata); } @@ -300,17 +299,10 @@ abstract public class OrderedListUpdater { return root; } - protected final Task taskContainer = new Task(); - - protected void saveAndUpdateModifiedDate(Metadata metadata, long taskId) { + protected void saveAndUpdateModifiedDate(Metadata metadata) { if(metadata.getSetValues().size() == 0) return; PluginServices.getMetadataService().save(metadata); - taskContainer.setId(taskId); - taskContainer.setValue(Task.MODIFICATION_DATE, DateUtilities.now()); - taskContainer.setValue(Task.DETAILS_DATE, DateUtilities.now()); - PluginServices.getTaskService().save(taskContainer); - taskContainer.clear(); } // --- task cascading operations diff --git a/astrid/plugin-src/com/todoroo/astrid/subtasks/SubtasksUpdater.java b/astrid/plugin-src/com/todoroo/astrid/subtasks/SubtasksUpdater.java index 1934f8e05..31d7ef56a 100644 --- a/astrid/plugin-src/com/todoroo/astrid/subtasks/SubtasksUpdater.java +++ b/astrid/plugin-src/com/todoroo/astrid/subtasks/SubtasksUpdater.java @@ -139,7 +139,7 @@ public class SubtasksUpdater extends OrderedListUpdater { metadata.setValue(SubtasksMetadata.ORDER, order); metadata.setValue(SubtasksMetadata.INDENT, indent); - saveAndUpdateModifiedDate(metadata, taskId); + saveAndUpdateModifiedDate(metadata); previousIndent.set(indent); previousOrder.set(order);