Update checkmark widget for numerical support

Co-authored-by: Alinson S. Xavier <git@axavier.org>
This commit is contained in:
Thomas S
2020-07-12 09:06:42 -05:00
committed by Alinson S. Xavier
parent a8e77b8df8
commit 96d23bdf22
13 changed files with 217 additions and 35 deletions

View File

@@ -327,9 +327,9 @@ public class Habit
if (isNumerical())
{
if(getTargetType() == AT_LEAST)
return todayCheckmark >= data.targetValue;
return todayCheckmark / 1000.0 >= data.targetValue;
else
return todayCheckmark <= data.targetValue;
return todayCheckmark / 1000.0 <= data.targetValue;
}
else return (todayCheckmark != UNCHECKED);
}

View File

@@ -177,6 +177,8 @@ public class ListHabitsBehavior
public interface NumberPickerCallback
{
void onNumberPicked(double newValue);
default void onNumberPickerDismissed() {}
}
public interface Screen

View File

@@ -73,4 +73,11 @@ public class WidgetBehavior
new ToggleRepetitionCommand(habitList, habit, timestamp),
habit.getId());
}
public void setNumericValue(@NonNull Habit habit, Timestamp timestamp, int newValue) {
commandRunner.execute(
new CreateRepetitionCommand(habit, timestamp, newValue),
habit.getId());
}
}