From b531684872c5a2ee3bb74f73e275408a71080e18 Mon Sep 17 00:00:00 2001 From: Dimitry Ivanov Date: Thu, 22 Nov 2018 13:05:14 +0300 Subject: [PATCH] Allow TaskListSpan isDone mutation --- .../ru/noties/markwon/spans/TaskListSpan.java | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/markwon/src/main/java/ru/noties/markwon/spans/TaskListSpan.java b/markwon/src/main/java/ru/noties/markwon/spans/TaskListSpan.java index 172b952c..25bc6a41 100644 --- a/markwon/src/main/java/ru/noties/markwon/spans/TaskListSpan.java +++ b/markwon/src/main/java/ru/noties/markwon/spans/TaskListSpan.java @@ -18,7 +18,9 @@ public class TaskListSpan implements LeadingMarginSpan { private final SpannableTheme theme; private final int blockIndent; - private final boolean isDone; + + // @since 2.0.1 field is NOT final (to allow mutation) + private boolean isDone; public TaskListSpan(@NonNull SpannableTheme theme, int blockIndent, boolean isDone) { this.theme = theme; @@ -26,6 +28,23 @@ public class TaskListSpan implements LeadingMarginSpan { this.isDone = isDone; } + /** + * @since 2.0.1 + */ + public boolean isDone() { + return isDone; + } + + /** + * Update {@link #isDone} property of this span. Please note that this is merely a visual change + * which is not changing underlying text in any means. + * + * @since 2.0.1 + */ + public void setDone(boolean isDone) { + this.isDone = isDone; + } + @Override public int getLeadingMargin(boolean first) { return theme.getBlockMargin() * blockIndent;