mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 01:08:50 -06:00
Show message after archiving/unarchiving habits
This commit is contained in:
@@ -18,10 +18,10 @@
|
||||
*/
|
||||
package org.isoron.uhabits.core.ui.screens.habits.show
|
||||
|
||||
import org.isoron.uhabits.core.commands.CommandRunner
|
||||
import org.isoron.uhabits.core.commands.ArchiveHabitsCommand
|
||||
import org.isoron.uhabits.core.commands.UnarchiveHabitsCommand
|
||||
import org.isoron.uhabits.core.commands.CommandRunner
|
||||
import org.isoron.uhabits.core.commands.DeleteHabitsCommand
|
||||
import org.isoron.uhabits.core.commands.UnarchiveHabitsCommand
|
||||
import org.isoron.uhabits.core.models.Entry
|
||||
import org.isoron.uhabits.core.models.Habit
|
||||
import org.isoron.uhabits.core.models.HabitList
|
||||
@@ -56,7 +56,8 @@ class ShowHabitMenuPresenter(
|
||||
}
|
||||
|
||||
fun onArchiveHabits() {
|
||||
commandRunner.run(ArchiveHabitsCommand(habitList,listOf(habit)))
|
||||
commandRunner.run(ArchiveHabitsCommand(habitList, listOf(habit)))
|
||||
screen.showMessage(Message.HABIT_ARCHIVED)
|
||||
}
|
||||
|
||||
fun onExportCSV() {
|
||||
@@ -80,7 +81,8 @@ class ShowHabitMenuPresenter(
|
||||
}
|
||||
|
||||
fun onUnarchiveHabits() {
|
||||
commandRunner.run(UnarchiveHabitsCommand(habitList,listOf(habit)))
|
||||
commandRunner.run(UnarchiveHabitsCommand(habitList, listOf(habit)))
|
||||
screen.showMessage(Message.HABIT_UNARCHIVED)
|
||||
}
|
||||
|
||||
fun onRandomize() {
|
||||
@@ -91,7 +93,10 @@ class ShowHabitMenuPresenter(
|
||||
if (i % 7 == 0) strength = max(0.0, min(100.0, strength + 10 * random.nextGaussian()))
|
||||
if (random.nextInt(100) > strength) continue
|
||||
var value = Entry.YES_MANUAL
|
||||
if (habit.isNumerical) value = (1000 + 250 * random.nextGaussian() * strength / 100).toInt() * 1000
|
||||
if (habit.isNumerical) {
|
||||
value =
|
||||
(1000 + 250 * random.nextGaussian() * strength / 100).toInt() * 1000
|
||||
}
|
||||
habit.originalEntries.add(Entry(DateUtils.getToday().minus(i), value))
|
||||
}
|
||||
habit.recompute()
|
||||
@@ -99,7 +104,9 @@ class ShowHabitMenuPresenter(
|
||||
}
|
||||
|
||||
enum class Message {
|
||||
COULD_NOT_EXPORT
|
||||
COULD_NOT_EXPORT,
|
||||
HABIT_ARCHIVED,
|
||||
HABIT_UNARCHIVED
|
||||
}
|
||||
|
||||
interface Screen {
|
||||
|
||||
Reference in New Issue
Block a user