Added type Note
This commit is contained in:
@ -210,6 +210,8 @@ class MainActivity : AppCompatActivity() {
|
||||
d.setView(dialogView)
|
||||
val notesET = dialogView.findViewById<EditText>(R.id.notes_edittext)
|
||||
val qtyET = dialogView.findViewById<EditText>(R.id.notes_qty_edittext)
|
||||
if (lunaEvent.type == LunaEvent.TYPE_NOTE || lunaEvent.type == LunaEvent.TYPE_CUSTOM)
|
||||
qtyET.visibility = View.GONE
|
||||
d.setPositiveButton(android.R.string.ok) { dialogInterface, i ->
|
||||
val qtyStr = qtyET.text.toString()
|
||||
if (qtyStr.isNotEmpty()) {
|
||||
@ -440,6 +442,10 @@ class MainActivity : AppCompatActivity() {
|
||||
logEvent(LunaEvent(LunaEvent.TYPE_ENEMA))
|
||||
dismiss()
|
||||
})
|
||||
contentView.findViewById<View>(R.id.button_note).setOnClickListener({
|
||||
askNotes(LunaEvent(LunaEvent.TYPE_NOTE))
|
||||
dismiss()
|
||||
})
|
||||
contentView.findViewById<View>(R.id.button_custom).setOnClickListener({
|
||||
Toast.makeText(anchor.context, "TODO: Implement custom events", Toast.LENGTH_SHORT).show()
|
||||
dismiss()
|
||||
|
@ -59,7 +59,12 @@ class LunaEventRecyclerAdapter: RecyclerView.Adapter<LunaEventRecyclerAdapter.Lu
|
||||
) {
|
||||
val item = items.get(position)
|
||||
holder.type.text = item.getTypeEmoji(context)
|
||||
holder.description.text = item.getTypeDescription(context)
|
||||
holder.description.text = when(item.type) {
|
||||
LunaEvent.TYPE_MEDICINE -> item.notes
|
||||
LunaEvent.TYPE_NOTE -> item.notes
|
||||
LunaEvent.TYPE_CUSTOM -> item.notes
|
||||
else -> item.getTypeDescription(context)
|
||||
}
|
||||
holder.time.text = formatTimeAgo(context, item.time)
|
||||
val qtyText = if ((item.quantity ?: 0) > 0) {
|
||||
item.quantity.toString() + " " + when (item.type) {
|
||||
|
@ -23,6 +23,7 @@ class LunaEvent {
|
||||
val TYPE_DIAPERCHANGE_PEE = "DIAPERCHANGE_PEE"
|
||||
val TYPE_MEDICINE = "MEDICINE"
|
||||
val TYPE_ENEMA = "ENEMA"
|
||||
val TYPE_NOTE = "NOTE"
|
||||
val TYPE_CUSTOM = "CUSTOM"
|
||||
}
|
||||
|
||||
@ -82,6 +83,7 @@ class LunaEvent {
|
||||
TYPE_DIAPERCHANGE_PEE -> R.string.event_diaperchange_pee_type
|
||||
TYPE_MEDICINE -> R.string.event_medicine_type
|
||||
TYPE_ENEMA -> R.string.event_enema_type
|
||||
TYPE_NOTE -> R.string.event_note_type
|
||||
else -> R.string.event_unknown_type
|
||||
}
|
||||
)
|
||||
@ -99,6 +101,7 @@ class LunaEvent {
|
||||
TYPE_DIAPERCHANGE_PEE -> R.string.event_diaperchange_pee_desc
|
||||
TYPE_MEDICINE -> R.string.event_medicine_desc
|
||||
TYPE_ENEMA -> R.string.event_enema_desc
|
||||
TYPE_NOTE -> R.string.event_note_desc
|
||||
else -> R.string.event_unknown_desc
|
||||
}
|
||||
)
|
||||
|
Reference in New Issue
Block a user