mirror of https://github.com/iSoron/uhabits.git
parent
1d372a8fbb
commit
e61e2a34e6
@ -1,27 +0,0 @@
|
||||
package org.isoron.uhabits.core.ui.widgets;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import org.isoron.uhabits.core.commands.CommandRunner;
|
||||
import org.isoron.uhabits.core.models.HabitList;
|
||||
|
||||
public class BaseWidgetBehavior {
|
||||
protected HabitList getHabitList() {
|
||||
return habitList;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
protected CommandRunner getCommandRunner() {
|
||||
return commandRunner;
|
||||
}
|
||||
|
||||
private HabitList habitList;
|
||||
|
||||
@NonNull
|
||||
private final CommandRunner commandRunner;
|
||||
|
||||
public BaseWidgetBehavior(HabitList habitList, @NonNull CommandRunner commandRunner) {
|
||||
this.habitList = habitList;
|
||||
this.commandRunner = commandRunner;
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
package org.isoron.uhabits.core.ui.widgets;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import org.isoron.uhabits.core.commands.CommandRunner;
|
||||
import org.isoron.uhabits.core.commands.CreateRepetitionCommand;
|
||||
import org.isoron.uhabits.core.models.Habit;
|
||||
import org.isoron.uhabits.core.models.HabitList;
|
||||
import org.isoron.uhabits.core.models.Timestamp;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
public class NumericalCheckmarkWidgetBehavior extends BaseWidgetBehavior{
|
||||
@Inject
|
||||
public NumericalCheckmarkWidgetBehavior(@NonNull HabitList habitList,
|
||||
@NonNull CommandRunner commandRunner){
|
||||
super(habitList, commandRunner);
|
||||
}
|
||||
|
||||
public void setNumericValue(@NonNull Habit habit, Timestamp timestamp, int newValue) {
|
||||
getCommandRunner().execute(
|
||||
new CreateRepetitionCommand(habit, timestamp, newValue),
|
||||
habit.getId());
|
||||
}
|
||||
}
|
Loading…
Reference in new issue