|
|
|
@ -20,13 +20,11 @@ import org.tasks.data.GoogleTask;
|
|
|
|
import org.tasks.data.GoogleTaskDao;
|
|
|
|
import org.tasks.data.GoogleTaskDao;
|
|
|
|
import org.tasks.data.GoogleTaskListDao;
|
|
|
|
import org.tasks.data.GoogleTaskListDao;
|
|
|
|
import org.tasks.preferences.Preferences;
|
|
|
|
import org.tasks.preferences.Preferences;
|
|
|
|
import org.tasks.sync.SyncAdapters;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class TaskMover {
|
|
|
|
public class TaskMover {
|
|
|
|
private final TaskDao taskDao;
|
|
|
|
private final TaskDao taskDao;
|
|
|
|
private final CaldavDao caldavDao;
|
|
|
|
private final CaldavDao caldavDao;
|
|
|
|
private final GoogleTaskDao googleTaskDao;
|
|
|
|
private final GoogleTaskDao googleTaskDao;
|
|
|
|
private final SyncAdapters syncAdapters;
|
|
|
|
|
|
|
|
private final GoogleTaskListDao googleTaskListDao;
|
|
|
|
private final GoogleTaskListDao googleTaskListDao;
|
|
|
|
private final Preferences preferences;
|
|
|
|
private final Preferences preferences;
|
|
|
|
|
|
|
|
|
|
|
|
@ -35,35 +33,26 @@ public class TaskMover {
|
|
|
|
TaskDao taskDao,
|
|
|
|
TaskDao taskDao,
|
|
|
|
CaldavDao caldavDao,
|
|
|
|
CaldavDao caldavDao,
|
|
|
|
GoogleTaskDao googleTaskDao,
|
|
|
|
GoogleTaskDao googleTaskDao,
|
|
|
|
SyncAdapters syncAdapters,
|
|
|
|
|
|
|
|
GoogleTaskListDao googleTaskListDao,
|
|
|
|
GoogleTaskListDao googleTaskListDao,
|
|
|
|
Preferences preferences) {
|
|
|
|
Preferences preferences) {
|
|
|
|
this.taskDao = taskDao;
|
|
|
|
this.taskDao = taskDao;
|
|
|
|
this.caldavDao = caldavDao;
|
|
|
|
this.caldavDao = caldavDao;
|
|
|
|
this.googleTaskDao = googleTaskDao;
|
|
|
|
this.googleTaskDao = googleTaskDao;
|
|
|
|
this.syncAdapters = syncAdapters;
|
|
|
|
|
|
|
|
this.googleTaskListDao = googleTaskListDao;
|
|
|
|
this.googleTaskListDao = googleTaskListDao;
|
|
|
|
this.preferences = preferences;
|
|
|
|
this.preferences = preferences;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void move(Long task, Filter selectedList) {
|
|
|
|
|
|
|
|
move(singletonList(task), selectedList);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void move(List<Long> tasks, Filter selectedList) {
|
|
|
|
public void move(List<Long> tasks, Filter selectedList) {
|
|
|
|
tasks = newArrayList(tasks);
|
|
|
|
tasks = newArrayList(tasks);
|
|
|
|
tasks.removeAll(googleTaskDao.findChildrenInList(tasks));
|
|
|
|
tasks.removeAll(googleTaskDao.findChildrenInList(tasks));
|
|
|
|
tasks.removeAll(caldavDao.findChildrenInList(tasks));
|
|
|
|
tasks.removeAll(caldavDao.findChildrenInList(tasks));
|
|
|
|
for (Task task : taskDao.fetch(tasks)) {
|
|
|
|
for (Task task : taskDao.fetch(tasks)) {
|
|
|
|
performMove(task, selectedList);
|
|
|
|
performMove(task, selectedList);
|
|
|
|
task.putTransitory(SyncFlags.GTASKS_SUPPRESS_SYNC, true);
|
|
|
|
|
|
|
|
task.setModificationDate(now());
|
|
|
|
|
|
|
|
taskDao.save(task);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (selectedList instanceof CaldavFilter) {
|
|
|
|
if (selectedList instanceof CaldavFilter) {
|
|
|
|
caldavDao.updateParents((((CaldavFilter) selectedList).getUuid()));
|
|
|
|
caldavDao.updateParents((((CaldavFilter) selectedList).getUuid()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
syncAdapters.sync();
|
|
|
|
taskDao.touch(tasks);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Filter getSingleFilter(List<Long> tasks) {
|
|
|
|
public Filter getSingleFilter(List<Long> tasks) {
|
|
|
|
|