From 1896fe89c7f55edfe0131c75a305636518125a08 Mon Sep 17 00:00:00 2001 From: Sam Bosley Date: Tue, 8 May 2012 17:39:30 -0700 Subject: [PATCH] Cleanup and polish to quick add bar in people view --- .../astrid/people/PeopleFilterExposer.java | 4 ++-- .../todoroo/astrid/people/PersonViewFragment.java | 15 +++++++++++++++ astrid/res/values/strings-core.xml | 2 +- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/astrid/plugin-src/com/todoroo/astrid/people/PeopleFilterExposer.java b/astrid/plugin-src/com/todoroo/astrid/people/PeopleFilterExposer.java index e5fd39c37..b204f79de 100644 --- a/astrid/plugin-src/com/todoroo/astrid/people/PeopleFilterExposer.java +++ b/astrid/plugin-src/com/todoroo/astrid/people/PeopleFilterExposer.java @@ -29,7 +29,7 @@ import com.todoroo.astrid.data.User; public class PeopleFilterExposer extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { - FilterListItem[] listAsArray = prepareFilters(context); + FilterListItem[] listAsArray = prepareFilters(); Intent broadcastIntent = new Intent(PeopleFilterAdapter.BROADCAST_SEND_PEOPLE_FILTERS); broadcastIntent.putExtra(AstridApiConstants.EXTRAS_RESPONSE, listAsArray); @@ -37,7 +37,7 @@ public class PeopleFilterExposer extends BroadcastReceiver { context.sendBroadcast(broadcastIntent); } - private FilterListItem[] prepareFilters(Context context) { + private FilterListItem[] prepareFilters() { TodorooCursor users = PluginServices.getUserDao().query(Query.select(User.PROPERTIES) .orderBy(Order.asc(User.NAME), Order.asc(User.EMAIL))); try { diff --git a/astrid/plugin-src/com/todoroo/astrid/people/PersonViewFragment.java b/astrid/plugin-src/com/todoroo/astrid/people/PersonViewFragment.java index 142e3510b..8be951002 100644 --- a/astrid/plugin-src/com/todoroo/astrid/people/PersonViewFragment.java +++ b/astrid/plugin-src/com/todoroo/astrid/people/PersonViewFragment.java @@ -4,12 +4,19 @@ import android.view.View; import android.view.ViewGroup; import com.timsu.astrid.R; +import com.todoroo.andlib.service.Autowired; import com.todoroo.astrid.activity.TaskListFragment; +import com.todoroo.astrid.dao.UserDao; +import com.todoroo.astrid.data.User; public class PersonViewFragment extends TaskListFragment { public static final String EXTRA_USER_ID_LOCAL = "user_local_id"; //$NON-NLS-1$ + @Autowired UserDao userDao; + + private User user; + @Override protected View getListBody(ViewGroup root) { ViewGroup parent = (ViewGroup) getActivity().getLayoutInflater().inflate(R.layout.task_list_body_person, root, false); @@ -20,10 +27,18 @@ public class PersonViewFragment extends TaskListFragment { return parent; } + @Override + protected void initializeData() { + super.initializeData(); + if (extras.containsKey(EXTRA_USER_ID_LOCAL)) + user = userDao.fetch(extras.getLong(EXTRA_USER_ID_LOCAL), User.PROPERTIES); + } + @Override protected void setupQuickAddBar() { super.setupQuickAddBar(); quickAddBar.setUsePeopleControl(false); + quickAddBar.getQuickAddBox().setHint(getString(R.string.TLA_quick_add_hint_assign, user.getDisplayName())); } } diff --git a/astrid/res/values/strings-core.xml b/astrid/res/values/strings-core.xml index e1c3af808..54ce5d625 100644 --- a/astrid/res/values/strings-core.xml +++ b/astrid/res/values/strings-core.xml @@ -139,7 +139,7 @@ Add a task - + Tap to assign %s a task