fix task rendering

This commit is contained in:
Phillip Thelen 2016-05-12 14:24:16 +02:00
parent ff70591cc5
commit 864d968f72
2 changed files with 20 additions and 2 deletions

View file

@ -58,8 +58,25 @@ public class BaseTaskViewHolder extends RecyclerView.ViewHolder implements View.
public void bindHolder(Task newTask, int position) {
this.task = newTask;
if (this.canContainMarkdown()) {
this.titleTextView.setText(this.task.parsedText);
this.notesTextView.setText(this.task.parsedNotes);
if (this.task.parsedText != null) {
this.titleTextView.setText(this.task.parsedText);
this.notesTextView.setText(this.task.parsedNotes);
} else {
this.titleTextView.setText(this.task.getText());
this.notesTextView.setText(this.task.getNotes());
Observable.just(this.task)
.map(task1 -> {
task.parsedText = MarkdownParser.parseMarkdown(task.getText());
task.parsedNotes = MarkdownParser.parseMarkdown(task.getNotes());
return task;
})
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(task2 -> {
this.titleTextView.setText(this.task.parsedText);
this.notesTextView.setText(this.task.parsedNotes);
});
}
} else {
this.titleTextView.setText(this.task.getText());
this.notesTextView.setText(this.task.getNotes());

View file

@ -62,6 +62,7 @@ public abstract class ChecklistedViewHolder extends BaseTaskViewHolder implement
@Override
public void bindHolder(Task newTask, int position) {
super.bindHolder(newTask, position);
this.checkbox.setChecked(this.task.completed);
if (this.shouldDisplayAsActive()) {
this.checkboxHolder.setBackgroundResource(this.task.getLightTaskColor());
} else {