diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebHomework.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebHomework.kt index 1a9ea5ae..f8a1f14e 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebHomework.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/web/EdudziennikWebHomework.kt @@ -49,14 +49,14 @@ class EdudziennikWebHomework(override val data: DataEdudziennik, val teacherName = homeworkElement.child(2).text() val teacher = data.getTeacherByFirstLast(teacherName) - val topic = homeworkElement.child(4).text() + val topic = homeworkElement.child(4).text()?.trim() val eventObject = Event( profileId = profileId, id = id, date = date, time = startTime, - topic = topic, + topic = topic ?: "", color = null, type = Event.TYPE_HOMEWORK, teacherId = teacher.id, diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebExams.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebExams.kt index 3a3b9d3b..82e63e79 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebExams.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebExams.kt @@ -66,7 +66,7 @@ class IdziennikWebExams(override val data: DataIdziennik, val subjectId = data.getSubject(subjectName, null, subjectName).id val teacherName = exam.getString("wpisal") ?: return@forEach val teacherId = data.getTeacherByLastFirst(teacherName).id - val topic = exam.getString("zakres") ?: "" + val topic = exam.getString("zakres")?.trim() ?: "" val lessonList = data.db.timetableDao().getForDateNow(profileId, examDate) val startTime = lessonList.firstOrNull { it.subjectId == subjectId }?.startTime diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebHomework.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebHomework.kt index 71ea7ea9..15e09fcd 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebHomework.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/web/IdziennikWebHomework.kt @@ -58,7 +58,7 @@ class IdziennikWebHomework(override val data: DataIdziennik, val teacherId = data.getTeacherByLastFirst(teacherName).id val lessonList = data.db.timetableDao().getForDateNow(profileId, eventDate) val startTime = lessonList.firstOrNull { it.subjectId == subjectId }?.displayStartTime - val topic = homework.getString("tytul") ?: "" + val topic = homework.getString("tytul")?.trim() ?: "" val seen = when (profile?.empty) { true -> true diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiEvents.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiEvents.kt index 1dff3e7d..52f52844 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiEvents.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiEvents.kt @@ -35,7 +35,7 @@ class LibrusApiEvents(override val data: DataLibrus, events?.forEach { event -> val id = event.getLong("Id") ?: return@forEach val eventDate = Date.fromY_m_d(event.getString("Date")) - val topic = event.getString("Content") ?: "" + val topic = event.getString("Content")?.trim() ?: "" val type = event.getJsonObject("Category")?.getLong("Id") ?: -1 val teacherId = event.getJsonObject("CreatedBy")?.getLong("Id") ?: -1 val subjectId = event.getJsonObject("Subject")?.getLong("Id") ?: -1 diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/api/MobidziennikApiEvents.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/api/MobidziennikApiEvents.kt index be389d79..02fbb67e 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/api/MobidziennikApiEvents.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/api/MobidziennikApiEvents.kt @@ -30,7 +30,7 @@ class MobidziennikApiEvents(val data: DataMobidziennik, rows: List) { val teacherId = cols[1].toLong() val subjectId = cols[3].toLong() var type = Event.TYPE_DEFAULT - var topic = cols[5] + var topic = cols[5].trim() Regexes.MOBIDZIENNIK_EVENT_TYPE.find(topic)?.let { val typeText = it.groupValues[1] when (typeText) { diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/api/MobidziennikApiHomework.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/api/MobidziennikApiHomework.kt index fe75674f..4623a26d 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/api/MobidziennikApiHomework.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/api/MobidziennikApiHomework.kt @@ -26,7 +26,7 @@ class MobidziennikApiHomework(val data: DataMobidziennik, rows: List) { val id = cols[0].toLong() val teacherId = cols[7].toLong() val subjectId = cols[6].toLong() - val topic = Html.fromHtml(cols[1])?.toString() ?: "" + val topic = Html.fromHtml(cols[1])?.toString()?.trim() ?: "" val eventDate = Date.fromYmd(cols[2]) val startTime = Time.fromYmdHm(cols[3]) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/api/VulcanApiEvents.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/api/VulcanApiEvents.kt index 0c4a0aa3..4ba7c460 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/api/VulcanApiEvents.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/api/VulcanApiEvents.kt @@ -57,7 +57,7 @@ class VulcanApiEvents(override val data: DataVulcan, val eventDate = Date.fromY_m_d(event.getString("DataTekst") ?: return@forEach) val subjectId = event.getLong("IdPrzedmiot") ?: -1 val teacherId = event.getLong("IdPracownik") ?: -1 - val topic = event.getString("Opis") ?: "" + val topic = event.getString("Opis")?.trim() ?: "" val lessonList = data.db.timetableDao().getForDateNow(profileId, eventDate) val startTime = lessonList.firstOrNull { it.subjectId == subjectId }?.startTime