Mark teacher with yellow when new and old are the same (#1529)

This commit is contained in:
Mateusz Idziejczak 2021-09-25 13:46:11 +02:00 committed by GitHub
parent a43ffcdef4
commit 2cb11e443c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 5 deletions

View File

@ -166,7 +166,7 @@ ext {
} }
dependencies { dependencies {
implementation "io.github.wulkanowy:sdk:8f3721f1f9" implementation "io.github.wulkanowy:sdk:230d2075df"
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5' coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'

View File

@ -360,7 +360,7 @@ class TimetableAdapter @Inject constructor() : RecyclerView.Adapter<RecyclerView
private fun updateTeacherColor(teacherTextView: TextView, lesson: Timetable) { private fun updateTeacherColor(teacherTextView: TextView, lesson: Timetable) {
teacherTextView.setTextColor( teacherTextView.setTextColor(
teacherTextView.context.getThemeAttrColor( teacherTextView.context.getThemeAttrColor(
if (lesson.teacherOld.isNotBlank() && lesson.teacherOld != lesson.teacher) R.attr.colorTimetableChange if (lesson.teacherOld.isNotBlank()) R.attr.colorTimetableChange
else android.R.attr.textColorSecondary else android.R.attr.textColorSecondary
) )
) )

View File

@ -89,14 +89,22 @@ class TimetableDialog : DialogFragment() {
R.attr.colorPrimary R.attr.colorPrimary
) )
) )
timetableDialogChangesValue.setTextColor(requireContext().getThemeAttrColor(R.attr.colorPrimary)) timetableDialogChangesValue.setTextColor(
requireContext().getThemeAttrColor(
R.attr.colorPrimary
)
)
} else { } else {
timetableDialogChangesTitle.setTextColor( timetableDialogChangesTitle.setTextColor(
requireContext().getThemeAttrColor( requireContext().getThemeAttrColor(
R.attr.colorTimetableChange R.attr.colorTimetableChange
) )
) )
timetableDialogChangesValue.setTextColor(requireContext().getThemeAttrColor(R.attr.colorTimetableChange)) timetableDialogChangesValue.setTextColor(
requireContext().getThemeAttrColor(
R.attr.colorTimetableChange
)
)
} }
timetableDialogChangesValue.text = when { timetableDialogChangesValue.text = when {
@ -128,6 +136,15 @@ class TimetableDialog : DialogFragment() {
} }
} }
} }
teacherOld.isNotBlank() && teacherOld == teacher -> {
timetableDialogTeacherValue.run {
visibility = GONE
}
timetableDialogTeacherNewValue.run {
visibility = VISIBLE
text = teacher
}
}
teacher.isNotBlank() -> timetableDialogTeacherValue.text = teacher teacher.isNotBlank() -> timetableDialogTeacherValue.text = teacher
else -> { else -> {
timetableDialogTeacherTitle.visibility = GONE timetableDialogTeacherTitle.visibility = GONE

View File

@ -173,7 +173,7 @@ class TimetableWidgetFactory(
updateNotCanceledLessonNumberColor(this, lesson) updateNotCanceledLessonNumberColor(this, lesson)
updateNotCanceledSubjectColor(this, lesson) updateNotCanceledSubjectColor(this, lesson)
val teacherChange = lesson.teacherOld.isNotBlank() && lesson.teacher != lesson.teacherOld val teacherChange = lesson.teacherOld.isNotBlank()
updateNotCanceledRoom(this, lesson, teacherChange) updateNotCanceledRoom(this, lesson, teacherChange)
updateNotCanceledTeacher(this, lesson, teacherChange) updateNotCanceledTeacher(this, lesson, teacherChange)
} }