From d4d4fadc94100c8d8b41b164a3c743e130ad16f7 Mon Sep 17 00:00:00 2001 From: Alex Baker Date: Tue, 27 May 2014 10:22:48 -0500 Subject: [PATCH] Pass TaskService to TaskAdapter --- .../com/todoroo/astrid/activity/TaskListFragment.java | 2 +- .../java/com/todoroo/astrid/adapter/TaskAdapter.java | 9 +++------ .../astrid/subtasks/AstridOrderedListFragmentHelper.java | 2 +- .../subtasks/OrderedMetadataListFragmentHelper.java | 2 +- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/astrid/src/main/java/com/todoroo/astrid/activity/TaskListFragment.java b/astrid/src/main/java/com/todoroo/astrid/activity/TaskListFragment.java index e95c37c96..8dba729f9 100644 --- a/astrid/src/main/java/com/todoroo/astrid/activity/TaskListFragment.java +++ b/astrid/src/main/java/com/todoroo/astrid/activity/TaskListFragment.java @@ -759,7 +759,7 @@ public class TaskListFragment extends InjectingListFragment implements OnSortSel protected TaskAdapter createTaskAdapter(TodorooCursor cursor) { - return new TaskAdapter(this, getTaskRowResource(), + return new TaskAdapter(taskService, this, getTaskRowResource(), cursor, sqlQueryTemplate, new OnCompletedTaskListener() { @Override diff --git a/astrid/src/main/java/com/todoroo/astrid/adapter/TaskAdapter.java b/astrid/src/main/java/com/todoroo/astrid/adapter/TaskAdapter.java index 8ae283c8a..079a69c2e 100644 --- a/astrid/src/main/java/com/todoroo/astrid/adapter/TaskAdapter.java +++ b/astrid/src/main/java/com/todoroo/astrid/adapter/TaskAdapter.java @@ -45,9 +45,7 @@ import com.todoroo.andlib.data.Property.IntegerProperty; import com.todoroo.andlib.data.Property.LongProperty; import com.todoroo.andlib.data.Property.StringProperty; import com.todoroo.andlib.data.TodorooCursor; -import com.todoroo.andlib.service.Autowired; import com.todoroo.andlib.service.ContextManager; -import com.todoroo.andlib.service.DependencyInjectionService; import com.todoroo.andlib.utility.AndroidUtilities; import com.todoroo.andlib.utility.DateUtilities; import com.todoroo.andlib.utility.Pair; @@ -175,7 +173,7 @@ public class TaskAdapter extends CursorAdapter implements Filterable { // --- instance variables - @Autowired protected TaskService taskService; + private final TaskService taskService; protected final Context context; protected final TaskListFragment fragment; @@ -210,11 +208,10 @@ public class TaskAdapter extends CursorAdapter implements Filterable { * @param onCompletedTaskListener * task listener. can be null */ - public TaskAdapter(TaskListFragment fragment, int resource, + public TaskAdapter(TaskService taskService, TaskListFragment fragment, int resource, Cursor c, AtomicReference query, OnCompletedTaskListener onCompletedTaskListener) { super(ContextManager.getContext(), c, false); - DependencyInjectionService.getInstance().inject(this); - + this.taskService = taskService; this.context = ContextManager.getContext(); this.query = query; this.resource = resource; diff --git a/astrid/src/main/java/com/todoroo/astrid/subtasks/AstridOrderedListFragmentHelper.java b/astrid/src/main/java/com/todoroo/astrid/subtasks/AstridOrderedListFragmentHelper.java index adef0f083..c156a9ce0 100644 --- a/astrid/src/main/java/com/todoroo/astrid/subtasks/AstridOrderedListFragmentHelper.java +++ b/astrid/src/main/java/com/todoroo/astrid/subtasks/AstridOrderedListFragmentHelper.java @@ -210,7 +210,7 @@ public class AstridOrderedListFragmentHelper implements OrderedListFragmen private DraggableTaskAdapter(TaskListFragment activity, int resource, Cursor c, AtomicReference query) { - super(activity, resource, c, query, null); + super(taskService, activity, resource, c, query, null); } @Override diff --git a/astrid/src/main/java/com/todoroo/astrid/subtasks/OrderedMetadataListFragmentHelper.java b/astrid/src/main/java/com/todoroo/astrid/subtasks/OrderedMetadataListFragmentHelper.java index 62e0bada6..1660850a1 100644 --- a/astrid/src/main/java/com/todoroo/astrid/subtasks/OrderedMetadataListFragmentHelper.java +++ b/astrid/src/main/java/com/todoroo/astrid/subtasks/OrderedMetadataListFragmentHelper.java @@ -220,7 +220,7 @@ public class OrderedMetadataListFragmentHelper implements OrderedListFragm private DraggableTaskAdapter(TaskListFragment activity, int resource, Cursor c, AtomicReference query) { - super(activity, resource, c, query, null); + super(taskService, activity, resource, c, query, null); } @Override