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())) { if (!TextUtils.isEmpty(task.task.getTitle())) {
task.task.putTransitory(SyncFlags.GTASKS_SUPPRESS_SYNC, true); task.task.putTransitory(SyncFlags.GTASKS_SUPPRESS_SYNC, true);
task.task.putTransitory(TaskDao.TRANS_SUPPRESS_REFRESH, true);
gtasksMetadataService.saveTaskAndMetadata(task); gtasksMetadataService.saveTaskAndMetadata(task);
} }
} }

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

Loading…
Cancel
Save