1
0
mirror of https://github.com/wulkanowy/wulkanowy.git synced 2025-01-19 08:56:46 -06:00

Display info in timetable as-is when lesson has change flag (#1521)

This commit is contained in:
Mikołaj Pich 2021-09-16 11:59:23 +02:00 committed by GitHub
parent 258782c648
commit 5ba8289c87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 6 deletions

View File

@ -157,7 +157,7 @@ ext {
} }
dependencies { dependencies {
implementation "io.github.wulkanowy:sdk:1.2.2" implementation "io.github.wulkanowy:sdk:d74acd3989"
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5' coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'

View File

@ -13,7 +13,6 @@ import io.github.wulkanowy.R
import io.github.wulkanowy.data.db.entities.Timetable import io.github.wulkanowy.data.db.entities.Timetable
import io.github.wulkanowy.databinding.DialogTimetableBinding import io.github.wulkanowy.databinding.DialogTimetableBinding
import io.github.wulkanowy.utils.capitalise import io.github.wulkanowy.utils.capitalise
import io.github.wulkanowy.utils.decapitalise
import io.github.wulkanowy.utils.getThemeAttrColor import io.github.wulkanowy.utils.getThemeAttrColor
import io.github.wulkanowy.utils.lifecycleAwareVariable import io.github.wulkanowy.utils.lifecycleAwareVariable
import io.github.wulkanowy.utils.toFormattedString import io.github.wulkanowy.utils.toFormattedString
@ -52,7 +51,7 @@ class TimetableDialog : DialogFragment() {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
with(lesson) { with(lesson) {
setInfo(info, teacher, canceled, changes) setInfo(info, canceled, changes)
setSubject(subject, subjectOld) setSubject(subject, subjectOld)
setTeacher(teacher, teacherOld) setTeacher(teacher, teacherOld)
setGroup(group) setGroup(group)
@ -80,7 +79,7 @@ class TimetableDialog : DialogFragment() {
} }
@SuppressLint("DefaultLocale") @SuppressLint("DefaultLocale")
private fun setInfo(info: String, teacher: String, canceled: Boolean, changes: Boolean) { private fun setInfo(info: String, canceled: Boolean, changes: Boolean) {
with(binding) { with(binding) {
when { when {
info.isNotBlank() -> { info.isNotBlank() -> {
@ -102,8 +101,6 @@ class TimetableDialog : DialogFragment() {
timetableDialogChangesValue.text = when { timetableDialogChangesValue.text = when {
canceled && !changes -> "Lekcja odwołana: $info" canceled && !changes -> "Lekcja odwołana: $info"
changes && teacher.isNotBlank() -> "Zastępstwo: $teacher"
changes && teacher.isBlank() -> "Zastępstwo, ${info.decapitalise()}"
else -> info.capitalise() else -> info.capitalise()
} }
} }