[Settings] Add setting for showing teacher absences

This commit is contained in:
Kacper Ziubryniewicz 2019-10-02 12:52:39 +02:00
parent 0a578e9a28
commit 46d0459070
5 changed files with 54 additions and 31 deletions

1
.gitignore vendored
View File

@ -42,6 +42,7 @@ captures/
.idea/assetWizardSettings.xml .idea/assetWizardSettings.xml
.idea/dictionaries .idea/dictionaries
.idea/libraries .idea/libraries
.idea/copyright
# Android Studio 3 in .gitignore file. # Android Studio 3 in .gitignore file.
.idea/caches .idea/caches
.idea/modules.xml .idea/modules.xml

View File

@ -181,7 +181,7 @@ public class AgendaFragment extends Fragment {
)); ));
} }
if (app.profile.getStudentData("showTeacherAbsences", true)) {
List<TeacherAbsenceFull> teacherAbsenceList = app.db.teacherAbsenceDao().getAllFull(App.profileId); List<TeacherAbsenceFull> teacherAbsenceList = app.db.teacherAbsenceDao().getAllFull(App.profileId);
List<TeacherAbsenceCounter> teacherAbsenceCounters = new ArrayList<>(); List<TeacherAbsenceCounter> teacherAbsenceCounters = new ArrayList<>();
@ -219,6 +219,7 @@ public class AgendaFragment extends Fragment {
counter.getTeacherAbsenceCount() counter.getTeacherAbsenceCount()
)); ));
} }
}
List<EventFull> events = app.db.eventDao().getAllNow(App.profileId); List<EventFull> events = app.db.eventDao().getAllNow(App.profileId);

View File

@ -45,6 +45,7 @@ import pl.szczodrzynski.edziennik.BuildConfig;
import pl.szczodrzynski.edziennik.Notifier; import pl.szczodrzynski.edziennik.Notifier;
import pl.szczodrzynski.edziennik.R; import pl.szczodrzynski.edziennik.R;
import pl.szczodrzynski.edziennik.MainActivity; import pl.szczodrzynski.edziennik.MainActivity;
import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore;
import pl.szczodrzynski.edziennik.ui.modules.webpush.WebPushConfigActivity; import pl.szczodrzynski.edziennik.ui.modules.webpush.WebPushConfigActivity;
import pl.szczodrzynski.edziennik.ui.dialogs.changelog.ChangelogDialog; import pl.szczodrzynski.edziennik.ui.dialogs.changelog.ChangelogDialog;
import pl.szczodrzynski.edziennik.utils.models.Endpoint; import pl.szczodrzynski.edziennik.utils.models.Endpoint;
@ -1057,6 +1058,24 @@ public class SettingsNewFragment extends MaterialAboutFragment {
}) })
); );
if (app.profile.getLoginStoreType() == LoginStore.LOGIN_TYPE_LIBRUS) {
items.add(
new MaterialAboutSwitchItem(
getString(R.string.settings_register_show_teacher_absences_text),
null,
new IconicsDrawable(activity)
.icon(CommunityMaterial.Icon.cmd_account_arrow_right)
.size(IconicsSize.dp(iconSizeDp))
.color(IconicsColor.colorInt(iconColor))
)
.setChecked(app.profile.getStudentData("showTeacherAbsences", true))
.setOnChangeAction((isChecked, tag) -> {
app.profile.putStudentData("showTeacherAbsences", isChecked);
return true;
})
);
}
} }
return items; return items;
} }

View File

@ -854,4 +854,5 @@
<string name="agenda_teacher_absence">Absent teachers</string> <string name="agenda_teacher_absence">Absent teachers</string>
<string name="sync_action_syncing_grade_comments">Getting grade comments</string> <string name="sync_action_syncing_grade_comments">Getting grade comments</string>
<string name="sync_action_syncing_school_free_days">Getting school free days</string> <string name="sync_action_syncing_school_free_days">Getting school free days</string>
<string name="settings_register_show_teacher_absences_text">Show teacher absences</string>
</resources> </resources>

View File

@ -910,4 +910,5 @@
<string name="homework_no_data">Brak zadań domowych.</string> <string name="homework_no_data">Brak zadań domowych.</string>
<string name="agenda_teacher_absence">Nieobecni nauczyciele</string> <string name="agenda_teacher_absence">Nieobecni nauczyciele</string>
<string name="sync_action_syncing_grade_comments">Pobieranie komentarzy ocen</string> <string name="sync_action_syncing_grade_comments">Pobieranie komentarzy ocen</string>
<string name="settings_register_show_teacher_absences_text">Pokazuj nieobecności nauczycieli</string>
</resources> </resources>