From 660618f7a0405a1dc309f9d5b6e2897e2eaced02 Mon Sep 17 00:00:00 2001 From: Arne Jans Date: Thu, 22 Dec 2011 23:52:46 +0100 Subject: [PATCH] Fixed the setTitle-stuff not showing anything. Now it updates the old header and the actionbar-title. --- .../astrid/activity/FilterListActivity.java | 2 +- .../activity/FilterListWrapperActivity.java | 11 +++++++++++ .../astrid/activity/TaskListActivity.java | 17 +++++------------ .../activity/TaskListWrapperActivity.java | 11 +++++++++++ 4 files changed, 28 insertions(+), 13 deletions(-) diff --git a/astrid/src/com/todoroo/astrid/activity/FilterListActivity.java b/astrid/src/com/todoroo/astrid/activity/FilterListActivity.java index dbc99bcb0..1a74124cd 100644 --- a/astrid/src/com/todoroo/astrid/activity/FilterListActivity.java +++ b/astrid/src/com/todoroo/astrid/activity/FilterListActivity.java @@ -199,7 +199,7 @@ public class FilterListActivity extends ExpandableListFragment { public void onClick(View v) { Intent intent = TagsPlugin.newTagDialog(getActivity()); startActivity(intent); - AndroidUtilities.callApiMethod(5, FilterListActivity.this, "overridePendingTransition", + AndroidUtilities.callApiMethod(5, getActivity(), "overridePendingTransition", new Class[] { Integer.TYPE, Integer.TYPE }, R.anim.slide_left_in, R.anim.slide_left_out); } diff --git a/astrid/src/com/todoroo/astrid/activity/FilterListWrapperActivity.java b/astrid/src/com/todoroo/astrid/activity/FilterListWrapperActivity.java index 922970d1c..a3c90ee40 100644 --- a/astrid/src/com/todoroo/astrid/activity/FilterListWrapperActivity.java +++ b/astrid/src/com/todoroo/astrid/activity/FilterListWrapperActivity.java @@ -2,6 +2,7 @@ package com.todoroo.astrid.activity; import android.os.Bundle; import android.support.v4.app.Fragment; +import android.widget.TextView; import com.timsu.astrid.R; import com.todoroo.astrid.service.ThemeService; @@ -24,4 +25,14 @@ public class FilterListWrapperActivity extends AstridWrapperActivity { mMultipleFragments = true; } } + + @Override + public void setTitle(CharSequence title) { + Fragment frag = (Fragment) getSupportFragmentManager() + .findFragmentById(R.id.tasklist_fragment); + if (frag != null && frag.isInLayout()) + ((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/TaskListActivity.java b/astrid/src/com/todoroo/astrid/activity/TaskListActivity.java index 15759a255..05ad2478d 100644 --- a/astrid/src/com/todoroo/astrid/activity/TaskListActivity.java +++ b/astrid/src/com/todoroo/astrid/activity/TaskListActivity.java @@ -354,15 +354,15 @@ public class TaskListActivity extends ListFragment implements OnScrollListener, isFilter = true; } else { filter = CoreFilterExposer.buildInboxFilter(getResources()); - //getView().findViewById(R.id.headerLogo).setVisibility(View.VISIBLE); - //getView().findViewById(R.id.listLabel).setVisibility(View.GONE); +// getView().findViewById(R.id.headerLogo).setVisibility(View.VISIBLE); +// getView().findViewById(R.id.listLabel).setVisibility(View.GONE); isFilter = false; } setUpTaskList(); // FIXME put this into the wrapper activity -// if(Constants.DEBUG) -// setTitle("[D] " + filter.title); //$NON-NLS-1$ + if(Constants.DEBUG) + getActivity().setTitle("[D] " + filter.title); //$NON-NLS-1$ contextMenuExtensionLoader.loadInNewThread(getActivity()); } @@ -843,12 +843,6 @@ public class TaskListActivity extends ListFragment implements OnScrollListener, getActivity().sendOrderedBroadcast(broadcastIntent, AstridApiConstants.PERMISSION_READ); } - // FIXME: put this into the wrapper-activity eventually -// @Override -// public void setTitle(CharSequence title) { -// ((TextView)findViewById(R.id.listLabel)).setText(title); -// } - /** * Fill in the Task List with current items * @param withCustomId force task with given custom id to be part of list @@ -859,8 +853,7 @@ public class TaskListActivity extends ListFragment implements OnScrollListener, sqlQueryTemplate.set(SortHelper.adjustQueryForFlagsAndSort(filter.sqlQuery, sortFlags, sortSort)); - // FIXME: put this into the wrapper-activity eventually -// setTitle(filter.title); + getActivity().setTitle(filter.title); // perform query TodorooCursor currentCursor = taskService.fetchFiltered( diff --git a/astrid/src/com/todoroo/astrid/activity/TaskListWrapperActivity.java b/astrid/src/com/todoroo/astrid/activity/TaskListWrapperActivity.java index d8210e943..5000125f0 100644 --- a/astrid/src/com/todoroo/astrid/activity/TaskListWrapperActivity.java +++ b/astrid/src/com/todoroo/astrid/activity/TaskListWrapperActivity.java @@ -2,6 +2,7 @@ package com.todoroo.astrid.activity; import android.os.Bundle; import android.support.v4.app.Fragment; +import android.widget.TextView; import com.timsu.astrid.R; import com.todoroo.astrid.service.ThemeService; @@ -23,4 +24,14 @@ public class TaskListWrapperActivity extends AstridWrapperActivity { mMultipleFragments = true; } } + + @Override + public void setTitle(CharSequence title) { + Fragment frag = (Fragment) getSupportFragmentManager() + .findFragmentById(R.id.tasklist_fragment); + if (frag != null && frag.isInLayout()) + ((TextView)frag.getView().findViewById(R.id.listLabel)).setText(title); + // update the actionbar-title + getSupportActionBar().setTitle(title); + } }