forked from github/wulkanowy-mirror
Dialogs adjustments to meet MD rules (#1227)
This commit is contained in:
@ -44,10 +44,10 @@ class AttendanceDialog : DialogFragment() {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
with(binding) {
|
||||
attendanceDialogSubject.text = attendance.subject
|
||||
attendanceDialogDescription.setText(attendance.description)
|
||||
attendanceDialogDate.text = attendance.date.toFormattedString()
|
||||
attendanceDialogNumber.text = attendance.number.toString()
|
||||
attendanceDialogSubjectValue.text = attendance.subject
|
||||
attendanceDialogDescriptionValue.setText(attendance.description)
|
||||
attendanceDialogDateValue.text = attendance.date.toFormattedString()
|
||||
attendanceDialogNumberValue.text = attendance.number.toString()
|
||||
attendanceDialogClose.setOnClickListener { dismiss() }
|
||||
}
|
||||
}
|
||||
|
@ -52,15 +52,15 @@ class MobileDeviceTokenDialog : BaseDialogFragment<DialogMobileDeviceBinding>(),
|
||||
}
|
||||
|
||||
override fun updateData(token: MobileDeviceToken) {
|
||||
with(binding.mobileDeviceDialogToken) {
|
||||
with(binding.mobileDeviceDialogTokenValue) {
|
||||
text = token.token
|
||||
setOnClickListener { clickCopy(token.token) }
|
||||
}
|
||||
with(binding.mobileDeviceDialogSymbol) {
|
||||
with(binding.mobileDeviceDialogSymbolValue) {
|
||||
text = token.symbol
|
||||
setOnClickListener { clickCopy(token.symbol) }
|
||||
}
|
||||
with(binding.mobileDeviceDialogPin) {
|
||||
with(binding.mobileDeviceDialogPinValue) {
|
||||
text = token.pin
|
||||
setOnClickListener { clickCopy(token.pin) }
|
||||
}
|
||||
|
@ -49,14 +49,14 @@ class NoteDialog : DialogFragment() {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
with(binding) {
|
||||
noteDialogDate.text = note.date.toFormattedString()
|
||||
noteDialogCategory.text = note.category
|
||||
noteDialogTeacher.text = note.teacher
|
||||
noteDialogContent.text = note.content
|
||||
noteDialogDateValue.text = note.date.toFormattedString()
|
||||
noteDialogCategoryValue.text = note.category
|
||||
noteDialogTeacherValue.text = note.teacher
|
||||
noteDialogContentValue.text = note.content
|
||||
}
|
||||
|
||||
if (note.isPointsShow) {
|
||||
with(binding.noteDialogPoints) {
|
||||
with(binding.noteDialogPointsValue) {
|
||||
text = "${if (note.points > 0) "+" else ""}${note.points}"
|
||||
setTextColor(
|
||||
when (NoteCategory.getByValue(note.categoryType)) {
|
||||
|
@ -63,13 +63,13 @@ class TimetableDialog : DialogFragment() {
|
||||
|
||||
private fun setSubject(subject: String, subjectOld: String) {
|
||||
with(binding) {
|
||||
timetableDialogSubject.text = subject
|
||||
timetableDialogLessonValue.text = subject
|
||||
if (subjectOld.isNotBlank() && subjectOld != subject) {
|
||||
timetableDialogSubject.run {
|
||||
timetableDialogLessonValue.run {
|
||||
paintFlags = paintFlags or STRIKE_THRU_TEXT_FLAG
|
||||
text = subjectOld
|
||||
}
|
||||
timetableDialogSubjectNew.run {
|
||||
timetableDialogLessonNewValue.run {
|
||||
visibility = VISIBLE
|
||||
text = subject
|
||||
}
|
||||
@ -88,17 +88,17 @@ class TimetableDialog : DialogFragment() {
|
||||
R.attr.colorPrimary
|
||||
)
|
||||
)
|
||||
timetableDialogChanges.setTextColor(requireContext().getThemeAttrColor(R.attr.colorPrimary))
|
||||
timetableDialogChangesValue.setTextColor(requireContext().getThemeAttrColor(R.attr.colorPrimary))
|
||||
} else {
|
||||
timetableDialogChangesTitle.setTextColor(
|
||||
requireContext().getThemeAttrColor(
|
||||
R.attr.colorTimetableChange
|
||||
)
|
||||
)
|
||||
timetableDialogChanges.setTextColor(requireContext().getThemeAttrColor(R.attr.colorTimetableChange))
|
||||
timetableDialogChangesValue.setTextColor(requireContext().getThemeAttrColor(R.attr.colorTimetableChange))
|
||||
}
|
||||
|
||||
timetableDialogChanges.text = when {
|
||||
timetableDialogChangesValue.text = when {
|
||||
canceled && !changes -> "Lekcja odwołana: $info"
|
||||
changes && teacher.isNotBlank() -> "Zastępstwo: $teacher"
|
||||
changes && teacher.isBlank() -> "Zastępstwo, ${info.decapitalize()}"
|
||||
@ -107,7 +107,7 @@ class TimetableDialog : DialogFragment() {
|
||||
}
|
||||
else -> {
|
||||
timetableDialogChangesTitle.visibility = GONE
|
||||
timetableDialogChanges.visibility = GONE
|
||||
timetableDialogChangesValue.visibility = GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -117,22 +117,22 @@ class TimetableDialog : DialogFragment() {
|
||||
with(binding) {
|
||||
when {
|
||||
teacherOld.isNotBlank() && teacherOld != teacher -> {
|
||||
timetableDialogTeacher.run {
|
||||
timetableDialogTeacherValue.run {
|
||||
visibility = VISIBLE
|
||||
paintFlags = paintFlags or STRIKE_THRU_TEXT_FLAG
|
||||
text = teacherOld
|
||||
}
|
||||
if (teacher.isNotBlank()) {
|
||||
timetableDialogTeacherNew.run {
|
||||
timetableDialogTeacherNewValue.run {
|
||||
visibility = VISIBLE
|
||||
text = teacher
|
||||
}
|
||||
}
|
||||
}
|
||||
teacher.isNotBlank() -> timetableDialogTeacher.text = teacher
|
||||
teacher.isNotBlank() -> timetableDialogTeacherValue.text = teacher
|
||||
else -> {
|
||||
timetableDialogTeacherTitle.visibility = GONE
|
||||
timetableDialogTeacher.visibility = GONE
|
||||
timetableDialogTeacherValue.visibility = GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -141,10 +141,10 @@ class TimetableDialog : DialogFragment() {
|
||||
private fun setGroup(group: String) {
|
||||
with(binding) {
|
||||
when {
|
||||
group.isNotBlank() -> timetableDialogGroup.text = group
|
||||
group.isNotBlank() -> timetableDialogGroupValue.text = group
|
||||
else -> {
|
||||
timetableDialogGroupTitle.visibility = GONE
|
||||
timetableDialogGroup.visibility = GONE
|
||||
timetableDialogGroupValue.visibility = GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -154,22 +154,22 @@ class TimetableDialog : DialogFragment() {
|
||||
with(binding) {
|
||||
when {
|
||||
roomOld.isNotBlank() && roomOld != room -> {
|
||||
timetableDialogRoom.run {
|
||||
timetableDialogRoomValue.run {
|
||||
visibility = VISIBLE
|
||||
paintFlags = paintFlags or STRIKE_THRU_TEXT_FLAG
|
||||
text = roomOld
|
||||
}
|
||||
if (room.isNotBlank()) {
|
||||
timetableDialogRoomNew.run {
|
||||
timetableDialogRoomNewValue.run {
|
||||
visibility = VISIBLE
|
||||
text = room
|
||||
}
|
||||
}
|
||||
}
|
||||
room.isNotBlank() -> timetableDialogRoom.text = room
|
||||
room.isNotBlank() -> timetableDialogRoomValue.text = room
|
||||
else -> {
|
||||
timetableDialogRoomTitle.visibility = GONE
|
||||
timetableDialogRoom.visibility = GONE
|
||||
timetableDialogRoomValue.visibility = GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -177,7 +177,7 @@ class TimetableDialog : DialogFragment() {
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
private fun setTime(start: LocalDateTime, end: LocalDateTime) {
|
||||
binding.timetableDialogTime.text =
|
||||
binding.timetableDialogTimeValue.text =
|
||||
"${start.toFormattedString("HH:mm")} - ${end.toFormattedString("HH:mm")}"
|
||||
}
|
||||
}
|
||||
|
@ -42,39 +42,39 @@ class CompletedLessonDialog : DialogFragment() {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
with(binding) {
|
||||
completedLessonDialogSubject.text = completedLesson.subject
|
||||
completedLessonDialogTopic.text = completedLesson.topic
|
||||
completedLessonDialogTeacher.text = completedLesson.teacher
|
||||
completedLessonDialogAbsence.text = completedLesson.absence
|
||||
completedLessonDialogChanges.text = completedLesson.substitution
|
||||
completedLessonDialogResources.text = completedLesson.resources
|
||||
completedLessonDialogSubjectValue.text = completedLesson.subject
|
||||
completedLessonDialogTopicValue.text = completedLesson.topic
|
||||
completedLessonDialogTeacherValue.text = completedLesson.teacher
|
||||
completedLessonDialogAbsenceValue.text = completedLesson.absence
|
||||
completedLessonDialogChangesValue.text = completedLesson.substitution
|
||||
completedLessonDialogResourcesValue.text = completedLesson.resources
|
||||
}
|
||||
|
||||
completedLesson.substitution.let {
|
||||
if (it.isBlank()) {
|
||||
with(binding) {
|
||||
completedLessonDialogChangesTitle.visibility = View.GONE
|
||||
completedLessonDialogChanges.visibility = View.GONE
|
||||
completedLessonDialogChangesValue.visibility = View.GONE
|
||||
}
|
||||
} else binding.completedLessonDialogChanges.text = it
|
||||
} else binding.completedLessonDialogChangesValue.text = it
|
||||
}
|
||||
|
||||
completedLesson.absence.let {
|
||||
if (it.isBlank()) {
|
||||
with(binding) {
|
||||
completedLessonDialogAbsenceTitle.visibility = View.GONE
|
||||
completedLessonDialogAbsence.visibility = View.GONE
|
||||
completedLessonDialogAbsenceValue.visibility = View.GONE
|
||||
}
|
||||
} else binding.completedLessonDialogAbsence.text = it
|
||||
} else binding.completedLessonDialogAbsenceValue.text = it
|
||||
}
|
||||
|
||||
completedLesson.resources.let {
|
||||
if (it.isBlank()) {
|
||||
with(binding) {
|
||||
completedLessonDialogResourcesTitle.visibility = View.GONE
|
||||
completedLessonDialogResources.visibility = View.GONE
|
||||
completedLessonDialogResourcesValue.visibility = View.GONE
|
||||
}
|
||||
} else binding.completedLessonDialogResources.text = it
|
||||
} else binding.completedLessonDialogResourcesValue.text = it
|
||||
}
|
||||
|
||||
binding.completedLessonDialogClose.setOnClickListener { dismiss() }
|
||||
|
Reference in New Issue
Block a user