Feature collection #19
@@ -465,6 +465,52 @@ class MainActivity : AppCompatActivity() {
|
|||||||
dateTV.visibility = View.GONE
|
dateTV.visibility = View.GONE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val nextTextView = dialogView.findViewById<TextView>(R.id.notes_template_next)
|
||||||
|
val prevTextView = dialogView.findViewById<TextView>(R.id.notes_template_prev)
|
||||||
|
|
||||||
|
fun updateContent(current: LunaEvent) {
|
||||||
|
val allEvents = getAllEvents()
|
||||||
|
val prevEvent = getPreviousSameEvent(current, allEvents)
|
||||||
|
var nextEvent = getNextSameEvent(current, allEvents)
|
||||||
|
|
||||||
|
notesET.setText(current.notes)
|
||||||
|
if (useQuantity) {
|
||||||
|
qtyET.setText(current.quantity.toString())
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nextEvent == null && current != event) {
|
||||||
|
nextEvent = event
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nextEvent != null) {
|
||||||
|
nextTextView.setOnClickListener {
|
||||||
|
notesET.setText(nextEvent.notes)
|
||||||
|
if (useQuantity) {
|
||||||
|
qtyET.setText(nextEvent.quantity.toString())
|
||||||
|
}
|
||||||
|
updateContent(nextEvent)
|
||||||
|
}
|
||||||
|
nextTextView.alpha = 1.0f
|
||||||
|
} else {
|
||||||
|
nextTextView.setOnClickListener {}
|
||||||
|
nextTextView.alpha = 0.5f
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prevEvent != null) {
|
||||||
|
prevTextView.setOnClickListener {
|
||||||
|
notesET.setText(prevEvent.notes)
|
||||||
|
if (useQuantity) {
|
||||||
|
qtyET.setText(prevEvent.quantity.toString())
|
||||||
|
}
|
||||||
|
updateContent(prevEvent)
|
||||||
|
}
|
||||||
|
prevTextView.alpha = 1.0f
|
||||||
|
} else {
|
||||||
|
prevTextView.setOnClickListener {}
|
||||||
|
prevTextView.alpha = 0.5f
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
notesET.setText(event.notes)
|
notesET.setText(event.notes)
|
||||||
|
|
||||||
if (useQuantity) {
|
if (useQuantity) {
|
||||||
@@ -473,6 +519,8 @@ class MainActivity : AppCompatActivity() {
|
|||||||
qtyET.visibility = View.GONE
|
qtyET.visibility = View.GONE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateContent(event)
|
||||||
|
|
||||||
d.setPositiveButton(android.R.string.ok) { dialogInterface, i ->
|
d.setPositiveButton(android.R.string.ok) { dialogInterface, i ->
|
||||||
val notes = notesET.text.toString()
|
val notes = notesET.text.toString()
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,29 @@
|
|||||||
android:hint="@string/log_notes_dialog_note_hint"
|
android:hint="@string/log_notes_dialog_note_hint"
|
||||||
android:background="@drawable/textview_background"/>
|
android:background="@drawable/textview_background"/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:gravity="end"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/notes_template_prev"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textSize="18dp"
|
||||||
|
android:text="⬅️"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/notes_template_next"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textSize="18dp"
|
||||||
|
android:text="➡️"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/dialog_date_picker"
|
android:id="@+id/dialog_date_picker"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
|||||||
Reference in New Issue
Block a user