Compare commits
1 Commits
c5188e4df9
...
e5e397ef09
| Author | SHA1 | Date | |
|---|---|---|---|
| e5e397ef09 |
@@ -283,6 +283,8 @@ class MainActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun askNotes(lunaEvent: LunaEvent) {
|
fun askNotes(lunaEvent: LunaEvent) {
|
||||||
|
val previous = getPreviousSameEvent(lunaEvent, getAllEvents())
|
||||||
|
|
||||||
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)
|
||||||
d.setTitle(lunaEvent.getTypeDescription(this))
|
d.setTitle(lunaEvent.getTypeDescription(this))
|
||||||
@@ -290,6 +292,16 @@ class MainActivity : AppCompatActivity() {
|
|||||||
d.setView(dialogView)
|
d.setView(dialogView)
|
||||||
val notesET = dialogView.findViewById<EditText>(R.id.notes_edittext)
|
val notesET = dialogView.findViewById<EditText>(R.id.notes_edittext)
|
||||||
val qtyET = dialogView.findViewById<EditText>(R.id.notes_qty_edittext)
|
val qtyET = dialogView.findViewById<EditText>(R.id.notes_qty_edittext)
|
||||||
|
if (previous != null) {
|
||||||
|
// set field defaults from previous event
|
||||||
|
qtyET.alpha = 0.5f
|
||||||
|
notesET.alpha = 0.5f
|
||||||
|
notesET.setText(previous.notes)
|
||||||
|
qtyET.setText(previous.quantity.toString())
|
||||||
|
notesET.doOnTextChanged { text, start, count, after -> qtyET.alpha = 1.0f }
|
||||||
|
notesET.doOnTextChanged { text, start, count, after -> notesET.alpha = 1.0f }
|
||||||
|
}
|
||||||
|
|
||||||
if (lunaEvent.type == LunaEvent.TYPE_NOTE || lunaEvent.type == LunaEvent.TYPE_CUSTOM)
|
if (lunaEvent.type == LunaEvent.TYPE_NOTE || lunaEvent.type == LunaEvent.TYPE_CUSTOM)
|
||||||
qtyET.visibility = View.GONE
|
qtyET.visibility = View.GONE
|
||||||
d.setPositiveButton(android.R.string.ok) { dialogInterface, i ->
|
d.setPositiveButton(android.R.string.ok) { dialogInterface, i ->
|
||||||
|
|||||||
Reference in New Issue
Block a user