mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 09:08:52 -06:00
Hide completed according to the target value
This commit is contained in:
@@ -28,6 +28,8 @@ import java.util.*;
|
|||||||
|
|
||||||
import javax.inject.*;
|
import javax.inject.*;
|
||||||
|
|
||||||
|
import static org.isoron.uhabits.models.Checkmark.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The thing that the user wants to track.
|
* The thing that the user wants to track.
|
||||||
*/
|
*/
|
||||||
@@ -163,6 +165,13 @@ public class Habit
|
|||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isCompletedToday()
|
||||||
|
{
|
||||||
|
int todayCheckmark = getCheckmarks().getTodayValue();
|
||||||
|
if (isNumerical()) return todayCheckmark >= targetValue;
|
||||||
|
else return (todayCheckmark != UNCHECKED);
|
||||||
|
}
|
||||||
|
|
||||||
public void setColor(@NonNull Integer color)
|
public void setColor(@NonNull Integer color)
|
||||||
{
|
{
|
||||||
this.color = color;
|
this.color = color;
|
||||||
|
|||||||
@@ -23,8 +23,6 @@ import android.support.annotation.*;
|
|||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import static org.isoron.uhabits.models.Checkmark.*;
|
|
||||||
|
|
||||||
public class HabitMatcher
|
public class HabitMatcher
|
||||||
{
|
{
|
||||||
public static final HabitMatcher WITH_ALARM = new HabitMatcherBuilder()
|
public static final HabitMatcher WITH_ALARM = new HabitMatcherBuilder()
|
||||||
@@ -75,14 +73,8 @@ public class HabitMatcher
|
|||||||
{
|
{
|
||||||
if (!isArchivedAllowed() && habit.isArchived()) return false;
|
if (!isArchivedAllowed() && habit.isArchived()) return false;
|
||||||
if (isReminderRequired() && !habit.hasReminder()) return false;
|
if (isReminderRequired() && !habit.hasReminder()) return false;
|
||||||
|
if (!isCompletedAllowed() && habit.isCompletedToday()) return false;
|
||||||
if(!isCompletedAllowed())
|
if (!allowedColors.contains(habit.getColor())) return false;
|
||||||
{
|
|
||||||
int todayCheckmark = habit.getCheckmarks().getTodayValue();
|
|
||||||
if (todayCheckmark != UNCHECKED) return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!allowedColors.contains(habit.getColor())) return false;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user