From 965f5e73d9deb8b197857f82f854219e861c0fa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Szczodrzy=C5=84ski?= Date: Fri, 15 Nov 2019 19:55:46 +0100 Subject: [PATCH] [Bugs] Update gradle. Fix crashes in the timetable widget. --- .../main/java/pl/szczodrzynski/edziennik/WidgetTimetable.kt | 4 ++-- .../edziennik/ui/dialogs/event/EventManualV2Dialog.kt | 2 ++ .../edziennik/ui/dialogs/timetable/LessonDetailsDialog.kt | 2 ++ gradle/wrapper/gradle-wrapper.properties | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/WidgetTimetable.kt b/app/src/main/java/pl/szczodrzynski/edziennik/WidgetTimetable.kt index 088f4c60..ab5d21da 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/WidgetTimetable.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/WidgetTimetable.kt @@ -185,12 +185,12 @@ class WidgetTimetable : AppWidgetProvider() { // search for lessons to display val timetableDate = Date.getToday() var checkedDays = 0 - var lessons = lessonList.filter { it.profileId == profile.id && it.displayDate == timetableDate } + var lessons = lessonList.filter { it.profileId == profile.id && it.displayDate == timetableDate && it.type != Lesson.TYPE_NO_LESSONS } while ((lessons.isEmpty() || lessons.none { it.displayDate != today || (it.displayDate == today && it.displayEndTime != null && it.displayEndTime!! >= now) }) && checkedDays < 7) { timetableDate.stepForward(0, 0, 1) - lessons = lessonList.filter { it.profileId == profile.id && it.displayDate == timetableDate } + lessons = lessonList.filter { it.profileId == profile.id && it.displayDate == timetableDate && it.type != Lesson.TYPE_NO_LESSONS } checkedDays++ } diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/event/EventManualV2Dialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/event/EventManualV2Dialog.kt index faaab700..1d63ee69 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/event/EventManualV2Dialog.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/event/EventManualV2Dialog.kt @@ -50,6 +50,8 @@ class EventManualV2Dialog( private var defaultLoaded = false init { run { + if (activity.isFinishing) + return@run job = Job() onShowListener?.invoke(TAG) b = DialogEventManualV2Binding.inflate(activity.layoutInflater) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/timetable/LessonDetailsDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/timetable/LessonDetailsDialog.kt index 2ad4557b..fb52df03 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/timetable/LessonDetailsDialog.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/timetable/LessonDetailsDialog.kt @@ -33,6 +33,8 @@ class LessonDetailsDialog( private lateinit var dialog: AlertDialog init { run { + if (activity.isFinishing) + return@run onShowListener?.invoke(TAG) b = DialogLessonDetailsBinding.inflate(activity.layoutInflater) dialog = MaterialAlertDialogBuilder(activity) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 7ddd4838..9edbc9cb 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip \ No newline at end of file +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip \ No newline at end of file