From 2e05416fb5b5fd6f54705a2a217e434ebcc10ed9 Mon Sep 17 00:00:00 2001 From: Mateusz Idziejczak Date: Sun, 27 Sep 2020 16:33:36 +0200 Subject: [PATCH] Show groups next to subjects in timetable (#953) --- .../preferences/PreferencesRepository.kt | 3 +++ .../ui/modules/timetable/TimetableAdapter.kt | 5 ++++ .../ui/modules/timetable/TimetableFragment.kt | 3 ++- .../modules/timetable/TimetablePresenter.kt | 1 + .../ui/modules/timetable/TimetableView.kt | 2 +- app/src/main/res/layout/item_timetable.xml | 23 +++++++++++++++---- app/src/main/res/values-pl/strings.xml | 1 + .../main/res/values/preferences_defaults.xml | 1 + app/src/main/res/values/preferences_keys.xml | 1 + app/src/main/res/values/strings.xml | 1 + app/src/main/res/xml/scheme_preferences.xml | 6 +++++ 11 files changed, 41 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/preferences/PreferencesRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/preferences/PreferencesRepository.kt index fa12622ce..da31751a1 100644 --- a/app/src/main/java/io/github/wulkanowy/data/repositories/preferences/PreferencesRepository.kt +++ b/app/src/main/java/io/github/wulkanowy/data/repositories/preferences/PreferencesRepository.kt @@ -75,6 +75,9 @@ class PreferencesRepository @Inject constructor( val fillMessageContent: Boolean get() = getBoolean(R.string.pref_key_fill_message_content, R.bool.pref_default_fill_message_content) + val showGroupsInPlan: Boolean + get() = getBoolean(R.string.pref_key_timetable_show_groups, R.bool.pref_default_timetable_show_groups) + val showWholeClassPlan: String get() = getString(R.string.pref_key_timetable_show_whole_class, R.string.pref_default_timetable_show_whole_class) diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableAdapter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableAdapter.kt index 58be38cec..f049f828e 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableAdapter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableAdapter.kt @@ -41,6 +41,8 @@ class TimetableAdapter @Inject constructor() : RecyclerView.Adapter() @@ -99,6 +101,7 @@ class TimetableAdapter @Inject constructor() : RecyclerView.Adapter(R.layout.fragme else false } - override fun updateData(data: List, showWholeClassPlanType: String, showTimetableTimers: Boolean) { + override fun updateData(data: List, showWholeClassPlanType: String, showGroupsInPlanType: Boolean, showTimetableTimers: Boolean) { with(timetableAdapter) { items = data.toMutableList() showTimers = showTimetableTimers showWholeClassPlan = showWholeClassPlanType + showGroupsInPlan = showGroupsInPlanType notifyDataSetChanged() } } diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetablePresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetablePresenter.kt index 8581b73c6..f924650a0 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetablePresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetablePresenter.kt @@ -143,6 +143,7 @@ class TimetablePresenter @Inject constructor( view?.apply { updateData( showWholeClassPlanType = prefRepository.showWholeClassPlan, + showGroupsInPlanType = prefRepository.showGroupsInPlan, showTimetableTimers = prefRepository.showTimetableTimers, data = it.data!! .filter { item -> if (prefRepository.showWholeClassPlan == "no") item.isStudentPlan else true } diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableView.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableView.kt index fe34f1ee9..244120176 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableView.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableView.kt @@ -12,7 +12,7 @@ interface TimetableView : BaseView { fun initView() - fun updateData(data: List, showWholeClassPlanType: String, showTimetableTimers: Boolean) + fun updateData(data: List, showWholeClassPlanType: String, showGroupsInPlanType: Boolean, showTimetableTimers: Boolean) fun updateNavigationDay(date: String) diff --git a/app/src/main/res/layout/item_timetable.xml b/app/src/main/res/layout/item_timetable.xml index 4e278261a..ccef6e72d 100644 --- a/app/src/main/res/layout/item_timetable.xml +++ b/app/src/main/res/layout/item_timetable.xml @@ -74,7 +74,22 @@ app:layout_constraintBottom_toBottomOf="@+id/timetableItemNumber" app:layout_constraintStart_toEndOf="@+id/timetableItemTimeStart" tools:text="22" - tools:visibility="gone" /> + tools:visibility="visible" /> + + + tools:visibility="visible" /> diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 330174525..0923951ad 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -395,6 +395,7 @@ Motyw aplikacji Rozwiń oceny Oznaczaj bieżącą lekcję na planie + Pokazuj grupę obok przedmiotu na planie Pokazuj listę wykresów w ocenach klasy Pokazuj lekcje całej klasy Pokazuj przedmioty bez ocen w Oceny diff --git a/app/src/main/res/values/preferences_defaults.xml b/app/src/main/res/values/preferences_defaults.xml index d42cfc324..fb82e0ed6 100644 --- a/app/src/main/res/values/preferences_defaults.xml +++ b/app/src/main/res/values/preferences_defaults.xml @@ -18,6 +18,7 @@ 0.33 0.33 true + false no alphabetic false diff --git a/app/src/main/res/values/preferences_keys.xml b/app/src/main/res/values/preferences_keys.xml index e9f9054e0..0cfa485e3 100644 --- a/app/src/main/res/values/preferences_keys.xml +++ b/app/src/main/res/values/preferences_keys.xml @@ -22,6 +22,7 @@ fill_message_content grade_sorting_mode show_whole_class_plan + show_groups_in_plan timetable_show_timers homework_fullscreen subjects_without_grades diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 073e77385..bf4727be6 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -411,6 +411,7 @@ Application theme Expand grades Mark current lesson in timetable + Show groups next to subjects in timetable Show chart list in class grades Show whole class lessons Show subjects without grades in Grades diff --git a/app/src/main/res/xml/scheme_preferences.xml b/app/src/main/res/xml/scheme_preferences.xml index 99cb33669..3f24c787a 100644 --- a/app/src/main/res/xml/scheme_preferences.xml +++ b/app/src/main/res/xml/scheme_preferences.xml @@ -40,6 +40,12 @@ app:key="@string/pref_key_grade_statistics_list" app:singleLineTitle="false" app:title="@string/pref_view_grade_statistics_list" /> +