[UI/Timetable] Show lesson replacing notes in all places.

This commit is contained in:
Kuba Szczodrzyński 2022-11-30 10:41:43 +01:00
parent 678baf46e5
commit dfd1083e41
No known key found for this signature in database
GPG Key ID: 7919598F25F38819
4 changed files with 12 additions and 4 deletions

View File

@ -61,6 +61,7 @@ class CounterActivity : AppCompatActivity(), CoroutineScope {
it.type != Lesson.TYPE_SHIFTED_SOURCE
})
}
lessonList.onEach { it.filterNotes() }
}
b.bellSync.setImageDrawable(
@ -101,13 +102,15 @@ class CounterActivity : AppCompatActivity(), CoroutineScope {
when {
actual != null -> {
b.lessonName.text = actual.displaySubjectName
b.lessonName.text = actual.getNoteSubstituteText(showNotes = true)
?: actual.displaySubjectName
val left = actual.displayEndTime!! - now
b.timeLeft.text = timeLeft(left.toInt(), "\n", countInSeconds)
}
next != null -> {
b.lessonName.text = next.displaySubjectName
b.lessonName.text = next.getNoteSubstituteText(showNotes = true)
?: next.displaySubjectName
val till = next.displayStartTime!! - now
b.timeLeft.text = timeTill(till.toInt(), "\n", countInSeconds)

View File

@ -232,6 +232,7 @@ class HomeTimetableCard(
}
lessons = lessons.filter { it.type != Lesson.TYPE_NO_LESSONS }
lessons.onEach { it.filterNotes() }
b.timetableLayout.visibility = View.VISIBLE
b.noTimetableLayout.visibility = View.GONE
@ -344,6 +345,7 @@ class HomeTimetableCard(
private val LessonFull?.subjectSpannable: CharSequence
get() = if (this == null) "?" else when {
hasReplacingNotes() -> getNoteSubstituteText(showNotes = true) ?: "?"
isCancelled -> displaySubjectName?.asStrikethroughSpannable() ?: "?"
isChange -> displaySubjectName?.asItalicSpannable() ?: "?"
else -> displaySubjectName ?: "?"

View File

@ -337,8 +337,11 @@ class WidgetTimetableProvider : AppWidgetProvider() {
scrollPos = pos + 1
}
// remove notes from other profiles
lesson.filterNotes()
// set the subject and classroom name
model.subjectName = lesson.displaySubjectName
model.subjectName = lesson.getNoteSubstituteText(showNotes = true)
?: lesson.displaySubjectName
model.classroomName = lesson.displayClassroom
// set the bell sync to calculate progress in ListProvider

View File

@ -19,7 +19,7 @@ public class ItemWidgetTimetableModel {
public Time endTime;
public boolean lessonPassed;
public boolean lessonCurrent;
public String subjectName = "";
public CharSequence subjectName = "";
public String classroomName = "";
public boolean lessonChange = false;
public boolean lessonChangeNoClassroom = false;