|
|
|
@ -24,11 +24,13 @@ import com.todoroo.astrid.data.Task;
|
|
|
|
import com.todoroo.astrid.ui.CheckableImageView;
|
|
|
|
import com.todoroo.astrid.ui.CheckableImageView;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import org.tasks.R;
|
|
|
|
import org.tasks.R;
|
|
|
|
|
|
|
|
import org.tasks.preferences.Preferences;
|
|
|
|
import org.tasks.ui.CheckBoxes;
|
|
|
|
import org.tasks.ui.CheckBoxes;
|
|
|
|
|
|
|
|
|
|
|
|
class ViewHolder extends RecyclerView.ViewHolder {
|
|
|
|
class ViewHolder extends RecyclerView.ViewHolder {
|
|
|
|
|
|
|
|
|
|
|
|
private final Context context;
|
|
|
|
private final Context context;
|
|
|
|
|
|
|
|
private final Preferences preferences;
|
|
|
|
private final CheckBoxes checkBoxes;
|
|
|
|
private final CheckBoxes checkBoxes;
|
|
|
|
private final TagFormatter tagFormatter;
|
|
|
|
private final TagFormatter tagFormatter;
|
|
|
|
private final int textColorSecondary;
|
|
|
|
private final int textColorSecondary;
|
|
|
|
@ -53,6 +55,9 @@ class ViewHolder extends RecyclerView.ViewHolder {
|
|
|
|
@BindView(R.id.title)
|
|
|
|
@BindView(R.id.title)
|
|
|
|
TextView nameView;
|
|
|
|
TextView nameView;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@BindView(R.id.description)
|
|
|
|
|
|
|
|
TextView description;
|
|
|
|
|
|
|
|
|
|
|
|
@BindView(R.id.completeBox)
|
|
|
|
@BindView(R.id.completeBox)
|
|
|
|
CheckableImageView completeBox;
|
|
|
|
CheckableImageView completeBox;
|
|
|
|
|
|
|
|
|
|
|
|
@ -66,7 +71,7 @@ class ViewHolder extends RecyclerView.ViewHolder {
|
|
|
|
ViewHolder(
|
|
|
|
ViewHolder(
|
|
|
|
Context context,
|
|
|
|
Context context,
|
|
|
|
ViewGroup view,
|
|
|
|
ViewGroup view,
|
|
|
|
boolean showFullTaskTitle,
|
|
|
|
Preferences preferences,
|
|
|
|
int fontSize,
|
|
|
|
int fontSize,
|
|
|
|
CheckBoxes checkBoxes,
|
|
|
|
CheckBoxes checkBoxes,
|
|
|
|
TagFormatter tagFormatter,
|
|
|
|
TagFormatter tagFormatter,
|
|
|
|
@ -80,6 +85,7 @@ class ViewHolder extends RecyclerView.ViewHolder {
|
|
|
|
int rowPadding) {
|
|
|
|
int rowPadding) {
|
|
|
|
super(view);
|
|
|
|
super(view);
|
|
|
|
this.context = context;
|
|
|
|
this.context = context;
|
|
|
|
|
|
|
|
this.preferences = preferences;
|
|
|
|
this.checkBoxes = checkBoxes;
|
|
|
|
this.checkBoxes = checkBoxes;
|
|
|
|
this.tagFormatter = tagFormatter;
|
|
|
|
this.tagFormatter = tagFormatter;
|
|
|
|
this.textColorOverdue = textColorOverdue;
|
|
|
|
this.textColorOverdue = textColorOverdue;
|
|
|
|
@ -91,12 +97,18 @@ class ViewHolder extends RecyclerView.ViewHolder {
|
|
|
|
this.selectedColor = selectedColor;
|
|
|
|
this.selectedColor = selectedColor;
|
|
|
|
ButterKnife.bind(this, view);
|
|
|
|
ButterKnife.bind(this, view);
|
|
|
|
|
|
|
|
|
|
|
|
if (showFullTaskTitle) {
|
|
|
|
if (preferences.getBoolean(R.string.p_fullTaskTitle, false)) {
|
|
|
|
nameView.setMaxLines(Integer.MAX_VALUE);
|
|
|
|
nameView.setMaxLines(Integer.MAX_VALUE);
|
|
|
|
nameView.setSingleLine(false);
|
|
|
|
nameView.setSingleLine(false);
|
|
|
|
nameView.setEllipsize(null);
|
|
|
|
nameView.setEllipsize(null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (preferences.getBoolean(R.string.p_show_full_description, false)) {
|
|
|
|
|
|
|
|
description.setMaxLines(Integer.MAX_VALUE);
|
|
|
|
|
|
|
|
description.setSingleLine(false);
|
|
|
|
|
|
|
|
description.setEllipsize(null);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (atLeastKitKat()) {
|
|
|
|
if (atLeastKitKat()) {
|
|
|
|
rowBody.setPadding(0, rowPadding, 0, rowPadding);
|
|
|
|
rowBody.setPadding(0, rowPadding, 0, rowPadding);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
@ -166,11 +178,14 @@ class ViewHolder extends RecyclerView.ViewHolder {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void bindView(Task task) {
|
|
|
|
void bindView(Task task) {
|
|
|
|
// TODO: see if this is a performance issue
|
|
|
|
|
|
|
|
this.task = task;
|
|
|
|
this.task = task;
|
|
|
|
|
|
|
|
|
|
|
|
setFieldContentsAndVisibility();
|
|
|
|
setFieldContentsAndVisibility();
|
|
|
|
setTaskAppearance();
|
|
|
|
setTaskAppearance();
|
|
|
|
|
|
|
|
if (preferences.getBoolean(R.string.p_show_description, true)) {
|
|
|
|
|
|
|
|
description.setText(task.getNotes());
|
|
|
|
|
|
|
|
description.setVisibility(task.hasNotes() ? View.VISIBLE : View.GONE);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** Helper method to set the contents and visibility of each field */
|
|
|
|
/** Helper method to set the contents and visibility of each field */
|
|
|
|
|