mirror of
https://github.com/szkolny-eu/szkolny-android.git
synced 2024-11-24 19:04:38 -06:00
[Widgets/Timetable] Show lessons date in unified timetable widget.
This commit is contained in:
parent
54121c99a3
commit
209f98594f
@ -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);
|
||||
|
||||
|
@ -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())
|
||||
|
Loading…
Reference in New Issue
Block a user