1 Commits

Author SHA1 Message Date
6f3061974d fix puke event quantity
The LunaEvent class treats quantities of 0
as a value to set. To workaround this, the
quantity index needs to start at >0.
2025-11-06 21:49:08 +01:00
2 changed files with 2 additions and 2 deletions

View File

@@ -275,7 +275,7 @@ class MainActivity : AppCompatActivity() {
d.setPositiveButton(android.R.string.ok) { dialogInterface, i -> d.setPositiveButton(android.R.string.ok) { dialogInterface, i ->
val pos = spinner.selectedItemPosition val pos = spinner.selectedItemPosition
logEvent(LunaEvent(LunaEvent.TYPE_PUKE, pos)) logEvent(LunaEvent(LunaEvent.TYPE_PUKE, pos + 1))
} }
d.setNegativeButton(android.R.string.cancel) { dialogInterface, i -> dialogInterface.dismiss() } d.setNegativeButton(android.R.string.cancel) { dialogInterface, i -> dialogInterface.dismiss() }
val alertDialog = d.create() val alertDialog = d.create()

View File

@@ -67,7 +67,7 @@ class NumericUtils (val context: Context) {
LunaEvent.TYPE_TEMPERATURE -> LunaEvent.TYPE_TEMPERATURE ->
(item.quantity / 10.0f).toString() (item.quantity / 10.0f).toString()
LunaEvent.TYPE_PUKE -> LunaEvent.TYPE_PUKE ->
context.resources.getStringArray(R.array.AmountLabels)[item.quantity] context.resources.getStringArray(R.array.AmountLabels)[item.quantity - 1]
else -> else ->
item.quantity item.quantity
}) })