Change text when there are no lessons today and tomorrow in dashboard (#1571)

This commit is contained in:
Damian Czupryn 2021-10-09 17:36:22 +02:00 committed by GitHub
parent 2ab0a57a41
commit 4e69cfe23c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 2 deletions

View File

@ -301,26 +301,31 @@ class DashboardAdapter @Inject constructor() : RecyclerView.Adapter<RecyclerView
dateToNavigate = currentDate
updateLessonView(item, currentTimetable, binding)
binding.dashboardLessonsItemTitleTomorrow.isVisible = false
binding.dashboardLessonsItemTitleTodayAndTomorrow.isVisible = false
}
tomorrowTimetable.isNotEmpty() -> {
dateToNavigate = tomorrowDate
updateLessonView(item, tomorrowTimetable, binding)
binding.dashboardLessonsItemTitleTomorrow.isVisible = true
binding.dashboardLessonsItemTitleTodayAndTomorrow.isVisible = false
}
currentDayHeader != null && currentDayHeader.content.isNotBlank() -> {
dateToNavigate = currentDate
updateLessonView(item, emptyList(), binding, currentDayHeader)
binding.dashboardLessonsItemTitleTomorrow.isVisible = false
binding.dashboardLessonsItemTitleTodayAndTomorrow.isVisible = false
}
tomorrowDayHeader != null && tomorrowDayHeader.content.isNotBlank() -> {
dateToNavigate = tomorrowDate
updateLessonView(item, emptyList(), binding, tomorrowDayHeader)
binding.dashboardLessonsItemTitleTomorrow.isVisible = true
binding.dashboardLessonsItemTitleTodayAndTomorrow.isVisible = false
}
else -> {
dateToNavigate = tomorrowDate
dateToNavigate = currentDate
updateLessonView(item, emptyList(), binding)
binding.dashboardLessonsItemTitleTomorrow.isVisible =
binding.dashboardLessonsItemTitleTomorrow.isVisible = false
binding.dashboardLessonsItemTitleTodayAndTomorrow.isVisible =
!(item.isLoading && item.error == null)
}
}

View File

@ -42,6 +42,19 @@
app:layout_constraintBottom_toBottomOf="@id/dashboard_lessons_item_title"
app:layout_constraintStart_toEndOf="@id/dashboard_lessons_item_title" />
<TextView
android:id="@+id/dashboard_lessons_item_title_today_and_tomorrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:text="@string/dashboard_timetable_title_today_and_tomorrow"
android:textColor="?colorOnSurface"
android:textSize="14sp"
tools:visibility="invisible"
app:layout_constraintBaseline_toBaselineOf="@id/dashboard_lessons_item_title"
app:layout_constraintBottom_toBottomOf="@id/dashboard_lessons_item_title"
app:layout_constraintStart_toEndOf="@id/dashboard_lessons_item_title" />
<TextView
android:id="@+id/dashboard_lessons_item_first_title"
android:layout_width="wrap_content"

View File

@ -504,6 +504,7 @@
<!--Dashboard-->
<string name="dashboard_timetable_title">Lessons</string>
<string name="dashboard_timetable_title_tomorrow">(Tomorrow)</string>
<string name="dashboard_timetable_title_today_and_tomorrow">(Today and tomorrow)</string>
<string name="dashboard_timetable_first_lesson_title_moment">In a moment:</string>
<string name="dashboard_timetable_first_lesson_title_soon">Soon:</string>
<string name="dashboard_timetable_first_lesson_title_first">First:</string>