|
|
@ -69,6 +69,7 @@ import com.todoroo.andlib.widget.GestureService;
|
|
|
|
import com.todoroo.andlib.widget.GestureService.GestureInterface;
|
|
|
|
import com.todoroo.andlib.widget.GestureService.GestureInterface;
|
|
|
|
import com.todoroo.astrid.activity.SortSelectionActivity.OnSortSelectedListener;
|
|
|
|
import com.todoroo.astrid.activity.SortSelectionActivity.OnSortSelectedListener;
|
|
|
|
import com.todoroo.astrid.adapter.TaskAdapter;
|
|
|
|
import com.todoroo.astrid.adapter.TaskAdapter;
|
|
|
|
|
|
|
|
import com.todoroo.astrid.adapter.TaskAdapter.OnCompletedTaskListener;
|
|
|
|
import com.todoroo.astrid.adapter.TaskAdapter.ViewHolder;
|
|
|
|
import com.todoroo.astrid.adapter.TaskAdapter.ViewHolder;
|
|
|
|
import com.todoroo.astrid.api.AstridApiConstants;
|
|
|
|
import com.todoroo.astrid.api.AstridApiConstants;
|
|
|
|
import com.todoroo.astrid.api.Filter;
|
|
|
|
import com.todoroo.astrid.api.Filter;
|
|
|
@ -141,6 +142,9 @@ public class TaskListActivity extends ListActivity implements OnScrollListener,
|
|
|
|
/** token for passing a {@link Filter} object through extras */
|
|
|
|
/** token for passing a {@link Filter} object through extras */
|
|
|
|
public static final String TOKEN_FILTER = "filter"; //$NON-NLS-1$
|
|
|
|
public static final String TOKEN_FILTER = "filter"; //$NON-NLS-1$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** token for indicating source of TLA launch */
|
|
|
|
|
|
|
|
public static final String TOKEN_SOURCE = "source"; //$NON-NLS-1$
|
|
|
|
|
|
|
|
|
|
|
|
// --- instance variables
|
|
|
|
// --- instance variables
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired ExceptionService exceptionService;
|
|
|
|
@Autowired ExceptionService exceptionService;
|
|
|
@ -172,7 +176,7 @@ public class TaskListActivity extends ListActivity implements OnScrollListener,
|
|
|
|
private EditText quickAddBox;
|
|
|
|
private EditText quickAddBox;
|
|
|
|
private Timer backgroundTimer;
|
|
|
|
private Timer backgroundTimer;
|
|
|
|
private final LinkedHashSet<SyncAction> syncActions = new LinkedHashSet<SyncAction>();
|
|
|
|
private final LinkedHashSet<SyncAction> syncActions = new LinkedHashSet<SyncAction>();
|
|
|
|
|
|
|
|
private boolean isInbox;
|
|
|
|
|
|
|
|
|
|
|
|
private final TaskListContextMenuExtensionLoader contextMenuExtensionLoader = new TaskListContextMenuExtensionLoader();
|
|
|
|
private final TaskListContextMenuExtensionLoader contextMenuExtensionLoader = new TaskListContextMenuExtensionLoader();
|
|
|
|
private VoiceInputAssistant voiceInputAssistant;
|
|
|
|
private VoiceInputAssistant voiceInputAssistant;
|
|
|
@ -218,6 +222,26 @@ public class TaskListActivity extends ListActivity implements OnScrollListener,
|
|
|
|
onNewIntent(getIntent());
|
|
|
|
onNewIntent(getIntent());
|
|
|
|
|
|
|
|
|
|
|
|
Eula.showEula(this);
|
|
|
|
Eula.showEula(this);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(getIntent().hasExtra(TOKEN_SOURCE)) {
|
|
|
|
|
|
|
|
switch(getIntent().getIntExtra(TOKEN_SOURCE, Constants.SOURCE_DEFAULT)) {
|
|
|
|
|
|
|
|
case Constants.SOURCE_NOTIFICATION:
|
|
|
|
|
|
|
|
StatisticsService.reportEvent("launch-from-notification"); //$NON-NLS-1$
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Constants.SOURCE_OTHER:
|
|
|
|
|
|
|
|
StatisticsService.reportEvent("launch-from-other"); //$NON-NLS-1$
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Constants.SOURCE_PPWIDGET:
|
|
|
|
|
|
|
|
StatisticsService.reportEvent("launch-from-ppw"); //$NON-NLS-1$
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Constants.SOURCE_WIDGET:
|
|
|
|
|
|
|
|
StatisticsService.reportEvent("launch-from-widget"); //$NON-NLS-1$
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Constants.SOURCE_C2DM:
|
|
|
|
|
|
|
|
StatisticsService.reportEvent("launch-from-c2dm"); //$NON-NLS-1$
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
@ -227,10 +251,12 @@ public class TaskListActivity extends ListActivity implements OnScrollListener,
|
|
|
|
Bundle extras = intent.getExtras();
|
|
|
|
Bundle extras = intent.getExtras();
|
|
|
|
if(extras != null && extras.containsKey(TOKEN_FILTER)) {
|
|
|
|
if(extras != null && extras.containsKey(TOKEN_FILTER)) {
|
|
|
|
filter = extras.getParcelable(TOKEN_FILTER);
|
|
|
|
filter = extras.getParcelable(TOKEN_FILTER);
|
|
|
|
|
|
|
|
isInbox = true;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
filter = CoreFilterExposer.buildInboxFilter(getResources());
|
|
|
|
filter = CoreFilterExposer.buildInboxFilter(getResources());
|
|
|
|
findViewById(R.id.headerLogo).setVisibility(View.VISIBLE);
|
|
|
|
findViewById(R.id.headerLogo).setVisibility(View.VISIBLE);
|
|
|
|
findViewById(R.id.listLabel).setVisibility(View.GONE);
|
|
|
|
findViewById(R.id.listLabel).setVisibility(View.GONE);
|
|
|
|
|
|
|
|
isInbox = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
setUpTaskList();
|
|
|
|
setUpTaskList();
|
|
|
@ -671,7 +697,13 @@ public class TaskListActivity extends ListActivity implements OnScrollListener,
|
|
|
|
|
|
|
|
|
|
|
|
// set up list adapters
|
|
|
|
// set up list adapters
|
|
|
|
taskAdapter = new TaskAdapter(this, R.layout.task_adapter_row,
|
|
|
|
taskAdapter = new TaskAdapter(this, R.layout.task_adapter_row,
|
|
|
|
currentCursor, sqlQueryTemplate, false, null);
|
|
|
|
currentCursor, sqlQueryTemplate, false, new OnCompletedTaskListener() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onCompletedTask(Task item, boolean newState) {
|
|
|
|
|
|
|
|
if(newState == true)
|
|
|
|
|
|
|
|
onTaskCompleted(item);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
setListAdapter(taskAdapter);
|
|
|
|
setListAdapter(taskAdapter);
|
|
|
|
getListView().setOnScrollListener(this);
|
|
|
|
getListView().setOnScrollListener(this);
|
|
|
|
registerForContextMenu(getListView());
|
|
|
|
registerForContextMenu(getListView());
|
|
|
@ -727,6 +759,18 @@ public class TaskListActivity extends ListActivity implements OnScrollListener,
|
|
|
|
* ============================================================== actions
|
|
|
|
* ============================================================== actions
|
|
|
|
* ====================================================================== */
|
|
|
|
* ====================================================================== */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* A task was completed from the task adapter
|
|
|
|
|
|
|
|
* @param item task that was completed
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@SuppressWarnings("nls")
|
|
|
|
|
|
|
|
protected void onTaskCompleted(Task item) {
|
|
|
|
|
|
|
|
if(isInbox)
|
|
|
|
|
|
|
|
StatisticsService.reportEvent("task-completed-inbox");
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
StatisticsService.reportEvent("task-completed-filter");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Quick-add a new task
|
|
|
|
* Quick-add a new task
|
|
|
|
* @param title
|
|
|
|
* @param title
|
|
|
@ -748,6 +792,7 @@ public class TaskListActivity extends ListActivity implements OnScrollListener,
|
|
|
|
selectCustomId(task.getId());
|
|
|
|
selectCustomId(task.getId());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
StatisticsService.reportEvent("task-created-tasklist");
|
|
|
|
return task;
|
|
|
|
return task;
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
exceptionService.displayAndReportError(this, "quick-add-task", e);
|
|
|
|
exceptionService.displayAndReportError(this, "quick-add-task", e);
|
|
|
@ -975,22 +1020,27 @@ public class TaskListActivity extends ListActivity implements OnScrollListener,
|
|
|
|
// handle my own menus
|
|
|
|
// handle my own menus
|
|
|
|
switch (item.getItemId()) {
|
|
|
|
switch (item.getItemId()) {
|
|
|
|
case MENU_ADDONS_ID:
|
|
|
|
case MENU_ADDONS_ID:
|
|
|
|
|
|
|
|
StatisticsService.reportEvent("tla-menu-addons"); //$NON-NLS-1$
|
|
|
|
intent = new Intent(this, AddOnActivity.class);
|
|
|
|
intent = new Intent(this, AddOnActivity.class);
|
|
|
|
startActivityForResult(intent, ACTIVITY_ADDONS);
|
|
|
|
startActivityForResult(intent, ACTIVITY_ADDONS);
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
case MENU_SETTINGS_ID:
|
|
|
|
case MENU_SETTINGS_ID:
|
|
|
|
|
|
|
|
StatisticsService.reportEvent("tla-menu-settings"); //$NON-NLS-1$
|
|
|
|
intent = new Intent(this, EditPreferences.class);
|
|
|
|
intent = new Intent(this, EditPreferences.class);
|
|
|
|
startActivityForResult(intent, ACTIVITY_SETTINGS);
|
|
|
|
startActivityForResult(intent, ACTIVITY_SETTINGS);
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
case MENU_SORT_ID:
|
|
|
|
case MENU_SORT_ID:
|
|
|
|
|
|
|
|
StatisticsService.reportEvent("tla-menu-sort"); //$NON-NLS-1$
|
|
|
|
AlertDialog dialog = SortSelectionActivity.createDialog(this,
|
|
|
|
AlertDialog dialog = SortSelectionActivity.createDialog(this,
|
|
|
|
this, sortFlags, sortSort);
|
|
|
|
this, sortFlags, sortSort);
|
|
|
|
dialog.show();
|
|
|
|
dialog.show();
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
case MENU_SYNC_ID:
|
|
|
|
case MENU_SYNC_ID:
|
|
|
|
|
|
|
|
StatisticsService.reportEvent("tla-menu-sync"); //$NON-NLS-1$
|
|
|
|
performSyncAction();
|
|
|
|
performSyncAction();
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
case MENU_HELP_ID:
|
|
|
|
case MENU_HELP_ID:
|
|
|
|
|
|
|
|
StatisticsService.reportEvent("tla-menu-help"); //$NON-NLS-1$
|
|
|
|
intent = new Intent(Intent.ACTION_VIEW,
|
|
|
|
intent = new Intent(Intent.ACTION_VIEW,
|
|
|
|
Uri.parse(Constants.HELP_URL));
|
|
|
|
Uri.parse(Constants.HELP_URL));
|
|
|
|
startActivity(intent);
|
|
|
|
startActivity(intent);
|
|
|
|