Remove some usage of TaskService.fetchById

pull/467/head
Alex Baker 9 years ago
parent 570904378f
commit 4beb84fbe2

@ -53,7 +53,6 @@ import com.todoroo.astrid.gtasks.api.GtasksInvoker;
import com.todoroo.astrid.gtasks.api.HttpNotFoundException;
import com.todoroo.astrid.gtasks.sync.GtasksSyncService;
import com.todoroo.astrid.gtasks.sync.GtasksTaskContainer;
import com.todoroo.astrid.service.TaskService;
import com.todoroo.astrid.utility.Constants;
import org.tasks.Broadcaster;
@ -93,7 +92,6 @@ public class GoogleTaskSyncAdapter extends InjectingAbstractThreadedSyncAdapter
@Inject GtasksPreferenceService gtasksPreferenceService;
@Inject Broadcaster broadcaster;
@Inject TaskService taskService;
@Inject StoreObjectDao storeObjectDao;
@Inject GtasksSyncService gtasksSyncService;
@Inject GtasksListService gtasksListService;
@ -389,7 +387,7 @@ public class GoogleTaskSyncAdapter extends InjectingAbstractThreadedSyncAdapter
// merge astrid dates with google dates
if(task.task.isSaved()) {
Task local = taskService.fetchById(task.task.getId(), Task.PROPERTIES);
Task local = taskDao.fetch(task.task.getId(), Task.PROPERTIES);
if (local == null) {
task.task.clearValue(Task.ID);
task.task.clearValue(Task.UUID);

@ -14,8 +14,8 @@ import android.text.TextUtils;
import android.text.format.Time;
import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.astrid.dao.TaskDao;
import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.service.TaskService;
import org.tasks.R;
import org.tasks.calendars.AndroidCalendarEvent;
@ -35,16 +35,16 @@ public class GCalHelper {
/** If task has no estimated time, how early to set a task in calendar (seconds)*/
private static final long DEFAULT_CAL_TIME = DateUtilities.ONE_HOUR;
private final TaskService taskService;
private final TaskDao taskDao;
private final Preferences preferences;
private final PermissionChecker permissionChecker;
private final CalendarEventProvider calendarEventProvider;
private final ContentResolver cr;
@Inject
public GCalHelper(@ForApplication Context context, TaskService taskService, Preferences preferences,
public GCalHelper(@ForApplication Context context, TaskDao taskDao, Preferences preferences,
PermissionChecker permissionChecker, CalendarEventProvider calendarEventProvider) {
this.taskService = taskService;
this.taskDao = taskDao;
this.preferences = preferences;
this.permissionChecker = permissionChecker;
this.calendarEventProvider = calendarEventProvider;
@ -56,7 +56,7 @@ public class GCalHelper {
if (!TextUtils.isEmpty(task.getCalendarURI())) {
uri = task.getCalendarURI();
} else {
task = taskService.fetchById(task.getId(), Task.CALENDAR_URI);
task = taskDao.fetch(task.getId(), Task.CALENDAR_URI);
if(task == null) {
return null;
}
@ -151,7 +151,7 @@ public class GCalHelper {
if(task.containsNonNullValue(Task.CALENDAR_URI)) {
uri = task.getCalendarURI();
} else {
task = taskService.fetchById(task.getId(), Task.CALENDAR_URI);
task = taskDao.fetch(task.getId(), Task.CALENDAR_URI);
if(task == null) {
return false;
}

@ -14,8 +14,8 @@ import android.provider.CalendarContract;
import android.text.TextUtils;
import com.todoroo.astrid.api.AstridApiConstants;
import com.todoroo.astrid.dao.TaskDao;
import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.service.TaskService;
import org.tasks.R;
import org.tasks.injection.BroadcastComponent;
@ -27,7 +27,7 @@ import timber.log.Timber;
public class GCalTaskCompleteListener extends InjectingBroadcastReceiver {
@Inject TaskService taskService;
@Inject TaskDao taskDao;
@Override
public void onReceive(Context context, Intent intent) {
@ -38,7 +38,7 @@ public class GCalTaskCompleteListener extends InjectingBroadcastReceiver {
return;
}
Task task = taskService.fetchById(taskId, Task.ID, Task.TITLE, Task.CALENDAR_URI);
Task task = taskDao.fetch(taskId, Task.ID, Task.TITLE, Task.CALENDAR_URI);
if(task == null) {
return;
}

@ -75,7 +75,7 @@ public class TimerPlugin {
// 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
if (!task.containsNonNullValue(Task.TIMER_START)) {
task = taskService.fetchById(task.getId(), Task.ID, Task.TIMER_START, Task.ELAPSED_SECONDS);
task = taskDao.fetch(task.getId(), Task.ID, Task.TIMER_START, Task.ELAPSED_SECONDS);
}
if (task == null) {
return;

@ -9,8 +9,8 @@ import android.content.Context;
import android.content.Intent;
import com.todoroo.astrid.api.AstridApiConstants;
import com.todoroo.astrid.dao.TaskDao;
import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.service.TaskService;
import org.tasks.injection.BroadcastComponent;
import org.tasks.injection.InjectingBroadcastReceiver;
@ -19,7 +19,7 @@ import javax.inject.Inject;
public class TimerTaskCompleteListener extends InjectingBroadcastReceiver {
@Inject TaskService taskService;
@Inject TaskDao taskDao;
@Inject TimerPlugin timerPlugin;
@Override
@ -31,7 +31,7 @@ public class TimerTaskCompleteListener extends InjectingBroadcastReceiver {
return;
}
Task task = taskService.fetchById(taskId, Task.ID, Task.ELAPSED_SECONDS,
Task task = taskDao.fetch(taskId, Task.ID, Task.ELAPSED_SECONDS,
Task.TIMER_START);
if(task == null || task.getTimerStart() == 0) {
return;

Loading…
Cancel
Save