add quantity selection to poo and pee events #22

Closed
mwarning wants to merge 4 commits from mwarning/luna-tracker:quantity into master
13 changed files with 490 additions and 206 deletions
Showing only changes of commit 0a8ca7f9d1 - Show all commits

View File

@@ -45,9 +45,9 @@ class LunaEvent: Comparable<LunaEvent> {
jo.put("type", value) jo.put("type", value)
} }
var quantity: Int var quantity: Int
get() = jo.optInt("quantity") get() = jo.optInt("quantity", -1)
set(value) { set(value) {
if (value > 0) if (value >= 0)
jo.put("quantity", value) jo.put("quantity", value)
} }
var notes: String var notes: String

View File

@@ -62,7 +62,7 @@ class NumericUtils (val context: Context) {
fun formatEventQuantity(event: LunaEvent): String { fun formatEventQuantity(event: LunaEvent): String {
val formatted = StringBuilder() val formatted = StringBuilder()
if (event.quantity > 0) { if (event.quantity >= 0) {
formatted.append(when (event.type) { formatted.append(when (event.type) {
LunaEvent.TYPE_TEMPERATURE -> LunaEvent.TYPE_TEMPERATURE ->
(event.quantity / 10.0f).toString() (event.quantity / 10.0f).toString()