diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/MainActivity.kt b/app/src/main/java/pl/szczodrzynski/edziennik/MainActivity.kt index 7e43c292..4995f873 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/MainActivity.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/MainActivity.kt @@ -56,20 +56,20 @@ import pl.szczodrzynski.edziennik.ui.modules.messages.MessagesFragment import pl.szczodrzynski.edziennik.utils.models.NavTarget import pl.szczodrzynski.edziennik.network.ServerRequest import pl.szczodrzynski.edziennik.sync.SyncJob -import pl.szczodrzynski.edziennik.ui.modules.agenda.RegisterAgendaDefaultFragment -import pl.szczodrzynski.edziennik.ui.modules.announcements.RegisterAnnouncementsFragment -import pl.szczodrzynski.edziennik.ui.modules.attendance.RegisterAttendancesFragment +import pl.szczodrzynski.edziennik.ui.modules.agenda.AgendaDefaultFragment +import pl.szczodrzynski.edziennik.ui.modules.announcements.AnnouncementsFragment +import pl.szczodrzynski.edziennik.ui.modules.attendance.AttendanceFragment import pl.szczodrzynski.edziennik.ui.modules.base.DebugFragment import pl.szczodrzynski.edziennik.ui.modules.base.FeedbackFragment import pl.szczodrzynski.edziennik.ui.modules.base.HelpFragment import pl.szczodrzynski.edziennik.ui.modules.grades.editor.GradesEditorFragment -import pl.szczodrzynski.edziennik.ui.modules.grades.RegisterGradesFragment +import pl.szczodrzynski.edziennik.ui.modules.grades.GradesFragment import pl.szczodrzynski.edziennik.ui.modules.home.HomeFragment -import pl.szczodrzynski.edziennik.ui.modules.notices.RegisterNoticesFragment -import pl.szczodrzynski.edziennik.ui.modules.notifications.RegisterNotificationsFragment +import pl.szczodrzynski.edziennik.ui.modules.behaviour.BehaviourFragment +import pl.szczodrzynski.edziennik.ui.modules.notifications.NotificationsFragment import pl.szczodrzynski.edziennik.ui.modules.settings.ProfileManagerFragment import pl.szczodrzynski.edziennik.ui.modules.settings.SettingsNewFragment -import pl.szczodrzynski.edziennik.ui.modules.timetable.RegisterTimetableFragment +import pl.szczodrzynski.edziennik.ui.modules.timetable.TimetableFragment import pl.szczodrzynski.edziennik.utils.SwipeRefreshLayoutNoTouch import pl.szczodrzynski.edziennik.utils.Utils import pl.szczodrzynski.navlib.bottomsheet.items.BottomSheetPrimaryItem @@ -98,8 +98,8 @@ class MainActivity : AppCompatActivity() { const val DRAWER_ITEM_GRADES = 13 const val DRAWER_ITEM_MESSAGES = 17 const val DRAWER_ITEM_HOMEWORK = 14 - const val DRAWER_ITEM_NOTICES = 15 - const val DRAWER_ITEM_ATTENDANCES = 16 + const val DRAWER_ITEM_BEHAVIOUR = 15 + const val DRAWER_ITEM_ATTENDANCE = 16 const val DRAWER_ITEM_ANNOUNCEMENTS = 18 const val DRAWER_ITEM_NOTIFICATIONS = 20 const val DRAWER_ITEM_SETTINGS = 101 @@ -123,17 +123,17 @@ class MainActivity : AppCompatActivity() { .isStatic(true) .withPopToHome(false) - list += NavTarget(DRAWER_ITEM_TIMETABLE, R.string.menu_timetable, RegisterTimetableFragment::class) + list += NavTarget(DRAWER_ITEM_TIMETABLE, R.string.menu_timetable, TimetableFragment::class) .withIcon(CommunityMaterial.Icon2.cmd_timetable) .withBadgeTypeId(TYPE_LESSON_CHANGE) .isInDrawer(true) - list += NavTarget(DRAWER_ITEM_AGENDA, R.string.menu_agenda, RegisterAgendaDefaultFragment::class) + list += NavTarget(DRAWER_ITEM_AGENDA, R.string.menu_agenda, AgendaDefaultFragment::class) .withIcon(CommunityMaterial.Icon.cmd_calendar) .withBadgeTypeId(TYPE_EVENT) .isInDrawer(true) - list += NavTarget(DRAWER_ITEM_GRADES, R.string.menu_grades, RegisterGradesFragment::class) + list += NavTarget(DRAWER_ITEM_GRADES, R.string.menu_grades, GradesFragment::class) .withIcon(CommunityMaterial.Icon2.cmd_numeric_5_box) .withBadgeTypeId(TYPE_GRADE) .isInDrawer(true) @@ -148,24 +148,24 @@ class MainActivity : AppCompatActivity() { .withBadgeTypeId(TYPE_HOMEWORK) .isInDrawer(true) - list += NavTarget(DRAWER_ITEM_NOTICES, R.string.menu_notices, RegisterNoticesFragment::class) + list += NavTarget(DRAWER_ITEM_BEHAVIOUR, R.string.menu_notices, BehaviourFragment::class) .withIcon(CommunityMaterial.Icon2.cmd_message_alert) .withBadgeTypeId(TYPE_NOTICE) .isInDrawer(true) - list += NavTarget(DRAWER_ITEM_ATTENDANCES, R.string.menu_attendances, RegisterAttendancesFragment::class) + list += NavTarget(DRAWER_ITEM_ATTENDANCE, R.string.menu_attendance, AttendanceFragment::class) .withIcon(CommunityMaterial.Icon.cmd_calendar_remove) .withBadgeTypeId(TYPE_ATTENDANCE) .isInDrawer(true) - list += NavTarget(DRAWER_ITEM_ANNOUNCEMENTS, R.string.menu_announcements, RegisterAnnouncementsFragment::class) + list += NavTarget(DRAWER_ITEM_ANNOUNCEMENTS, R.string.menu_announcements, AnnouncementsFragment::class) .withIcon(CommunityMaterial.Icon.cmd_bulletin_board) .withBadgeTypeId(TYPE_ANNOUNCEMENT) .isInDrawer(true) // static drawer items - list += NavTarget(DRAWER_ITEM_NOTIFICATIONS, R.string.menu_notifications, RegisterNotificationsFragment::class) + list += NavTarget(DRAWER_ITEM_NOTIFICATIONS, R.string.menu_notifications, NotificationsFragment::class) .withIcon(CommunityMaterial.Icon.cmd_bell_ring) .isInDrawer(true) .isStatic(true) @@ -537,8 +537,8 @@ class MainActivity : AppCompatActivity() { DRAWER_ITEM_AGENDA -> FEATURE_AGENDA DRAWER_ITEM_GRADES -> FEATURE_GRADES DRAWER_ITEM_HOMEWORK -> FEATURE_HOMEWORK - DRAWER_ITEM_NOTICES -> FEATURE_NOTICES - DRAWER_ITEM_ATTENDANCES -> FEATURE_ATTENDANCES + DRAWER_ITEM_BEHAVIOUR -> FEATURE_NOTICES + DRAWER_ITEM_ATTENDANCE -> FEATURE_ATTENDANCE DRAWER_ITEM_MESSAGES -> when (MessagesFragment.pageSelection) { 1 -> FEATURE_MESSAGES_OUTBOX else -> FEATURE_MESSAGES_INBOX @@ -553,8 +553,8 @@ class MainActivity : AppCompatActivity() { DRAWER_ITEM_AGENDA -> R.string.sync_feature_agenda DRAWER_ITEM_GRADES -> R.string.sync_feature_grades DRAWER_ITEM_HOMEWORK -> R.string.sync_feature_homework - DRAWER_ITEM_NOTICES -> R.string.sync_feature_notices - DRAWER_ITEM_ATTENDANCES -> R.string.sync_feature_attendances + DRAWER_ITEM_BEHAVIOUR -> R.string.sync_feature_notices + DRAWER_ITEM_ATTENDANCE -> R.string.sync_feature_attendance DRAWER_ITEM_MESSAGES -> when (MessagesFragment.pageSelection) { 1 -> R.string.sync_feature_messages_outbox else -> R.string.sync_feature_messages_inbox diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Edziennik.java b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Edziennik.java index 1e18057d..99ab1a4b 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Edziennik.java +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Edziennik.java @@ -84,7 +84,7 @@ import static pl.szczodrzynski.edziennik.data.api.AppError.stringErrorType; import static pl.szczodrzynski.edziennik.data.api.interfaces.EdziennikInterface.FEATURE_AGENDA; import static pl.szczodrzynski.edziennik.data.api.interfaces.EdziennikInterface.FEATURE_ALL; import static pl.szczodrzynski.edziennik.data.api.interfaces.EdziennikInterface.FEATURE_ANNOUNCEMENTS; -import static pl.szczodrzynski.edziennik.data.api.interfaces.EdziennikInterface.FEATURE_ATTENDANCES; +import static pl.szczodrzynski.edziennik.data.api.interfaces.EdziennikInterface.FEATURE_ATTENDANCE; import static pl.szczodrzynski.edziennik.data.api.interfaces.EdziennikInterface.FEATURE_GRADES; import static pl.szczodrzynski.edziennik.data.api.interfaces.EdziennikInterface.FEATURE_HOMEWORK; import static pl.szczodrzynski.edziennik.data.api.interfaces.EdziennikInterface.FEATURE_MESSAGES_INBOX; @@ -354,7 +354,7 @@ public class Edziennik { app.notifier.add(new Notification(app.getContext(), text) .withProfileData(profile.getId(), profile.getName()) .withType(Notification.TYPE_NEW_NOTICE) - .withFragmentRedirect(MainActivity.DRAWER_ITEM_NOTICES) + .withFragmentRedirect(MainActivity.DRAWER_ITEM_BEHAVIOUR) .withLongExtra("noticeId", notice.id) .withAddedDate(notice.addedDate) ); @@ -382,7 +382,7 @@ public class Edziennik { app.notifier.add(new Notification(app.getContext(), text) .withProfileData(profile.getId(), profile.getName()) .withType(Notification.TYPE_NEW_ATTENDANCE) - .withFragmentRedirect(MainActivity.DRAWER_ITEM_ATTENDANCES) + .withFragmentRedirect(MainActivity.DRAWER_ITEM_ATTENDANCE) .withLongExtra("attendanceId", attendance.id) .withAddedDate(attendance.addedDate) ); @@ -849,7 +849,7 @@ public class Edziennik { app.getString(R.string.menu_grades), app.getString(R.string.menu_homework), app.getString(R.string.menu_notices), - app.getString(R.string.menu_attendances), + app.getString(R.string.menu_attendance), app.getString(R.string.title_messages_inbox_single), app.getString(R.string.title_messages_sent_single), app.getString(R.string.menu_announcements) @@ -860,7 +860,7 @@ public class Edziennik { FEATURE_GRADES, FEATURE_HOMEWORK, FEATURE_NOTICES, - FEATURE_ATTENDANCES, + FEATURE_ATTENDANCE, FEATURE_MESSAGES_INBOX, FEATURE_MESSAGES_OUTBOX, FEATURE_ANNOUNCEMENTS diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Iuczniowie.java b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Iuczniowie.java index 83b8a8e9..33c69671 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Iuczniowie.java +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Iuczniowie.java @@ -200,7 +200,7 @@ public class Iuczniowie implements EdziennikInterface { targetEndpoints.add("Exams"); targetEndpoints.add("Notices"); targetEndpoints.add("Announcements"); - targetEndpoints.add("Attendances"); + targetEndpoints.add("Attendance"); targetEndpoints.add("MessagesInbox"); targetEndpoints.add("MessagesOutbox"); targetEndpoints.add("Finish"); @@ -241,8 +241,8 @@ public class Iuczniowie implements EdziennikInterface { case FEATURE_NOTICES: targetEndpoints.add("Notices"); break; - case FEATURE_ATTENDANCES: - targetEndpoints.add("Attendances"); + case FEATURE_ATTENDANCE: + targetEndpoints.add("Attendance"); break; case FEATURE_MESSAGES_INBOX: targetEndpoints.add("MessagesInbox"); @@ -300,9 +300,9 @@ public class Iuczniowie implements EdziennikInterface { } } - this.attendancesMonth = today.month; - this.attendancesYear = today.year; - this.attendancesPrevMonthChecked = false; + this.attendanceMonth = today.month; + this.attendanceYear = today.year; + this.attendancePrevMonthChecked = false; this.examsMonth = today.month; this.examsYear = today.year; this.examsMonthsChecked = 0; @@ -352,8 +352,8 @@ public class Iuczniowie implements EdziennikInterface { case "Announcements": getAnnouncements(); break; - case "Attendances": - getAttendances(); + case "Attendance": + getAttendance(); break; case "MessagesInbox": getMessagesInbox(); @@ -1196,17 +1196,17 @@ public class Iuczniowie implements EdziennikInterface { }); } - private int attendancesYear; - private int attendancesMonth; - private boolean attendancesPrevMonthChecked = false; - private void getAttendances() { - callback.onActionStarted(R.string.sync_action_syncing_attendances); + private int attendanceYear; + private int attendanceMonth; + private boolean attendancePrevMonthChecked = false; + private void getAttendance() { + callback.onActionStarted(R.string.sync_action_syncing_attendance); apiRequest(Request.builder() .url(IDZIENNIK_URL +"/mod_panelRodzica/obecnosci/WS_obecnosciUcznia.asmx/pobierzObecnosciUcznia") .userAgent(userAgent) .addParameter("idPozDziennika", loginRegisterId) - .addParameter("mc", attendancesMonth) - .addParameter("rok", attendancesYear) + .addParameter("mc", attendanceMonth) + .addParameter("rok", attendanceYear) .addParameter("dataTygodnia", "") .postJson(), (result, response) -> { JsonObject data = result.getAsJsonObject("d"); @@ -1281,25 +1281,25 @@ public class Iuczniowie implements EdziennikInterface { } } - int attendancesDateValue = attendancesYear*10000 + attendancesMonth*100; - if (profile.getEmpty() && attendancesDateValue > profile.getSemesterStart(1).getValue()) { - attendancesPrevMonthChecked = true; // do not need to check prev month later - attendancesMonth--; - if (attendancesMonth < 1) { - attendancesMonth = 12; - attendancesYear--; + int attendanceDateValue = attendanceYear *10000 + attendanceMonth *100; + if (profile.getEmpty() && attendanceDateValue > profile.getSemesterStart(1).getValue()) { + attendancePrevMonthChecked = true; // do not need to check prev month later + attendanceMonth--; + if (attendanceMonth < 1) { + attendanceMonth = 12; + attendanceYear--; } - r("get", "Attendances"); - } else if (!attendancesPrevMonthChecked /* get also the previous month */) { - attendancesMonth--; - if (attendancesMonth < 1) { - attendancesMonth = 12; - attendancesYear--; + r("get", "Attendance"); + } else if (!attendancePrevMonthChecked /* get also the previous month */) { + attendanceMonth--; + if (attendanceMonth < 1) { + attendanceMonth = 12; + attendanceYear--; } - attendancesPrevMonthChecked = true; - r("get", "Attendances"); + attendancePrevMonthChecked = true; + r("get", "Attendance"); } else { - r("finish", "Attendances"); + r("finish", "Attendance"); } }); } diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Librus.java b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Librus.java index 83bda4b6..aa7f635f 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Librus.java +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Librus.java @@ -297,8 +297,8 @@ public class Librus implements EdziennikInterface { targetEndpoints.add("Homework"); targetEndpoints.add("LuckyNumbers"); targetEndpoints.add("Notices"); - targetEndpoints.add("AttendancesTypes"); - targetEndpoints.add("Attendances"); + targetEndpoints.add("AttendanceTypes"); + targetEndpoints.add("Attendance"); targetEndpoints.add("Announcements"); targetEndpoints.add("PtMeetings"); @@ -371,9 +371,9 @@ public class Librus implements EdziennikInterface { case FEATURE_NOTICES: targetEndpoints.add("Notices"); break; - case FEATURE_ATTENDANCES: - targetEndpoints.add("AttendancesTypes"); - targetEndpoints.add("Attendances"); + case FEATURE_ATTENDANCE: + targetEndpoints.add("AttendanceTypes"); + targetEndpoints.add("Attendance"); break; case FEATURE_MESSAGES_INBOX: if (!hasMessagesLogin) { @@ -527,11 +527,11 @@ public class Librus implements EdziennikInterface { case "Notices": getNotices(); break; - case "AttendancesTypes": - getAttendancesTypes(); + case "AttendanceTypes": + getAttendanceTypes(); break; - case "Attendances": - getAttendances(); + case "Attendance": + getAttendance(); break; case "Announcements": getAnnouncements(); @@ -2888,11 +2888,11 @@ public class Librus implements EdziennikInterface { } private SparseArray> attendanceTypes = new SparseArray<>(); - private void getAttendancesTypes() { + private void getAttendanceTypes() { callback.onActionStarted(R.string.sync_action_syncing_attendance_types); apiRequest("Attendances/Types", data -> { if (data == null) { - r("finish", "AttendancesTypes"); + r("finish", "AttendanceTypes"); return; } try { @@ -2907,7 +2907,7 @@ public class Librus implements EdziennikInterface { ) ); } - r("finish", "AttendancesTypes"); + r("finish", "AttendanceTypes"); } catch (Exception e) { finishWithError(new AppError(TAG, 2782, CODE_OTHER, e, data)); @@ -2915,18 +2915,18 @@ public class Librus implements EdziennikInterface { }); } - private void getAttendances() { - callback.onActionStarted(R.string.sync_action_syncing_attendances); + private void getAttendance() { + callback.onActionStarted(R.string.sync_action_syncing_attendance); apiRequest("Attendances"+(fullSync ? "" : "?dateFrom="+ Date.getToday().stepForward(0, -1, 0).getStringY_m_d()), data -> { if (data == null) { - r("finish", "Attendances"); + r("finish", "Attendance"); return; } try { - JsonArray jAttendances = data.get("Attendances").getAsJsonArray(); + JsonArray jAttendance = data.get("Attendances").getAsJsonArray(); - for (JsonElement attendanceEl : jAttendances) { + for (JsonElement attendanceEl : jAttendance) { JsonObject attendance = attendanceEl.getAsJsonObject(); int type = attendance.getAsJsonObject("Type").get("Id").getAsInt(); @@ -2992,7 +2992,7 @@ public class Librus implements EdziennikInterface { metadataList.add(new Metadata(profileId, Metadata.TYPE_ATTENDANCE, attendanceObject.id, profile.getEmpty(), profile.getEmpty(), addedDate)); } } - r("finish", "Attendances"); + r("finish", "Attendance"); } catch (Exception e) { finishWithError(new AppError(TAG, 2872, CODE_OTHER, e, data)); @@ -3380,7 +3380,7 @@ public class Librus implements EdziennikInterface { configurableEndpoints.put("Homework", new Endpoint("Homework",true, false, profile.getChangedEndpoints())); configurableEndpoints.put("LuckyNumbers", new Endpoint("LuckyNumbers",true, false, profile.getChangedEndpoints())); configurableEndpoints.put("Notices", new Endpoint("Notices",true, false, profile.getChangedEndpoints())); - configurableEndpoints.put("Attendances", new Endpoint("Attendances",true, false, profile.getChangedEndpoints())); + configurableEndpoints.put("Attendance", new Endpoint("Attendance",true, false, profile.getChangedEndpoints())); configurableEndpoints.put("Announcements", new Endpoint("Announcements",true, true, profile.getChangedEndpoints())); configurableEndpoints.put("PtMeetings", new Endpoint("PtMeetings",true, true, profile.getChangedEndpoints())); configurableEndpoints.put("TeacherFreeDays", new Endpoint("TeacherFreeDays",false, false, profile.getChangedEndpoints())); diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Mobidziennik.java b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Mobidziennik.java index c8c6b52e..4a3d191f 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Mobidziennik.java +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Mobidziennik.java @@ -150,7 +150,7 @@ public class Mobidziennik implements EdziennikInterface { private String loginPassword = null; private int studentId = -1; - private long attendancesLastSync = 0; + private long attendanceLastSync = 0; private boolean prepare(@NonNull Context activityContext, @NonNull SyncCallback callback, int profileId, @Nullable Profile profile, @NonNull LoginStore loginStore) { this.activityContext = activityContext; @@ -171,7 +171,7 @@ public class Mobidziennik implements EdziennikInterface { return false; } this.studentId = profile == null ? -1 : profile.getStudentData("studentId", -1); - this.attendancesLastSync = profile == null ? 0 : profile.getStudentData("attendancesLastSync", (long)0); + this.attendanceLastSync = profile == null ? 0 : profile.getStudentData("attendanceLastSync", (long)0); fakeLogin = BuildConfig.DEBUG && loginUsername.toLowerCase().startsWith("fake"); teamList = profileId == -1 ? new ArrayList<>() : app.db.teamDao().getAllNow(profileId); @@ -204,7 +204,7 @@ public class Mobidziennik implements EdziennikInterface { targetEndpoints = new ArrayList<>(); targetEndpoints.add("GetData"); targetEndpoints.add("ProcessData"); - targetEndpoints.add("Attendances"); + targetEndpoints.add("Attendance"); targetEndpoints.add("ClassCalendar"); targetEndpoints.add("GradeDetails"); targetEndpoints.add("NoticeDetails"); @@ -256,8 +256,8 @@ public class Mobidziennik implements EdziennikInterface { case FEATURE_NOTICES: targetEndpoints.add("NoticeDetails"); break; - case FEATURE_ATTENDANCES: - targetEndpoints.add("Attendances"); + case FEATURE_ATTENDANCE: + targetEndpoints.add("Attendance"); break; case FEATURE_MESSAGES_INBOX: targetEndpoints.add("MessagesInbox"); @@ -314,8 +314,8 @@ public class Mobidziennik implements EdziennikInterface { case "NoticeDetails": getNoticeDetails(); break; - case "Attendances": - getAttendances(); + case "Attendance": + getAttendance(); break; case "Messages": getAllMessages(); @@ -597,7 +597,7 @@ public class Mobidziennik implements EdziennikInterface { processLessons(table); } if (i == 16) { - processAttendances(table); + processAttendance(table); } if (i == 17) { processNotices(table); @@ -1051,20 +1051,20 @@ public class Mobidziennik implements EdziennikInterface { this.lessonId = lessonId; } } - private Date attendancesCheckDate = Week.getWeekStart(); - private void getAttendances() { - r("finish", "Attendances"); - // TODO: 2019-09-10 please download attendances from /dziennik/frekwencja. /mobile does not work above v13.0 + private Date attendanceCheckDate = Week.getWeekStart(); + private void getAttendance() { + r("finish", "Attendance"); + // TODO: 2019-09-10 please download attendance from /dziennik/frekwencja. /mobile does not work above v13.0 if (true) { return; } - callback.onActionStarted(R.string.sync_action_syncing_attendances); - d(TAG, "Get attendances for week "+attendancesCheckDate.getStringY_m_d()); + callback.onActionStarted(R.string.sync_action_syncing_attendance); + d(TAG, "Get attendance for week "+ attendanceCheckDate.getStringY_m_d()); Request.builder() .url(fakeLogin ? "https://szkolny.eu/mobimobi/mobi_mod_frekwencja.php" : "https://" + loginServerName + ".mobidziennik.pl/mobile/frekwencja") .userAgent(System.getProperty("http.agent")) .addParameter("uczen", studentId) - .addParameter("data_poniedzialek", attendancesCheckDate.getStringY_m_d()) + .addParameter("data_poniedzialek", attendanceCheckDate.getStringY_m_d()) .post() .callback(new TextCallbackHandler() { @Override @@ -1076,11 +1076,11 @@ public class Mobidziennik implements EdziennikInterface { public void onSuccess(String data, Response response) { // just skip any failures here if (data == null || data.equals("")) { - r("finish", "Attendances"); + r("finish", "Attendance"); return; } if (data.contains("nie-pamietam-hasla")) { - r("finish", "Attendances"); + r("finish", "Attendance"); return; } @@ -1135,7 +1135,7 @@ public class Mobidziennik implements EdziennikInterface { continue; AttendanceLessonRange range = ranges.get(currentIndex); - Date date = attendancesCheckDate.clone().stepForward(0, 0, range.weekDay); + Date date = attendanceCheckDate.clone().stepForward(0, 0, range.weekDay); long addedDate = date.combineWith(range.startTime); int markerIndex = 0; @@ -1201,7 +1201,7 @@ public class Mobidziennik implements EdziennikInterface { markerIndex++; attendanceList.add(attendanceObject); if (attendanceObject.type != TYPE_PRESENT) { - boolean markAsRead = onlyFeature == FEATURE_ATTENDANCES && attendancesLastSync == 0; + boolean markAsRead = onlyFeature == FEATURE_ATTENDANCE && attendanceLastSync == 0; metadataList.add(new Metadata(profileId, Metadata.TYPE_ATTENDANCE, attendanceObject.id, profile.getEmpty() || markAsRead, profile.getEmpty() || markAsRead, addedDate)); } } @@ -1209,40 +1209,40 @@ public class Mobidziennik implements EdziennikInterface { } catch (Exception e) { Crashlytics.logException(e); e.printStackTrace(); - if (onlyFeature == FEATURE_ATTENDANCES) + if (onlyFeature == FEATURE_ATTENDANCE) finishWithError(new AppError(TAG, 955, CODE_OTHER, response, e, data)); else - r("finish", "Attendances"); + r("finish", "Attendance"); return; } - if (onlyFeature == FEATURE_ATTENDANCES) { - // syncing attendances exclusively - if (attendancesLastSync == 0) { - // first sync - get attendances until it's start of the school year - attendancesLastSync = profile.getSemesterStart(1).getInMillis(); + if (onlyFeature == FEATURE_ATTENDANCE) { + // syncing attendance exclusively + if (attendanceLastSync == 0) { + // first sync - get attendance until it's start of the school year + attendanceLastSync = profile.getSemesterStart(1).getInMillis(); } - Date lastSyncDate = Date.fromMillis(attendancesLastSync); + Date lastSyncDate = Date.fromMillis(attendanceLastSync); lastSyncDate.stepForward(0, 0, -7); - if (lastSyncDate.getValue() < attendancesCheckDate.getValue()) { - attendancesCheckDate.stepForward(0, 0, -7); - r("get", "Attendances"); + if (lastSyncDate.getValue() < attendanceCheckDate.getValue()) { + attendanceCheckDate.stepForward(0, 0, -7); + r("get", "Attendance"); } else { - profile.putStudentData("attendancesLastSync", System.currentTimeMillis()); - r("finish", "Attendances"); + profile.putStudentData("attendanceLastSync", System.currentTimeMillis()); + r("finish", "Attendance"); } } else { - if (attendancesLastSync != 0) { + if (attendanceLastSync != 0) { // not a first sync - Date lastSyncDate = Date.fromMillis(attendancesLastSync); + Date lastSyncDate = Date.fromMillis(attendanceLastSync); lastSyncDate.stepForward(0, 0, 2); - if (lastSyncDate.getValue() >= attendancesCheckDate.getValue()) { - profile.putStudentData("attendancesLastSync", System.currentTimeMillis()); + if (lastSyncDate.getValue() >= attendanceCheckDate.getValue()) { + profile.putStudentData("attendanceLastSync", System.currentTimeMillis()); } } - r("finish", "Attendances"); + r("finish", "Attendance"); } } }) @@ -1675,12 +1675,12 @@ public class Mobidziennik implements EdziennikInterface { } } - private void processAttendances(String table) + private void processAttendance(String table) { if (true) return; - String[] attendances = table.split("\n"); - for (String attendanceStr: attendances) + String[] attendanceList = table.split("\n"); + for (String attendanceStr: attendanceList) { if (attendanceStr.isEmpty()) { continue; @@ -1718,7 +1718,7 @@ public class Mobidziennik implements EdziennikInterface { mobiLesson.date, mobiLesson.startTime, type); - attendanceList.add(attendanceObject); + this.attendanceList.add(attendanceObject); metadataList.add(new Metadata(profileId, Metadata.TYPE_ATTENDANCE, attendanceObject.id, profile.getEmpty(), profile.getEmpty(), System.currentTimeMillis())); } } diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Vulcan.java b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Vulcan.java index d1095dcb..355f974c 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Vulcan.java +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Vulcan.java @@ -110,7 +110,7 @@ public class Vulcan implements EdziennikInterface { private static final String ENDPOINT_EVENTS = "mobile-api/Uczen.v3.Uczen/Sprawdziany"; private static final String ENDPOINT_HOMEWORK = "mobile-api/Uczen.v3.Uczen/ZadaniaDomowe"; private static final String ENDPOINT_NOTICES = "mobile-api/Uczen.v3.Uczen/UwagiUcznia"; - private static final String ENDPOINT_ATTENDANCES = "mobile-api/Uczen.v3.Uczen/Frekwencje"; + private static final String ENDPOINT_ATTENDANCE = "mobile-api/Uczen.v3.Uczen/Frekwencje"; private static final String ENDPOINT_MESSAGES_RECEIVED = "mobile-api/Uczen.v3.Uczen/WiadomosciOdebrane"; private static final String ENDPOINT_MESSAGES_SENT = "mobile-api/Uczen.v3.Uczen/WiadomosciWyslane"; private static final String ENDPOINT_MESSAGES_CHANGE_STATUS = "mobile-api/Uczen.v3.Uczen/ZmienStatusWiadomosci"; @@ -261,7 +261,7 @@ public class Vulcan implements EdziennikInterface { targetEndpoints.add("Events"); targetEndpoints.add("Homework"); targetEndpoints.add("Notices"); - targetEndpoints.add("Attendances"); + targetEndpoints.add("Attendance"); targetEndpoints.add("MessagesInbox"); targetEndpoints.add("MessagesOutbox"); targetEndpoints.add("Finish"); @@ -303,8 +303,8 @@ public class Vulcan implements EdziennikInterface { case FEATURE_NOTICES: targetEndpoints.add("Notices"); break; - case FEATURE_ATTENDANCES: - targetEndpoints.add("Attendances"); + case FEATURE_ATTENDANCE: + targetEndpoints.add("Attendance"); break; case FEATURE_MESSAGES_INBOX: targetEndpoints.add("MessagesInbox"); @@ -386,8 +386,8 @@ public class Vulcan implements EdziennikInterface { case "Notices": getNotices(); break; - case "Attendances": - getAttendances(); + case "Attendance": + getAttendance(); break; case "MessagesInbox": getMessagesInbox(); @@ -1459,18 +1459,18 @@ public class Vulcan implements EdziennikInterface { }); } - private void getAttendances() { - callback.onActionStarted(R.string.sync_action_syncing_attendances); + private void getAttendance() { + callback.onActionStarted(R.string.sync_action_syncing_attendance); JsonObject json = new JsonObject(); json.addProperty("DataPoczatkowa", true ? getCurrentSemesterStartDate().getStringY_m_d() : oneMonthBack.getStringY_m_d()); json.addProperty("DataKoncowa", getCurrentSemesterEndDate().getStringY_m_d()); json.addProperty("IdOddzial", studentClassId); json.addProperty("IdUczen", studentId); json.addProperty("IdOkresKlasyfikacyjny", studentSemesterId); - apiRequest(schoolSymbol+"/"+ENDPOINT_ATTENDANCES, json, result -> { - JsonArray attendances = result.getAsJsonObject("Data").getAsJsonArray("Frekwencje"); + apiRequest(schoolSymbol+"/"+ ENDPOINT_ATTENDANCE, json, result -> { + JsonArray attendanceList = result.getAsJsonObject("Data").getAsJsonArray("Frekwencje"); - for (JsonElement attendanceEl: attendances) { + for (JsonElement attendanceEl: attendanceList) { JsonObject attendance = attendanceEl.getAsJsonObject(); Pair attendanceCategory = attendanceCategories.get(attendance.get("IdKategoria").getAsInt()); @@ -1497,12 +1497,12 @@ public class Vulcan implements EdziennikInterface { lessonRanges.get(attendance.get("IdPoraLekcji").getAsInt()).first, type); - attendanceList.add(attendanceObject); + this.attendanceList.add(attendanceObject); if (attendanceObject.type != TYPE_PRESENT) { metadataList.add(new Metadata(profileId, Metadata.TYPE_ATTENDANCE, attendanceObject.id, profile.getEmpty(), profile.getEmpty(), attendanceObject.lessonDate.combineWith(attendanceObject.startTime))); } } - r("finish", "Attendances"); + r("finish", "Attendance"); }); } diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/interfaces/EdziennikInterface.java b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/interfaces/EdziennikInterface.java index 5b2af1b8..962b1bef 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/interfaces/EdziennikInterface.java +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/interfaces/EdziennikInterface.java @@ -36,7 +36,7 @@ public interface EdziennikInterface { int FEATURE_GRADES = 3; int FEATURE_HOMEWORK = 4; int FEATURE_NOTICES = 5; - int FEATURE_ATTENDANCES = 6; + int FEATURE_ATTENDANCE = 6; int FEATURE_MESSAGES_INBOX = 7; int FEATURE_MESSAGES_OUTBOX = 8; int FEATURE_ANNOUNCEMENTS = 9; diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/v2/Constants.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/v2/Constants.kt index 59165f11..84efcebc 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/v2/Constants.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/v2/Constants.kt @@ -6,7 +6,7 @@ const val FEATURE_AGENDA = 2 const val FEATURE_GRADES = 3 const val FEATURE_HOMEWORK = 4 const val FEATURE_NOTICES = 5 -const val FEATURE_ATTENDANCES = 6 +const val FEATURE_ATTENDANCE = 6 const val FEATURE_MESSAGES_INBOX = 7 const val FEATURE_MESSAGES_OUTBOX = 8 const val FEATURE_ANNOUNCEMENTS = 9 diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/db/modules/metadata/MetadataDao.java b/app/src/main/java/pl/szczodrzynski/edziennik/data/db/modules/metadata/MetadataDao.java index 95733185..e7f3a410 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/db/modules/metadata/MetadataDao.java +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/db/modules/metadata/MetadataDao.java @@ -204,7 +204,7 @@ public abstract class MetadataDao { public abstract void deleteUnusedNotices(int profileId); @Query("DELETE FROM metadata WHERE profileId = :profileId AND thingType = "+TYPE_ATTENDANCE+" AND thingId NOT IN (SELECT attendanceId FROM attendances WHERE profileId = :profileId);") - public abstract void deleteUnusedAttendances(int profileId); + public abstract void deleteUnusedAttendance(int profileId); @Query("DELETE FROM metadata WHERE profileId = :profileId AND thingType = "+TYPE_EVENT+" AND thingId NOT IN (SELECT eventId FROM events WHERE profileId = :profileId AND eventType != -1);") public abstract void deleteUnusedEvents(int profileId); @@ -225,7 +225,7 @@ public abstract class MetadataDao { public void deleteUnused(int profileId) { deleteUnusedGrades(profileId); deleteUnusedNotices(profileId); - deleteUnusedAttendances(profileId); + deleteUnusedAttendance(profileId); deleteUnusedEvents(profileId); deleteUnusedHomework(profileId); deleteUnusedLessonChanges(profileId); diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/db/modules/profiles/ProfileFull.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/db/modules/profiles/ProfileFull.kt index f692bcf5..ae41a733 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/db/modules/profiles/ProfileFull.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/db/modules/profiles/ProfileFull.kt @@ -5,11 +5,11 @@ import androidx.room.ColumnInfo import com.google.gson.JsonObject import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_AGENDA import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_ANNOUNCEMENTS -import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_ATTENDANCES +import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_ATTENDANCE import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_GRADES import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_HOMEWORK import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_MESSAGES -import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_NOTICES +import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_BEHAVIOUR import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_TIMETABLE import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore.* @@ -52,8 +52,8 @@ class ProfileFull : Profile { fragmentIds.add(DRAWER_ITEM_GRADES) fragmentIds.add(DRAWER_ITEM_MESSAGES) fragmentIds.add(DRAWER_ITEM_HOMEWORK) - fragmentIds.add(DRAWER_ITEM_NOTICES) - fragmentIds.add(DRAWER_ITEM_ATTENDANCES) + fragmentIds.add(DRAWER_ITEM_BEHAVIOUR) + fragmentIds.add(DRAWER_ITEM_ATTENDANCE) return fragmentIds } LOGIN_TYPE_LIBRUS -> { @@ -63,8 +63,8 @@ class ProfileFull : Profile { fragmentIds.add(DRAWER_ITEM_GRADES) fragmentIds.add(DRAWER_ITEM_MESSAGES) fragmentIds.add(DRAWER_ITEM_HOMEWORK) - fragmentIds.add(DRAWER_ITEM_NOTICES) - fragmentIds.add(DRAWER_ITEM_ATTENDANCES) + fragmentIds.add(DRAWER_ITEM_BEHAVIOUR) + fragmentIds.add(DRAWER_ITEM_ATTENDANCE) fragmentIds.add(DRAWER_ITEM_ANNOUNCEMENTS) return fragmentIds } @@ -74,8 +74,8 @@ class ProfileFull : Profile { fragmentIds.add(DRAWER_ITEM_AGENDA) fragmentIds.add(DRAWER_ITEM_GRADES) fragmentIds.add(DRAWER_ITEM_MESSAGES) - fragmentIds.add(DRAWER_ITEM_NOTICES) - fragmentIds.add(DRAWER_ITEM_ATTENDANCES) + fragmentIds.add(DRAWER_ITEM_BEHAVIOUR) + fragmentIds.add(DRAWER_ITEM_ATTENDANCE) fragmentIds.add(DRAWER_ITEM_ANNOUNCEMENTS) return fragmentIds } diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/RegisterAgendaCalendarFragment.java b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/AgendaCalendarFragment.java similarity index 95% rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/RegisterAgendaCalendarFragment.java rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/AgendaCalendarFragment.java index 0ac063fc..ffd58d51 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/RegisterAgendaCalendarFragment.java +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/AgendaCalendarFragment.java @@ -27,7 +27,7 @@ import java.util.List; import pl.szczodrzynski.edziennik.App; import pl.szczodrzynski.edziennik.R; -import pl.szczodrzynski.edziennik.databinding.FragmentRegisterAgendaCalendarBinding; +import pl.szczodrzynski.edziennik.databinding.FragmentAgendaCalendarBinding; import pl.szczodrzynski.edziennik.data.db.modules.events.EventFull; import pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonFull; import pl.szczodrzynski.edziennik.ui.dialogs.event.EventListDialog; @@ -36,11 +36,11 @@ import pl.szczodrzynski.edziennik.utils.Themes; import static pl.szczodrzynski.edziennik.utils.Utils.intToStr; -public class RegisterAgendaCalendarFragment extends Fragment { +public class AgendaCalendarFragment extends Fragment { private App app = null; private Activity activity = null; - private FragmentRegisterAgendaCalendarBinding b = null; + private FragmentAgendaCalendarBinding b = null; @Override public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { @@ -52,7 +52,7 @@ public class RegisterAgendaCalendarFragment extends Fragment { if (app.profile == null) return inflater.inflate(R.layout.fragment_loading, container, false); // activity, context and profile is valid - b = DataBindingUtil.inflate(inflater, R.layout.fragment_register_agenda_calendar, container, false); + b = DataBindingUtil.inflate(inflater, R.layout.fragment_agenda_calendar, container, false); return b.getRoot(); } diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/RegisterAgendaDefaultFragment.java b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/AgendaDefaultFragment.java similarity index 97% rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/RegisterAgendaDefaultFragment.java rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/AgendaDefaultFragment.java index c3dbd0c6..ec5f847b 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/RegisterAgendaDefaultFragment.java +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/AgendaDefaultFragment.java @@ -36,8 +36,8 @@ import java.util.Locale; import pl.szczodrzynski.edziennik.App; import pl.szczodrzynski.edziennik.R; import pl.szczodrzynski.edziennik.MainActivity; -import pl.szczodrzynski.edziennik.databinding.FragmentRegisterAgendaCalendarBinding; -import pl.szczodrzynski.edziennik.databinding.FragmentRegisterAgendaDefaultBinding; +import pl.szczodrzynski.edziennik.databinding.FragmentAgendaCalendarBinding; +import pl.szczodrzynski.edziennik.databinding.FragmentAgendaDefaultBinding; import pl.szczodrzynski.edziennik.data.db.modules.events.EventFull; import pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonFull; import pl.szczodrzynski.edziennik.ui.dialogs.event.EventListDialog; @@ -55,15 +55,14 @@ import pl.szczodrzynski.navlib.bottomsheet.items.BottomSheetSeparatorItem; import static pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata.TYPE_EVENT; import static pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile.AGENDA_CALENDAR; import static pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile.AGENDA_DEFAULT; -import static pl.szczodrzynski.edziennik.utils.Utils.bs; import static pl.szczodrzynski.edziennik.utils.Utils.intToStr; -public class RegisterAgendaDefaultFragment extends Fragment { +public class AgendaDefaultFragment extends Fragment { private App app = null; private MainActivity activity = null; - private FragmentRegisterAgendaDefaultBinding b_default = null; - private FragmentRegisterAgendaCalendarBinding b_calendar = null; + private FragmentAgendaDefaultBinding b_default = null; + private FragmentAgendaCalendarBinding b_calendar = null; private int viewType = AGENDA_DEFAULT; @Override @@ -78,11 +77,11 @@ public class RegisterAgendaDefaultFragment extends Fragment { // activity, context and profile is valid viewType = app.profile.getAgendaViewType(); if (viewType == AGENDA_DEFAULT) { - b_default = DataBindingUtil.inflate(inflater, R.layout.fragment_register_agenda_default, container, false); + b_default = DataBindingUtil.inflate(inflater, R.layout.fragment_agenda_default, container, false); return b_default.getRoot(); } else { - b_calendar = DataBindingUtil.inflate(inflater, R.layout.fragment_register_agenda_calendar, container, false); + b_calendar = DataBindingUtil.inflate(inflater, R.layout.fragment_agenda_calendar, container, false); return b_calendar.getRoot(); } } diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/announcements/RegisterAnnouncementsFragment.java b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/announcements/AnnouncementsFragment.java similarity index 95% rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/announcements/RegisterAnnouncementsFragment.java rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/announcements/AnnouncementsFragment.java index 8e70a958..c539486a 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/announcements/RegisterAnnouncementsFragment.java +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/announcements/AnnouncementsFragment.java @@ -7,30 +7,31 @@ import android.view.View; import android.view.ViewGroup; import android.widget.Toast; -import com.afollestad.materialdialogs.MaterialDialog; -import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial; - import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.databinding.DataBindingUtil; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; + +import com.afollestad.materialdialogs.MaterialDialog; +import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial; + import pl.szczodrzynski.edziennik.App; -import pl.szczodrzynski.edziennik.R; import pl.szczodrzynski.edziennik.MainActivity; +import pl.szczodrzynski.edziennik.R; import pl.szczodrzynski.edziennik.databinding.DialogAnnouncementBinding; -import pl.szczodrzynski.edziennik.databinding.FragmentRegisterSchoolNoticesBinding; +import pl.szczodrzynski.edziennik.databinding.FragmentAnnouncementsBinding; import pl.szczodrzynski.edziennik.utils.Themes; import pl.szczodrzynski.navlib.bottomsheet.items.BottomSheetPrimaryItem; import static pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata.TYPE_ANNOUNCEMENT; -public class RegisterAnnouncementsFragment extends Fragment { +public class AnnouncementsFragment extends Fragment { private App app = null; private MainActivity activity = null; - private FragmentRegisterSchoolNoticesBinding b = null; + private FragmentAnnouncementsBinding b = null; @Override public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { @@ -42,7 +43,7 @@ public class RegisterAnnouncementsFragment extends Fragment { if (app.profile == null) return inflater.inflate(R.layout.fragment_loading, container, false); // activity, context and profile is valid - b = DataBindingUtil.inflate(inflater, R.layout.fragment_register_school_notices, container, false); + b = DataBindingUtil.inflate(inflater, R.layout.fragment_announcements, container, false); b.refreshLayout.setParent(activity.getSwipeRefreshLayout()); return b.getRoot(); } diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/AttendancesAdapter.java b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/AttendanceAdapter.java similarity index 97% rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/AttendancesAdapter.java rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/AttendanceAdapter.java index a8b71528..e1e53f5a 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/AttendancesAdapter.java +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/AttendanceAdapter.java @@ -24,12 +24,12 @@ import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.T import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_PRESENT; import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_RELEASED; -public class AttendancesAdapter extends RecyclerView.Adapter { +public class AttendanceAdapter extends RecyclerView.Adapter { private Context context; public List attendanceList; //getting the context and product list with constructor - public AttendancesAdapter(Context mCtx, List noticeList) { + public AttendanceAdapter(Context mCtx, List noticeList) { this.context = mCtx; this.attendanceList = noticeList; } diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/RegisterAttendancesFragment.java b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/AttendanceFragment.java similarity index 87% rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/RegisterAttendancesFragment.java rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/AttendanceFragment.java index e5f8b43a..d28aadf9 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/RegisterAttendancesFragment.java +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/attendance/AttendanceFragment.java @@ -1,18 +1,8 @@ package pl.szczodrzynski.edziennik.ui.modules.attendance; -import androidx.appcompat.widget.PopupMenu; -import androidx.databinding.DataBindingUtil; - import android.graphics.Color; import android.os.AsyncTask; import android.os.Bundle; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.fragment.app.Fragment; -import androidx.core.graphics.ColorUtils; -import androidx.recyclerview.widget.LinearLayoutManager; - import android.os.Handler; import android.util.LongSparseArray; import android.view.Gravity; @@ -24,6 +14,14 @@ import android.view.animation.Animation; import android.view.animation.Transformation; import android.widget.Toast; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.appcompat.widget.PopupMenu; +import androidx.core.graphics.ColorUtils; +import androidx.databinding.DataBindingUtil; +import androidx.fragment.app.Fragment; +import androidx.recyclerview.widget.LinearLayoutManager; + import com.danimahardhika.cafebar.CafeBar; import com.mikepenz.iconics.IconicsColor; import com.mikepenz.iconics.IconicsDrawable; @@ -37,14 +35,14 @@ import java.util.Locale; import antonkozyriatskyi.circularprogressindicator.CircularProgressIndicator; import pl.szczodrzynski.edziennik.App; -import pl.szczodrzynski.edziennik.R; import pl.szczodrzynski.edziennik.MainActivity; -import pl.szczodrzynski.edziennik.databinding.FragmentRegisterAttendancesBinding; +import pl.szczodrzynski.edziennik.R; import pl.szczodrzynski.edziennik.data.db.modules.attendance.AttendanceFull; import pl.szczodrzynski.edziennik.data.db.modules.subjects.Subject; +import pl.szczodrzynski.edziennik.databinding.FragmentAttendanceBinding; +import pl.szczodrzynski.edziennik.utils.Themes; import pl.szczodrzynski.edziennik.utils.models.Date; import pl.szczodrzynski.edziennik.utils.models.Week; -import pl.szczodrzynski.edziennik.utils.Themes; import pl.szczodrzynski.navlib.bottomsheet.items.BottomSheetPrimaryItem; import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_ABSENT; @@ -57,11 +55,11 @@ import static pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore.LOGIN_ import static pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore.LOGIN_TYPE_VULCAN; import static pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata.TYPE_ATTENDANCE; -public class RegisterAttendancesFragment extends Fragment { +public class AttendanceFragment extends Fragment { private App app = null; private MainActivity activity = null; - private FragmentRegisterAttendancesBinding b = null; + private FragmentAttendanceBinding b = null; private int displayMode = MODE_YEAR; private static final int MODE_YEAR = 0; @@ -84,7 +82,7 @@ public class RegisterAttendancesFragment extends Fragment { if (app.profile == null) return inflater.inflate(R.layout.fragment_loading, container, false); // activity, context and profile is valid - b = DataBindingUtil.inflate(inflater, R.layout.fragment_register_attendances, container, false); + b = DataBindingUtil.inflate(inflater, R.layout.fragment_attendance, container, false); b.refreshLayout.setParent(activity.getSwipeRefreshLayout()); return b.getRoot(); } @@ -106,14 +104,14 @@ public class RegisterAttendancesFragment extends Fragment { ); /*b.refreshLayout.setOnRefreshListener(() -> { - activity.syncCurrentFeature(MainActivity.DRAWER_ITEM_ATTENDANCES, b.refreshLayout); + activity.syncCurrentFeature(MainActivity.DRAWER_ITEM_ATTENDANCE, b.refreshLayout); });*/ b.attendancePercentage.setProgressTextAdapter(PERCENTAGE_ADAPTER); b.attendancePercentage.setMaxProgress(100.0f); - b.attendancesSummaryTitle.setOnClickListener((v -> { - PopupMenu popupMenu = new PopupMenu(activity, b.attendancesSummaryTitle, Gravity.END); + b.attendanceSummaryTitle.setOnClickListener((v -> { + PopupMenu popupMenu = new PopupMenu(activity, b.attendanceSummaryTitle, Gravity.END); popupMenu.getMenu().add(0, 0, 0, R.string.summary_mode_year); popupMenu.getMenu().add(0, 1, 1, R.string.summary_mode_semester_1); popupMenu.getMenu().add(0, 2, 2, R.string.summary_mode_semester_2); @@ -126,11 +124,11 @@ public class RegisterAttendancesFragment extends Fragment { })); if (app.profile.getLoginStoreType() == LOGIN_TYPE_MOBIDZIENNIK) { - long attendancesLastSync = app.profile.getStudentData("attendancesLastSync", (long)0); - if (attendancesLastSync == 0) { - attendancesLastSync = app.profile.getSemesterStart(1).getInMillis(); + long attendanceLastSync = app.profile.getStudentData("attendanceLastSync", (long)0); + if (attendanceLastSync == 0) { + attendanceLastSync = app.profile.getSemesterStart(1).getInMillis(); } - Date lastSyncDate = Date.fromMillis(attendancesLastSync); + Date lastSyncDate = Date.fromMillis(attendanceLastSync); if (lastSyncDate.getValue() < Week.getWeekStart().getValue()) { CafeBar.builder(activity) .to(activity.getNavView().getCoordinator()) @@ -158,13 +156,13 @@ public class RegisterAttendancesFragment extends Fragment { } if (app.profile.getLoginStoreType() == LOGIN_TYPE_MOBIDZIENNIK && false) { - b.attendancesSummarySubject.setVisibility(View.GONE); + b.attendanceSummarySubject.setVisibility(View.GONE); } else { - b.attendancesSummarySubject.setOnClickListener((v -> { + b.attendanceSummarySubject.setOnClickListener((v -> { AsyncTask.execute(() -> { List subjectList = app.db.subjectDao().getAllNow(App.profileId); - PopupMenu popupMenu = new PopupMenu(activity, b.attendancesSummarySubject, Gravity.END); + PopupMenu popupMenu = new PopupMenu(activity, b.attendanceSummarySubject, Gravity.END); popupMenu.getMenu().add(0, -1, 0, R.string.subject_filter_disabled); int index = 0; DecimalFormat format = new DecimalFormat("0.00"); @@ -180,7 +178,7 @@ public class RegisterAttendancesFragment extends Fragment { } popupMenu.setOnMenuItemClickListener((item -> { subjectIdFilter = item.getItemId(); - b.attendancesSummarySubject.setText(item.getTitle().toString().replaceAll("\\s-\\s[0-9]{1,2}\\.[0-9]{1,2}%", "")); + b.attendanceSummarySubject.setText(item.getTitle().toString().replaceAll("\\s-\\s[0-9]{1,2}\\.[0-9]{1,2}%", "")); updateList(); return true; })); @@ -192,20 +190,20 @@ public class RegisterAttendancesFragment extends Fragment { LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext()); - b.attendancesView.setHasFixedSize(true); - b.attendancesView.setLayoutManager(linearLayoutManager); + b.attendanceView.setHasFixedSize(true); + b.attendanceView.setLayoutManager(linearLayoutManager); - app.db.attendanceDao().getAll(App.profileId).observe(this, attendances -> { + app.db.attendanceDao().getAll(App.profileId).observe(this, attendance -> { if (app == null || app.profile == null || activity == null || b == null || !isAdded()) return; - if (attendances == null) { - b.attendancesView.setVisibility(View.GONE); - b.attendancesNoData.setVisibility(View.VISIBLE); + if (attendance == null) { + b.attendanceView.setVisibility(View.GONE); + b.attendanceNoData.setVisibility(View.VISIBLE); return; } - attendanceList = attendances; + attendanceList = attendance; countSubjectStats(); @@ -274,29 +272,29 @@ public class RegisterAttendancesFragment extends Fragment { } } if (filteredList.size() > 0) { - AttendancesAdapter adapter; - b.attendancesView.setVisibility(View.VISIBLE); - b.attendancesNoData.setVisibility(View.GONE); - if ((adapter = (AttendancesAdapter) b.attendancesView.getAdapter()) != null) { + AttendanceAdapter adapter; + b.attendanceView.setVisibility(View.VISIBLE); + b.attendanceNoData.setVisibility(View.GONE); + if ((adapter = (AttendanceAdapter) b.attendanceView.getAdapter()) != null) { adapter.attendanceList = filteredList; adapter.notifyDataSetChanged(); } else { - adapter = new AttendancesAdapter(getContext(), filteredList); - b.attendancesView.setAdapter(adapter); + adapter = new AttendanceAdapter(getContext(), filteredList); + b.attendanceView.setAdapter(adapter); } } else { - b.attendancesView.setVisibility(View.GONE); - b.attendancesNoData.setVisibility(View.VISIBLE); + b.attendanceView.setVisibility(View.GONE); + b.attendanceNoData.setVisibility(View.VISIBLE); } // SUMMARY if (displayMode == MODE_YEAR) { - b.attendancesSummaryTitle.setText(getString(R.string.attendances_summary_title_year)); + b.attendanceSummaryTitle.setText(getString(R.string.attendance_summary_title_year)); } else { - b.attendancesSummaryTitle.setText(getString(R.string.attendances_summary_title_semester_format, displayMode)); + b.attendanceSummaryTitle.setText(getString(R.string.attendance_summary_title_semester_format, displayMode)); } b.presentCountContainer.setVisibility(presentCount == 0 ? View.GONE : View.VISIBLE); b.presentCount.setText(String.format(Locale.getDefault(), "%d", presentCount)); diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/notices/RegisterNoticesFragment.java b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/behaviour/BehaviourFragment.java similarity index 95% rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/notices/RegisterNoticesFragment.java rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/behaviour/BehaviourFragment.java index 72a97e67..29f46afe 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/notices/RegisterNoticesFragment.java +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/behaviour/BehaviourFragment.java @@ -1,4 +1,4 @@ -package pl.szczodrzynski.edziennik.ui.modules.notices; +package pl.szczodrzynski.edziennik.ui.modules.behaviour; import android.graphics.Color; import android.os.AsyncTask; @@ -9,10 +9,6 @@ import android.view.View; import android.view.ViewGroup; import android.widget.Toast; -import java.util.ArrayList; -import java.util.List; -import java.util.Locale; - import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.widget.PopupMenu; @@ -22,22 +18,26 @@ import androidx.recyclerview.widget.LinearLayoutManager; import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial; +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; + import pl.szczodrzynski.edziennik.App; -import pl.szczodrzynski.edziennik.R; import pl.szczodrzynski.edziennik.MainActivity; -import pl.szczodrzynski.edziennik.databinding.FragmentRegisterNoticesBinding; +import pl.szczodrzynski.edziennik.R; import pl.szczodrzynski.edziennik.data.db.modules.notices.Notice; import pl.szczodrzynski.edziennik.data.db.modules.notices.NoticeFull; +import pl.szczodrzynski.edziennik.databinding.FragmentBehaviourBinding; import pl.szczodrzynski.edziennik.utils.Themes; import pl.szczodrzynski.navlib.bottomsheet.items.BottomSheetPrimaryItem; import static pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata.TYPE_NOTICE; -public class RegisterNoticesFragment extends Fragment { +public class BehaviourFragment extends Fragment { private App app = null; private MainActivity activity = null; - private FragmentRegisterNoticesBinding b = null; + private FragmentBehaviourBinding b = null; private int displayMode = MODE_YEAR; private static final int MODE_YEAR = 0; @@ -56,7 +56,7 @@ public class RegisterNoticesFragment extends Fragment { if (app.profile == null) return inflater.inflate(R.layout.fragment_loading, container, false); // activity, context and profile is valid - b = DataBindingUtil.inflate(inflater, R.layout.fragment_register_notices, container, false); + b = DataBindingUtil.inflate(inflater, R.layout.fragment_behaviour, container, false); b.refreshLayout.setParent(activity.getSwipeRefreshLayout()); return b.getRoot(); } @@ -78,7 +78,7 @@ public class RegisterNoticesFragment extends Fragment { ); /*b.refreshLayout.setOnRefreshListener(() -> { - activity.syncCurrentFeature(MainActivity.DRAWER_ITEM_NOTICES, b.refreshLayout); + activity.syncCurrentFeature(MainActivity.DRAWER_ITEM_BEHAVIOUR, b.refreshLayout); });*/ b.noticesSummaryTitle.setOnClickListener((v -> { diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/notices/NoticesAdapter.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/behaviour/NoticesAdapter.kt similarity index 98% rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/notices/NoticesAdapter.kt rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/behaviour/NoticesAdapter.kt index 41efc20f..c9693842 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/notices/NoticesAdapter.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/behaviour/NoticesAdapter.kt @@ -1,4 +1,4 @@ -package pl.szczodrzynski.edziennik.ui.modules.notices +package pl.szczodrzynski.edziennik.ui.modules.behaviour import android.content.Context import android.graphics.PorterDuff diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/RegisterGradesFragment.java b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/GradesFragment.java similarity index 99% rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/RegisterGradesFragment.java rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/GradesFragment.java index dddd897b..1a6b99dc 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/RegisterGradesFragment.java +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/grades/GradesFragment.java @@ -21,14 +21,14 @@ import java.util.ArrayList; import java.util.List; import pl.szczodrzynski.edziennik.App; -import pl.szczodrzynski.edziennik.R; import pl.szczodrzynski.edziennik.MainActivity; -import pl.szczodrzynski.edziennik.databinding.FragmentRegisterGradesBinding; +import pl.szczodrzynski.edziennik.R; import pl.szczodrzynski.edziennik.data.db.modules.grades.Grade; import pl.szczodrzynski.edziennik.data.db.modules.grades.GradeFull; import pl.szczodrzynski.edziennik.data.db.modules.subjects.Subject; -import pl.szczodrzynski.edziennik.utils.models.ItemGradesSubjectModel; +import pl.szczodrzynski.edziennik.databinding.FragmentGradesBinding; import pl.szczodrzynski.edziennik.utils.Themes; +import pl.szczodrzynski.edziennik.utils.models.ItemGradesSubjectModel; import pl.szczodrzynski.navlib.bottomsheet.items.BottomSheetPrimaryItem; import pl.szczodrzynski.navlib.bottomsheet.items.BottomSheetSeparatorItem; @@ -42,11 +42,11 @@ import static pl.szczodrzynski.edziennik.utils.models.AppConfig.ORDER_BY_DATE_AS import static pl.szczodrzynski.edziennik.utils.models.AppConfig.ORDER_BY_DATE_DESC; import static pl.szczodrzynski.edziennik.utils.models.AppConfig.ORDER_BY_SUBJECT_ASC; -public class RegisterGradesFragment extends Fragment { +public class GradesFragment extends Fragment { private App app = null; private MainActivity activity = null; - private FragmentRegisterGradesBinding b = null; + private FragmentGradesBinding b = null; @Override public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { @@ -58,7 +58,7 @@ public class RegisterGradesFragment extends Fragment { if (app.profile == null) return inflater.inflate(R.layout.fragment_loading, container, false); // activity, context and profile is valid - b = DataBindingUtil.inflate(inflater, R.layout.fragment_register_grades, container, false); + b = DataBindingUtil.inflate(inflater, R.layout.fragment_grades, container, false); b.refreshLayout.setParent(activity.getSwipeRefreshLayout()); b.refreshLayout.setNestedScrollingEnabled(true); return b.getRoot(); diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/messages/MessagesComposeActivity.java b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/messages/MessagesComposeActivity.java index 04a0b025..ff22e48e 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/messages/MessagesComposeActivity.java +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/messages/MessagesComposeActivity.java @@ -35,14 +35,14 @@ import java.util.List; import pl.szczodrzynski.edziennik.App; import pl.szczodrzynski.edziennik.R; -import pl.szczodrzynski.edziennik.data.api.Edziennik; import pl.szczodrzynski.edziennik.data.api.AppError; +import pl.szczodrzynski.edziennik.data.api.Edziennik; import pl.szczodrzynski.edziennik.data.api.interfaces.SyncCallback; -import pl.szczodrzynski.edziennik.databinding.MessagesComposeActivityBinding; import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore; import pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile; import pl.szczodrzynski.edziennik.data.db.modules.profiles.ProfileFull; import pl.szczodrzynski.edziennik.data.db.modules.teachers.Teacher; +import pl.szczodrzynski.edziennik.databinding.ActivityComposeMessageBinding; import pl.szczodrzynski.edziennik.utils.Colors; import pl.szczodrzynski.edziennik.utils.Themes; @@ -50,7 +50,7 @@ public class MessagesComposeActivity extends AppCompatActivity { private static final String TAG = "MessageCompose"; private App app; - private MessagesComposeActivityBinding b; + private ActivityComposeMessageBinding b; private List teachers = new ArrayList<>(); private ActionBar actionBar; private MessagesComposeInfo composeInfo; @@ -60,7 +60,7 @@ public class MessagesComposeActivity extends AppCompatActivity { super.onCreate(savedInstanceState); app = (App)getApplication(); setTheme(Themes.INSTANCE.getAppTheme()); - b = DataBindingUtil.inflate(getLayoutInflater(), R.layout.messages_compose_activity, null, false); + b = DataBindingUtil.inflate(getLayoutInflater(), R.layout.activity_compose_message, null, false); setContentView(b.getRoot()); composeInfo = Edziennik.getApi(app, app.profile.getLoginStoreType()).getComposeInfo(app.profile); diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/messages/RegisterMessagesWebFragment.java b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/messages/MessagesWebFragment.java similarity index 97% rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/messages/RegisterMessagesWebFragment.java rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/messages/MessagesWebFragment.java index aeda8455..343f4076 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/messages/RegisterMessagesWebFragment.java +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/messages/MessagesWebFragment.java @@ -17,12 +17,6 @@ import android.os.Bundle; import android.os.Environment; import android.os.Handler; import android.provider.MediaStore; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.core.app.ActivityCompat; -import androidx.databinding.DataBindingUtil; -import androidx.fragment.app.Fragment; -import androidx.core.content.FileProvider; import android.util.Log; import android.view.LayoutInflater; import android.view.View; @@ -39,6 +33,13 @@ import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.core.app.ActivityCompat; +import androidx.core.content.FileProvider; +import androidx.databinding.DataBindingUtil; +import androidx.fragment.app.Fragment; + import com.afollestad.materialdialogs.MaterialDialog; import com.afollestad.materialdialogs.StackingBehavior; @@ -51,7 +52,7 @@ import java.util.Date; import pl.szczodrzynski.edziennik.App; import pl.szczodrzynski.edziennik.R; -import pl.szczodrzynski.edziennik.databinding.FragmentRegisterMessagesWebBinding; +import pl.szczodrzynski.edziennik.databinding.FragmentMessagesWebBinding; import pl.szczodrzynski.edziennik.utils.Anim; import pl.szczodrzynski.edziennik.utils.Themes; @@ -59,12 +60,12 @@ import static android.app.Activity.RESULT_OK; import static android.content.Context.DOWNLOAD_SERVICE; import static pl.szczodrzynski.edziennik.utils.Utils.readableFileSize; -public class RegisterMessagesWebFragment extends Fragment { +public class MessagesWebFragment extends Fragment { private static final String TAG = "RegisterMessagesWeb"; private App app = null; private Activity activity = null; - private FragmentRegisterMessagesWebBinding b = null; + private FragmentMessagesWebBinding b = null; private WebView webView; private ProgressBar progressBar; @@ -80,7 +81,7 @@ public class RegisterMessagesWebFragment extends Fragment { if (app.profile == null) return inflater.inflate(R.layout.fragment_loading, container, false); // activity, context and profile is valid - b = DataBindingUtil.inflate(inflater, R.layout.fragment_register_messages_web, container, false); + b = DataBindingUtil.inflate(inflater, R.layout.fragment_messages_web, container, false); return b.getRoot(); } @@ -350,7 +351,7 @@ public class RegisterMessagesWebFragment extends Fragment { @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { super.onPageStarted(view, url, favicon); - RegisterMessagesWebFragment.this.error.setVisibility(View.GONE); + MessagesWebFragment.this.error.setVisibility(View.GONE); loadingFinished = false; //SHOW LOADING IF IT ISNT ALREADY VISIBLE if (progressBar.getVisibility() != View.VISIBLE) @@ -385,8 +386,8 @@ public class RegisterMessagesWebFragment extends Fragment { if (app == null || app.profile == null || activity == null || b == null || !isAdded()) return; - RegisterMessagesWebFragment.this.error.setVisibility(View.VISIBLE); - RegisterMessagesWebFragment.this.error.setText(getString(R.string.error_occured_format, error.toString())); + MessagesWebFragment.this.error.setVisibility(View.VISIBLE); + MessagesWebFragment.this.error.setText(getString(R.string.error_occured_format, error.toString())); super.onReceivedError(view, request, error); } }); diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/notifications/RegisterNotificationsFragment.java b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/notifications/NotificationsFragment.java similarity index 90% rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/notifications/RegisterNotificationsFragment.java rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/notifications/NotificationsFragment.java index 44c7e8d0..0ed54999 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/notifications/RegisterNotificationsFragment.java +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/notifications/NotificationsFragment.java @@ -2,26 +2,27 @@ package pl.szczodrzynski.edziennik.ui.modules.notifications; import android.app.Activity; import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.databinding.DataBindingUtil; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; import pl.szczodrzynski.edziennik.App; import pl.szczodrzynski.edziennik.R; -import pl.szczodrzynski.edziennik.databinding.FragmentRegisterNotificationsBinding; +import pl.szczodrzynski.edziennik.databinding.FragmentNotificationsBinding; import pl.szczodrzynski.edziennik.utils.Themes; -public class RegisterNotificationsFragment extends Fragment { +public class NotificationsFragment extends Fragment { private App app = null; private Activity activity = null; - private FragmentRegisterNotificationsBinding b = null; + private FragmentNotificationsBinding b = null; @Override public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { @@ -33,7 +34,7 @@ public class RegisterNotificationsFragment extends Fragment { if (app.profile == null) return inflater.inflate(R.layout.fragment_loading, container, false); // activity, context and profile is valid - b = DataBindingUtil.inflate(inflater, R.layout.fragment_register_notifications, container, false); + b = DataBindingUtil.inflate(inflater, R.layout.fragment_notifications, container, false); return b.getRoot(); } diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/SettingsNewFragment.java b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/SettingsNewFragment.java index 41105860..34726682 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/SettingsNewFragment.java +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/SettingsNewFragment.java @@ -351,8 +351,8 @@ public class SettingsNewFragment extends MaterialAboutFragment { buttonIds.add(MainActivity.DRAWER_ITEM_GRADES); buttonIds.add(MainActivity.DRAWER_ITEM_MESSAGES); buttonIds.add(MainActivity.DRAWER_ITEM_HOMEWORK); - buttonIds.add(MainActivity.DRAWER_ITEM_NOTICES); - buttonIds.add(MainActivity.DRAWER_ITEM_ATTENDANCES); + buttonIds.add(MainActivity.DRAWER_ITEM_BEHAVIOUR); + buttonIds.add(MainActivity.DRAWER_ITEM_ATTENDANCE); buttonIds.add(MainActivity.DRAWER_ITEM_ANNOUNCEMENTS); buttonIds.add(MainActivity.DRAWER_ITEM_NOTIFICATIONS); buttonIds.add(MainActivity.DRAWER_ITEM_SETTINGS); @@ -365,7 +365,7 @@ public class SettingsNewFragment extends MaterialAboutFragment { buttonCaptions.add(getString(R.string.menu_messages)); buttonCaptions.add(getString(R.string.menu_homework)); buttonCaptions.add(getString(R.string.menu_notices)); - buttonCaptions.add(getString(R.string.menu_attendances)); + buttonCaptions.add(getString(R.string.menu_attendance)); buttonCaptions.add(getString(R.string.menu_announcements)); buttonCaptions.add(getString(R.string.menu_notifications)); buttonCaptions.add(getString(R.string.menu_settings)); @@ -1101,8 +1101,8 @@ public class SettingsNewFragment extends MaterialAboutFragment { case "Notices": stringRes = R.string.settings_sync_customize_endpoint_notices; break; - case "Attendances": - stringRes = R.string.settings_sync_customize_endpoint_attendances; + case "Attendance": + stringRes = R.string.settings_sync_customize_endpoint_attendance; break; case "Announcements": stringRes = R.string.settings_sync_customize_endpoint_announcements; diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/timetable/RegisterTimetableDayFragment.java b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/timetable/TimetableDayFragment.java similarity index 93% rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/timetable/RegisterTimetableDayFragment.java rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/timetable/TimetableDayFragment.java index ae04e29b..26f78b82 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/timetable/RegisterTimetableDayFragment.java +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/timetable/TimetableDayFragment.java @@ -1,6 +1,10 @@ package pl.szczodrzynski.edziennik.ui.modules.timetable; import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.databinding.DataBindingUtil; @@ -8,25 +12,21 @@ import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; - import java.util.ArrayList; import pl.szczodrzynski.edziennik.App; -import pl.szczodrzynski.edziennik.R; import pl.szczodrzynski.edziennik.MainActivity; -import pl.szczodrzynski.edziennik.databinding.FragmentRegisterTimetableDayBinding; +import pl.szczodrzynski.edziennik.R; +import pl.szczodrzynski.edziennik.databinding.FragmentTimetableDayBinding; +import pl.szczodrzynski.edziennik.utils.Themes; import pl.szczodrzynski.edziennik.utils.models.Date; import pl.szczodrzynski.edziennik.utils.models.Time; -import pl.szczodrzynski.edziennik.utils.Themes; -public class RegisterTimetableDayFragment extends Fragment { +public class TimetableDayFragment extends Fragment { private App app = null; private MainActivity activity = null; - private FragmentRegisterTimetableDayBinding b = null; + private FragmentTimetableDayBinding b = null; private RecyclerView recyclerView; @@ -40,7 +40,7 @@ public class RegisterTimetableDayFragment extends Fragment { if (app.profile == null) return inflater.inflate(R.layout.fragment_loading, container, false); // activity, context and profile is valid - b = DataBindingUtil.inflate(inflater, R.layout.fragment_register_timetable_day, container, false); + b = DataBindingUtil.inflate(inflater, R.layout.fragment_timetable_day, container, false); b.refreshLayout.setParent(activity.getSwipeRefreshLayout()); return b.getRoot(); } diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/timetable/RegisterTimetableFragment.java b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/timetable/TimetableFragment.java similarity index 98% rename from app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/timetable/RegisterTimetableFragment.java rename to app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/timetable/TimetableFragment.java index 524b9b6d..09eda619 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/timetable/RegisterTimetableFragment.java +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/timetable/TimetableFragment.java @@ -14,18 +14,6 @@ import android.net.Uri; import android.os.AsyncTask; import android.os.Build; import android.os.Bundle; -import androidx.annotation.NonNull; -import com.google.android.material.tabs.TabLayout; - -import androidx.annotation.Nullable; -import androidx.core.content.FileProvider; -import androidx.databinding.DataBindingUtil; -import androidx.fragment.app.Fragment; -import androidx.fragment.app.FragmentManager; -import androidx.fragment.app.FragmentPagerAdapter; -import androidx.viewpager.widget.ViewPager; -import androidx.cardview.widget.CardView; - import android.os.Environment; import android.text.Html; import android.util.Log; @@ -36,7 +24,18 @@ import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.cardview.widget.CardView; +import androidx.core.content.FileProvider; +import androidx.databinding.DataBindingUtil; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentPagerAdapter; +import androidx.viewpager.widget.ViewPager; + import com.afollestad.materialdialogs.MaterialDialog; +import com.google.android.material.tabs.TabLayout; import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial; import java.io.File; @@ -47,18 +46,18 @@ import java.util.List; import java.util.TreeMap; import pl.szczodrzynski.edziennik.App; -import pl.szczodrzynski.edziennik.R; import pl.szczodrzynski.edziennik.MainActivity; -import pl.szczodrzynski.edziennik.databinding.FragmentRegisterTimetableBinding; +import pl.szczodrzynski.edziennik.R; import pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonFull; +import pl.szczodrzynski.edziennik.databinding.FragmentTimetableBinding; import pl.szczodrzynski.edziennik.ui.dialogs.event.EventManualDialog; import pl.szczodrzynski.edziennik.ui.modules.home.HomeFragment; -import pl.szczodrzynski.edziennik.utils.models.Date; -import pl.szczodrzynski.edziennik.utils.models.Time; -import pl.szczodrzynski.edziennik.utils.models.Week; import pl.szczodrzynski.edziennik.utils.SpannableHtmlTagHandler; import pl.szczodrzynski.edziennik.utils.Themes; import pl.szczodrzynski.edziennik.utils.Utils; +import pl.szczodrzynski.edziennik.utils.models.Date; +import pl.szczodrzynski.edziennik.utils.models.Time; +import pl.szczodrzynski.edziennik.utils.models.Week; import pl.szczodrzynski.navlib.bottomsheet.items.BottomSheetPrimaryItem; import pl.szczodrzynski.navlib.bottomsheet.items.BottomSheetSeparatorItem; @@ -68,12 +67,12 @@ import static pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata.TYPE_ import static pl.szczodrzynski.edziennik.utils.Utils.bs; import static pl.szczodrzynski.edziennik.utils.Utils.d; -public class RegisterTimetableFragment extends Fragment { +public class TimetableFragment extends Fragment { private static final String TAG = "RegisterTimetable"; private App app = null; private MainActivity activity = null; - private FragmentRegisterTimetableBinding b = null; + private FragmentTimetableBinding b = null; private ViewPager viewPager; private static int pageSelection = -1; @@ -89,7 +88,7 @@ public class RegisterTimetableFragment extends Fragment { if (app.profile == null) return inflater.inflate(R.layout.fragment_loading, container, false); // activity, context and profile is valid - b = DataBindingUtil.inflate(inflater, R.layout.fragment_register_timetable, container, false); + b = DataBindingUtil.inflate(inflater, R.layout.fragment_timetable, container, false); return b.getRoot(); } @@ -154,13 +153,13 @@ public class RegisterTimetableFragment extends Fragment { for (int i = 0; i < app.appConfig.timetableDisplayDaysForward + app.appConfig.timetableDisplayDaysBackward + 1; i++) { Bundle args = new Bundle(); args.putLong("date", date.getValue()); - RegisterTimetableDayFragment registerTimetableDayFragment = new RegisterTimetableDayFragment(); - registerTimetableDayFragment.setArguments(args); + TimetableDayFragment timetableDayFragment = new TimetableDayFragment(); + timetableDayFragment.setArguments(args); StringBuilder pageTitle = new StringBuilder(Week.getFullDayName(date.getWeekDay())); if (i > weekEnd || i < weekBeginning) { pageTitle.append(", ").append(date.getStringDm()); } - adapter.addFragment(registerTimetableDayFragment, pageTitle.toString()); + adapter.addFragment(timetableDayFragment, pageTitle.toString()); date.stepForward(0, 0, 1); } viewPager.setAdapter(adapter); diff --git a/app/src/main/res/layout/messages_compose_activity.xml b/app/src/main/res/layout/activity_compose_message.xml similarity index 100% rename from app/src/main/res/layout/messages_compose_activity.xml rename to app/src/main/res/layout/activity_compose_message.xml diff --git a/app/src/main/res/layout/fragment_register_agenda_calendar.xml b/app/src/main/res/layout/fragment_agenda_calendar.xml similarity index 100% rename from app/src/main/res/layout/fragment_register_agenda_calendar.xml rename to app/src/main/res/layout/fragment_agenda_calendar.xml diff --git a/app/src/main/res/layout/fragment_register_agenda_default.xml b/app/src/main/res/layout/fragment_agenda_default.xml similarity index 100% rename from app/src/main/res/layout/fragment_register_agenda_default.xml rename to app/src/main/res/layout/fragment_agenda_default.xml diff --git a/app/src/main/res/layout/fragment_register_school_notices.xml b/app/src/main/res/layout/fragment_announcements.xml similarity index 100% rename from app/src/main/res/layout/fragment_register_school_notices.xml rename to app/src/main/res/layout/fragment_announcements.xml diff --git a/app/src/main/res/layout/fragment_register_attendances.xml b/app/src/main/res/layout/fragment_attendance.xml similarity index 97% rename from app/src/main/res/layout/fragment_register_attendances.xml rename to app/src/main/res/layout/fragment_attendance.xml index c8992f78..c0ddb3d4 100644 --- a/app/src/main/res/layout/fragment_register_attendances.xml +++ b/app/src/main/res/layout/fragment_attendance.xml @@ -27,7 +27,7 @@ android:orientation="vertical"> - \ No newline at end of file + diff --git a/app/src/main/res/layout/fragment_register_notices.xml b/app/src/main/res/layout/fragment_behaviour.xml similarity index 100% rename from app/src/main/res/layout/fragment_register_notices.xml rename to app/src/main/res/layout/fragment_behaviour.xml diff --git a/app/src/main/res/layout/fragment_register_grades.xml b/app/src/main/res/layout/fragment_grades.xml similarity index 100% rename from app/src/main/res/layout/fragment_register_grades.xml rename to app/src/main/res/layout/fragment_grades.xml diff --git a/app/src/main/res/layout/fragment_register_messages_web.xml b/app/src/main/res/layout/fragment_messages_web.xml similarity index 100% rename from app/src/main/res/layout/fragment_register_messages_web.xml rename to app/src/main/res/layout/fragment_messages_web.xml diff --git a/app/src/main/res/layout/fragment_register_notifications.xml b/app/src/main/res/layout/fragment_notifications.xml similarity index 100% rename from app/src/main/res/layout/fragment_register_notifications.xml rename to app/src/main/res/layout/fragment_notifications.xml diff --git a/app/src/main/res/layout/fragment_register_timetable.xml b/app/src/main/res/layout/fragment_timetable.xml similarity index 100% rename from app/src/main/res/layout/fragment_register_timetable.xml rename to app/src/main/res/layout/fragment_timetable.xml diff --git a/app/src/main/res/layout/fragment_register_timetable_day.xml b/app/src/main/res/layout/fragment_timetable_day.xml similarity index 100% rename from app/src/main/res/layout/fragment_register_timetable_day.xml rename to app/src/main/res/layout/fragment_timetable_day.xml diff --git a/app/src/main/res/values-en/strings.xml b/app/src/main/res/values-en/strings.xml index e898c234..599c4191 100644 --- a/app/src/main/res/values-en/strings.xml +++ b/app/src/main/res/values-en/strings.xml @@ -69,8 +69,8 @@ Releases: All subjects Summary - loading… - Summary - semester %d  - Summary - all year  + Summary - semester %d  + Summary - all year  Back Adjust the bell sync time. Format: ±H:MM:SS Incorrect format @@ -401,7 +401,7 @@ Add a new student Agenda Notice board - Attendance + Attendance Grades Grade editing simulator Help @@ -598,7 +598,7 @@ Share exams in your class Enable Event sharing Notice board - Attendances + Attendances Class free days Classrooms Events/agenda @@ -680,7 +680,7 @@ Getting account info Getting notice board Getting attendance types - Getting attendance + Getting attendance Getting behaviour grades categories Getting behaviour grades Getting agenda @@ -747,7 +747,7 @@ Syncing agenda… All Syncing announcements… - Syncing attendances… + Syncing attendance… Syncing grades… Syncing homework… Syncing received messages… diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index cc848455..b9de8bbb 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -76,8 +76,8 @@ Zwolnienia: Wszystkie przedmioty Podsumowanie - ładowanie… - Podsumowanie - semestr %d  - Podsumowanie - cały rok  + Podsumowanie - semestr %d  + Podsumowanie - cały rok  Wróć Dostosuj wartość przesunięcia dzwonka. Format: ±H:MM:SS Nieprawidłowy format @@ -425,7 +425,7 @@ Dodaj nowego ucznia Terminarz Tablica ogłoszeń - Frekwencja + Frekwencja Zapisz plan lekcji jako obraz Generuje plan lekcji na cały tydzień Oceny @@ -643,7 +643,7 @@ Udostępniaj sprawdziany w swojej klasie Włącz Udostępnianie wydarzeń Tablica ogłoszeń - Obecności/nieobecności + Obecności/nieobecności Dni wolne klasy Sale lekcyjne Wydarzenia/terminarz @@ -726,7 +726,7 @@ Pobieranie informacji o koncie Pobieranie ogłoszeń szkolnych Pobieranie kategorii obecności - Pobieranie obecności + Pobieranie obecności Pobieranie kategorii ocen z zachowania Pobieranie ocen z zachowania Pobieranie kalendarza @@ -794,7 +794,7 @@ Pobieram terminarz… Wszystkie Pobieram tablicę ogłoszeń… - Pobieram obecności… + Pobieram obecności… Pobieram oceny… Pobieram zadania domowe… Pobieram wiadomości odebrane…