diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/widgets/timetable/WidgetTimetableFactory.java b/app/src/main/java/pl/szczodrzynski/edziennik/ui/widgets/timetable/WidgetTimetableFactory.java index 6791369f..4d0b04f0 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/widgets/timetable/WidgetTimetableFactory.java +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/widgets/timetable/WidgetTimetableFactory.java @@ -35,6 +35,7 @@ import pl.szczodrzynski.edziennik.R; import pl.szczodrzynski.edziennik.utils.models.Date; import pl.szczodrzynski.edziennik.utils.models.ItemWidgetTimetableModel; import pl.szczodrzynski.edziennik.utils.models.Time; +import pl.szczodrzynski.edziennik.utils.models.Week; import static android.util.TypedValue.COMPLEX_UNIT_SP; @@ -153,7 +154,10 @@ public class WidgetTimetableFactory implements RemoteViewsService.RemoteViewsFac views.setViewVisibility(R.id.widgetTimetableProfileName, View.VISIBLE); views.setViewVisibility(R.id.widgetTimetableContent, View.GONE); - views.setTextViewText(R.id.widgetTimetableProfileName, lesson.separatorProfileName); + if (lesson.lessonDate == null) + views.setTextViewText(R.id.widgetTimetableProfileName, lesson.separatorProfileName); + else + views.setTextViewText(R.id.widgetTimetableProfileName, lesson.separatorProfileName+"\n"+Week.getFullDayName(lesson.lessonDate.getWeekDay())); views.setTextViewTextSize(R.id.widgetTimetableProfileName, COMPLEX_UNIT_SP, lesson.bigStyle ? 30 : 20); views.setTextColor(R.id.widgetTimetableProfileName, lesson.darkTheme ? 0xffffffff : 0xff000000); diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/widgets/timetable/WidgetTimetableProvider.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/widgets/timetable/WidgetTimetableProvider.kt index 1b494ece..b56e951b 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/widgets/timetable/WidgetTimetableProvider.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/widgets/timetable/WidgetTimetableProvider.kt @@ -204,16 +204,6 @@ class WidgetTimetableProvider : AppWidgetProvider() { for (profile in profileList) { - // add a profile separator with its name - if (unified) { - val separator = ItemWidgetTimetableModel() - separator.profileId = profile.id - separator.bigStyle = widgetConfig.bigStyle - separator.darkTheme = widgetConfig.darkTheme - separator.separatorProfileName = profile.name - models.add(separator) - } - // search for lessons to display val timetableDate = Date.getToday() var checkedDays = 0 @@ -244,6 +234,19 @@ class WidgetTimetableProvider : AppWidgetProvider() { checkedDays++ } + // add a profile separator with its name + if (unified) { + val separator = ItemWidgetTimetableModel() + separator.profileId = profile.id + separator.bigStyle = widgetConfig.bigStyle + separator.darkTheme = widgetConfig.darkTheme + separator.separatorProfileName = profile.name + if (lessons.isNotEmpty() && lessons[0].type != TYPE_NO_LESSONS) { + separator.lessonDate = timetableDate + } + models.add(separator) + } + // set the displayingDate to show in the header if (!unified) { if (lessons.isNotEmpty())