[Agenda] Add showing teachers absence time

This commit is contained in:
Kacper Ziubryniewicz 2019-09-29 17:57:10 +02:00
parent 2c4e0e3121
commit d7b2369a32
2 changed files with 16 additions and 1 deletions

View File

@ -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)
}
}

View File

@ -21,9 +21,16 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_rounded_8dp_outline"
android:orientation="vertical"
android:padding="8dp">
<TextView
android:id="@+id/teacherAbsenceTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="@style/NavView.TextView.Helper"
tools:text="2 września - 5 kwietnia"/>
<TextView
android:id="@+id/teacherAbsenceTeacher"
android:layout_width="wrap_content"