Suppress refresh during sync

pull/437/head
Alex Baker 8 years ago
parent 3c397ebcb4
commit 7c84c3c1b6

@ -268,6 +268,7 @@ public class GoogleTaskSyncAdapter extends InjectingAbstractThreadedSyncAdapter
}
if (!TextUtils.isEmpty(task.task.getTitle())) {
task.task.putTransitory(SyncFlags.GTASKS_SUPPRESS_SYNC, true);
task.task.putTransitory(TaskDao.TRANS_SUPPRESS_REFRESH, true);
gtasksMetadataService.saveTaskAndMetadata(task);
}
}

@ -46,6 +46,8 @@ import timber.log.Timber;
@Singleton
public class TaskDao {
public static final String TRANS_SUPPRESS_REFRESH = "suppress-refresh";
private final RemoteModelDao<Task> dao;
private final MetadataDao metadataDao;
@ -401,8 +403,14 @@ public class TaskDao {
}
broadcaster.taskUpdated(task, values);
broadcastRefresh(task);
}
private void broadcastRefresh(Task task) {
if (!task.checkAndClearTransitory(TRANS_SUPPRESS_REFRESH)) {
broadcaster.refresh();
}
}
/**
* Called after the task was just completed

Loading…
Cancel
Save