From 99006d7923f0305bd088dd39e61c91a10c47d38c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Szczodrzy=C5=84ski?= Date: Wed, 18 Dec 2019 22:06:43 +0100 Subject: [PATCH] [UI/Dialogs] Update Lesson Details dialog when no classroom/teacher. Fix double events when metadata duplicated for different type. --- .../data/db/modules/events/EventDao.java | 2 ++ .../main/res/layout/dialog_lesson_details.xml | 23 +++++++++---------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/db/modules/events/EventDao.java b/app/src/main/java/pl/szczodrzynski/edziennik/data/db/modules/events/EventDao.java index ae55ec3c..12925c41 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/db/modules/events/EventDao.java +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/db/modules/events/EventDao.java @@ -68,6 +68,7 @@ public abstract class EventDao { "LEFT JOIN eventTypes USING(profileId, eventType)\n" + "LEFT JOIN metadata ON eventId = thingId AND (thingType = " + TYPE_EVENT + " OR thingType = " + TYPE_HOMEWORK + ") AND metadata.profileId = "+profileId+"\n" + "WHERE events.profileId = "+profileId+" AND events.eventBlacklisted = 0 AND "+filter+"\n" + + "GROUP BY eventId\n" + "ORDER BY eventDate, eventStartTime ASC"; Log.d("DB", query); return getAll(new SimpleSQLiteQuery(query)); @@ -111,6 +112,7 @@ public abstract class EventDao { "LEFT JOIN eventTypes USING(profileId, eventType)\n" + "LEFT JOIN metadata ON eventId = thingId AND (thingType = " + TYPE_EVENT + " OR thingType = " + TYPE_HOMEWORK + ") AND metadata.profileId = "+profileId+"\n" + "WHERE events.profileId = "+profileId+" AND events.eventBlacklisted = 0 AND "+filter+"\n" + + "GROUP BY eventId\n" + "ORDER BY eventStartTime, addedDate ASC")); } public List getNotNotifiedNow(int profileId) { diff --git a/app/src/main/res/layout/dialog_lesson_details.xml b/app/src/main/res/layout/dialog_lesson_details.xml index a282bf51..21d3332c 100644 --- a/app/src/main/res/layout/dialog_lesson_details.xml +++ b/app/src/main/res/layout/dialog_lesson_details.xml @@ -154,13 +154,13 @@ android:layout_weight="1" android:layout_marginEnd="8dp" android:layout_marginRight="8dp" - android:orientation="vertical"> + android:orientation="vertical" + android:visibility="@{teacherName != null || oldTeacherName != null ? View.VISIBLE : View.GONE}"> + android:text="@string/dialog_lesson_details_teacher" /> + android:orientation="vertical" + android:visibility="@{teamName != null || oldTeamName != null ? View.VISIBLE : View.GONE}"> + android:text="@string/dialog_lesson_details_team" /> + android:orientation="vertical" + android:visibility="@{classroom != null || oldClassroom != null ? View.VISIBLE : View.GONE}"> + android:text="@string/dialog_lesson_details_classroom" /> + android:orientation="vertical" + android:visibility="@{App.devMode ? View.VISIBLE : View.GONE}">