Compare commits
1 Commits
cbba6b7a90
...
53bab2d22c
| Author | SHA1 | Date | |
|---|---|---|---|
| 53bab2d22c |
@@ -204,7 +204,6 @@ class MainActivity : AppCompatActivity() {
|
||||
|
||||
fun askBabyBottleContent(existingEvent: LunaEvent? = null, onEnd: (() -> Unit)? = null) {
|
||||
val isNewEvent = (existingEvent != null)
|
||||
// Show number picker dialog
|
||||
val event = if (existingEvent == null) {
|
||||
LunaEvent(TYPE_BABY_BOTTLE)
|
||||
} else {
|
||||
@@ -313,7 +312,14 @@ class MainActivity : AppCompatActivity() {
|
||||
alertDialog.show()
|
||||
}
|
||||
|
||||
fun askPukeValue() {
|
||||
fun askPukeValue(existingEvent: LunaEvent? = null, onEnd: (() -> Unit)? = null) {
|
||||
val isNewEvent = (existingEvent != null)
|
||||
val event = if (existingEvent == null) {
|
||||
LunaEvent(LunaEvent.TYPE_PUKE)
|
||||
} else {
|
||||
existingEvent
|
||||
}
|
||||
|
||||
val d = AlertDialog.Builder(this)
|
||||
val dialogView = layoutInflater.inflate(R.layout.puke_dialog, null)
|
||||
d.setTitle(R.string.log_puke_dialog_title)
|
||||
@@ -325,8 +331,11 @@ class MainActivity : AppCompatActivity() {
|
||||
spinner.setSelection(1)
|
||||
|
||||
d.setPositiveButton(android.R.string.ok) { dialogInterface, i ->
|
||||
val pos = spinner.selectedItemPosition
|
||||
logEvent(LunaEvent(LunaEvent.TYPE_PUKE, pos))
|
||||
event.quantity = spinner.selectedItemPosition
|
||||
if (isNewEvent) {
|
||||
logEvent(event)
|
||||
}
|
||||
onEnd?.invoke()
|
||||
}
|
||||
d.setNegativeButton(android.R.string.cancel) { dialogInterface, i -> dialogInterface.dismiss() }
|
||||
val alertDialog = d.create()
|
||||
@@ -335,9 +344,8 @@ class MainActivity : AppCompatActivity() {
|
||||
|
||||
fun askNotes(existingEvent: LunaEvent? = null, onEnd: (() -> Unit)? = null) {
|
||||
val isNewEvent = (existingEvent != null)
|
||||
// Show number picker dialog
|
||||
val event = if (existingEvent == null) {
|
||||
LunaEvent(TYPE_BABY_BOTTLE)
|
||||
LunaEvent(LunaEvent.TYPE_NOTE)
|
||||
} else {
|
||||
existingEvent
|
||||
}
|
||||
@@ -527,8 +535,8 @@ class MainActivity : AppCompatActivity() {
|
||||
LunaEvent.TYPE_NOTE -> askNotes(event, { showEventDetailDialog(event) })
|
||||
LunaEvent.TYPE_TEMPERATURE,
|
||||
LunaEvent.TYPE_COLIC,
|
||||
LunaEvent.TYPE_FOOD,
|
||||
LunaEvent.TYPE_PUKE,
|
||||
LunaEvent.TYPE_FOOD -> {}
|
||||
LunaEvent.TYPE_PUKE -> askPukeValue(event, { showEventDetailDialog(event) })
|
||||
LunaEvent.TYPE_BATH,
|
||||
LunaEvent.TYPE_CUSTOM -> {}
|
||||
else -> {}
|
||||
|
||||
Reference in New Issue
Block a user