From d15a681c412c6b5aa53079782b7d20f4af4bbb3d Mon Sep 17 00:00:00 2001 From: Arne Jans Date: Mon, 13 Aug 2012 21:06:40 +0200 Subject: [PATCH] Fixed zombie lists. After deleting a list from its settings, it will go back to Active Tasks --- .../todoroo/astrid/actfm/TagSettingsActivity.java | 1 + .../com/todoroo/astrid/actfm/TagViewFragment.java | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/TagSettingsActivity.java b/astrid/plugin-src/com/todoroo/astrid/actfm/TagSettingsActivity.java index 237ab6aa0..4d4ed8544 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/TagSettingsActivity.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/TagSettingsActivity.java @@ -524,6 +524,7 @@ public class TagSettingsActivity extends FragmentActivity { protected boolean deleteTag() { boolean result = tagService.deleteOrLeaveTag(this, tagData.getValue(TagData.NAME), TagService.SHOW_ACTIVE_TASKS); + setResult(Activity.RESULT_OK); finish(); return result; } diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/TagViewFragment.java b/astrid/plugin-src/com/todoroo/astrid/actfm/TagViewFragment.java index bfdc0ec48..34dd3057d 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/TagViewFragment.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/TagViewFragment.java @@ -485,8 +485,19 @@ public class TagViewFragment extends TaskListFragment { public void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_CODE_SETTINGS && resultCode == Activity.RESULT_OK) { tagData = tagDataService.fetchById(tagData.getId(), TagData.PROPERTIES); // refetch - if (tagData == null) // This can happen if a tag has been deleted as part of a sync + if (tagData == null) { + // This can happen if a tag has been deleted as part of a sync return; + } else if (tagData.isDeleted()) { + // tag was deleted locally in settings + // go back to active tasks + FilterListFragment fl = ((AstridActivity) getActivity()).getFilterListFragment(); + if (fl != null) { + fl.switchToActiveTasks(); + fl.clear(); // Should auto refresh + } + return; + } filter = TagFilterExposer.filterFromTagData(getActivity(), tagData); getActivity().getIntent().putExtra(TOKEN_FILTER, filter); extras.putParcelable(TOKEN_FILTER, filter);