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

Fix blank description in exam details (#1778)

This commit is contained in:
Rafał Borcz 2022-02-10 07:36:44 +01:00 committed by GitHub
parent 6290663f02
commit 84d0ba525f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 9 deletions

View File

@ -5,6 +5,7 @@ import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.fragment.app.DialogFragment import androidx.fragment.app.DialogFragment
import io.github.wulkanowy.R
import io.github.wulkanowy.data.db.entities.Exam import io.github.wulkanowy.data.db.entities.Exam
import io.github.wulkanowy.databinding.DialogExamBinding import io.github.wulkanowy.databinding.DialogExamBinding
import io.github.wulkanowy.utils.lifecycleAwareVariable import io.github.wulkanowy.utils.lifecycleAwareVariable
@ -47,7 +48,9 @@ class ExamDialog : DialogFragment() {
examDialogTypeValue.text = exam.type examDialogTypeValue.text = exam.type
examDialogTeacherValue.text = exam.teacher examDialogTeacherValue.text = exam.teacher
examDialogDateValue.text = exam.entryDate.toFormattedString() examDialogDateValue.text = exam.entryDate.toFormattedString()
examDialogDescriptionValue.text = exam.description examDialogDescriptionValue.text = exam.description.ifBlank {
getString(R.string.all_no_data)
}
examDialogClose.setOnClickListener { dismiss() } examDialogClose.setOnClickListener { dismiss() }
} }

View File

@ -10,11 +10,7 @@ import io.github.wulkanowy.R
import io.github.wulkanowy.data.db.entities.Grade import io.github.wulkanowy.data.db.entities.Grade
import io.github.wulkanowy.data.enums.GradeColorTheme import io.github.wulkanowy.data.enums.GradeColorTheme
import io.github.wulkanowy.databinding.DialogGradeBinding import io.github.wulkanowy.databinding.DialogGradeBinding
import io.github.wulkanowy.utils.colorStringId import io.github.wulkanowy.utils.*
import io.github.wulkanowy.utils.getBackgroundColor
import io.github.wulkanowy.utils.getGradeColor
import io.github.wulkanowy.utils.lifecycleAwareVariable
import io.github.wulkanowy.utils.toFormattedString
class GradeDetailsDialog : DialogFragment() { class GradeDetailsDialog : DialogFragment() {
@ -80,9 +76,7 @@ class GradeDetailsDialog : DialogFragment() {
setBackgroundResource(grade.getBackgroundColor(gradeColorTheme)) setBackgroundResource(grade.getBackgroundColor(gradeColorTheme))
} }
gradeDialogTeacherValue.text = if (grade.teacher.isBlank()) { gradeDialogTeacherValue.text = grade.teacher.ifBlank { getString(R.string.all_no_data) }
getString(R.string.all_no_data)
} else grade.teacher
gradeDialogDescriptionValue.text = grade.run { gradeDialogDescriptionValue.text = grade.run {
when { when {