1 Commits

Author SHA1 Message Date
2c48e3614c notes: add icons to use previous/next event as template 2025-11-07 21:19:38 +01:00

View File

@@ -302,7 +302,7 @@ class MainActivity : AppCompatActivity() {
val clearTextView = dialogView.findViewById<TextView>(R.id.notes_clear) val clearTextView = dialogView.findViewById<TextView>(R.id.notes_clear)
val prevTextView = dialogView.findViewById<TextView>(R.id.notes_template_prev) val prevTextView = dialogView.findViewById<TextView>(R.id.notes_template_prev)
fun update(current: LunaEvent) { fun updateContent(current: LunaEvent) {
val prevEvent = getPreviousSameEvent(current, allEvents) val prevEvent = getPreviousSameEvent(current, allEvents)
val nextEvent = getNextSameEvent(current, allEvents) val nextEvent = getNextSameEvent(current, allEvents)
@@ -318,7 +318,7 @@ class MainActivity : AppCompatActivity() {
if (useQuantity) { if (useQuantity) {
qtyET.setText(nextEvent.quantity.toString()) qtyET.setText(nextEvent.quantity.toString())
} }
update(nextEvent) updateContent(nextEvent)
} }
} else { } else {
nextTextView.visibility = View.GONE nextTextView.visibility = View.GONE
@@ -331,26 +331,27 @@ class MainActivity : AppCompatActivity() {
if (useQuantity) { if (useQuantity) {
qtyET.setText(prevEvent.quantity.toString()) qtyET.setText(prevEvent.quantity.toString())
} }
update(prevEvent) updateContent(prevEvent)
} }
} else { } else {
nextTextView.visibility = View.GONE nextTextView.visibility = View.GONE
} }
} }
update(lunaEvent)
clearTextView.setOnClickListener { clearTextView.setOnClickListener {
notesET.setText("") notesET.setText("")
if (useQuantity) { if (useQuantity) {
qtyET.setText("") qtyET.setText("")
} }
updateContent(lunaEvent)
} }
if (!useQuantity) { if (!useQuantity) {
qtyET.visibility = View.GONE qtyET.visibility = View.GONE
} }
updateContent(lunaEvent)
d.setPositiveButton(android.R.string.ok) { dialogInterface, i -> d.setPositiveButton(android.R.string.ok) { dialogInterface, i ->
val qtyStr = qtyET.text.toString() val qtyStr = qtyET.text.toString()
if (qtyStr.isNotEmpty() && useQuantity) { if (qtyStr.isNotEmpty() && useQuantity) {