From cfa8fc9e2f5073bf02f2929a4fe41b4f283627bd Mon Sep 17 00:00:00 2001 From: Alex Baker Date: Mon, 1 Feb 2016 15:10:50 -0600 Subject: [PATCH] Set title when loading fragment --- .../todoroo/astrid/activity/TaskListActivity.java | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/todoroo/astrid/activity/TaskListActivity.java b/src/main/java/com/todoroo/astrid/activity/TaskListActivity.java index 736bcc48a..879304851 100644 --- a/src/main/java/com/todoroo/astrid/activity/TaskListActivity.java +++ b/src/main/java/com/todoroo/astrid/activity/TaskListActivity.java @@ -199,14 +199,12 @@ public class TaskListActivity extends InjectingAppCompatActivity implements if (intent.hasExtra(TaskListFragment.TOKEN_FILTER)) { Filter filter = intent.getParcelableExtra(TaskListFragment.TOKEN_FILTER); extras.putAll(configureIntentAndExtrasWithFilter(intent, filter)); - setListsTitle(filter.listingTitle); taskListFragment = newTaskListFragment(filter, extras); } else { taskListFragment = getTaskListFragment(); if (taskListFragment == null) { Filter filter = getDefaultFilter(); extras.putAll(configureIntentAndExtrasWithFilter(intent, filter)); - setListsTitle(filter.listingTitle); taskListFragment = newTaskListFragment(filter, extras); } } @@ -231,6 +229,8 @@ public class TaskListActivity extends InjectingAppCompatActivity implements } private void loadTaskListFragment(boolean onCreate, TaskListFragment taskListFragment) { + Filter filter = taskListFragment.getFilter(); + getSupportActionBar().setTitle(filter.listingTitle); FragmentManager fragmentManager = getFragmentManager(); if (onCreate) { fragmentManager.popBackStackImmediate(null, FragmentManager.POP_BACK_STACK_INCLUSIVE); @@ -368,9 +368,6 @@ public class TaskListActivity extends InjectingAppCompatActivity implements getTaskEditFragment().onBackPressed(); } - if ((item instanceof Filter)) { - setSelectedItem((Filter) item); - } // If showing both fragments, directly update the tasklist-fragment Intent intent = getIntent(); @@ -520,14 +517,6 @@ public class TaskListActivity extends InjectingAppCompatActivity implements } } - public void setListsTitle(String title) { - getSupportActionBar().setTitle(title); - } - - public void setSelectedItem(Filter item) { - getSupportActionBar().setTitle(item.listingTitle); - } - @Override public void onBackPressed() { if (navigationDrawer.isDrawerOpen()) {