diff --git a/astrid/src/com/todoroo/astrid/activity/AstridWrapperActivity.java b/astrid/src/com/todoroo/astrid/activity/AstridWrapperActivity.java index 4f3b6d5c3..e146428b3 100644 --- a/astrid/src/com/todoroo/astrid/activity/AstridWrapperActivity.java +++ b/astrid/src/com/todoroo/astrid/activity/AstridWrapperActivity.java @@ -37,6 +37,24 @@ public class AstridWrapperActivity extends FragmentActivity */ protected boolean mMultipleFragments = false; + protected FilterListActivity getFilterListFragment() { + FilterListActivity frag = (FilterListActivity) getSupportFragmentManager() + .findFragmentById(R.id.filterlist_fragment); + if (frag == null || !frag.isInLayout()) + return null; + + return frag; + } + + protected TaskListActivity getTaskListFragment() { + TaskListActivity frag = (TaskListActivity) getSupportFragmentManager() + .findFragmentById(R.id.tasklist_fragment); + if (frag == null || !frag.isInLayout()) + return null; + + return frag; + } + /* (non-Javadoc) * @see android.support.v4.app.FragmentActivity#onCreate(android.os.Bundle) */ @@ -45,6 +63,19 @@ public class AstridWrapperActivity extends FragmentActivity super.onCreate(savedInstanceState); } + /* (non-Javadoc) + * @see android.app.Activity#onNewIntent(android.content.Intent) + */ + @Override + protected void onNewIntent(Intent intent) { + super.onNewIntent(intent); + FilterListActivity frag = getFilterListFragment(); + if (frag != null) { + // forwarding for search-requests + frag.onNewIntent(intent); + } + } + /** * Handles items being clicked from the filterlist-fragment. Return true if item is handled. */ diff --git a/astrid/src/com/todoroo/astrid/activity/FilterListWrapperActivity.java b/astrid/src/com/todoroo/astrid/activity/FilterListWrapperActivity.java index 0c494c7d6..d0e7799db 100644 --- a/astrid/src/com/todoroo/astrid/activity/FilterListWrapperActivity.java +++ b/astrid/src/com/todoroo/astrid/activity/FilterListWrapperActivity.java @@ -26,9 +26,8 @@ public class FilterListWrapperActivity extends AstridWrapperActivity { protected void onResume() { super.onResume(); - Fragment frag = (Fragment) getSupportFragmentManager() - .findFragmentById(R.id.tasklist_fragment); - if (frag != null && frag.isInLayout()) { + Fragment frag = getTaskListFragment(); + if (frag != null) { mMultipleFragments = true; } else { mMultipleFragments = false; @@ -37,9 +36,8 @@ public class FilterListWrapperActivity extends AstridWrapperActivity { @Override public void setTitle(CharSequence title) { - Fragment frag = (Fragment) getSupportFragmentManager() - .findFragmentById(R.id.tasklist_fragment); - if (frag != null && frag.isInLayout()) + Fragment frag = getTaskListFragment(); + if (frag != null) ((TextView)frag.getView().findViewById(R.id.listLabel)).setText(title); // update the actionbar-title getSupportActionBar().setTitle(title); diff --git a/astrid/src/com/todoroo/astrid/activity/TaskListWrapperActivity.java b/astrid/src/com/todoroo/astrid/activity/TaskListWrapperActivity.java index 9c31a8b09..2301c8035 100644 --- a/astrid/src/com/todoroo/astrid/activity/TaskListWrapperActivity.java +++ b/astrid/src/com/todoroo/astrid/activity/TaskListWrapperActivity.java @@ -25,9 +25,8 @@ public class TaskListWrapperActivity extends AstridWrapperActivity { protected void onResume() { super.onResume(); - Fragment frag = (Fragment) getSupportFragmentManager() - .findFragmentById(R.id.filterlist_fragment); - if (frag != null && frag.isInLayout()) { + Fragment frag = getFilterListFragment(); + if (frag != null) { mMultipleFragments = true; } else { mMultipleFragments = false; @@ -36,9 +35,8 @@ public class TaskListWrapperActivity extends AstridWrapperActivity { @Override public void setTitle(CharSequence title) { - Fragment frag = (Fragment) getSupportFragmentManager() - .findFragmentById(R.id.tasklist_fragment); - if (frag != null && frag.isInLayout()) + Fragment frag = getTaskListFragment(); + if (frag != null) ((TextView)frag.getView().findViewById(R.id.listLabel)).setText(title); // update the actionbar-title getSupportActionBar().setTitle(title);