mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 01:08:50 -06:00
improve yes/no dialog design
This commit is contained in:
@@ -23,6 +23,7 @@ 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.HabitType
|
||||
import org.isoron.uhabits.core.models.PaletteColor
|
||||
import org.isoron.uhabits.core.models.Timestamp
|
||||
import org.isoron.uhabits.core.preferences.Preferences
|
||||
import org.isoron.uhabits.core.tasks.ExportCSVTask
|
||||
@@ -62,9 +63,12 @@ open class ListHabitsBehavior @Inject constructor(
|
||||
}
|
||||
} else {
|
||||
screen.showCheckmarkDialog(
|
||||
entry.notes
|
||||
) { newNotes ->
|
||||
commandRunner.run(CreateRepetitionCommand(habitList, habit, timestamp, entry.value, newNotes))
|
||||
entry.value,
|
||||
entry.notes,
|
||||
timestamp.toDialogDateString(),
|
||||
habit.color,
|
||||
) { newValue, newNotes ->
|
||||
commandRunner.run(CreateRepetitionCommand(habitList, habit, timestamp, newValue, newNotes))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -148,7 +152,7 @@ open class ListHabitsBehavior @Inject constructor(
|
||||
}
|
||||
|
||||
fun interface CheckMarkDialogCallback {
|
||||
fun onNotesSaved(notes: String)
|
||||
fun onNotesSaved(value: Int, notes: String)
|
||||
fun onNotesDismissed() {}
|
||||
}
|
||||
|
||||
@@ -164,7 +168,10 @@ open class ListHabitsBehavior @Inject constructor(
|
||||
callback: NumberPickerCallback
|
||||
)
|
||||
fun showCheckmarkDialog(
|
||||
value: Int,
|
||||
notes: String,
|
||||
dateString: String,
|
||||
color: PaletteColor,
|
||||
callback: CheckMarkDialogCallback
|
||||
)
|
||||
|
||||
|
||||
@@ -90,13 +90,19 @@ class HistoryCardPresenter(
|
||||
showNumberPicker(timestamp)
|
||||
} else {
|
||||
val entry = habit.computedEntries.get(timestamp)
|
||||
screen.showCheckmarkDialog(entry.notes) { newNotes ->
|
||||
screen.showCheckmarkDialog(
|
||||
entry.value,
|
||||
entry.notes,
|
||||
timestamp.toDialogDateString(),
|
||||
preferences,
|
||||
habit.color,
|
||||
) { newValue, newNotes ->
|
||||
commandRunner.run(
|
||||
CreateRepetitionCommand(
|
||||
habitList,
|
||||
habit,
|
||||
timestamp,
|
||||
entry.value,
|
||||
newValue,
|
||||
newNotes,
|
||||
),
|
||||
)
|
||||
@@ -200,7 +206,11 @@ class HistoryCardPresenter(
|
||||
callback: ListHabitsBehavior.NumberPickerCallback,
|
||||
)
|
||||
fun showCheckmarkDialog(
|
||||
value: Int,
|
||||
notes: String,
|
||||
dateString: String,
|
||||
preferences: Preferences,
|
||||
color: PaletteColor,
|
||||
callback: ListHabitsBehavior.CheckMarkDialogCallback,
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user