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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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()

View File

@ -1,14 +1,15 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".ui.modules.attendance.AttendanceFragment">
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="50dp">
android:layout_height="0dp"
android:layout_weight="1">
<com.google.android.material.progressindicator.CircularProgressIndicator
android:id="@+id/attendanceProgress"
@ -170,4 +171,4 @@
app:srcCompat="@drawable/ic_chevron_right"
app:tint="?colorPrimary" />
</io.github.wulkanowy.ui.widgets.MaterialLinearLayout>
</FrameLayout>
</LinearLayout>