Fixing more bugs: adding a new tag then going back to task list needed a tagArray refresh, removed some toString() references in TagController.

pull/14/head
Tim Su 17 years ago
parent 4f287f28e1
commit 8016312cf1

@ -106,15 +106,6 @@ public class TaskList extends Activity {
tagController = new TagController(this); tagController = new TagController(this);
tagController.open(); tagController.open();
tagMap = tagController.getAllTagsAsMap();
// check if we want to filter by tag
Bundle extras = getIntent().getExtras();
if(extras != null && extras.containsKey(TAG_TOKEN)) {
TagIdentifier identifier = new TagIdentifier(extras.getLong(TAG_TOKEN));
filterTag = tagMap.get(identifier);
}
listView = (ListView)findViewById(R.id.tasklist); listView = (ListView)findViewById(R.id.tasklist);
addButton = (Button)findViewById(R.id.addtask); addButton = (Button)findViewById(R.id.addtask);
addButton.setOnClickListener(new addButton.setOnClickListener(new
@ -156,6 +147,14 @@ public class TaskList extends Activity {
Cursor tasksCursor; Cursor tasksCursor;
// load tags (again)
tagMap = tagController.getAllTagsAsMap();
Bundle extras = getIntent().getExtras();
if(extras != null && extras.containsKey(TAG_TOKEN)) {
TagIdentifier identifier = new TagIdentifier(extras.getLong(TAG_TOKEN));
filterTag = tagMap.get(identifier);
}
// get the array of tasks // get the array of tasks
if(filterTag != null) { if(filterTag != null) {
List<TaskIdentifier> tasks = tagController.getTaggedTasks( List<TaskIdentifier> tasks = tagController.getTaggedTasks(

@ -28,4 +28,9 @@ public abstract class Identifier {
return ((Identifier)o).getId() == getId(); return ((Identifier)o).getId() == getId();
} }
@Override
public String toString() {
return getClass().getSimpleName() + ": " + id;
}
} }

@ -143,7 +143,7 @@ public class TagController extends AbstractController {
return false; return false;
return tagDatabase.delete(TAG_TABLE_NAME, return tagDatabase.delete(TAG_TABLE_NAME,
KEY_ROWID + " = " + tagId.toString(), null) > 0; KEY_ROWID + " = " + tagId.idAsString(), null) > 0;
} }
// --- single tag to task operations // --- single tag to task operations

@ -55,7 +55,7 @@ public class TaskController extends AbstractController {
for(int i = 0; i < idList.size(); i++) { for(int i = 0; i < idList.size(); i++) {
where.append(KEY_ROWID); where.append(KEY_ROWID);
where.append("="); where.append("=");
where.append(idList.get(i).toString()); where.append(idList.get(i).idAsString());
if(i < idList.size()-1) if(i < idList.size()-1)
where.append(" OR "); where.append(" OR ");
} }

Loading…
Cancel
Save