diff --git a/app/src/main/java/io/github/wulkanowy/data/db/shared/SharedPrefContract.java b/app/src/main/java/io/github/wulkanowy/data/db/shared/SharedPrefContract.java index 48e2b1937..b9d3fd14c 100644 --- a/app/src/main/java/io/github/wulkanowy/data/db/shared/SharedPrefContract.java +++ b/app/src/main/java/io/github/wulkanowy/data/db/shared/SharedPrefContract.java @@ -19,6 +19,8 @@ public interface SharedPrefContract { boolean isShowGradesSummary(); + boolean isShowAttendancePresent(); + int getServicesInterval(); boolean isMobileDisable(); diff --git a/app/src/main/java/io/github/wulkanowy/data/db/shared/SharedPrefRepository.java b/app/src/main/java/io/github/wulkanowy/data/db/shared/SharedPrefRepository.java index 35d30ae6c..484af3d1e 100644 --- a/app/src/main/java/io/github/wulkanowy/data/db/shared/SharedPrefRepository.java +++ b/app/src/main/java/io/github/wulkanowy/data/db/shared/SharedPrefRepository.java @@ -65,6 +65,11 @@ public class SharedPrefRepository implements SharedPrefContract { return settingsSharedPref.getBoolean(SettingsFragment.SHARED_KEY_GRADES_SUMMARY, false); } + @Override + public boolean isShowAttendancePresent() { + return settingsSharedPref.getBoolean(SettingsFragment.SHARED_KEY_ATTENDANCE_PRESENT, false); + } + @Override public int getServicesInterval() { return Integer.parseInt(settingsSharedPref.getString(SettingsFragment.SHARED_KEY_SERVICES_INTERVAL, "60")); diff --git a/app/src/main/java/io/github/wulkanowy/ui/main/attendance/AttendanceTabPresenter.java b/app/src/main/java/io/github/wulkanowy/ui/main/attendance/AttendanceTabPresenter.java index effc38bc0..5731cbb39 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/main/attendance/AttendanceTabPresenter.java +++ b/app/src/main/java/io/github/wulkanowy/ui/main/attendance/AttendanceTabPresenter.java @@ -93,6 +93,7 @@ public class AttendanceTabPresenter extends BasePresenter subItems = new ArrayList<>(); for (AttendanceLesson lesson : lessonList) { + if (!isShowPresent && lesson.getPresence()) { + continue; + } + lesson.setDescription(getRepository().getResRepo().getAttendanceLessonDescription(lesson)); subItems.add(new AttendanceSubItem(headerItem, lesson)); } + if (!isShowPresent && subItems.isEmpty()) { + continue; + } + headerItem.setSubItems(subItems); headerItem.setExpanded(false); headerItems.add(headerItem); diff --git a/app/src/main/java/io/github/wulkanowy/ui/main/settings/SettingsFragment.java b/app/src/main/java/io/github/wulkanowy/ui/main/settings/SettingsFragment.java index 0359bacaa..8b53f0773 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/main/settings/SettingsFragment.java +++ b/app/src/main/java/io/github/wulkanowy/ui/main/settings/SettingsFragment.java @@ -14,6 +14,8 @@ public class SettingsFragment extends PreferenceFragmentCompat public static final String SHARED_KEY_GRADES_SUMMARY = "grades_summary"; + public static final String SHARED_KEY_ATTENDANCE_PRESENT = "attendance_present"; + public static final String SHARED_KEY_SERVICES_ENABLE = "services_enable"; public static final String SHARED_KEY_NOTIFY_ENABLE = "notify_enable"; diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 65fc4f4ca..0b3236293 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -124,6 +124,8 @@ Widok Domyślny widok Pokazuj podsumowanie w ocenach + Pokazuj obecność we frekwencji + Wymagany restart Powiadomienia Pokazuj powiadomienia diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 019601a3f..12ad9898a 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -119,6 +119,8 @@ View Default view after startup Show summary in grades + Show present in attendance + Required restart Notifications Show the notifications diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index bc4f81304..b620e2990 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -11,7 +11,13 @@ + android:title="@string/pref_grades_summary_line_show" + android:summary="@string/required_restart" /> +