Sync history and comments in both comment fragments

pull/14/head
Sam Bosley 13 years ago
parent 446436b2bb
commit f43a318f1e

@ -48,7 +48,6 @@ import com.todoroo.astrid.dao.UserActivityDao;
import com.todoroo.astrid.data.RemoteModel;
import com.todoroo.astrid.data.UserActivity;
import com.todoroo.astrid.helper.ImageDiskCache;
import com.todoroo.astrid.helper.ProgressBarSyncResultCallback;
import com.todoroo.astrid.service.StatisticsService;
public abstract class CommentsFragment extends ListFragment {
@ -264,21 +263,10 @@ public abstract class CommentsFragment extends ListFragment {
protected void refreshActivity(boolean manual) {
if (actFmPreferenceService.isLoggedIn()) {
final ProgressBarSyncResultCallback callback = new ProgressBarSyncResultCallback(
getActivity(), this, R.id.comments_progressBar, new Runnable() {
@Override
public void run() {
refreshUpdatesList();
}
});
callback.started();
callback.incrementMax(100);
Runnable doneRunnable = new Runnable() {
@Override
public void run() {
callback.incrementProgress(50);
callback.finished();
refreshUpdatesList();
}
};
if (hasModel()) {
@ -287,7 +275,6 @@ public abstract class CommentsFragment extends ListFragment {
// actFmSyncService.fetchPersonalUpdates(manual, doneRunnable);
doneRunnable.run();
}
callback.incrementProgress(50);
}
}

@ -19,8 +19,13 @@ import com.timsu.astrid.R;
import com.todoroo.andlib.service.Autowired;
import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.actfm.sync.ActFmSyncThread;
import com.todoroo.astrid.actfm.sync.messages.BriefMe;
import com.todoroo.astrid.actfm.sync.messages.FetchHistory;
import com.todoroo.astrid.actfm.sync.messages.NameMaps;
import com.todoroo.astrid.activity.TaskListActivity;
import com.todoroo.astrid.adapter.UpdateAdapter;
import com.todoroo.astrid.dao.TagDataDao;
import com.todoroo.astrid.data.RemoteModel;
import com.todoroo.astrid.data.TagData;
import com.todoroo.astrid.data.Task;
@ -39,6 +44,9 @@ public class TagCommentsFragment extends CommentsFragment {
@Autowired
private TagDataService tagDataService;
@Autowired
private TagDataDao tagDataDao;
public TagCommentsFragment() {
super();
}
@ -119,8 +127,10 @@ public class TagCommentsFragment extends CommentsFragment {
@Override
protected void performFetch(boolean manual, Runnable done) {
done.run();
// actFmSyncService.fetchUpdatesForTag(tagData, manual, done);
if (tagData != null) {
ActFmSyncThread.getInstance().enqueueMessage(new BriefMe<TagData>(TagData.class, tagData.getUuid(), tagData.getValue(TagData.PUSHED_AT)), done);
new FetchHistory<TagData>(tagDataDao, TagData.HISTORY_FETCH_DATE, NameMaps.TABLE_ID_TAGS, tagData.getUuid(), null, tagData.getValue(TagData.HISTORY_FETCH_DATE), true).execute();
}
}
@Override

@ -8,6 +8,10 @@ import android.widget.ListView;
import com.timsu.astrid.R;
import com.todoroo.andlib.service.Autowired;
import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.astrid.actfm.sync.ActFmSyncThread;
import com.todoroo.astrid.actfm.sync.messages.BriefMe;
import com.todoroo.astrid.actfm.sync.messages.FetchHistory;
import com.todoroo.astrid.actfm.sync.messages.NameMaps;
import com.todoroo.astrid.adapter.UpdateAdapter;
import com.todoroo.astrid.dao.TaskDao;
import com.todoroo.astrid.data.Task;
@ -76,8 +80,10 @@ public class TaskCommentsFragment extends CommentsFragment {
@Override
protected void performFetch(boolean manual, Runnable done) {
done.run();
// actFmSyncService.fetchUpdatesForTask(task, manual, done);
if (task != null) {
ActFmSyncThread.getInstance().enqueueMessage(new BriefMe<Task>(Task.class, task.getUuid(), task.getValue(Task.PUSHED_AT)), done);
new FetchHistory<Task>(taskDao, Task.HISTORY_FETCH_DATE, NameMaps.TABLE_ID_TASKS, task.getUuid(), null, task.getValue(Task.HISTORY_FETCH_DATE), false).execute();
}
}
@Override

Loading…
Cancel
Save