add signature setting

For multiple users it helps to
keep track about who did what.
This commit is contained in:
2025-09-29 03:31:16 +02:00
parent c4b345bfd9
commit 3043b86a14
7 changed files with 84 additions and 1 deletions

View File

@@ -13,6 +13,7 @@ import android.view.ViewGroup
import android.widget.AdapterView
import android.widget.ArrayAdapter
import android.widget.EditText
import android.widget.LinearLayout
import android.widget.NumberPicker
import android.widget.PopupWindow
import android.widget.Spinner
@@ -57,6 +58,7 @@ class MainActivity : AppCompatActivity() {
lateinit var buttonsContainer: ViewGroup
lateinit var recyclerView: RecyclerView
lateinit var handler: Handler
var signature = ""
var savingEvent = false
val updateListRunnable: Runnable = Runnable {
if (logbook != null && !pauseLogbookUpdate)
@@ -168,6 +170,8 @@ class MainActivity : AppCompatActivity() {
logbookRepo = FileLogbookRepository()
}
signature = settingsRepository.loadSignature()
val noBreastfeeding = settingsRepository.loadNoBreastfeeding()
findViewById<View>(R.id.layout_nipples).visibility = when (noBreastfeeding) {
true -> View.GONE
@@ -386,6 +390,14 @@ class MainActivity : AppCompatActivity() {
pauseLogbookUpdate = false
})
// show optional signature
dialogView.findViewById<TextView>(R.id.dialog_event_detail_type_signature).text = event.signature
dialogView.findViewById<LinearLayout>(R.id.dialog_event_signature_layout).visibility = if (event.signature.isNotEmpty()) {
View.VISIBLE
} else {
View.GONE
}
// create next/previous links to events of the same type
val previousTextView = dialogView.findViewById<TextView>(R.id.dialog_event_previous)
@@ -635,6 +647,8 @@ class MainActivity : AppCompatActivity() {
fun logEvent(event: LunaEvent) {
savingEvent(true)
event.signature = signature
setLoading(true)
logbook?.logs?.add(0, event)
recyclerView.adapter?.notifyItemInserted(0)
@@ -785,7 +799,9 @@ class MainActivity : AppCompatActivity() {
dismiss()
})
contentView.findViewById<View>(R.id.button_puke).setOnClickListener({
askNotes(LunaEvent(LunaEvent.TYPE_PUKE))
logEvent(
LunaEvent(LunaEvent.TYPE_PUKE)
)
dismiss()
})
contentView.findViewById<View>(R.id.button_colic).setOnClickListener({