Compare commits

..

8 Commits

Author SHA1 Message Date
mwarning d204b877f5 activity_setting: fine tune layout style 2025-09-29 05:04:13 +02:00
mwarning 335c1d13af add signature setting
For multiple users it helps to
keep track about who did what.
2025-09-29 05:04:09 +02:00
mwarning 15dc8a1bef DateUtils: move event details formatting to DateUtils
Also display second as 0 since it is easier
to read and does not have meaning for the user.
2025-09-29 04:57:16 +02:00
mwarning 251ebd647a add bath event type 2025-09-29 04:57:16 +02:00
mwarning e09df3b0bf add no-breastfeeding help text 2025-09-29 04:57:16 +02:00
mwarning f36005de3b more_events_popup: move enema to bottom and adjust padding
Enemas are usually are rare thing. Let's
move it to the bottom. Also adjust padding
to have more space to display all items.
2025-09-29 04:57:16 +02:00
mwarning 19abf20628 simplify puke event 2025-09-29 04:57:13 +02:00
mwarning 730ef95220 add complex puke event 2025-09-29 04:56:14 +02:00
6 changed files with 10 additions and 61 deletions
@@ -263,26 +263,6 @@ class MainActivity : AppCompatActivity() {
alertDialog.show() alertDialog.show()
} }
fun askPukeValue() {
val d = AlertDialog.Builder(this)
val dialogView = layoutInflater.inflate(R.layout.puke_dialog, null)
d.setTitle(R.string.log_puke_dialog_title)
d.setMessage(R.string.log_puke_dialog_description)
d.setView(dialogView)
val spinner = dialogView.findViewById<Spinner>(R.id.dialog_puke_value)
spinner.adapter = ArrayAdapter.createFromResource(this, R.array.AmountLabels, android.R.layout.simple_spinner_dropdown_item)
spinner.setSelection(1)
d.setPositiveButton(android.R.string.ok) { dialogInterface, i ->
val pos = spinner.selectedItemPosition
logEvent(LunaEvent(LunaEvent.TYPE_PUKE, signature, pos))
}
d.setNegativeButton(android.R.string.cancel) { dialogInterface, i -> dialogInterface.dismiss() }
val alertDialog = d.create()
alertDialog.show()
}
fun askNotes(lunaEvent: LunaEvent) { fun askNotes(lunaEvent: LunaEvent) {
val d = AlertDialog.Builder(this) val d = AlertDialog.Builder(this)
val dialogView = layoutInflater.inflate(R.layout.dialog_notes, null) val dialogView = layoutInflater.inflate(R.layout.dialog_notes, null)
@@ -801,15 +781,15 @@ class MainActivity : AppCompatActivity() {
val inflater = LayoutInflater.from(anchor.context) val inflater = LayoutInflater.from(anchor.context)
contentView = inflater.inflate(R.layout.more_events_popup, null) contentView = inflater.inflate(R.layout.more_events_popup, null)
contentView.findViewById<View>(R.id.button_medicine).setOnClickListener { contentView.findViewById<View>(R.id.button_medicine).setOnClickListener {
askNotes(LunaEvent(LunaEvent.TYPE_MEDICINE)) askNotes(LunaEvent(LunaEvent.TYPE_MEDICINE, signature))
dismiss() dismiss()
} }
contentView.findViewById<View>(R.id.button_enema).setOnClickListener({ contentView.findViewById<View>(R.id.button_enema).setOnClickListener({
logEvent(LunaEvent(LunaEvent.TYPE_ENEMA)) logEvent(LunaEvent(LunaEvent.TYPE_ENEMA, signature))
dismiss() dismiss()
}) })
contentView.findViewById<View>(R.id.button_note).setOnClickListener({ contentView.findViewById<View>(R.id.button_note).setOnClickListener({
askNotes(LunaEvent(LunaEvent.TYPE_NOTE)) askNotes(LunaEvent(LunaEvent.TYPE_NOTE, signature))
dismiss() dismiss()
}) })
contentView.findViewById<View>(R.id.button_temperature).setOnClickListener({ contentView.findViewById<View>(R.id.button_temperature).setOnClickListener({
@@ -817,12 +797,14 @@ class MainActivity : AppCompatActivity() {
dismiss() dismiss()
}) })
contentView.findViewById<View>(R.id.button_puke).setOnClickListener({ contentView.findViewById<View>(R.id.button_puke).setOnClickListener({
askPukeValue() logEvent(
LunaEvent(LunaEvent.TYPE_PUKE, signature)
)
dismiss() dismiss()
}) })
contentView.findViewById<View>(R.id.button_colic).setOnClickListener({ contentView.findViewById<View>(R.id.button_colic).setOnClickListener({
logEvent( logEvent(
LunaEvent(LunaEvent.TYPE_COLIC) LunaEvent(LunaEvent.TYPE_COLIC, signature)
) )
dismiss() dismiss()
}) })
@@ -832,7 +814,7 @@ class MainActivity : AppCompatActivity() {
}) })
contentView.findViewById<View>(R.id.button_bath).setOnClickListener({ contentView.findViewById<View>(R.id.button_bath).setOnClickListener({
logEvent( logEvent(
LunaEvent(LunaEvent.TYPE_BATH) LunaEvent(LunaEvent.TYPE_BATH, signature)
) )
dismiss() dismiss()
}) })
@@ -69,9 +69,10 @@ class LunaEvent: Comparable<LunaEvent> {
throw IllegalArgumentException("JSONObject is not a LunaEvent") throw IllegalArgumentException("JSONObject is not a LunaEvent")
} }
constructor(type: String) { constructor(type: String, signature: String) {
this.jo = JSONObject() this.jo = JSONObject()
this.time = System.currentTimeMillis() / 1000 this.time = System.currentTimeMillis() / 1000
this.signature = signature
this.type = type this.type = type
} }
-2
View File
@@ -66,8 +66,6 @@ class NumericUtils (val context: Context) {
formatted.append(when (item.type) { formatted.append(when (item.type) {
LunaEvent.TYPE_TEMPERATURE -> LunaEvent.TYPE_TEMPERATURE ->
(item.quantity / 10.0f).toString() (item.quantity / 10.0f).toString()
LunaEvent.TYPE_PUKE ->
context.resources.getStringArray(R.array.AmountLabels)[item.quantity]
else -> else ->
item.quantity item.quantity
}) })
-17
View File
@@ -1,17 +0,0 @@
<?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:layout_gravity="center"
android:gravity="center"
android:orientation="vertical">
<Spinner
android:id="@+id/dialog_puke_value"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:paddingHorizontal="16dp"
android:paddingVertical="8dp"/>
</LinearLayout>
-8
View File
@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="AmountLabels">
<item>@string/amount_low</item>
<item>@string/amount_normal</item>
<item>@string/amount_high</item>
</string-array>
</resources>
-7
View File
@@ -12,9 +12,6 @@
<string name="log_temperature_dialog_title">Temperature</string> <string name="log_temperature_dialog_title">Temperature</string>
<string name="log_temperature_dialog_description">Insert the temperature</string> <string name="log_temperature_dialog_description">Insert the temperature</string>
<string name="log_puke_dialog_title">Puke</string>
<string name="log_puke_dialog_description">Select the amount</string>
<string name="event_bottle_type" translatable="false">🍼</string> <string name="event_bottle_type" translatable="false">🍼</string>
<string name="event_food_type" translatable="false">🥣</string> <string name="event_food_type" translatable="false">🥣</string>
<string name="event_scale_type" translatable="false">⚖️</string> <string name="event_scale_type" translatable="false">⚖️</string>
@@ -75,10 +72,6 @@
<string name="year_ago">year</string> <string name="year_ago">year</string>
<string name="years_ago">years</string> <string name="years_ago">years</string>
<string name="amount_low">Low</string>
<string name="amount_normal">Normal</string>
<string name="amount_high">High</string>
<string name="no_connection">No connection</string> <string name="no_connection">No connection</string>
<string name="no_connection_explain">Unable to reach WebDAV service</string> <string name="no_connection_explain">Unable to reach WebDAV service</string>
<string name="no_connection_go_to_settings">Settings</string> <string name="no_connection_go_to_settings">Settings</string>