Prevent changing the current day by accident when excusing absences (#1599)

This commit is contained in:
Michael
2021-11-13 19:56:17 +01:00
committed by GitHub
parent 6de937703a
commit c183428107
4 changed files with 18 additions and 12 deletions

View File

@ -12,6 +12,7 @@ import android.view.View.INVISIBLE
import android.view.View.VISIBLE
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.view.ActionMode
import androidx.core.view.isVisible
import androidx.recyclerview.widget.LinearLayoutManager
import com.google.android.material.datepicker.CalendarConstraints
import com.google.android.material.datepicker.MaterialDatePicker
@ -216,13 +217,7 @@ class AttendanceFragment : BaseFragment<FragmentAttendanceBinding>(R.layout.frag
}
override fun showExcuseButton(show: Boolean) {
with(binding.attendanceExcuseButton) {
if (show) {
show()
} else {
hide()
}
}
binding.attendanceExcuseButton.isVisible = show
}
override fun showAttendanceDialog(lesson: Attendance) {
@ -293,12 +288,16 @@ class AttendanceFragment : BaseFragment<FragmentAttendanceBinding>(R.layout.frag
}
override fun showExcuseCheckboxes(show: Boolean) {
attendanceAdapter.apply {
with(attendanceAdapter) {
excuseActionMode = show
notifyDataSetChanged()
}
}
override fun showDayNavigation(show: Boolean) {
binding.attendanceNavContainer.isVisible = show
}
override fun finishActionMode() {
actionMode?.finish()
}

View File

@ -174,6 +174,8 @@ class AttendancePresenter @Inject constructor(
view?.apply {
showExcuseCheckboxes(true)
showExcuseButton(false)
enableSwipe(false)
showDayNavigation(false)
}
attendanceToExcuseList.clear()
return true
@ -183,6 +185,8 @@ class AttendancePresenter @Inject constructor(
view?.apply {
showExcuseCheckboxes(false)
showExcuseButton(true)
enableSwipe(true)
showDayNavigation(true)
}
}

View File

@ -60,6 +60,8 @@ interface AttendanceView : BaseView {
fun showExcuseCheckboxes(show: Boolean)
fun showDayNavigation(show: Boolean)
fun finishActionMode()
fun popView()