|
|
@ -151,7 +151,6 @@ public class RTMSyncService extends SynchronizationService {
|
|
|
|
|
|
|
|
|
|
|
|
// get RTM timeline
|
|
|
|
// get RTM timeline
|
|
|
|
final String timeline = rtmService.timelines_create();
|
|
|
|
final String timeline = rtmService.timelines_create();
|
|
|
|
syncHandler.post(new ProgressUpdater(20, 100));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// load RTM lists
|
|
|
|
// load RTM lists
|
|
|
|
RtmLists lists = rtmService.lists_getList();
|
|
|
|
RtmLists lists = rtmService.lists_getList();
|
|
|
@ -163,24 +162,40 @@ public class RTMSyncService extends SynchronizationService {
|
|
|
|
if(INBOX_LIST_NAME.equalsIgnoreCase(list.getName()))
|
|
|
|
if(INBOX_LIST_NAME.equalsIgnoreCase(list.getName()))
|
|
|
|
INBOX_LIST_NAME = list.getName();
|
|
|
|
INBOX_LIST_NAME = list.getName();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
syncHandler.post(new ProgressUpdater(40, 100));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// read all tasks
|
|
|
|
// read all tasks
|
|
|
|
|
|
|
|
List<TaskProxy> remoteChanges = new LinkedList<TaskProxy>();
|
|
|
|
Date lastSyncDate = Preferences.getSyncRTMLastSync(activity);
|
|
|
|
Date lastSyncDate = Preferences.getSyncRTMLastSync(activity);
|
|
|
|
String filter = "";
|
|
|
|
String filter = "";
|
|
|
|
if(lastSyncDate == null) // 1st time sync, just uncompleted tasks
|
|
|
|
if(lastSyncDate == null) // 1st time sync, just uncompleted tasks
|
|
|
|
filter = "status:incomplete";
|
|
|
|
filter = "status:incomplete";
|
|
|
|
RtmTasks tasks = rtmService.tasks_getList(null, filter, lastSyncDate);
|
|
|
|
int progress = 0;
|
|
|
|
syncHandler.post(new ProgressUpdater(100, 100));
|
|
|
|
for(final String listId : listIdToNameMap.keySet()) {
|
|
|
|
|
|
|
|
RtmTasks tasks;
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
tasks = rtmService.tasks_getList(listId, filter, lastSyncDate);
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
syncHandler.post(new Runnable() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void run() {
|
|
|
|
|
|
|
|
DialogUtilities.okDialog(activity,
|
|
|
|
|
|
|
|
"List " + listIdToNameMap.get(listId) +
|
|
|
|
|
|
|
|
" import failed (too big?)", null);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
List<TaskProxy> remoteChanges = new LinkedList<TaskProxy>();
|
|
|
|
for(RtmTaskList taskList : tasks.getLists()) {
|
|
|
|
for(RtmTaskList taskList : tasks.getLists()) {
|
|
|
|
for(RtmTaskSeries taskSeries : taskList.getSeries()) {
|
|
|
|
for(RtmTaskSeries taskSeries : taskList.getSeries()) {
|
|
|
|
TaskProxy remoteTask = parseRemoteTask(taskList.getId(), taskSeries);
|
|
|
|
TaskProxy remoteTask = parseRemoteTask(taskList.getId(), taskSeries);
|
|
|
|
remoteChanges.add(remoteTask);
|
|
|
|
remoteChanges.add(remoteTask);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
syncHandler.post(new ProgressUpdater(++progress, listIdToNameMap.size()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
synchronizeTasks(activity, remoteChanges, new SynchronizeHelper() {
|
|
|
|
synchronizeTasks(activity, remoteChanges, new SynchronizeHelper() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public String createTask(String listName) throws IOException {
|
|
|
|
public String createTask(String listName) throws IOException {
|
|
|
|