From 75da01e64647326a995d5a28089bd58e44dd3ab0 Mon Sep 17 00:00:00 2001 From: Sam Bosley Date: Thu, 17 Jan 2013 10:45:28 -0800 Subject: [PATCH] Fixed several issues with the title only mode --- .../todoroo/astrid/adapter/TaskAdapter.java | 93 +++++++++---------- 1 file changed, 46 insertions(+), 47 deletions(-) diff --git a/astrid/src/com/todoroo/astrid/adapter/TaskAdapter.java b/astrid/src/com/todoroo/astrid/adapter/TaskAdapter.java index e6011f3e2..295e59b75 100644 --- a/astrid/src/com/todoroo/astrid/adapter/TaskAdapter.java +++ b/astrid/src/com/todoroo/astrid/adapter/TaskAdapter.java @@ -375,8 +375,7 @@ public class TaskAdapter extends CursorAdapter implements Filterable { viewHolder.details1.setTag(viewHolder); // add UI component listeners - if (!titleOnlyLayout) - addListeners(view); + addListeners(view); return view; } @@ -397,8 +396,7 @@ public class TaskAdapter extends CursorAdapter implements Filterable { task.readFromCursor(cursor); setFieldContentsAndVisibility(view); - if (!titleOnlyLayout) - setTaskAppearance(viewHolder, task); + setTaskAppearance(viewHolder, task); } /** @@ -457,7 +455,6 @@ public class TaskAdapter extends CursorAdapter implements Filterable { } if (titleOnlyLayout) { - setupCompleteBox(viewHolder); return; } @@ -1099,9 +1096,6 @@ public class TaskAdapter extends CursorAdapter implements Filterable { } boolean state = task.isCompleted(); - - setupDueDateAndTags(viewHolder, task); - TextView name = viewHolder.nameView; if(state) { name.setPaintFlags(name.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); @@ -1111,46 +1105,51 @@ public class TaskAdapter extends CursorAdapter implements Filterable { name.setTextAppearance(activity, R.style.TextAppearance_TAd_ItemTitle); } name.setTextSize(fontSize); - float detailTextSize = Math.max(10, fontSize * 14 / 20); - if(viewHolder.details1 != null) - viewHolder.details1.setTextSize(detailTextSize); - if(viewHolder.details2 != null) - viewHolder.details2.setTextSize(detailTextSize); - if(viewHolder.dueDate != null) { - viewHolder.dueDate.setTextSize(detailTextSize); - if (simpleLayout) - viewHolder.dueDate.setTypeface(null, 0); - } - if (viewHolder.tagsView != null) { - viewHolder.tagsView.setTextSize(detailTextSize); - if (simpleLayout) - viewHolder.tagsView.setTypeface(null, 0); - } - paint.setTextSize(detailTextSize); - // image view - final AsyncImageView pictureView = viewHolder.picture; { - if (pictureView != null) { - if(task.getValue(Task.USER_ID) == Task.USER_ID_SELF && !viewHolder.isTaskRabbit) { - pictureView.setVisibility(View.GONE); - if (viewHolder.pictureBorder != null) - viewHolder.pictureBorder.setVisibility(View.GONE); - } else { - pictureView.setVisibility(View.VISIBLE); - if (viewHolder.pictureBorder != null) - viewHolder.pictureBorder.setVisibility(View.VISIBLE); - pictureView.setUrl(null); - if (viewHolder.isTaskRabbit) { - pictureView.setDefaultImageResource(R.drawable.task_rabbit_image); - } else if(task.getValue(Task.USER_ID) == Task.USER_ID_UNASSIGNED) - pictureView.setDefaultImageResource(R.drawable.icn_anyone_transparent); - 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$ + if (!titleOnlyLayout) { + setupDueDateAndTags(viewHolder, task); + + float detailTextSize = Math.max(10, fontSize * 14 / 20); + if(viewHolder.details1 != null) + viewHolder.details1.setTextSize(detailTextSize); + if(viewHolder.details2 != null) + viewHolder.details2.setTextSize(detailTextSize); + if(viewHolder.dueDate != null) { + viewHolder.dueDate.setTextSize(detailTextSize); + if (simpleLayout) + viewHolder.dueDate.setTypeface(null, 0); + } + if (viewHolder.tagsView != null) { + viewHolder.tagsView.setTextSize(detailTextSize); + if (simpleLayout) + viewHolder.tagsView.setTypeface(null, 0); + } + paint.setTextSize(detailTextSize); + + // image view + final AsyncImageView pictureView = viewHolder.picture; { + if (pictureView != null) { + if(task.getValue(Task.USER_ID) == Task.USER_ID_SELF && !viewHolder.isTaskRabbit) { + pictureView.setVisibility(View.GONE); + if (viewHolder.pictureBorder != null) + viewHolder.pictureBorder.setVisibility(View.GONE); + } else { + pictureView.setVisibility(View.VISIBLE); + if (viewHolder.pictureBorder != null) + viewHolder.pictureBorder.setVisibility(View.VISIBLE); + pictureView.setUrl(null); + if (viewHolder.isTaskRabbit) { + pictureView.setDefaultImageResource(R.drawable.task_rabbit_image); + } else if(task.getValue(Task.USER_ID) == Task.USER_ID_UNASSIGNED) + pictureView.setDefaultImageResource(R.drawable.icn_anyone_transparent); + 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$ + } } } }