Removed several unneeded task flags

pull/14/head
Tim Su 13 years ago
parent 77aaf2030d
commit 1403011f31

@ -148,14 +148,28 @@ public abstract class SyncProvider<TYPE extends SyncContainer> {
notification.flags |= Notification.FLAG_ONGOING_EVENT;
}
/**
* Synchronize this providerwith sync toast
* @param context
*/
public void synchronize(final Context context) {
synchronize(context, true);
}
/**
* Synchronize this provider
* @param context
* @param showSyncToast should we toast to indicate synchronizing?
*/
public void synchronize(final Context context, final boolean showSyncToast) {
// display toast
if(context instanceof Activity) {
if(getUtilities().isLoggedIn() && getUtilities().shouldShowToast()) {
((Activity) context).runOnUiThread(new Runnable() {
@Override
public void run() {
makeSyncToast(context);
if(showSyncToast)
makeSyncToast(context);
}
});
}

@ -44,7 +44,6 @@ import com.todoroo.astrid.service.StatisticsService;
import com.todoroo.astrid.sync.SyncProvider;
import com.todoroo.astrid.sync.SyncProviderUtilities;
import com.todoroo.astrid.utility.Constants;
import com.todoroo.astrid.utility.Flags;
@SuppressWarnings("nls")
public class ActFmSyncProvider extends SyncProvider<ActFmTaskContainer> {
@ -124,12 +123,6 @@ public class ActFmSyncProvider extends SyncProvider<ActFmTaskContainer> {
}
}
protected void makeSyncToast(Context context) {
if (!Flags.checkAndClear(Flags.ACTFM_SUPPRESS_SYNC_TOAST)) {
super.makeSyncToast(context);
}
}
// ----------------------------------------------------------------------
// ----------------------------------------------------- synchronization!
// ----------------------------------------------------------------------

@ -75,7 +75,7 @@ public class RepeatTaskCompleteListener extends BroadcastReceiver {
task.setValue(Task.COMPLETION_DATE, 0L);
task.setValue(Task.DUE_DATE, newDueDate);
task.setValue(Task.HIDE_UNTIL, hideUntil);
Flags.set(Flags.ACTFM_REPEATED_TASK);
task.setModelFlag("repeat-complete"); //$NON-NLS-1$
PluginServices.getTaskService().save(task);
return;
}

@ -498,8 +498,7 @@ public class TaskListActivity extends ListActivity implements OnScrollListener,
@Override
public void run() {
Preferences.setLong(LAST_AUTOSYNC_ATTEMPT, DateUtilities.now());
Flags.set(Flags.ACTFM_SUPPRESS_SYNC_TOAST);
new ActFmSyncProvider().synchronize(TaskListActivity.this);
new ActFmSyncProvider().synchronize(TaskListActivity.this, false);
}
}.start();
}

@ -24,7 +24,6 @@ import com.todoroo.astrid.reminders.ReminderService;
import com.todoroo.astrid.service.StatisticsConstants;
import com.todoroo.astrid.service.StatisticsService;
import com.todoroo.astrid.utility.AstridPreferences;
import com.todoroo.astrid.utility.Flags;
/**
* Data Access layer for {@link Task}-related operations.
@ -286,7 +285,7 @@ public class TaskDao extends DatabaseDao<Task> {
* Astrid. Order matters here!
*/
public static void afterSave(Task task, ContentValues values) {
if(values == null || Flags.checkAndClear(Flags.SUPPRESS_HOOKS))
if(values == null)
return;
task.markSaved();

@ -26,25 +26,10 @@ public class Flags {
*/
public static final int ACTFM_SUPPRESS_SYNC = 1 << 3;
/**
* If set, indicates save hooks should be suppressed
*/
public static final int SUPPRESS_HOOKS = 1 << 4;
/**
* If set, indicates to suppress the next gtasks sync attempt
*/
public static final int GTASKS_SUPPRESS_SYNC = 1 << 5;
/**
* If set, indicates next task was a completed repeating task
*/
public static final int ACTFM_REPEATED_TASK = 1 << 6;
/**
* If set, indicates to suppress the toast when synchronizing (used for act.fm autosync)
*/
public static final int ACTFM_SUPPRESS_SYNC_TOAST = 1 << 7;
public static final int GTASKS_SUPPRESS_SYNC = 1 << 4;
public static boolean checkAndClear(int flag) {
boolean set = (state & flag) > 0;

Loading…
Cancel
Save