forked from github/szkolny
[Agenda] Add showing teachers absence time
This commit is contained in:
parent
2c4e0e3121
commit
d7b2369a32
@ -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)
|
||||
}
|
||||
}
|
||||
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user