diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/event/EventListDialog.java b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/event/EventListDialog.java index 6cd3fbbd..b4e7c6db 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/event/EventListDialog.java +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/event/EventListDialog.java @@ -20,7 +20,9 @@ import pl.szczodrzynski.edziennik.App; import pl.szczodrzynski.edziennik.R; import pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonChange; import pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonFull; +import pl.szczodrzynski.edziennik.data.db.modules.teachers.TeacherAbsenceFull; import pl.szczodrzynski.edziennik.ui.dialogs.lessonchange.LessonChangeDialog; +import pl.szczodrzynski.edziennik.ui.dialogs.teacherabsence.TeacherAbsenceDialog; import pl.szczodrzynski.edziennik.utils.models.Date; import pl.szczodrzynski.edziennik.utils.models.Time; @@ -171,7 +173,8 @@ public class EventListDialog { examsView.setNestedScrollingEnabled(false); examsView.setLayoutManager(new LinearLayoutManager(context)); - CardView lessonChangeContainer = dialogView.findViewById(R.id.lesson_change_container); + CardView lessonChangeContainer = dialogView.findViewById(R.id.lessonChangeContainer); + CardView teacherAbsenceContainer = dialogView.findViewById(R.id.teacherAbsenceContainer); //lessonChangeContainer.setVisibility(View.GONE); if (time == null) { app.db.lessonChangeDao().getLessonChangeCounterByDate(App.profileId, date).observe((LifecycleOwner) context, counter -> { @@ -179,14 +182,38 @@ public class EventListDialog { return; if (counter.lessonChangeCount > 0) { lessonChangeContainer.setVisibility(View.VISIBLE); - TextView lessonChangeCount = dialogView.findViewById(R.id.lesson_change_count); - lessonChangeCount.setText(Integer.toString(counter.lessonChangeCount)); + TextView lessonChangeCount = dialogView.findViewById(R.id.lessonChangeCount); + lessonChangeCount.setText(String.valueOf(counter.lessonChangeCount)); lessonChangeContainer.setCardBackgroundColor(0xff78909c); lessonChangeContainer.setOnClickListener((v -> { new LessonChangeDialog(context).show(app, date); })); } }); + + app.db.teacherAbsenceDao().getAllByDateFull(App.profileId, date).observe((LifecycleOwner) context, teacherAbsenceList -> { + if (teacherAbsenceList == null) + return; + if (teacherAbsenceList.size() > 0) { + int count = 0; + for (TeacherAbsenceFull teacherAbsence : teacherAbsenceList) { + Date dateFrom = teacherAbsence.getDateFrom(); + Date dateTo = teacherAbsence.getDateTo(); + + if (date.compareTo(dateFrom) >= 0 && date.compareTo(dateTo) <= 0) { + count++; + } + } + + teacherAbsenceContainer.setVisibility(View.VISIBLE); + TextView teacherAbsenceCount = dialogView.findViewById(R.id.teacherAbsenceCount); + teacherAbsenceCount.setText(String.valueOf(count)); + teacherAbsenceContainer.setCardBackgroundColor(0xffff1744); + teacherAbsenceContainer.setOnClickListener(( v -> { + new TeacherAbsenceDialog(context).show(app, date); + })); + } + }); } app.db.eventDao().getAllByDateTime(profileId, date, time).observe((LifecycleOwner) context, events -> { diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/AgendaFragment.java b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/AgendaFragment.java index 8d4e47ca..726a8637 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/AgendaFragment.java +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/AgendaFragment.java @@ -210,8 +210,8 @@ public class AgendaFragment extends Fragment { endTime.setTimeInMillis(startTime.getTimeInMillis() + (1000 * 60 * 45)); eventList.add(new TeacherAbsenceEvent( date.getInMillis(), - 0xff8f0119, - Colors.legibleTextColor(0xff8f0119), + 0xffff1744, + Colors.legibleTextColor(0xffff1744), startTime, endTime, App.profileId, diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/lessonchange/LessonChangeEventRenderer.java b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/lessonchange/LessonChangeEventRenderer.java index 8aa8f4b0..2490e1bf 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/lessonchange/LessonChangeEventRenderer.java +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/lessonchange/LessonChangeEventRenderer.java @@ -14,7 +14,7 @@ public class LessonChangeEventRenderer extends EventRenderer public void render(View view, LessonChangeEvent event) { CardView card = view.findViewById(R.id.lesson_change_card); TextView changeText = view.findViewById(R.id.lesson_change_text); - TextView changeCount = view.findViewById(R.id.lesson_change_count); + TextView changeCount = view.findViewById(R.id.lessonChangeCount); card.setCardBackgroundColor(event.getColor()); changeText.setTextColor(event.getTextColor()); changeCount.setTextColor(event.getTextColor()); diff --git a/app/src/main/res/layout/dialog_event_list.xml b/app/src/main/res/layout/dialog_event_list.xml index 4489f929..0e9f6120 100644 --- a/app/src/main/res/layout/dialog_event_list.xml +++ b/app/src/main/res/layout/dialog_event_list.xml @@ -15,7 +15,7 @@ app:layout_constraintTop_toTopOf="parent"> + + - \ No newline at end of file + diff --git a/app/src/main/res/values-en/strings.xml b/app/src/main/res/values-en/strings.xml index 87ad1860..863f9802 100644 --- a/app/src/main/res/values-en/strings.xml +++ b/app/src/main/res/values-en/strings.xml @@ -851,7 +851,7 @@ Abort message Save draft Send - Teachers absence + Absent teachers Getting grade comments Getting school free days diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e617bdd3..b081c59e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -908,6 +908,6 @@ Aktualne Minione Brak zadań domowych. - Nieobecność nauczycieli + Nieobecni nauczyciele Pobieranie komentarzy ocen