Cleanup and polish to quick add bar in people view

pull/14/head
Sam Bosley 13 years ago
parent cc76e6d178
commit 1896fe89c7

@ -29,7 +29,7 @@ import com.todoroo.astrid.data.User;
public class PeopleFilterExposer extends BroadcastReceiver { public class PeopleFilterExposer extends BroadcastReceiver {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
FilterListItem[] listAsArray = prepareFilters(context); FilterListItem[] listAsArray = prepareFilters();
Intent broadcastIntent = new Intent(PeopleFilterAdapter.BROADCAST_SEND_PEOPLE_FILTERS); Intent broadcastIntent = new Intent(PeopleFilterAdapter.BROADCAST_SEND_PEOPLE_FILTERS);
broadcastIntent.putExtra(AstridApiConstants.EXTRAS_RESPONSE, listAsArray); broadcastIntent.putExtra(AstridApiConstants.EXTRAS_RESPONSE, listAsArray);
@ -37,7 +37,7 @@ public class PeopleFilterExposer extends BroadcastReceiver {
context.sendBroadcast(broadcastIntent); context.sendBroadcast(broadcastIntent);
} }
private FilterListItem[] prepareFilters(Context context) { private FilterListItem[] prepareFilters() {
TodorooCursor<User> users = PluginServices.getUserDao().query(Query.select(User.PROPERTIES) TodorooCursor<User> users = PluginServices.getUserDao().query(Query.select(User.PROPERTIES)
.orderBy(Order.asc(User.NAME), Order.asc(User.EMAIL))); .orderBy(Order.asc(User.NAME), Order.asc(User.EMAIL)));
try { try {

@ -4,12 +4,19 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import com.timsu.astrid.R; import com.timsu.astrid.R;
import com.todoroo.andlib.service.Autowired;
import com.todoroo.astrid.activity.TaskListFragment; import com.todoroo.astrid.activity.TaskListFragment;
import com.todoroo.astrid.dao.UserDao;
import com.todoroo.astrid.data.User;
public class PersonViewFragment extends TaskListFragment { public class PersonViewFragment extends TaskListFragment {
public static final String EXTRA_USER_ID_LOCAL = "user_local_id"; //$NON-NLS-1$ public static final String EXTRA_USER_ID_LOCAL = "user_local_id"; //$NON-NLS-1$
@Autowired UserDao userDao;
private User user;
@Override @Override
protected View getListBody(ViewGroup root) { protected View getListBody(ViewGroup root) {
ViewGroup parent = (ViewGroup) getActivity().getLayoutInflater().inflate(R.layout.task_list_body_person, root, false); 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; 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 @Override
protected void setupQuickAddBar() { protected void setupQuickAddBar() {
super.setupQuickAddBar(); super.setupQuickAddBar();
quickAddBar.setUsePeopleControl(false); quickAddBar.setUsePeopleControl(false);
quickAddBar.getQuickAddBox().setHint(getString(R.string.TLA_quick_add_hint_assign, user.getDisplayName()));
} }
} }

@ -139,7 +139,7 @@
<!-- Quick Add Edit Box Hint--> <!-- Quick Add Edit Box Hint-->
<string name="TLA_quick_add_hint">Add a task</string> <string name="TLA_quick_add_hint">Add a task</string>
<!-- Quick Add Edit Box Hint for assigning --> <!-- Quick Add Edit Box Hint for assigning (%s -> name)-->
<string name="TLA_quick_add_hint_assign">Tap to assign %s a task</string> <string name="TLA_quick_add_hint_assign">Tap to assign %s a task</string>
<!-- Notification Volumne notification--> <!-- Notification Volumne notification-->

Loading…
Cancel
Save