Show deleted tasks on task list for one minute

pull/253/head
Alex Baker 10 years ago
parent 4695b427ad
commit 73da08a6eb

@ -7,10 +7,7 @@ package com.todoroo.astrid.activity;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.view.MenuItemCompat; import android.support.v4.view.MenuItemCompat;
@ -75,13 +72,6 @@ public class TaskListActivity extends AstridActivity implements OnPageChangeList
public static final String OPEN_TASK = "openTask"; //$NON-NLS-1$ public static final String OPEN_TASK = "openTask"; //$NON-NLS-1$
private final BroadcastReceiver refreshReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
refreshTaskList();
}
};
/** /**
* @see android.app.Activity#onCreate(Bundle) * @see android.app.Activity#onCreate(Bundle)
*/ */
@ -139,18 +129,9 @@ public class TaskListActivity extends AstridActivity implements OnPageChangeList
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
registerReceiver(refreshReceiver, new IntentFilter(AstridApiConstants.BROADCAST_EVENT_REFRESH));
getTaskListFragment().setSyncOngoing(gtasksPreferenceService.isOngoing()); getTaskListFragment().setSyncOngoing(gtasksPreferenceService.isOngoing());
} }
@Override
protected void onPause() {
super.onPause();
unregisterReceiver(refreshReceiver);
}
@Override @Override
public boolean onCreateOptionsMenu(Menu menu) { public boolean onCreateOptionsMenu(Menu menu) {
if (isDrawerOpen()) { if (isDrawerOpen()) {

@ -25,7 +25,9 @@ public class SortHelper {
public static final int FLAG_SHOW_HIDDEN = 1 << 2; public static final int FLAG_SHOW_HIDDEN = 1 << 2;
public static final int FLAG_SHOW_DELETED = 1 << 3; public static final int FLAG_SHOW_DELETED = 1 << 3;
public static final int FLAG_DRAG_DROP = 1 << 4; public static final int FLAG_DRAG_DROP = 1 << 4;
public static final int FLAG_SHOW_RECENTLY_COMPLETED = 1 << 5; @SuppressWarnings("UnusedDeclaration")
@Deprecated
private static final int FLAG_SHOW_RECENTLY_COMPLETED = 1 << 5;
public static final int SORT_AUTO = 0; public static final int SORT_AUTO = 0;
public static final int SORT_ALPHA = 1; public static final int SORT_ALPHA = 1;
@ -55,8 +57,7 @@ public class SortHelper {
if((flags & FLAG_SHOW_COMPLETED) > 0) { if((flags & FLAG_SHOW_COMPLETED) > 0) {
originalSql = originalSql.replace(Task.COMPLETION_DATE.eq(0).toString(), originalSql = originalSql.replace(Task.COMPLETION_DATE.eq(0).toString(),
Criterion.all.toString()); Criterion.all.toString());
} } else {
if ((flags & FLAG_SHOW_RECENTLY_COMPLETED) > 0) {
originalSql = originalSql.replace(Task.COMPLETION_DATE.eq(0).toString(), originalSql = originalSql.replace(Task.COMPLETION_DATE.eq(0).toString(),
Criterion.or(Task.COMPLETION_DATE.lte(0), Task.COMPLETION_DATE.gt(DateUtilities.now() - 60000)).toString()); Criterion.or(Task.COMPLETION_DATE.lte(0), Task.COMPLETION_DATE.gt(DateUtilities.now() - 60000)).toString());
} }

@ -195,7 +195,6 @@ public class ScrollableViewsFactory implements RemoteViewsService.RemoteViewsFac
} }
int flags = preferences.getSortFlags(); int flags = preferences.getSortFlags();
flags |= SortHelper.FLAG_SHOW_RECENTLY_COMPLETED;
int sort = preferences.getSortMode(); int sort = preferences.getSortMode();
if(sort == 0) { if(sort == 0) {
sort = SortHelper.SORT_WIDGET; sort = SortHelper.SORT_WIDGET;

Loading…
Cancel
Save