mirror of
https://github.com/wulkanowy/wulkanowy.git
synced 2025-01-18 21:06:45 -06:00
Add option to hide present in attendance (#96)
This commit is contained in:
parent
89350e5793
commit
cb2d4a905d
@ -19,6 +19,8 @@ public interface SharedPrefContract {
|
||||
|
||||
boolean isShowGradesSummary();
|
||||
|
||||
boolean isShowAttendancePresent();
|
||||
|
||||
int getServicesInterval();
|
||||
|
||||
boolean isMobileDisable();
|
||||
|
@ -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"));
|
||||
|
@ -93,6 +93,7 @@ public class AttendanceTabPresenter extends BasePresenter<AttendanceTabContract.
|
||||
@Override
|
||||
public void onDoInBackgroundLoading() throws Exception {
|
||||
Week week = getRepository().getDbRepo().getWeek(date);
|
||||
boolean isShowPresent = getRepository().getSharedRepo().isShowAttendancePresent();
|
||||
|
||||
if (week == null || !week.getAttendanceSynced()) {
|
||||
syncData();
|
||||
@ -118,10 +119,18 @@ public class AttendanceTabPresenter extends BasePresenter<AttendanceTabContract.
|
||||
List<AttendanceSubItem> 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);
|
||||
|
@ -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";
|
||||
|
@ -124,6 +124,8 @@
|
||||
<string name="pref_view_header">Widok</string>
|
||||
<string name="pref_tab_list">Domyślny widok</string>
|
||||
<string name="pref_grades_summary_line_show">Pokazuj podsumowanie w ocenach</string>
|
||||
<string name="pref_attendance_present_show">Pokazuj obecność we frekwencji</string>
|
||||
<string name="required_restart">Wymagany restart</string>
|
||||
|
||||
<string name="pref_notify_header">Powiadomienia</string>
|
||||
<string name="pref_notify_switch">Pokazuj powiadomienia</string>
|
||||
|
@ -119,6 +119,8 @@
|
||||
<string name="pref_view_header">View</string>
|
||||
<string name="pref_tab_list">Default view after startup</string>
|
||||
<string name="pref_grades_summary_line_show">Show summary in grades</string>
|
||||
<string name="pref_attendance_present_show">Show present in attendance</string>
|
||||
<string name="required_restart">Required restart</string>
|
||||
|
||||
<string name="pref_notify_header">Notifications</string>
|
||||
<string name="pref_notify_switch">Show the notifications</string>
|
||||
|
@ -11,7 +11,13 @@
|
||||
<SwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="grades_summary"
|
||||
android:title="@string/pref_grades_summary_line_show"/>
|
||||
android:title="@string/pref_grades_summary_line_show"
|
||||
android:summary="@string/required_restart" />
|
||||
<SwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="attendance_present"
|
||||
android:title="@string/pref_attendance_present_show"
|
||||
android:summary="@string/required_restart" />
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:title="@string/pref_services_header">
|
||||
<SwitchPreference
|
||||
|
Loading…
x
Reference in New Issue
Block a user