|
|
|
@ -23,6 +23,7 @@ import androidx.annotation.*;
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.lang3.builder.*;
|
|
|
|
|
|
|
|
|
|
import java.time.LocalDate;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.concurrent.*;
|
|
|
|
@ -31,6 +32,7 @@ import javax.inject.*;
|
|
|
|
|
import static org.isoron.uhabits.core.models.Checkmark.*;
|
|
|
|
|
import static org.isoron.uhabits.core.utils.StringUtils.defaultToStringStyle;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The thing that the user wants to track.
|
|
|
|
|
*/
|
|
|
|
@ -66,6 +68,8 @@ public class Habit
|
|
|
|
|
@NonNull
|
|
|
|
|
private CheckmarkList checkmarks;
|
|
|
|
|
|
|
|
|
|
private LocalDate lastDismissed = LocalDate.MIN;
|
|
|
|
|
|
|
|
|
|
private ModelObservable observable = new ModelObservable();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -339,6 +343,17 @@ public class Habit
|
|
|
|
|
return data.type == NUMBER_HABIT;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public synchronized boolean isDismissedToday()
|
|
|
|
|
{
|
|
|
|
|
LocalDate today = LocalDate.now();
|
|
|
|
|
return lastDismissed.equals(today);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public synchronized void dismiss()
|
|
|
|
|
{
|
|
|
|
|
lastDismissed = LocalDate.now();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public HabitData getData()
|
|
|
|
|
{
|
|
|
|
|
return new HabitData(data);
|
|
|
|
|