4 Commits

Author SHA1 Message Date
aaccef54a5 use creation dialog as edit dialog 2025-11-10 17:51:02 +01:00
5eeb462836 Bumped version 2025-11-06 22:21:05 +01:00
5b777c0b88 Merge pull request 'fix puke event quantity' (#18) from mwarning/luna-tracker:fixpuke into master
I already tagged the commit when I accepted the previous PR, so it may have already been picked up by the F-Droid build pipeline. I'll send this one too and see if it makes in time.
2025-11-06 22:17:40 +01:00
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
7 changed files with 260 additions and 208 deletions

View File

@@ -12,8 +12,8 @@ android {
applicationId = "it.danieleverducci.lunatracker"
minSdk = 21
targetSdk = 34
versionCode = 6
versionName = "0.8"
versionCode = 7
versionName = "0.9"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

View File

@@ -6,7 +6,6 @@ import android.content.DialogInterface
import android.content.Intent
import android.os.Bundle
import android.os.Handler
import android.text.Editable
import android.util.Log
import android.view.LayoutInflater
import android.view.View
@@ -22,7 +21,6 @@ import android.widget.Toast
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import androidx.core.widget.doOnTextChanged
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.progressindicator.LinearProgressIndicator
@@ -31,7 +29,6 @@ import com.thegrizzlylabs.sardineandroid.impl.SardineException
import it.danieleverducci.lunatracker.adapters.LunaEventRecyclerAdapter
import it.danieleverducci.lunatracker.entities.Logbook
import it.danieleverducci.lunatracker.entities.LunaEvent
import it.danieleverducci.lunatracker.entities.LunaEvent.Companion.TYPE_BABY_BOTTLE
import it.danieleverducci.lunatracker.repository.FileLogbookRepository
import it.danieleverducci.lunatracker.repository.LocalSettingsRepository
import it.danieleverducci.lunatracker.repository.LogbookListObtainedListener
@@ -85,7 +82,7 @@ class MainActivity : AppCompatActivity() {
// Set listeners
findViewById<View>(R.id.logbooks_add_button).setOnClickListener { showAddLogbookDialog(true) }
findViewById<View>(R.id.button_bottle).setOnClickListener { askBabyBottleContent() }
findViewById<View>(R.id.button_bottle).setOnClickListener { askBabyBottleContent(LunaEvent(LunaEvent.TYPE_BABY_BOTTLE)) }
findViewById<View>(R.id.button_food).setOnClickListener { askNotes(LunaEvent(LunaEvent.TYPE_FOOD)) }
findViewById<View>(R.id.button_nipple_left).setOnClickListener { logEvent(
LunaEvent(
@@ -103,14 +100,10 @@ class MainActivity : AppCompatActivity() {
)
) }
findViewById<View>(R.id.button_change_poo).setOnClickListener { logEvent(
LunaEvent(
LunaEvent.TYPE_DIAPERCHANGE_POO
)
LunaEvent(LunaEvent.TYPE_DIAPERCHANGE_POO)
) }
findViewById<View>(R.id.button_change_pee).setOnClickListener { logEvent(
LunaEvent(
LunaEvent.TYPE_DIAPERCHANGE_PEE
)
LunaEvent(LunaEvent.TYPE_DIAPERCHANGE_PEE)
) }
val moreButton = findViewById<View>(R.id.button_more)
moreButton.setOnClickListener {
@@ -202,15 +195,7 @@ class MainActivity : AppCompatActivity() {
return logbook?.logs ?: arrayListOf()
}
fun askBabyBottleContent(existingEvent: LunaEvent? = null, onEnd: (() -> Unit)? = null) {
val isNewEvent = (existingEvent != null)
val event = if (existingEvent == null) {
LunaEvent(TYPE_BABY_BOTTLE)
} else {
existingEvent
}
val previous = getPreviousSameEvent(event, getAllEvents())
fun askBabyBottleContent(event: LunaEvent, showDetailsAtEnd : Boolean = false) {
val d = AlertDialog.Builder(this)
val dialogView = layoutInflater.inflate(R.layout.number_picker_dialog, null)
d.setTitle(R.string.log_bottle_dialog_title)
@@ -222,56 +207,39 @@ class MainActivity : AppCompatActivity() {
numberPicker.maxValue = 25 // "250
numberPicker.displayedValues = ((10..250 step 10).map { it.toString() }.toTypedArray())
numberPicker.wrapSelectorWheel = false
if (previous != null) {
numberPicker.value = previous.quantity / 10
}
numberPicker.value = event.quantity / 10
val dateTextView = dialogView.findViewById<TextView>(R.id.dialog_date_picker)
dateTextView.text =
String.format(getString(R.string.dialog_event_detail_datetime_icon), DateUtils.formatDateTime(event.time))
val pickedDateTime = Calendar.getInstance()
val currentDateTime = Calendar.getInstance()
currentDateTime.time = Date(event.time * 1000)
dateTextView.setOnClickListener {
// Show datetime picker
val startYear = currentDateTime.get(Calendar.YEAR)
val startMonth = currentDateTime.get(Calendar.MONTH)
val startDay = currentDateTime.get(Calendar.DAY_OF_MONTH)
val startHour = currentDateTime.get(Calendar.HOUR_OF_DAY)
val startMinute = currentDateTime.get(Calendar.MINUTE)
DatePickerDialog(this, { _, year, month, day ->
TimePickerDialog(this, { _, hour, minute ->
pickedDateTime.set(year, month, day, hour, minute)
val time = pickedDateTime.time.time / 1000
dateTextView.text = String.format(getString(R.string.dialog_event_detail_datetime_icon), DateUtils.formatDateTime(time))
}, startHour, startMinute, android.text.format.DateFormat.is24HourFormat(this@MainActivity)).show()
}, startYear, startMonth, startDay).show()
}
val dateTV = dialogView.findViewById<TextView>(R.id.dialog_date_picker)
val pickedDateTime = datePickHelper(event.time, dateTV)
d.setPositiveButton(android.R.string.ok) { dialogInterface, i ->
event.quantity = numberPicker.value * 10
event.time = pickedDateTime.time.time / 1000 // Seconds since epoch
if (isNewEvent) {
logEvent(event)
val quantity = numberPicker.value * 10
val time = pickedDateTime.time.time / 1000
if (event.time != time || event.quantity != quantity) {
event.quantity = quantity
event.time = time
saveEvent(event)
}
if (showDetailsAtEnd) {
showEventDetailDialog(event)
}
logbook?.sort()
recyclerView.adapter?.notifyDataSetChanged()
saveLogbook()
onEnd?.invoke()
}
d.setNegativeButton(android.R.string.cancel) { dialogInterface, i ->
dialogInterface.dismiss()
onEnd?.invoke()
if (showDetailsAtEnd) {
showEventDetailDialog(event)
}
}
val alertDialog = d.create()
alertDialog.show()
}
fun askWeightValue() {
fun askWeightValue(event: LunaEvent, showDetailsAtEnd: Boolean = false) {
// Show number picker dialog
val d = AlertDialog.Builder(this)
val dialogView = layoutInflater.inflate(R.layout.number_edit_dialog, null)
@@ -279,19 +247,41 @@ class MainActivity : AppCompatActivity() {
d.setMessage(R.string.log_weight_dialog_description)
d.setView(dialogView)
val weightET = dialogView.findViewById<EditText>(R.id.dialog_number_edittext)
val dateTV = dialogView.findViewById<TextView>(R.id.dialog_date_picker)
val pickedDateTime = datePickHelper(event.time, dateTV)
d.setPositiveButton(android.R.string.ok) { dialogInterface, i ->
val weight = weightET.text.toString().toIntOrNull()
if (weight != null)
logEvent(LunaEvent(LunaEvent.TYPE_WEIGHT, weight))
else
if (weight != null) {
val quantity = weight
val time = pickedDateTime.time.time / 1000
if (event.quantity != quantity || event.time != time) {
event.quantity = quantity
event.time = time
saveEvent(event)
}
} else {
Toast.makeText(this, R.string.toast_integer_error, Toast.LENGTH_SHORT).show()
}
d.setNegativeButton(android.R.string.cancel) { dialogInterface, i -> dialogInterface.dismiss() }
if (showDetailsAtEnd) {
showEventDetailDialog(event)
}
}
d.setNegativeButton(android.R.string.cancel) { dialogInterface, i ->
if (showDetailsAtEnd) {
showEventDetailDialog(event)
}
dialogInterface.dismiss()
}
val alertDialog = d.create()
alertDialog.show()
}
fun askTemperatureValue() {
fun askTemperatureValue(event: LunaEvent, showDetailsAtEnd: Boolean = false) {
// Show number picker dialog
val d = AlertDialog.Builder(this)
val dialogView = layoutInflater.inflate(R.layout.temperature_dialog, null)
@@ -303,26 +293,75 @@ class MainActivity : AppCompatActivity() {
tempSlider.valueFrom = range.first.toFloat()
tempSlider.valueTo = range.second.toFloat()
tempSlider.value = range.third.toFloat()
val dateTV = dialogView.findViewById<TextView>(R.id.dialog_date_picker)
val pickedDateTime = datePickHelper(event.time, dateTV)
val tempTextView = dialogView.findViewById<TextView>(R.id.dialog_temperature_display)
tempTextView.text = range.third.toString()
tempSlider.addOnChangeListener({s, v, b -> tempTextView.text = v.toString()})
d.setPositiveButton(android.R.string.ok) { dialogInterface, i ->
val temperature = (tempSlider.value * 10).toInt() // In tenth of a grade
logEvent(LunaEvent(LunaEvent.TYPE_TEMPERATURE, temperature))
val quantity = (tempSlider.value * 10).toInt() // temperature in tenth of a grade
val time = pickedDateTime.time.time / 1000
if (event.time != time || event.quantity != quantity) {
event.quantity = quantity
event.time = time
saveEvent(event)
}
if (showDetailsAtEnd) {
showEventDetailDialog(event)
}
}
d.setNegativeButton(android.R.string.cancel) { dialogInterface, i ->
dialogInterface.dismiss()
if (showDetailsAtEnd) {
showEventDetailDialog(event)
}
}
d.setNegativeButton(android.R.string.cancel) { dialogInterface, i -> dialogInterface.dismiss() }
val alertDialog = d.create()
alertDialog.show()
}
fun askPukeValue(existingEvent: LunaEvent? = null, onEnd: (() -> Unit)? = null) {
val isNewEvent = (existingEvent != null)
val event = if (existingEvent == null) {
LunaEvent(LunaEvent.TYPE_PUKE)
} else {
existingEvent
fun datePickHelper(eventTime: Long, dateTextView: TextView): Calendar {
val fmt = getString(R.string.dialog_event_detail_datetime_icon)
dateTextView.text = String.format(fmt, DateUtils.formatDateTime(eventTime))
val dateTime = Calendar.getInstance()
dateTime.time = Date(eventTime * 1000)
dateTextView.setOnClickListener {
// Show datetime picker
val startYear = dateTime.get(Calendar.YEAR)
val startMonth = dateTime.get(Calendar.MONTH)
val startDay = dateTime.get(Calendar.DAY_OF_MONTH)
val startHour = dateTime.get(Calendar.HOUR_OF_DAY)
val startMinute = dateTime.get(Calendar.MINUTE)
DatePickerDialog(this, { _, year, month, day ->
TimePickerDialog(this, { _, hour, minute ->
dateTime.set(year, month, day, hour, minute)
val time = dateTime.time.time / 1000
dateTextView.text = String.format(getString(R.string.dialog_event_detail_datetime_icon), DateUtils.formatDateTime(time))
}, startHour, startMinute, android.text.format.DateFormat.is24HourFormat(this@MainActivity)).show()
}, startYear, startMonth, startDay).show()
}
return dateTime
}
fun saveEvent(event: LunaEvent) {
if (!getAllEvents().contains(event)) {
// new event
logEvent(event)
}
logbook?.sort()
recyclerView.adapter?.notifyDataSetChanged()
saveLogbook()
}
fun askPukeValue(event: LunaEvent, showDetailsAtEnd: Boolean = false) {
val d = AlertDialog.Builder(this)
val dialogView = layoutInflater.inflate(R.layout.puke_dialog, null)
d.setTitle(R.string.log_puke_dialog_title)
@@ -333,90 +372,69 @@ class MainActivity : AppCompatActivity() {
spinner.adapter = ArrayAdapter.createFromResource(this, R.array.AmountLabels, android.R.layout.simple_spinner_dropdown_item)
spinner.setSelection(event.quantity)
val dateTV = dialogView.findViewById<TextView>(R.id.dialog_date_picker)
val pickedDateTime = datePickHelper(event.time, dateTV)
d.setPositiveButton(android.R.string.ok) { dialogInterface, i ->
event.quantity = spinner.selectedItemPosition
if (isNewEvent) {
logEvent(event)
val quantity = spinner.selectedItemPosition + 1
val time = pickedDateTime.time.time / 1000
if (event.quantity != quantity || event.time != time) {
event.quantity = quantity
event.time = time
saveEvent(event)
}
onEnd?.invoke()
if (showDetailsAtEnd) {
showEventDetailDialog(event)
}
}
d.setNegativeButton(android.R.string.cancel) { dialogInterface, i ->
dialogInterface.dismiss()
onEnd?.invoke
if (showDetailsAtEnd) {
showEventDetailDialog(event)
}
}
val alertDialog = d.create()
alertDialog.show()
}
// Ask to edit events to be edited (only affects date)
fun askPlain(existingEvent: LunaEvent? = null, onEnd: (() -> Unit)? = null) {
val isNewEvent = (existingEvent != null)
val event = if (existingEvent == null) {
LunaEvent(LunaEvent.TYPE_NOTE)
} else {
existingEvent
}
fun askPlain(event: LunaEvent, showDetailsAtEnd: Boolean = false) {
val d = AlertDialog.Builder(this)
val dialogView = layoutInflater.inflate(R.layout.dialog_plain_event, null)
d.setTitle(event.getTypeDescription(this))
d.setMessage(event.getDialogMessage(this))
d.setView(dialogView)
val dateET = dialogView.findViewById<TextView>(R.id.notes_date_picker)
val pickedDateTime = Calendar.getInstance()
val currentDateTime = Calendar.getInstance()
currentDateTime.time = Date(event.time * 1000)
dateET.text = String.format(getString(R.string.dialog_event_detail_datetime_icon), DateUtils.formatDateTime(event.time))
dateET.setOnClickListener {
// Show datetime picker
val startYear = currentDateTime.get(Calendar.YEAR)
val startMonth = currentDateTime.get(Calendar.MONTH)
val startDay = currentDateTime.get(Calendar.DAY_OF_MONTH)
val startHour = currentDateTime.get(Calendar.HOUR_OF_DAY)
val startMinute = currentDateTime.get(Calendar.MINUTE)
DatePickerDialog(this, { _, year, month, day ->
TimePickerDialog(this, { _, hour, minute ->
pickedDateTime.set(year, month, day, hour, minute)
val time = pickedDateTime.time.time / 1000
dateET.setText(String.format(getString(R.string.dialog_event_detail_datetime_icon), DateUtils.formatDateTime(time)))
}, startHour, startMinute, android.text.format.DateFormat.is24HourFormat(this@MainActivity)).show()
}, startYear, startMonth, startDay).show()
}
val dateTV = dialogView.findViewById<TextView>(R.id.dialog_date_picker)
val pickedDateTime = datePickHelper(event.time, dateTV)
d.setPositiveButton(android.R.string.ok) { dialogInterface, i ->
// Save event and move it to the right position in the logbook
event.time = pickedDateTime.time.time / 1000 // Seconds since epoch
if (isNewEvent) {
logEvent(event)
val time = pickedDateTime.time.time / 1000
if (event.time != time) {
event.time = time
saveEvent(event)
}
logbook?.sort()
recyclerView.adapter?.notifyDataSetChanged()
saveLogbook()
onEnd?.invoke()
if (showDetailsAtEnd) {
showEventDetailDialog(event)
}
}
d.setNegativeButton(android.R.string.cancel) { dialogInterface, i ->
dialogInterface.dismiss()
onEnd?.invoke()
if (showDetailsAtEnd) {
showEventDetailDialog(event)
}
}
val alertDialog = d.create()
alertDialog.show()
}
fun askNotes(existingEvent: LunaEvent? = null, onEnd: (() -> Unit)? = null) {
val isNewEvent = (existingEvent != null)
val event = if (existingEvent == null) {
LunaEvent(LunaEvent.TYPE_NOTE)
} else {
existingEvent
}
fun askNotes(event: LunaEvent, showDetailsAtEnd: Boolean = false) {
val useQuantity = (event.type != LunaEvent.TYPE_NOTE && event.type != LunaEvent.TYPE_CUSTOM)
val d = AlertDialog.Builder(this)
@@ -426,29 +444,9 @@ class MainActivity : AppCompatActivity() {
d.setView(dialogView)
val notesET = dialogView.findViewById<EditText>(R.id.notes_edittext)
val qtyET = dialogView.findViewById<EditText>(R.id.notes_qty_edittext)
val dateET = dialogView.findViewById<TextView>(R.id.notes_date_picker)
val pickedDateTime = Calendar.getInstance()
val currentDateTime = Calendar.getInstance()
currentDateTime.time = Date(event.time * 1000)
dateET.text = String.format(getString(R.string.dialog_event_detail_datetime_icon), DateUtils.formatDateTime(event.time))
dateET.setOnClickListener {
// Show datetime picker
val startYear = currentDateTime.get(Calendar.YEAR)
val startMonth = currentDateTime.get(Calendar.MONTH)
val startDay = currentDateTime.get(Calendar.DAY_OF_MONTH)
val startHour = currentDateTime.get(Calendar.HOUR_OF_DAY)
val startMinute = currentDateTime.get(Calendar.MINUTE)
DatePickerDialog(this, { _, year, month, day ->
TimePickerDialog(this, { _, hour, minute ->
pickedDateTime.set(year, month, day, hour, minute)
val time = pickedDateTime.time.time / 1000
dateET.setText(String.format(getString(R.string.dialog_event_detail_datetime_icon), DateUtils.formatDateTime(time)))
}, startHour, startMinute, android.text.format.DateFormat.is24HourFormat(this@MainActivity)).show()
}, startYear, startMonth, startDay).show()
}
val dateTV = dialogView.findViewById<TextView>(R.id.notes_date_picker)
val pickedDateTime = datePickHelper(event.time, dateTV)
notesET.setText(event.notes)
@@ -459,32 +457,43 @@ class MainActivity : AppCompatActivity() {
}
d.setPositiveButton(android.R.string.ok) { dialogInterface, i ->
val notes = notesET.text.toString()
val time = pickedDateTime.time.time / 1000
if (useQuantity) {
val qty = qtyET.text.toString().toIntOrNull()
if (qty != null) {
event.quantity = qty
val quantity = qtyET.text.toString().toIntOrNull()
if (quantity != null) {
if (event.time != time || event.notes != notes || event.quantity != quantity ) {
event.quantity = quantity
event.notes = notes
event.time = time
saveEvent(event)
}
} else {
Toast.makeText(this, R.string.toast_integer_error, Toast.LENGTH_SHORT).show()
onEnd?.invoke()
return@setPositiveButton
}
}
event.notes = notesET.text.toString()
event.time = pickedDateTime.time.time / 1000 // Seconds since epoch
if (isNewEvent) {
logEvent(event)
if (showDetailsAtEnd) {
showEventDetailDialog(event)
}
} else {
if (event.time != time || event.notes != notes) {
event.notes = notes
event.time = time
saveEvent(event)
}
if (showDetailsAtEnd) {
showEventDetailDialog(event)
}
}
logbook?.sort()
recyclerView.adapter?.notifyDataSetChanged()
saveLogbook()
onEnd?.invoke()
}
d.setNegativeButton(android.R.string.cancel) { dialogInterface, i ->
dialogInterface.dismiss()
onEnd?.invoke()
if (showDetailsAtEnd) {
showEventDetailDialog(event)
}
}
val alertDialog = d.create()
@@ -564,22 +573,22 @@ class MainActivity : AppCompatActivity() {
d.setNegativeButton(R.string.dialog_event_detail_edit_button) { dialogInterface, i ->
Log.d("MainActivity", "negative button pressed: ${event.type}")
when (event.type) {
TYPE_BABY_BOTTLE -> askBabyBottleContent(event, { showEventDetailDialog(event) })
LunaEvent.TYPE_WEIGHT -> {}
LunaEvent.TYPE_BABY_BOTTLE -> askBabyBottleContent(event, true)
LunaEvent.TYPE_WEIGHT -> askWeightValue(event, true)
LunaEvent.TYPE_BREASTFEEDING_LEFT_NIPPLE,
LunaEvent.TYPE_BREASTFEEDING_BOTH_NIPPLE,
LunaEvent.TYPE_BREASTFEEDING_RIGHT_NIPPLE,
LunaEvent.TYPE_ENEMA,
LunaEvent.TYPE_BATH,
LunaEvent.TYPE_COLIC,
LunaEvent.TYPE_CUSTOM,
LunaEvent.TYPE_DIAPERCHANGE_POO,
LunaEvent.TYPE_DIAPERCHANGE_PEE -> { askPlain(event, { showEventDetailDialog(event) }) }
LunaEvent.TYPE_MEDICINE -> askNotes(event, { showEventDetailDialog(event) })
LunaEvent.TYPE_NOTE -> askNotes(event, { showEventDetailDialog(event) })
LunaEvent.TYPE_TEMPERATURE, //todo
LunaEvent.TYPE_FOOD -> askNotes(event, { showEventDetailDialog(event) })
LunaEvent.TYPE_PUKE -> askPukeValue(event, { showEventDetailDialog(event) })
LunaEvent.TYPE_CUSTOM -> {} // todo?
LunaEvent.TYPE_DIAPERCHANGE_PEE -> askPlain(event, true)
LunaEvent.TYPE_MEDICINE -> askNotes(event, true)
LunaEvent.TYPE_NOTE -> askNotes(event, true)
LunaEvent.TYPE_TEMPERATURE -> askTemperatureValue(event, true)
LunaEvent.TYPE_FOOD -> askNotes(event, true)
LunaEvent.TYPE_PUKE -> askPukeValue(event, true)
else -> {}
}
}
@@ -987,38 +996,34 @@ class MainActivity : AppCompatActivity() {
askNotes(LunaEvent(LunaEvent.TYPE_MEDICINE))
dismiss()
}
contentView.findViewById<View>(R.id.button_enema).setOnClickListener({
contentView.findViewById<View>(R.id.button_enema).setOnClickListener {
logEvent(LunaEvent(LunaEvent.TYPE_ENEMA))
dismiss()
})
contentView.findViewById<View>(R.id.button_note).setOnClickListener({
}
contentView.findViewById<View>(R.id.button_note).setOnClickListener {
askNotes(LunaEvent(LunaEvent.TYPE_NOTE))
dismiss()
})
contentView.findViewById<View>(R.id.button_temperature).setOnClickListener({
askTemperatureValue()
}
contentView.findViewById<View>(R.id.button_temperature).setOnClickListener {
askTemperatureValue(LunaEvent(LunaEvent.TYPE_TEMPERATURE))
dismiss()
})
contentView.findViewById<View>(R.id.button_puke).setOnClickListener({
askPukeValue()
}
contentView.findViewById<View>(R.id.button_puke).setOnClickListener {
askPukeValue(LunaEvent(LunaEvent.TYPE_PUKE))
dismiss()
})
contentView.findViewById<View>(R.id.button_colic).setOnClickListener({
logEvent(
LunaEvent(LunaEvent.TYPE_COLIC)
)
}
contentView.findViewById<View>(R.id.button_colic).setOnClickListener {
logEvent(LunaEvent(LunaEvent.TYPE_COLIC))
dismiss()
})
contentView.findViewById<View>(R.id.button_scale).setOnClickListener({
askWeightValue()
}
contentView.findViewById<View>(R.id.button_scale).setOnClickListener {
askWeightValue(LunaEvent(LunaEvent.TYPE_WEIGHT))
dismiss()
})
contentView.findViewById<View>(R.id.button_bath).setOnClickListener({
logEvent(
LunaEvent(LunaEvent.TYPE_BATH)
)
}
contentView.findViewById<View>(R.id.button_bath).setOnClickListener {
logEvent(LunaEvent(LunaEvent.TYPE_BATH))
dismiss()
})
}
}.also { popupWindow ->
popupWindow.setOnDismissListener({
Handler(mainLooper).postDelayed({

View File

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

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/dialog_date_picker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="20dp"
android:layout_marginEnd="20dp"/>
</LinearLayout>

View File

@@ -1,10 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center">
android:gravity="center"
android:orientation="horizontal">
<EditText
android:id="@+id/dialog_number_edittext"
@@ -19,4 +25,14 @@
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:text="g"/>
</LinearLayout>
<TextView
android:id="@+id/dialog_date_picker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginEnd="20dp"/>
</LinearLayout>

View File

@@ -14,4 +14,11 @@
android:paddingHorizontal="16dp"
android:paddingVertical="8dp"/>
<TextView
android:id="@+id/dialog_date_picker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginEnd="20dp"/>
</LinearLayout>

View File

@@ -23,4 +23,12 @@
android:layout_height="wrap_content"
android:textSize="30sp"
android:textColor="@color/accent"/>
<TextView
android:id="@+id/dialog_date_picker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginEnd="20dp"/>
</LinearLayout>