diff --git a/app/src/main/java/org/tasks/preferences/AppearancePreferences.java b/app/src/main/java/org/tasks/preferences/AppearancePreferences.java
index 66cba21d5..e439ecb3d 100644
--- a/app/src/main/java/org/tasks/preferences/AppearancePreferences.java
+++ b/app/src/main/java/org/tasks/preferences/AppearancePreferences.java
@@ -49,6 +49,8 @@ public class AppearancePreferences extends InjectingPreferenceActivity
setExtraOnChange(R.string.p_fontSize, EXTRA_RESTART);
setExtraOnChange(R.string.p_rowPadding, EXTRA_RESTART);
setExtraOnChange(R.string.p_fullTaskTitle, EXTRA_RESTART);
+ setExtraOnChange(R.string.p_show_description, EXTRA_RESTART);
+ setExtraOnChange(R.string.p_show_full_description, EXTRA_RESTART);
setExtraOnChange(R.string.p_show_today_filter, EXTRA_FILTERS_CHANGED);
setExtraOnChange(R.string.p_show_recently_modified_filter, EXTRA_FILTERS_CHANGED);
setExtraOnChange(R.string.p_show_not_in_list_filter, EXTRA_FILTERS_CHANGED);
diff --git a/app/src/main/java/org/tasks/tasklist/ViewHolder.java b/app/src/main/java/org/tasks/tasklist/ViewHolder.java
index 63c7b72cb..5c96f5e65 100644
--- a/app/src/main/java/org/tasks/tasklist/ViewHolder.java
+++ b/app/src/main/java/org/tasks/tasklist/ViewHolder.java
@@ -24,11 +24,13 @@ import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.ui.CheckableImageView;
import java.util.List;
import org.tasks.R;
+import org.tasks.preferences.Preferences;
import org.tasks.ui.CheckBoxes;
class ViewHolder extends RecyclerView.ViewHolder {
private final Context context;
+ private final Preferences preferences;
private final CheckBoxes checkBoxes;
private final TagFormatter tagFormatter;
private final int textColorSecondary;
@@ -53,6 +55,9 @@ class ViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.title)
TextView nameView;
+ @BindView(R.id.description)
+ TextView description;
+
@BindView(R.id.completeBox)
CheckableImageView completeBox;
@@ -66,7 +71,7 @@ class ViewHolder extends RecyclerView.ViewHolder {
ViewHolder(
Context context,
ViewGroup view,
- boolean showFullTaskTitle,
+ Preferences preferences,
int fontSize,
CheckBoxes checkBoxes,
TagFormatter tagFormatter,
@@ -80,6 +85,7 @@ class ViewHolder extends RecyclerView.ViewHolder {
int rowPadding) {
super(view);
this.context = context;
+ this.preferences = preferences;
this.checkBoxes = checkBoxes;
this.tagFormatter = tagFormatter;
this.textColorOverdue = textColorOverdue;
@@ -91,12 +97,18 @@ class ViewHolder extends RecyclerView.ViewHolder {
this.selectedColor = selectedColor;
ButterKnife.bind(this, view);
- if (showFullTaskTitle) {
+ if (preferences.getBoolean(R.string.p_fullTaskTitle, false)) {
nameView.setMaxLines(Integer.MAX_VALUE);
nameView.setSingleLine(false);
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()) {
rowBody.setPadding(0, rowPadding, 0, rowPadding);
} else {
@@ -166,11 +178,14 @@ class ViewHolder extends RecyclerView.ViewHolder {
}
void bindView(Task task) {
- // TODO: see if this is a performance issue
this.task = task;
setFieldContentsAndVisibility();
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 */
diff --git a/app/src/main/java/org/tasks/tasklist/ViewHolderFactory.java b/app/src/main/java/org/tasks/tasklist/ViewHolderFactory.java
index 195f4a15c..ad991ca2f 100644
--- a/app/src/main/java/org/tasks/tasklist/ViewHolderFactory.java
+++ b/app/src/main/java/org/tasks/tasklist/ViewHolderFactory.java
@@ -23,13 +23,13 @@ public class ViewHolderFactory {
private final Context context;
private final CheckBoxes checkBoxes;
private final TagFormatter tagFormatter;
- private final boolean showFullTaskTitle;
private final int fontSize;
private final TaskDao taskDao;
private final DisplayMetrics metrics;
private final int background;
private final int selectedColor;
private final int rowPadding;
+ private final Preferences preferences;
@Inject
public ViewHolderFactory(
@@ -42,11 +42,11 @@ public class ViewHolderFactory {
this.checkBoxes = checkBoxes;
this.tagFormatter = tagFormatter;
this.taskDao = taskDao;
+ this.preferences = preferences;
textColorSecondary = getData(context, android.R.attr.textColorSecondary);
textColorOverdue = getColor(context, R.color.overdue);
background = getResourceId(context, R.attr.selectableItemBackground);
selectedColor = getData(context, R.attr.colorControlHighlight);
- showFullTaskTitle = preferences.getBoolean(R.string.p_fullTaskTitle, false);
fontSize = preferences.getFontSize();
metrics = context.getResources().getDisplayMetrics();
rowPadding = convertDpToPixels(metrics, preferences.getInt(R.string.p_rowPadding, 16));
@@ -57,7 +57,7 @@ public class ViewHolderFactory {
context,
(ViewGroup)
LayoutInflater.from(context).inflate(R.layout.task_adapter_row_simple, parent, false),
- showFullTaskTitle,
+ preferences,
fontSize,
checkBoxes,
tagFormatter,
diff --git a/app/src/main/res/layout/task_adapter_row_body.xml b/app/src/main/res/layout/task_adapter_row_body.xml
index 17d9d95cc..45fe72a2b 100644
--- a/app/src/main/res/layout/task_adapter_row_body.xml
+++ b/app/src/main/res/layout/task_adapter_row_body.xml
@@ -9,8 +9,6 @@
android:focusable="true"
android:orientation="vertical">
-
-
@@ -64,7 +62,17 @@
-
+
purchases
sync_ongoing
last_backup
+ show_description
+ show_full_description
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index a2656254f..28120d8b5 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -874,4 +874,6 @@ File %1$s contained %2$s.\n\n
Cannot access account
Reinitialize
Create new task
+ Show description
+ Show full description
diff --git a/app/src/main/res/xml/preferences_appearance.xml b/app/src/main/res/xml/preferences_appearance.xml
index 54c7c3d63..88621db36 100644
--- a/app/src/main/res/xml/preferences_appearance.xml
+++ b/app/src/main/res/xml/preferences_appearance.xml
@@ -23,6 +23,17 @@
android:key="@string/p_fullTaskTitle"
android:title="@string/EPr_fullTask_title"/>
+
+
+
+