From d7b2369a321464bb1398fee94cf340551c6e5aff Mon Sep 17 00:00:00 2001 From: Kacper Ziubryniewicz Date: Sun, 29 Sep 2019 17:57:10 +0200 Subject: [PATCH] [Agenda] Add showing teachers absence time --- .../ui/dialogs/teacherabsence/TeacherAbsenceAdapter.kt | 8 ++++++++ .../main/res/layout/row_dialog_teacher_absence_item.xml | 9 ++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/teacherabsence/TeacherAbsenceAdapter.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/teacherabsence/TeacherAbsenceAdapter.kt index 35292685..c64ea891 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/teacherabsence/TeacherAbsenceAdapter.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/teacherabsence/TeacherAbsenceAdapter.kt @@ -30,9 +30,17 @@ class TeacherAbsenceAdapter( val teacherAbsence: TeacherAbsenceFull = teacherAbsenceList[position] holder.teacherAbsenceTeacher.text = teacherAbsence.teacherFullName + + val time = when(teacherAbsence.dateFrom.compareTo(teacherAbsence.dateTo)) { + 0 -> teacherAbsence.dateFrom.formattedStringShort + else -> teacherAbsence.dateFrom.formattedStringShort + " - " + teacherAbsence.dateTo.formattedStringShort + } + + holder.teacherAbsenceTime.text = time } class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { var teacherAbsenceTeacher: TextView = itemView.findViewById(R.id.teacherAbsenceTeacher) + var teacherAbsenceTime: TextView = itemView.findViewById(R.id.teacherAbsenceTime) } } diff --git a/app/src/main/res/layout/row_dialog_teacher_absence_item.xml b/app/src/main/res/layout/row_dialog_teacher_absence_item.xml index c7befdf2..6aacce23 100644 --- a/app/src/main/res/layout/row_dialog_teacher_absence_item.xml +++ b/app/src/main/res/layout/row_dialog_teacher_absence_item.xml @@ -21,9 +21,16 @@ + +