Trying to add task rabbit to quick add and make the icon show up when they have posted to it

pull/14/head
Andrew Shaw 13 years ago
parent 57e97532f0
commit 6a0d86a9b4

@ -125,6 +125,7 @@ import com.todoroo.astrid.service.TaskService;
import com.todoroo.astrid.service.UpgradeService;
import com.todoroo.astrid.sync.SyncResultCallback;
import com.todoroo.astrid.sync.SyncV2Provider;
import com.todoroo.astrid.taskrabbit.TaskRabbitControlSet;
import com.todoroo.astrid.ui.DateChangedAlerts;
import com.todoroo.astrid.ui.DeadlineControlSet;
import com.todoroo.astrid.utility.AstridPreferences;
@ -250,6 +251,7 @@ public class TaskListFragment extends ListFragment implements OnScrollListener,
private RepeatControlSet repeatControl;
private GCalControlSet gcalControl;
private EditPeopleControlSet peopleControl;
private TaskRabbitControlSet taskRabbitControl;
/*
* ======================================================================
@ -652,10 +654,14 @@ public class TaskListFragment extends ListFragment implements OnScrollListener,
repeatControl.getDisplayView(), gcalControl.getDisplayView());
deadlineControl.setIsQuickadd(true);
taskRabbitControl = new TaskRabbitControlSet(this, R.layout.control_set_default_display);
peopleControl = new EditPeopleControlSet(getActivity(), this,
R.layout.control_set_assigned,
R.layout.control_set_default_display,
R.string.actfm_EPA_assign_label, TaskEditFragment.REQUEST_LOG_IN);
peopleControl.addListener(taskRabbitControl);
resetControlSets();

@ -82,6 +82,7 @@ import com.todoroo.astrid.notes.NotesDecorationExposer;
import com.todoroo.astrid.service.StatisticsConstants;
import com.todoroo.astrid.service.StatisticsService;
import com.todoroo.astrid.service.TaskService;
import com.todoroo.astrid.taskrabbit.TaskRabbitTaskContainer;
import com.todoroo.astrid.timers.TimerDecorationExposer;
import com.todoroo.astrid.utility.Constants;
@ -391,7 +392,9 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
// image view
final AsyncImageView pictureView = viewHolder.picture; {
if (pictureView != null) {
if(task.getValue(Task.USER_ID) == 0) {
TaskRabbitTaskContainer container = new TaskRabbitTaskContainer(task);
if(task.getValue(Task.USER_ID) == 0 && container.getTaskID() <= 0) {
pictureView.setVisibility(View.GONE);
if (viewHolder.pictureBorder != null)
viewHolder.pictureBorder.setVisibility(View.GONE);
@ -400,12 +403,18 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
if (viewHolder.pictureBorder != null)
viewHolder.pictureBorder.setVisibility(View.VISIBLE);
pictureView.setUrl(null);
if (container.getTaskID() > 0) {
pictureView.setDefaultImageResource(R.drawable.task_rabbit_image);
}
else {
pictureView.setDefaultImageResource(R.drawable.icn_default_person_image);
try {
JSONObject user = new JSONObject(task.getValue(Task.USER));
pictureView.setUrl(user.optString("picture")); //$NON-NLS-1$
} catch (JSONException e) {
Log.w("astrid", "task-adapter-image", e); //$NON-NLS-1$ //$NON-NLS-2$
}
}
}
}
}

Loading…
Cancel
Save