Show subjects without grades in "Grades"
MODIFY
app/src/main/java/io/github/wulkanowy/data/repositories/preferences/PreferencesRepository.kt
app/src/main/java/io/github/wulkanowy/data/repositories/preferences/PreferencesRepository.kt
@@ -80,6 +80,9 @@ class PreferencesRepository @Inject constructor(
val showTimetableTimers: Boolean
get() = getBoolean(R.string.pref_key_timetable_show_timers, R.bool.pref_default_timetable_show_timers)
+ val showSubjectsWithoutGrades: Boolean
+ get() = getBoolean(R.string.pref_key_subjects_without_grades, R.bool.pref_default_subjects_without_grades)
+
private fun getString(id: Int, default: Int) = getString(context.getString(id), default)
private fun getString(id: String, default: Int) = sharedPref.getString(id, context.getString(default)) ?: context.getString(default)

MODIFY
app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsPresenter.kt
app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsPresenter.kt
@@ -186,7 +186,7 @@ class GradeDetailsPresenter @Inject constructor(
private fun createGradeItems(items: List<GradeDetailsWithAverage>): List<GradeDetailsItem> {
return items
- .filter { it.grades.isNotEmpty() }
+ .let { if (!preferencesRepository.showSubjectsWithoutGrades) it.filter { it.grades.isNotEmpty() } else it.filter { true }}
.sortedBy { it.subject }
.map { (subject, average, points, _, grades) ->
val subItems = grades

MODIFY
app/src/main/res/values/preferences_defaults.xml
app/src/main/res/values/preferences_defaults.xml
<bool name="pref_default_fill_message_content">true</bool>
<string name="pref_default_timetable_show_whole_class">no</string>
<bool name="pref_default_timetable_show_timers">false</bool>
+ <bool name="pref_default_subjects_without_grades">false</bool>
</resources>

MODIFY
app/src/main/res/values/preferences_keys.xml
app/src/main/res/values/preferences_keys.xml
<string name="pref_key_fill_message_content">fill_message_content</string>
<string name="pref_key_timetable_show_whole_class">show_whole_class_plan</string>
<string name="pref_key_timetable_show_timers">timetable_show_timers</string>
+ <string name="pref_key_subjects_without_grades">subjects_without_grades</string>
</resources>

MODIFY
app/src/main/res/values/strings.xml
app/src/main/res/values/strings.xml
<string name="pref_view_timetable_show_timers">Mark current lesson in timetable</string>
<string name="pref_view_grade_statistics_list">Show chart list in class grades</string>
<string name="pref_view_timetable_show_whole_class">Show whole class lessons</string>
+ <string name="pref_view_subjects_without_grades">Show subjects without grades in Grades</string>
<string name="pref_view_grade_color_scheme">Grades color scheme</string>
<string name="pref_view_app_language">App language</string>

MODIFY
app/src/main/res/xml/scheme_preferences.xml
app/src/main/res/xml/scheme_preferences.xml
app:key="@string/pref_key_grade_statistics_list"
app:singleLineTitle="false"
app:title="@string/pref_view_grade_statistics_list" />
+ <SwitchPreferenceCompat
+ app:defaultValue="@bool/pref_default_subjects_without_grades"
+ app:iconSpaceReserved="false"
+ app:key="@string/pref_key_subjects_without_grades"
+ app:singleLineTitle="false"
+ app:title="@string/pref_view_subjects_without_grades" />
<ListPreference
app:defaultValue="@string/pref_default_timetable_show_whole_class"
app:entries="@array/timetable_show_whole_class_entries"

Show subjects without grades in "Grades" (#947)