Allow TaskListSpan isDone mutation

This commit is contained in:
Dimitry Ivanov 2018-11-22 13:05:14 +03:00
parent 65ece1621c
commit b531684872

View File

@ -18,7 +18,9 @@ public class TaskListSpan implements LeadingMarginSpan {
private final SpannableTheme theme; private final SpannableTheme theme;
private final int blockIndent; 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) { public TaskListSpan(@NonNull SpannableTheme theme, int blockIndent, boolean isDone) {
this.theme = theme; this.theme = theme;
@ -26,6 +28,23 @@ public class TaskListSpan implements LeadingMarginSpan {
this.isDone = isDone; 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 @Override
public int getLeadingMargin(boolean first) { public int getLeadingMargin(boolean first) {
return theme.getBlockMargin() * blockIndent; return theme.getBlockMargin() * blockIndent;