From a063a6d60efe7279eefc286493287f68a51408de Mon Sep 17 00:00:00 2001 From: Alex Baker Date: Sun, 31 Jan 2016 23:04:24 -0600 Subject: [PATCH] Fix crash on save after rotating manual lists --- .../todoroo/astrid/subtasks/SubtasksListFragment.java | 9 +++++---- .../todoroo/astrid/subtasks/SubtasksTagListFragment.java | 3 +-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/todoroo/astrid/subtasks/SubtasksListFragment.java b/src/main/java/com/todoroo/astrid/subtasks/SubtasksListFragment.java index f01025e06..4b9f8039a 100644 --- a/src/main/java/com/todoroo/astrid/subtasks/SubtasksListFragment.java +++ b/src/main/java/com/todoroo/astrid/subtasks/SubtasksListFragment.java @@ -9,6 +9,7 @@ import android.app.Activity; import android.content.Context; import android.view.View; import android.view.ViewGroup; +import android.widget.ListView; import com.todoroo.andlib.data.TodorooCursor; import com.todoroo.astrid.activity.TaskListFragment; @@ -75,8 +76,6 @@ public class SubtasksListFragment extends TaskListFragment { helper.beforeSetUpTaskList(filter); super.setUpTaskList(); - - unregisterForContextMenu(getListView()); } @Override @@ -88,9 +87,11 @@ public class SubtasksListFragment extends TaskListFragment { @Override public void onResume() { super.onResume(); - if (lastVisibleIndex >=0) { - getListView().setSelection(lastVisibleIndex); + ListView listView = getListView(); + if (lastVisibleIndex >= 0) { + listView.setSelection(lastVisibleIndex); } + unregisterForContextMenu(listView); } @Override diff --git a/src/main/java/com/todoroo/astrid/subtasks/SubtasksTagListFragment.java b/src/main/java/com/todoroo/astrid/subtasks/SubtasksTagListFragment.java index 9318aef71..56685705a 100644 --- a/src/main/java/com/todoroo/astrid/subtasks/SubtasksTagListFragment.java +++ b/src/main/java/com/todoroo/astrid/subtasks/SubtasksTagListFragment.java @@ -68,8 +68,6 @@ public class SubtasksTagListFragment extends TagViewFragment { helper.beforeSetUpTaskList(filter); super.setUpTaskList(); - - unregisterForContextMenu(getListView()); } @Override @@ -84,6 +82,7 @@ public class SubtasksTagListFragment extends TagViewFragment { if (lastVisibleIndex >= 0) { getListView().setSelection(lastVisibleIndex); } + unregisterForContextMenu(getListView()); } @Override