Code structure reformat (#1)

Code structure reformat
This commit is contained in:
Kacper Ziubryniewicz 2019-09-28 18:29:46 +02:00 committed by GitHub
commit ce0f2f74df
221 changed files with 1489 additions and 1489 deletions

View File

@ -29,22 +29,22 @@
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
android:name=".messages.MessagesComposeActivity" android:name="pl.szczodrzynski.edziennik.ui.modules.messages.MessagesComposeActivity"
android:configChanges="orientation|screenSize" android:configChanges="orientation|screenSize"
android:label="@string/messages_compose_title" android:label="@string/messages_compose_title"
android:theme="@style/AppTheme.Black" /> android:theme="@style/AppTheme.Black" />
<activity <activity
android:name=".activities.FeedbackActivity" android:name=".ui.modules.base.FeedbackActivity"
android:configChanges="orientation|screenSize|keyboardHidden" android:configChanges="orientation|screenSize|keyboardHidden"
android:label="@string/app_name" android:label="@string/app_name"
android:theme="@style/AppTheme" /> android:theme="@style/AppTheme" />
<activity <activity
android:name=".login.LoginActivity" android:name="pl.szczodrzynski.edziennik.ui.modules.login.LoginActivity"
android:configChanges="orientation|screenSize" android:configChanges="orientation|screenSize"
android:launchMode="singleTop" android:launchMode="singleTop"
android:theme="@style/AppTheme.Light" /> android:theme="@style/AppTheme.Light" />
<activity <activity
android:name=".intro.ChangelogIntroActivity" android:name=".ui.modules.intro.ChangelogIntroActivity"
android:configChanges="orientation|keyboardHidden" android:configChanges="orientation|keyboardHidden"
android:label="@string/app_name" android:label="@string/app_name"
android:theme="@style/Theme.Intro" /> android:theme="@style/Theme.Intro" />
@ -57,7 +57,7 @@
|_| |_|_| \___|_.__/ \__,_|___/\___/ |_| |_|_| \___|_.__/ \__,_|___/\___/
--> -->
<activity <activity
android:name=".activities.CrashActivity" android:name=".ui.modules.base.CrashActivity"
android:configChanges="orientation|screenSize|keyboardHidden" android:configChanges="orientation|screenSize|keyboardHidden"
android:process=":error_activity" android:process=":error_activity"
android:theme="@style/DeadTheme" /> android:theme="@style/DeadTheme" />
@ -72,7 +72,7 @@
|___/ |___/
--> -->
<activity <activity
android:name=".activities.CrashGtfoActivity" android:name=".ui.modules.base.CrashGtfoActivity"
android:configChanges="orientation|screenSize|keyboardHidden" android:configChanges="orientation|screenSize|keyboardHidden"
android:theme="@style/DeadTheme" /> android:theme="@style/DeadTheme" />
<activity <activity
@ -103,7 +103,7 @@
android:theme="@style/AppTheme.NoDisplay" /> android:theme="@style/AppTheme.NoDisplay" />
<activity <activity
android:name=".activities.SettingsLicenseActivity" android:name=".ui.modules.settings.SettingsLicenseActivity"
android:configChanges="orientation|keyboardHidden" android:configChanges="orientation|keyboardHidden"
android:theme="@style/AppTheme" /> android:theme="@style/AppTheme" />
@ -113,14 +113,14 @@
android:theme="@style/Base.Theme.AppCompat" /> android:theme="@style/Base.Theme.AppCompat" />
<activity <activity
android:name=".activities.WebPushConfigActivity" android:name=".ui.modules.webpush.WebPushConfigActivity"
android:configChanges="orientation|keyboardHidden" android:configChanges="orientation|keyboardHidden"
android:theme="@style/AppTheme.Dark" /> android:theme="@style/AppTheme.Dark" />
<activity <activity
android:name=".activities.CounterActivity" android:name=".ui.modules.home.CounterActivity"
android:theme="@style/AppTheme.Black" /> android:theme="@style/AppTheme.Black" />
<activity android:name=".activities.QrScannerActivity" /> <activity android:name=".ui.modules.webpush.QrScannerActivity" />
<provider <provider
android:name="androidx.core.content.FileProvider" android:name="androidx.core.content.FileProvider"

View File

@ -63,18 +63,18 @@ import me.leolin.shortcutbadger.ShortcutBadger;
import okhttp3.ConnectionSpec; import okhttp3.ConnectionSpec;
import okhttp3.OkHttpClient; import okhttp3.OkHttpClient;
import okhttp3.TlsVersion; import okhttp3.TlsVersion;
import pl.szczodrzynski.edziennik.activities.CrashActivity; import pl.szczodrzynski.edziennik.ui.modules.base.CrashActivity;
import pl.szczodrzynski.edziennik.api.Edziennik; import pl.szczodrzynski.edziennik.data.api.Edziennik;
import pl.szczodrzynski.edziennik.api.Iuczniowie; import pl.szczodrzynski.edziennik.data.api.Iuczniowie;
import pl.szczodrzynski.edziennik.api.Librus; import pl.szczodrzynski.edziennik.data.api.Librus;
import pl.szczodrzynski.edziennik.api.Mobidziennik; import pl.szczodrzynski.edziennik.data.api.Mobidziennik;
import pl.szczodrzynski.edziennik.api.Vulcan; import pl.szczodrzynski.edziennik.data.api.Vulcan;
import pl.szczodrzynski.edziennik.datamodels.AppDb; import pl.szczodrzynski.edziennik.data.db.AppDb;
import pl.szczodrzynski.edziennik.datamodels.DebugLog; import pl.szczodrzynski.edziennik.data.db.modules.debuglog.DebugLog;
import pl.szczodrzynski.edziennik.datamodels.LoginStore; import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore;
import pl.szczodrzynski.edziennik.datamodels.Profile; import pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile;
import pl.szczodrzynski.edziennik.datamodels.ProfileFull; import pl.szczodrzynski.edziennik.data.db.modules.profiles.ProfileFull;
import pl.szczodrzynski.edziennik.models.AppConfig; import pl.szczodrzynski.edziennik.utils.models.AppConfig;
import pl.szczodrzynski.edziennik.network.NetworkUtils; import pl.szczodrzynski.edziennik.network.NetworkUtils;
import pl.szczodrzynski.edziennik.network.TLSSocketFactory; import pl.szczodrzynski.edziennik.network.TLSSocketFactory;
import pl.szczodrzynski.edziennik.receivers.JobsCreator; import pl.szczodrzynski.edziennik.receivers.JobsCreator;
@ -83,8 +83,8 @@ import pl.szczodrzynski.edziennik.utils.PermissionChecker;
import pl.szczodrzynski.edziennik.utils.Themes; import pl.szczodrzynski.edziennik.utils.Themes;
import pl.szczodrzynski.edziennik.utils.Utils; import pl.szczodrzynski.edziennik.utils.Utils;
import static pl.szczodrzynski.edziennik.datamodels.LoginStore.LOGIN_TYPE_MOBIDZIENNIK; import static pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore.LOGIN_TYPE_MOBIDZIENNIK;
import static pl.szczodrzynski.edziennik.datamodels.LoginStore.LOGIN_TYPE_VULCAN; import static pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore.LOGIN_TYPE_VULCAN;
public class App extends androidx.multidex.MultiDexApplication { public class App extends androidx.multidex.MultiDexApplication {
private static final String TAG = "App"; private static final String TAG = "App";

View File

@ -9,8 +9,8 @@ import android.os.Bundle
import androidx.core.app.ActivityCompat import androidx.core.app.ActivityCompat
import com.google.gson.JsonArray import com.google.gson.JsonArray
import com.google.gson.JsonObject import com.google.gson.JsonObject
import pl.szczodrzynski.edziennik.datamodels.Profile import pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile
import pl.szczodrzynski.edziennik.datamodels.Teacher import pl.szczodrzynski.edziennik.data.db.modules.teachers.Teacher
import pl.szczodrzynski.navlib.R import pl.szczodrzynski.navlib.R
import pl.szczodrzynski.navlib.crc16 import pl.szczodrzynski.navlib.crc16
import pl.szczodrzynski.navlib.getColorFromRes import pl.szczodrzynski.navlib.getColorFromRes

View File

@ -19,7 +19,7 @@ import com.mikepenz.iconics.typeface.library.community.material.CommunityMateria
import com.mikepenz.iconics.typeface.library.szkolny.font.SzkolnyFont import com.mikepenz.iconics.typeface.library.szkolny.font.SzkolnyFont
import com.mikepenz.materialdrawer.model.ProfileSettingDrawerItem import com.mikepenz.materialdrawer.model.ProfileSettingDrawerItem
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem
import pl.szczodrzynski.edziennik.datamodels.Metadata.* import pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata.*
import pl.szczodrzynski.edziennik.utils.Themes import pl.szczodrzynski.edziennik.utils.Themes
import pl.szczodrzynski.navlib.NavView import pl.szczodrzynski.navlib.NavView
import pl.szczodrzynski.navlib.SystemBarsUtil import pl.szczodrzynski.navlib.SystemBarsUtil
@ -41,22 +41,35 @@ import com.mikepenz.materialdrawer.model.ProfileDrawerItem
import com.mikepenz.materialdrawer.model.interfaces.IProfile import com.mikepenz.materialdrawer.model.interfaces.IProfile
import pl.droidsonroids.gif.GifDrawable import pl.droidsonroids.gif.GifDrawable
import pl.szczodrzynski.edziennik.App.APP_URL import pl.szczodrzynski.edziennik.App.APP_URL
import pl.szczodrzynski.edziennik.api.AppError import pl.szczodrzynski.edziennik.data.api.AppError
import pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface.* import pl.szczodrzynski.edziennik.data.api.interfaces.EdziennikInterface.*
import pl.szczodrzynski.edziennik.api.interfaces.SyncCallback import pl.szczodrzynski.edziennik.data.api.interfaces.SyncCallback
import pl.szczodrzynski.edziennik.databinding.ActivitySzkolnyBinding import pl.szczodrzynski.edziennik.databinding.ActivitySzkolnyBinding
import pl.szczodrzynski.edziennik.datamodels.LoginStore import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore
import pl.szczodrzynski.edziennik.datamodels.Profile import pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile
import pl.szczodrzynski.edziennik.datamodels.ProfileFull import pl.szczodrzynski.edziennik.data.db.modules.profiles.ProfileFull
import pl.szczodrzynski.edziennik.dialogs.ChangelogDialog import pl.szczodrzynski.edziennik.ui.dialogs.changelog.ChangelogDialog
import pl.szczodrzynski.edziennik.fragments.* import pl.szczodrzynski.edziennik.ui.modules.homework.HomeworkFragment
import pl.szczodrzynski.edziennik.homework.HomeworkFragment import pl.szczodrzynski.edziennik.ui.modules.login.LoginActivity
import pl.szczodrzynski.edziennik.login.LoginActivity import pl.szczodrzynski.edziennik.ui.modules.messages.MessagesDetailsFragment
import pl.szczodrzynski.edziennik.messages.MessagesDetailsFragment import pl.szczodrzynski.edziennik.ui.modules.messages.MessagesFragment
import pl.szczodrzynski.edziennik.messages.MessagesFragment import pl.szczodrzynski.edziennik.utils.models.NavTarget
import pl.szczodrzynski.edziennik.models.NavTarget
import pl.szczodrzynski.edziennik.network.ServerRequest import pl.szczodrzynski.edziennik.network.ServerRequest
import pl.szczodrzynski.edziennik.sync.SyncJob import pl.szczodrzynski.edziennik.sync.SyncJob
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.GradesFragment
import pl.szczodrzynski.edziennik.ui.modules.home.HomeFragment
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.TimetableFragment
import pl.szczodrzynski.edziennik.utils.SwipeRefreshLayoutNoTouch import pl.szczodrzynski.edziennik.utils.SwipeRefreshLayoutNoTouch
import pl.szczodrzynski.edziennik.utils.Utils import pl.szczodrzynski.edziennik.utils.Utils
import pl.szczodrzynski.navlib.bottomsheet.items.BottomSheetPrimaryItem import pl.szczodrzynski.navlib.bottomsheet.items.BottomSheetPrimaryItem
@ -85,8 +98,8 @@ class MainActivity : AppCompatActivity() {
const val DRAWER_ITEM_GRADES = 13 const val DRAWER_ITEM_GRADES = 13
const val DRAWER_ITEM_MESSAGES = 17 const val DRAWER_ITEM_MESSAGES = 17
const val DRAWER_ITEM_HOMEWORK = 14 const val DRAWER_ITEM_HOMEWORK = 14
const val DRAWER_ITEM_NOTICES = 15 const val DRAWER_ITEM_BEHAVIOUR = 15
const val DRAWER_ITEM_ATTENDANCES = 16 const val DRAWER_ITEM_ATTENDANCE = 16
const val DRAWER_ITEM_ANNOUNCEMENTS = 18 const val DRAWER_ITEM_ANNOUNCEMENTS = 18
const val DRAWER_ITEM_NOTIFICATIONS = 20 const val DRAWER_ITEM_NOTIFICATIONS = 20
const val DRAWER_ITEM_SETTINGS = 101 const val DRAWER_ITEM_SETTINGS = 101
@ -110,17 +123,17 @@ class MainActivity : AppCompatActivity() {
.isStatic(true) .isStatic(true)
.withPopToHome(false) .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) .withIcon(CommunityMaterial.Icon2.cmd_timetable)
.withBadgeTypeId(TYPE_LESSON_CHANGE) .withBadgeTypeId(TYPE_LESSON_CHANGE)
.isInDrawer(true) .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) .withIcon(CommunityMaterial.Icon.cmd_calendar)
.withBadgeTypeId(TYPE_EVENT) .withBadgeTypeId(TYPE_EVENT)
.isInDrawer(true) .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) .withIcon(CommunityMaterial.Icon2.cmd_numeric_5_box)
.withBadgeTypeId(TYPE_GRADE) .withBadgeTypeId(TYPE_GRADE)
.isInDrawer(true) .isInDrawer(true)
@ -135,24 +148,24 @@ class MainActivity : AppCompatActivity() {
.withBadgeTypeId(TYPE_HOMEWORK) .withBadgeTypeId(TYPE_HOMEWORK)
.isInDrawer(true) .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) .withIcon(CommunityMaterial.Icon2.cmd_message_alert)
.withBadgeTypeId(TYPE_NOTICE) .withBadgeTypeId(TYPE_NOTICE)
.isInDrawer(true) .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) .withIcon(CommunityMaterial.Icon.cmd_calendar_remove)
.withBadgeTypeId(TYPE_ATTENDANCE) .withBadgeTypeId(TYPE_ATTENDANCE)
.isInDrawer(true) .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) .withIcon(CommunityMaterial.Icon.cmd_bulletin_board)
.withBadgeTypeId(TYPE_ANNOUNCEMENT) .withBadgeTypeId(TYPE_ANNOUNCEMENT)
.isInDrawer(true) .isInDrawer(true)
// static drawer items // 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) .withIcon(CommunityMaterial.Icon.cmd_bell_ring)
.isInDrawer(true) .isInDrawer(true)
.isStatic(true) .isStatic(true)
@ -524,8 +537,8 @@ class MainActivity : AppCompatActivity() {
DRAWER_ITEM_AGENDA -> FEATURE_AGENDA DRAWER_ITEM_AGENDA -> FEATURE_AGENDA
DRAWER_ITEM_GRADES -> FEATURE_GRADES DRAWER_ITEM_GRADES -> FEATURE_GRADES
DRAWER_ITEM_HOMEWORK -> FEATURE_HOMEWORK DRAWER_ITEM_HOMEWORK -> FEATURE_HOMEWORK
DRAWER_ITEM_NOTICES -> FEATURE_NOTICES DRAWER_ITEM_BEHAVIOUR -> FEATURE_NOTICES
DRAWER_ITEM_ATTENDANCES -> FEATURE_ATTENDANCES DRAWER_ITEM_ATTENDANCE -> FEATURE_ATTENDANCE
DRAWER_ITEM_MESSAGES -> when (MessagesFragment.pageSelection) { DRAWER_ITEM_MESSAGES -> when (MessagesFragment.pageSelection) {
1 -> FEATURE_MESSAGES_OUTBOX 1 -> FEATURE_MESSAGES_OUTBOX
else -> FEATURE_MESSAGES_INBOX else -> FEATURE_MESSAGES_INBOX
@ -540,8 +553,8 @@ class MainActivity : AppCompatActivity() {
DRAWER_ITEM_AGENDA -> R.string.sync_feature_agenda DRAWER_ITEM_AGENDA -> R.string.sync_feature_agenda
DRAWER_ITEM_GRADES -> R.string.sync_feature_grades DRAWER_ITEM_GRADES -> R.string.sync_feature_grades
DRAWER_ITEM_HOMEWORK -> R.string.sync_feature_homework DRAWER_ITEM_HOMEWORK -> R.string.sync_feature_homework
DRAWER_ITEM_NOTICES -> R.string.sync_feature_notices DRAWER_ITEM_BEHAVIOUR -> R.string.sync_feature_notices
DRAWER_ITEM_ATTENDANCES -> R.string.sync_feature_attendances DRAWER_ITEM_ATTENDANCE -> R.string.sync_feature_attendance
DRAWER_ITEM_MESSAGES -> when (MessagesFragment.pageSelection) { DRAWER_ITEM_MESSAGES -> when (MessagesFragment.pageSelection) {
1 -> R.string.sync_feature_messages_outbox 1 -> R.string.sync_feature_messages_outbox
else -> R.string.sync_feature_messages_inbox else -> R.string.sync_feature_messages_inbox

View File

@ -16,9 +16,9 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import pl.szczodrzynski.edziennik.datamodels.ProfileFull; import pl.szczodrzynski.edziennik.data.db.modules.profiles.ProfileFull;
import pl.szczodrzynski.edziennik.models.Date; import pl.szczodrzynski.edziennik.utils.models.Date;
import pl.szczodrzynski.edziennik.models.Time; import pl.szczodrzynski.edziennik.utils.models.Time;
import pl.szczodrzynski.edziennik.receivers.BootReceiver; import pl.szczodrzynski.edziennik.receivers.BootReceiver;
import pl.szczodrzynski.edziennik.sync.SyncJob; import pl.szczodrzynski.edziennik.sync.SyncJob;
import pl.szczodrzynski.edziennik.sync.SyncService; import pl.szczodrzynski.edziennik.sync.SyncService;
@ -221,7 +221,7 @@ public class Notifier {
| . ` |/ _ \| __| | _| |/ __/ _` | __| |/ _ \| '_ \ | . ` |/ _ \| __| | _| |/ __/ _` | __| |/ _ \| '_ \
| |\ | (_) | |_| | | | | (_| (_| | |_| | (_) | | | | | |\ | (_) | |_| | | | | (_| (_| | |_| | (_) | | | |
|_| \_|\___/ \__|_|_| |_|\___\__,_|\__|_|\___/|_| |*/ |_| \_|\___/ \__|_|_| |_|\___\__,_|\__|_|\___/|_| |*/
public void add(pl.szczodrzynski.edziennik.models.Notification notification) { public void add(pl.szczodrzynski.edziennik.utils.models.Notification notification) {
app.appConfig.notifications.add(notification); app.appConfig.notifications.add(notification);
} }
@ -235,8 +235,8 @@ public class Notifier {
} }
int unreadCount = 0; int unreadCount = 0;
List<pl.szczodrzynski.edziennik.models.Notification> notificationList = new ArrayList<>(); List<pl.szczodrzynski.edziennik.utils.models.Notification> notificationList = new ArrayList<>();
for (pl.szczodrzynski.edziennik.models.Notification notification: app.appConfig.notifications) { for (pl.szczodrzynski.edziennik.utils.models.Notification notification: app.appConfig.notifications) {
if (!notification.notified) { if (!notification.notified) {
notification.seen = false; notification.seen = false;
notification.notified = true; notification.notified = true;
@ -250,7 +250,7 @@ public class Notifier {
} }
} }
for (pl.szczodrzynski.edziennik.models.Notification notification: notificationList) { for (pl.szczodrzynski.edziennik.utils.models.Notification notification: notificationList) {
Intent intent = new Intent(app, MainActivity.class); Intent intent = new Intent(app, MainActivity.class);
notification.fillIntent(intent); notification.fillIntent(intent);
PendingIntent pendingIntent = PendingIntent.getActivity(app, notification.id, intent, 0); PendingIntent pendingIntent = PendingIntent.getActivity(app, notification.id, intent, 0);
@ -258,9 +258,9 @@ public class Notifier {
// title, text, type, date // title, text, type, date
.setContentTitle(notification.title) .setContentTitle(notification.title)
.setContentText(notification.text) .setContentText(notification.text)
.setSubText(pl.szczodrzynski.edziennik.models.Notification.stringType(app, notification.type)) .setSubText(pl.szczodrzynski.edziennik.utils.models.Notification.stringType(app, notification.type))
.setWhen(notification.addedDate) .setWhen(notification.addedDate)
.setTicker(app.getString(R.string.notification_ticker_format, pl.szczodrzynski.edziennik.models.Notification.stringType(app, notification.type))) .setTicker(app.getString(R.string.notification_ticker_format, pl.szczodrzynski.edziennik.utils.models.Notification.stringType(app, notification.type)))
// icon, color, lights, priority // icon, color, lights, priority
.setSmallIcon(R.drawable.ic_notification) .setSmallIcon(R.drawable.ic_notification)
.setColor(notificationColor) .setColor(notificationColor)
@ -349,7 +349,7 @@ public class Notifier {
} }
public void dump() { public void dump() {
for (pl.szczodrzynski.edziennik.models.Notification notification: app.appConfig.notifications) { for (pl.szczodrzynski.edziennik.utils.models.Notification notification: app.appConfig.notifications) {
Log.d(TAG, "Profile"+notification.profileId+" Notification from "+ Date.fromMillis(notification.addedDate).getFormattedString()+" "+ Time.fromMillis(notification.addedDate).getStringHMS()+" - "+notification.text); Log.d(TAG, "Profile"+notification.profileId+" Notification from "+ Date.fromMillis(notification.addedDate).getFormattedString()+" "+ Time.fromMillis(notification.addedDate).getStringHMS()+" - "+notification.text);
} }
} }

View File

@ -28,22 +28,22 @@ import java.lang.reflect.Method;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import pl.szczodrzynski.edziennik.datamodels.EventFull; import pl.szczodrzynski.edziennik.data.db.modules.events.EventFull;
import pl.szczodrzynski.edziennik.datamodels.LessonChange; import pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonChange;
import pl.szczodrzynski.edziennik.datamodels.LessonFull; import pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonFull;
import pl.szczodrzynski.edziennik.datamodels.Profile; import pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile;
import pl.szczodrzynski.edziennik.fragments.HomeFragment; import pl.szczodrzynski.edziennik.ui.modules.home.HomeFragment;
import pl.szczodrzynski.edziennik.models.Date; import pl.szczodrzynski.edziennik.utils.models.Date;
import pl.szczodrzynski.edziennik.models.ItemWidgetTimetableModel; import pl.szczodrzynski.edziennik.utils.models.ItemWidgetTimetableModel;
import pl.szczodrzynski.edziennik.models.Time; import pl.szczodrzynski.edziennik.utils.models.Time;
import pl.szczodrzynski.edziennik.models.Week; import pl.szczodrzynski.edziennik.utils.models.Week;
import pl.szczodrzynski.edziennik.widgets.WidgetConfig; import pl.szczodrzynski.edziennik.widgets.WidgetConfig;
import pl.szczodrzynski.edziennik.sync.SyncJob; import pl.szczodrzynski.edziennik.sync.SyncJob;
import pl.szczodrzynski.edziennik.widgets.timetable.LessonDetailsActivity; import pl.szczodrzynski.edziennik.widgets.timetable.LessonDetailsActivity;
import pl.szczodrzynski.edziennik.widgets.timetable.WidgetTimetableService; import pl.szczodrzynski.edziennik.widgets.timetable.WidgetTimetableService;
import static pl.szczodrzynski.edziennik.ExtensionsKt.filterOutArchived; import static pl.szczodrzynski.edziennik.ExtensionsKt.filterOutArchived;
import static pl.szczodrzynski.edziennik.datamodels.Event.TYPE_HOMEWORK; import static pl.szczodrzynski.edziennik.data.db.modules.events.Event.TYPE_HOMEWORK;
import static pl.szczodrzynski.edziennik.utils.Utils.bs; import static pl.szczodrzynski.edziennik.utils.Utils.bs;

View File

@ -1,9 +0,0 @@
package pl.szczodrzynski.edziennik.api.interfaces;
import java.util.List;
import pl.szczodrzynski.edziennik.datamodels.MessageFull;
public interface MessageListCallback {
void onSuccess(List<MessageFull> messageList);
}

View File

@ -1,9 +0,0 @@
package pl.szczodrzynski.edziennik.api.interfaces;
import java.util.List;
import pl.szczodrzynski.edziennik.datamodels.Teacher;
public interface RecipientListGetCallback {
void onSuccess(List<Teacher> teacherList);
}

View File

@ -1,6 +0,0 @@
package pl.szczodrzynski.edziennik.api.v2
import pl.szczodrzynski.edziennik.api.AppError
import pl.szczodrzynski.edziennik.datamodels.LoginStore
data class ApiLoginResult(val loginStore: LoginStore, val error: AppError?)

View File

@ -1,6 +0,0 @@
package pl.szczodrzynski.edziennik.api.v2
import pl.szczodrzynski.edziennik.api.AppError
import pl.szczodrzynski.edziennik.datamodels.Profile
data class FirstLoginResult(val profileList: ArrayList<Profile>, val error: AppError?)

View File

@ -1,10 +0,0 @@
package pl.szczodrzynski.edziennik.api.v2.librus.data
import pl.szczodrzynski.edziennik.App
import pl.szczodrzynski.edziennik.api.interfaces.ProgressCallback
import pl.szczodrzynski.edziennik.datamodels.LoginStore
import pl.szczodrzynski.edziennik.datamodels.Profile
class DataLibrus(val app: App, val profile: Profile, val loginStore: LoginStore, val callback: ProgressCallback, val onSuccess: () -> Unit) {
}

View File

@ -1,12 +0,0 @@
package pl.szczodrzynski.edziennik.api.v2.librus.firstlogin
import pl.szczodrzynski.edziennik.App
import pl.szczodrzynski.edziennik.api.interfaces.ProgressCallback
import pl.szczodrzynski.edziennik.datamodels.LoginStore
import pl.szczodrzynski.edziennik.datamodels.Profile
class FirstLoginLibrus(val app: App, val loginStore: LoginStore, val progressCallback: ProgressCallback, val onSuccess: (profileList: List<Profile>) -> Unit) {
init {
}
}

View File

@ -1,12 +0,0 @@
package pl.szczodrzynski.edziennik.api.v2.librus.firstlogin
import pl.szczodrzynski.edziennik.App
import pl.szczodrzynski.edziennik.api.interfaces.ProgressCallback
import pl.szczodrzynski.edziennik.datamodels.LoginStore
import pl.szczodrzynski.edziennik.datamodels.Profile
class FirstLoginSynergia(val app: App, val loginStore: LoginStore, val progressCallback: ProgressCallback, val onSuccess: (profileList: List<Profile>) -> Unit) {
init {
}
}

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.api; package pl.szczodrzynski.edziennik.data.api;
import android.content.Context; import android.content.Context;
import android.os.AsyncTask; import android.os.AsyncTask;

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.api; package pl.szczodrzynski.edziennik.data.api;
import android.app.Activity; import android.app.Activity;
import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetManager;
@ -43,27 +43,27 @@ import pl.szczodrzynski.edziennik.BuildConfig;
import pl.szczodrzynski.edziennik.R; import pl.szczodrzynski.edziennik.R;
import pl.szczodrzynski.edziennik.MainActivity; import pl.szczodrzynski.edziennik.MainActivity;
import pl.szczodrzynski.edziennik.WidgetTimetable; import pl.szczodrzynski.edziennik.WidgetTimetable;
import pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface; import pl.szczodrzynski.edziennik.data.api.interfaces.EdziennikInterface;
import pl.szczodrzynski.edziennik.api.interfaces.SyncCallback; import pl.szczodrzynski.edziennik.data.api.interfaces.SyncCallback;
import pl.szczodrzynski.edziennik.datamodels.AnnouncementFull; import pl.szczodrzynski.edziennik.data.db.modules.announcements.AnnouncementFull;
import pl.szczodrzynski.edziennik.datamodels.Attendance; import pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance;
import pl.szczodrzynski.edziennik.datamodels.AttendanceFull; import pl.szczodrzynski.edziennik.data.db.modules.attendance.AttendanceFull;
import pl.szczodrzynski.edziennik.datamodels.Event; import pl.szczodrzynski.edziennik.data.db.modules.events.Event;
import pl.szczodrzynski.edziennik.datamodels.EventFull; import pl.szczodrzynski.edziennik.data.db.modules.events.EventFull;
import pl.szczodrzynski.edziennik.datamodels.EventType; import pl.szczodrzynski.edziennik.data.db.modules.events.EventType;
import pl.szczodrzynski.edziennik.datamodels.GradeFull; import pl.szczodrzynski.edziennik.data.db.modules.grades.GradeFull;
import pl.szczodrzynski.edziennik.datamodels.LessonFull; import pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonFull;
import pl.szczodrzynski.edziennik.datamodels.LoginStore; import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore;
import pl.szczodrzynski.edziennik.datamodels.Message; import pl.szczodrzynski.edziennik.data.db.modules.messages.Message;
import pl.szczodrzynski.edziennik.datamodels.MessageFull; import pl.szczodrzynski.edziennik.data.db.modules.messages.MessageFull;
import pl.szczodrzynski.edziennik.datamodels.Metadata; import pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata;
import pl.szczodrzynski.edziennik.datamodels.Notice; import pl.szczodrzynski.edziennik.data.db.modules.notices.Notice;
import pl.szczodrzynski.edziennik.datamodels.NoticeFull; import pl.szczodrzynski.edziennik.data.db.modules.notices.NoticeFull;
import pl.szczodrzynski.edziennik.datamodels.Profile; import pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile;
import pl.szczodrzynski.edziennik.datamodels.ProfileFull; import pl.szczodrzynski.edziennik.data.db.modules.profiles.ProfileFull;
import pl.szczodrzynski.edziennik.datamodels.Team; import pl.szczodrzynski.edziennik.data.db.modules.teams.Team;
import pl.szczodrzynski.edziennik.models.Date; import pl.szczodrzynski.edziennik.utils.models.Date;
import pl.szczodrzynski.edziennik.models.Notification; import pl.szczodrzynski.edziennik.utils.models.Notification;
import pl.szczodrzynski.edziennik.network.ServerRequest; import pl.szczodrzynski.edziennik.network.ServerRequest;
import pl.szczodrzynski.edziennik.sync.SyncJob; import pl.szczodrzynski.edziennik.sync.SyncJob;
import pl.szczodrzynski.edziennik.utils.Themes; import pl.szczodrzynski.edziennik.utils.Themes;
@ -75,34 +75,34 @@ import static com.mikepenz.iconics.utils.IconicsConvertersKt.colorInt;
import static com.mikepenz.iconics.utils.IconicsConvertersKt.sizeDp; import static com.mikepenz.iconics.utils.IconicsConvertersKt.sizeDp;
import static pl.szczodrzynski.edziennik.App.APP_URL; import static pl.szczodrzynski.edziennik.App.APP_URL;
import static pl.szczodrzynski.edziennik.MainActivity.DRAWER_ITEM_HOME; import static pl.szczodrzynski.edziennik.MainActivity.DRAWER_ITEM_HOME;
import static pl.szczodrzynski.edziennik.api.AppError.CODE_OK; import static pl.szczodrzynski.edziennik.data.api.AppError.CODE_OK;
import static pl.szczodrzynski.edziennik.api.AppError.CODE_OTHER; import static pl.szczodrzynski.edziennik.data.api.AppError.CODE_OTHER;
import static pl.szczodrzynski.edziennik.api.AppError.CODE_PROFILE_ARCHIVED; import static pl.szczodrzynski.edziennik.data.api.AppError.CODE_PROFILE_ARCHIVED;
import static pl.szczodrzynski.edziennik.api.AppError.CODE_PROFILE_NOT_FOUND; import static pl.szczodrzynski.edziennik.data.api.AppError.CODE_PROFILE_NOT_FOUND;
import static pl.szczodrzynski.edziennik.api.AppError.stringErrorCode; import static pl.szczodrzynski.edziennik.data.api.AppError.stringErrorCode;
import static pl.szczodrzynski.edziennik.api.AppError.stringErrorType; import static pl.szczodrzynski.edziennik.data.api.AppError.stringErrorType;
import static pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface.FEATURE_AGENDA; import static pl.szczodrzynski.edziennik.data.api.interfaces.EdziennikInterface.FEATURE_AGENDA;
import static pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface.FEATURE_ALL; import static pl.szczodrzynski.edziennik.data.api.interfaces.EdziennikInterface.FEATURE_ALL;
import static pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface.FEATURE_ANNOUNCEMENTS; import static pl.szczodrzynski.edziennik.data.api.interfaces.EdziennikInterface.FEATURE_ANNOUNCEMENTS;
import static pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface.FEATURE_ATTENDANCES; import static pl.szczodrzynski.edziennik.data.api.interfaces.EdziennikInterface.FEATURE_ATTENDANCE;
import static pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface.FEATURE_GRADES; import static pl.szczodrzynski.edziennik.data.api.interfaces.EdziennikInterface.FEATURE_GRADES;
import static pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface.FEATURE_HOMEWORK; import static pl.szczodrzynski.edziennik.data.api.interfaces.EdziennikInterface.FEATURE_HOMEWORK;
import static pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface.FEATURE_MESSAGES_INBOX; import static pl.szczodrzynski.edziennik.data.api.interfaces.EdziennikInterface.FEATURE_MESSAGES_INBOX;
import static pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface.FEATURE_MESSAGES_OUTBOX; import static pl.szczodrzynski.edziennik.data.api.interfaces.EdziennikInterface.FEATURE_MESSAGES_OUTBOX;
import static pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface.FEATURE_NOTICES; import static pl.szczodrzynski.edziennik.data.api.interfaces.EdziennikInterface.FEATURE_NOTICES;
import static pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface.FEATURE_TIMETABLE; import static pl.szczodrzynski.edziennik.data.api.interfaces.EdziennikInterface.FEATURE_TIMETABLE;
import static pl.szczodrzynski.edziennik.datamodels.Event.TYPE_HOMEWORK; import static pl.szczodrzynski.edziennik.data.db.modules.events.Event.TYPE_HOMEWORK;
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_SEMESTER1_FINAL; import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_SEMESTER1_FINAL;
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_SEMESTER1_PROPOSED; import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_SEMESTER1_PROPOSED;
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_SEMESTER2_FINAL; import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_SEMESTER2_FINAL;
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_SEMESTER2_PROPOSED; import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_SEMESTER2_PROPOSED;
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_YEAR_FINAL; import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_YEAR_FINAL;
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_YEAR_PROPOSED; import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_YEAR_PROPOSED;
import static pl.szczodrzynski.edziennik.datamodels.LoginStore.LOGIN_TYPE_IUCZNIOWIE; import static pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore.LOGIN_TYPE_IUCZNIOWIE;
import static pl.szczodrzynski.edziennik.datamodels.LoginStore.LOGIN_TYPE_LIBRUS; import static pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore.LOGIN_TYPE_LIBRUS;
import static pl.szczodrzynski.edziennik.datamodels.LoginStore.LOGIN_TYPE_MOBIDZIENNIK; import static pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore.LOGIN_TYPE_MOBIDZIENNIK;
import static pl.szczodrzynski.edziennik.datamodels.LoginStore.LOGIN_TYPE_VULCAN; import static pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore.LOGIN_TYPE_VULCAN;
import static pl.szczodrzynski.edziennik.datamodels.Profile.REGISTRATION_ENABLED; import static pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile.REGISTRATION_ENABLED;
import static pl.szczodrzynski.edziennik.sync.SyncService.PROFILE_MAX_PROGRESS; import static pl.szczodrzynski.edziennik.sync.SyncService.PROFILE_MAX_PROGRESS;
import static pl.szczodrzynski.edziennik.utils.Utils.d; import static pl.szczodrzynski.edziennik.utils.Utils.d;
import static pl.szczodrzynski.edziennik.utils.Utils.ns; import static pl.szczodrzynski.edziennik.utils.Utils.ns;
@ -354,7 +354,7 @@ public class Edziennik {
app.notifier.add(new Notification(app.getContext(), text) app.notifier.add(new Notification(app.getContext(), text)
.withProfileData(profile.getId(), profile.getName()) .withProfileData(profile.getId(), profile.getName())
.withType(Notification.TYPE_NEW_NOTICE) .withType(Notification.TYPE_NEW_NOTICE)
.withFragmentRedirect(MainActivity.DRAWER_ITEM_NOTICES) .withFragmentRedirect(MainActivity.DRAWER_ITEM_BEHAVIOUR)
.withLongExtra("noticeId", notice.id) .withLongExtra("noticeId", notice.id)
.withAddedDate(notice.addedDate) .withAddedDate(notice.addedDate)
); );
@ -382,7 +382,7 @@ public class Edziennik {
app.notifier.add(new Notification(app.getContext(), text) app.notifier.add(new Notification(app.getContext(), text)
.withProfileData(profile.getId(), profile.getName()) .withProfileData(profile.getId(), profile.getName())
.withType(Notification.TYPE_NEW_ATTENDANCE) .withType(Notification.TYPE_NEW_ATTENDANCE)
.withFragmentRedirect(MainActivity.DRAWER_ITEM_ATTENDANCES) .withFragmentRedirect(MainActivity.DRAWER_ITEM_ATTENDANCE)
.withLongExtra("attendanceId", attendance.id) .withLongExtra("attendanceId", attendance.id)
.withAddedDate(attendance.addedDate) .withAddedDate(attendance.addedDate)
); );
@ -849,7 +849,7 @@ public class Edziennik {
app.getString(R.string.menu_grades), app.getString(R.string.menu_grades),
app.getString(R.string.menu_homework), app.getString(R.string.menu_homework),
app.getString(R.string.menu_notices), 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_inbox_single),
app.getString(R.string.title_messages_sent_single), app.getString(R.string.title_messages_sent_single),
app.getString(R.string.menu_announcements) app.getString(R.string.menu_announcements)
@ -860,7 +860,7 @@ public class Edziennik {
FEATURE_GRADES, FEATURE_GRADES,
FEATURE_HOMEWORK, FEATURE_HOMEWORK,
FEATURE_NOTICES, FEATURE_NOTICES,
FEATURE_ATTENDANCES, FEATURE_ATTENDANCE,
FEATURE_MESSAGES_INBOX, FEATURE_MESSAGES_INBOX,
FEATURE_MESSAGES_OUTBOX, FEATURE_MESSAGES_OUTBOX,
FEATURE_ANNOUNCEMENTS FEATURE_ANNOUNCEMENTS

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.api; package pl.szczodrzynski.edziennik.data.api;
import android.content.Context; import android.content.Context;
import android.graphics.Color; import android.graphics.Color;
@ -34,58 +34,58 @@ import okhttp3.HttpUrl;
import pl.szczodrzynski.edziennik.App; import pl.szczodrzynski.edziennik.App;
import pl.szczodrzynski.edziennik.BuildConfig; import pl.szczodrzynski.edziennik.BuildConfig;
import pl.szczodrzynski.edziennik.R; import pl.szczodrzynski.edziennik.R;
import pl.szczodrzynski.edziennik.api.interfaces.AttachmentGetCallback; import pl.szczodrzynski.edziennik.data.api.interfaces.AttachmentGetCallback;
import pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface; import pl.szczodrzynski.edziennik.data.api.interfaces.EdziennikInterface;
import pl.szczodrzynski.edziennik.api.interfaces.LoginCallback; import pl.szczodrzynski.edziennik.data.api.interfaces.LoginCallback;
import pl.szczodrzynski.edziennik.api.interfaces.MessageGetCallback; import pl.szczodrzynski.edziennik.data.api.interfaces.MessageGetCallback;
import pl.szczodrzynski.edziennik.api.interfaces.RecipientListGetCallback; import pl.szczodrzynski.edziennik.data.api.interfaces.RecipientListGetCallback;
import pl.szczodrzynski.edziennik.api.interfaces.SyncCallback; import pl.szczodrzynski.edziennik.data.api.interfaces.SyncCallback;
import pl.szczodrzynski.edziennik.datamodels.Announcement; import pl.szczodrzynski.edziennik.data.db.modules.announcements.Announcement;
import pl.szczodrzynski.edziennik.datamodels.Attendance; import pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance;
import pl.szczodrzynski.edziennik.datamodels.Event; import pl.szczodrzynski.edziennik.data.db.modules.events.Event;
import pl.szczodrzynski.edziennik.datamodels.Grade; import pl.szczodrzynski.edziennik.data.db.modules.grades.Grade;
import pl.szczodrzynski.edziennik.datamodels.Lesson; import pl.szczodrzynski.edziennik.data.db.modules.lessons.Lesson;
import pl.szczodrzynski.edziennik.datamodels.LessonChange; import pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonChange;
import pl.szczodrzynski.edziennik.datamodels.LoginStore; import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore;
import pl.szczodrzynski.edziennik.datamodels.LuckyNumber; import pl.szczodrzynski.edziennik.data.db.modules.luckynumber.LuckyNumber;
import pl.szczodrzynski.edziennik.datamodels.Message; import pl.szczodrzynski.edziennik.data.db.modules.messages.Message;
import pl.szczodrzynski.edziennik.datamodels.MessageFull; import pl.szczodrzynski.edziennik.data.db.modules.messages.MessageFull;
import pl.szczodrzynski.edziennik.datamodels.MessageRecipient; import pl.szczodrzynski.edziennik.data.db.modules.messages.MessageRecipient;
import pl.szczodrzynski.edziennik.datamodels.MessageRecipientFull; import pl.szczodrzynski.edziennik.data.db.modules.messages.MessageRecipientFull;
import pl.szczodrzynski.edziennik.datamodels.Metadata; import pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata;
import pl.szczodrzynski.edziennik.datamodels.Notice; import pl.szczodrzynski.edziennik.data.db.modules.notices.Notice;
import pl.szczodrzynski.edziennik.datamodels.Profile; import pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile;
import pl.szczodrzynski.edziennik.datamodels.ProfileFull; import pl.szczodrzynski.edziennik.data.db.modules.profiles.ProfileFull;
import pl.szczodrzynski.edziennik.datamodels.Subject; import pl.szczodrzynski.edziennik.data.db.modules.subjects.Subject;
import pl.szczodrzynski.edziennik.datamodels.Teacher; import pl.szczodrzynski.edziennik.data.db.modules.teachers.Teacher;
import pl.szczodrzynski.edziennik.datamodels.Team; import pl.szczodrzynski.edziennik.data.db.modules.teams.Team;
import pl.szczodrzynski.edziennik.messages.MessagesComposeInfo; import pl.szczodrzynski.edziennik.ui.modules.messages.MessagesComposeInfo;
import pl.szczodrzynski.edziennik.models.Date; import pl.szczodrzynski.edziennik.utils.models.Date;
import pl.szczodrzynski.edziennik.models.Endpoint; import pl.szczodrzynski.edziennik.utils.models.Endpoint;
import pl.szczodrzynski.edziennik.models.Time; import pl.szczodrzynski.edziennik.utils.models.Time;
import pl.szczodrzynski.edziennik.models.Week; import pl.szczodrzynski.edziennik.utils.models.Week;
import static pl.szczodrzynski.edziennik.api.AppError.CODE_INVALID_LOGIN; import static pl.szczodrzynski.edziennik.data.api.AppError.CODE_INVALID_LOGIN;
import static pl.szczodrzynski.edziennik.api.AppError.CODE_INVALID_SCHOOL_NAME; import static pl.szczodrzynski.edziennik.data.api.AppError.CODE_INVALID_SCHOOL_NAME;
import static pl.szczodrzynski.edziennik.api.AppError.CODE_MAINTENANCE; import static pl.szczodrzynski.edziennik.data.api.AppError.CODE_MAINTENANCE;
import static pl.szczodrzynski.edziennik.api.AppError.CODE_OTHER; import static pl.szczodrzynski.edziennik.data.api.AppError.CODE_OTHER;
import static pl.szczodrzynski.edziennik.datamodels.Attendance.TYPE_ABSENT; import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_ABSENT;
import static pl.szczodrzynski.edziennik.datamodels.Attendance.TYPE_ABSENT_EXCUSED; import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_ABSENT_EXCUSED;
import static pl.szczodrzynski.edziennik.datamodels.Attendance.TYPE_BELATED; import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_BELATED;
import static pl.szczodrzynski.edziennik.datamodels.Attendance.TYPE_PRESENT; import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_PRESENT;
import static pl.szczodrzynski.edziennik.datamodels.Attendance.TYPE_RELEASED; import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_RELEASED;
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_SEMESTER1_FINAL; import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_SEMESTER1_FINAL;
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_SEMESTER1_PROPOSED; import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_SEMESTER1_PROPOSED;
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_YEAR_FINAL; import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_YEAR_FINAL;
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_YEAR_PROPOSED; import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_YEAR_PROPOSED;
import static pl.szczodrzynski.edziennik.datamodels.LessonChange.TYPE_CANCELLED; import static pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonChange.TYPE_CANCELLED;
import static pl.szczodrzynski.edziennik.datamodels.LessonChange.TYPE_CHANGE; import static pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonChange.TYPE_CHANGE;
import static pl.szczodrzynski.edziennik.datamodels.Message.TYPE_DELETED; import static pl.szczodrzynski.edziennik.data.db.modules.messages.Message.TYPE_DELETED;
import static pl.szczodrzynski.edziennik.datamodels.Message.TYPE_RECEIVED; import static pl.szczodrzynski.edziennik.data.db.modules.messages.Message.TYPE_RECEIVED;
import static pl.szczodrzynski.edziennik.datamodels.Message.TYPE_SENT; import static pl.szczodrzynski.edziennik.data.db.modules.messages.Message.TYPE_SENT;
import static pl.szczodrzynski.edziennik.datamodels.Notice.TYPE_NEGATIVE; import static pl.szczodrzynski.edziennik.data.db.modules.notices.Notice.TYPE_NEGATIVE;
import static pl.szczodrzynski.edziennik.datamodels.Notice.TYPE_NEUTRAL; import static pl.szczodrzynski.edziennik.data.db.modules.notices.Notice.TYPE_NEUTRAL;
import static pl.szczodrzynski.edziennik.datamodels.Notice.TYPE_POSITIVE; import static pl.szczodrzynski.edziennik.data.db.modules.notices.Notice.TYPE_POSITIVE;
import static pl.szczodrzynski.edziennik.utils.Utils.crc16; import static pl.szczodrzynski.edziennik.utils.Utils.crc16;
import static pl.szczodrzynski.edziennik.utils.Utils.crc32; import static pl.szczodrzynski.edziennik.utils.Utils.crc32;
import static pl.szczodrzynski.edziennik.utils.Utils.d; import static pl.szczodrzynski.edziennik.utils.Utils.d;
@ -200,7 +200,7 @@ public class Iuczniowie implements EdziennikInterface {
targetEndpoints.add("Exams"); targetEndpoints.add("Exams");
targetEndpoints.add("Notices"); targetEndpoints.add("Notices");
targetEndpoints.add("Announcements"); targetEndpoints.add("Announcements");
targetEndpoints.add("Attendances"); targetEndpoints.add("Attendance");
targetEndpoints.add("MessagesInbox"); targetEndpoints.add("MessagesInbox");
targetEndpoints.add("MessagesOutbox"); targetEndpoints.add("MessagesOutbox");
targetEndpoints.add("Finish"); targetEndpoints.add("Finish");
@ -241,8 +241,8 @@ public class Iuczniowie implements EdziennikInterface {
case FEATURE_NOTICES: case FEATURE_NOTICES:
targetEndpoints.add("Notices"); targetEndpoints.add("Notices");
break; break;
case FEATURE_ATTENDANCES: case FEATURE_ATTENDANCE:
targetEndpoints.add("Attendances"); targetEndpoints.add("Attendance");
break; break;
case FEATURE_MESSAGES_INBOX: case FEATURE_MESSAGES_INBOX:
targetEndpoints.add("MessagesInbox"); targetEndpoints.add("MessagesInbox");
@ -300,9 +300,9 @@ public class Iuczniowie implements EdziennikInterface {
} }
} }
this.attendancesMonth = today.month; this.attendanceMonth = today.month;
this.attendancesYear = today.year; this.attendanceYear = today.year;
this.attendancesPrevMonthChecked = false; this.attendancePrevMonthChecked = false;
this.examsMonth = today.month; this.examsMonth = today.month;
this.examsYear = today.year; this.examsYear = today.year;
this.examsMonthsChecked = 0; this.examsMonthsChecked = 0;
@ -352,8 +352,8 @@ public class Iuczniowie implements EdziennikInterface {
case "Announcements": case "Announcements":
getAnnouncements(); getAnnouncements();
break; break;
case "Attendances": case "Attendance":
getAttendances(); getAttendance();
break; break;
case "MessagesInbox": case "MessagesInbox":
getMessagesInbox(); getMessagesInbox();
@ -1196,17 +1196,17 @@ public class Iuczniowie implements EdziennikInterface {
}); });
} }
private int attendancesYear; private int attendanceYear;
private int attendancesMonth; private int attendanceMonth;
private boolean attendancesPrevMonthChecked = false; private boolean attendancePrevMonthChecked = false;
private void getAttendances() { private void getAttendance() {
callback.onActionStarted(R.string.sync_action_syncing_attendances); callback.onActionStarted(R.string.sync_action_syncing_attendance);
apiRequest(Request.builder() apiRequest(Request.builder()
.url(IDZIENNIK_URL +"/mod_panelRodzica/obecnosci/WS_obecnosciUcznia.asmx/pobierzObecnosciUcznia") .url(IDZIENNIK_URL +"/mod_panelRodzica/obecnosci/WS_obecnosciUcznia.asmx/pobierzObecnosciUcznia")
.userAgent(userAgent) .userAgent(userAgent)
.addParameter("idPozDziennika", loginRegisterId) .addParameter("idPozDziennika", loginRegisterId)
.addParameter("mc", attendancesMonth) .addParameter("mc", attendanceMonth)
.addParameter("rok", attendancesYear) .addParameter("rok", attendanceYear)
.addParameter("dataTygodnia", "") .addParameter("dataTygodnia", "")
.postJson(), (result, response) -> { .postJson(), (result, response) -> {
JsonObject data = result.getAsJsonObject("d"); JsonObject data = result.getAsJsonObject("d");
@ -1281,25 +1281,25 @@ public class Iuczniowie implements EdziennikInterface {
} }
} }
int attendancesDateValue = attendancesYear*10000 + attendancesMonth*100; int attendanceDateValue = attendanceYear *10000 + attendanceMonth *100;
if (profile.getEmpty() && attendancesDateValue > profile.getSemesterStart(1).getValue()) { if (profile.getEmpty() && attendanceDateValue > profile.getSemesterStart(1).getValue()) {
attendancesPrevMonthChecked = true; // do not need to check prev month later attendancePrevMonthChecked = true; // do not need to check prev month later
attendancesMonth--; attendanceMonth--;
if (attendancesMonth < 1) { if (attendanceMonth < 1) {
attendancesMonth = 12; attendanceMonth = 12;
attendancesYear--; attendanceYear--;
} }
r("get", "Attendances"); r("get", "Attendance");
} else if (!attendancesPrevMonthChecked /* get also the previous month */) { } else if (!attendancePrevMonthChecked /* get also the previous month */) {
attendancesMonth--; attendanceMonth--;
if (attendancesMonth < 1) { if (attendanceMonth < 1) {
attendancesMonth = 12; attendanceMonth = 12;
attendancesYear--; attendanceYear--;
} }
attendancesPrevMonthChecked = true; attendancePrevMonthChecked = true;
r("get", "Attendances"); r("get", "Attendance");
} else { } else {
r("finish", "Attendances"); r("finish", "Attendance");
} }
}); });
} }

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.api; package pl.szczodrzynski.edziennik.data.api;
import android.content.Context; import android.content.Context;
import android.graphics.Color; import android.graphics.Color;
@ -45,39 +45,39 @@ import im.wangchao.mhttp.callback.TextCallbackHandler;
import pl.szczodrzynski.edziennik.App; import pl.szczodrzynski.edziennik.App;
import pl.szczodrzynski.edziennik.BuildConfig; import pl.szczodrzynski.edziennik.BuildConfig;
import pl.szczodrzynski.edziennik.R; import pl.szczodrzynski.edziennik.R;
import pl.szczodrzynski.edziennik.api.interfaces.AttachmentGetCallback; import pl.szczodrzynski.edziennik.data.api.interfaces.AttachmentGetCallback;
import pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface; import pl.szczodrzynski.edziennik.data.api.interfaces.EdziennikInterface;
import pl.szczodrzynski.edziennik.api.interfaces.LoginCallback; import pl.szczodrzynski.edziennik.data.api.interfaces.LoginCallback;
import pl.szczodrzynski.edziennik.api.interfaces.MessageGetCallback; import pl.szczodrzynski.edziennik.data.api.interfaces.MessageGetCallback;
import pl.szczodrzynski.edziennik.api.interfaces.RecipientListGetCallback; import pl.szczodrzynski.edziennik.data.api.interfaces.RecipientListGetCallback;
import pl.szczodrzynski.edziennik.api.interfaces.SyncCallback; import pl.szczodrzynski.edziennik.data.api.interfaces.SyncCallback;
import pl.szczodrzynski.edziennik.api.v2.models.DataStore; import pl.szczodrzynski.edziennik.data.api.v2.models.DataStore;
import pl.szczodrzynski.edziennik.datamodels.Announcement; import pl.szczodrzynski.edziennik.data.db.modules.announcements.Announcement;
import pl.szczodrzynski.edziennik.datamodels.Attendance; import pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance;
import pl.szczodrzynski.edziennik.datamodels.Event; import pl.szczodrzynski.edziennik.data.db.modules.events.Event;
import pl.szczodrzynski.edziennik.datamodels.EventType; import pl.szczodrzynski.edziennik.data.db.modules.events.EventType;
import pl.szczodrzynski.edziennik.datamodels.Grade; import pl.szczodrzynski.edziennik.data.db.modules.grades.Grade;
import pl.szczodrzynski.edziennik.datamodels.GradeCategory; import pl.szczodrzynski.edziennik.data.db.modules.grades.GradeCategory;
import pl.szczodrzynski.edziennik.datamodels.Lesson; import pl.szczodrzynski.edziennik.data.db.modules.lessons.Lesson;
import pl.szczodrzynski.edziennik.datamodels.LessonChange; import pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonChange;
import pl.szczodrzynski.edziennik.datamodels.LoginStore; import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore;
import pl.szczodrzynski.edziennik.datamodels.LuckyNumber; import pl.szczodrzynski.edziennik.data.db.modules.luckynumber.LuckyNumber;
import pl.szczodrzynski.edziennik.datamodels.Message; import pl.szczodrzynski.edziennik.data.db.modules.messages.Message;
import pl.szczodrzynski.edziennik.datamodels.MessageFull; import pl.szczodrzynski.edziennik.data.db.modules.messages.MessageFull;
import pl.szczodrzynski.edziennik.datamodels.MessageRecipient; import pl.szczodrzynski.edziennik.data.db.modules.messages.MessageRecipient;
import pl.szczodrzynski.edziennik.datamodels.MessageRecipientFull; import pl.szczodrzynski.edziennik.data.db.modules.messages.MessageRecipientFull;
import pl.szczodrzynski.edziennik.datamodels.Metadata; import pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata;
import pl.szczodrzynski.edziennik.datamodels.Notice; import pl.szczodrzynski.edziennik.data.db.modules.notices.Notice;
import pl.szczodrzynski.edziennik.datamodels.Profile; import pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile;
import pl.szczodrzynski.edziennik.datamodels.ProfileFull; import pl.szczodrzynski.edziennik.data.db.modules.profiles.ProfileFull;
import pl.szczodrzynski.edziennik.datamodels.Subject; import pl.szczodrzynski.edziennik.data.db.modules.subjects.Subject;
import pl.szczodrzynski.edziennik.datamodels.Teacher; import pl.szczodrzynski.edziennik.data.db.modules.teachers.Teacher;
import pl.szczodrzynski.edziennik.datamodels.Team; import pl.szczodrzynski.edziennik.data.db.modules.teams.Team;
import pl.szczodrzynski.edziennik.messages.MessagesComposeInfo; import pl.szczodrzynski.edziennik.ui.modules.messages.MessagesComposeInfo;
import pl.szczodrzynski.edziennik.models.Date; import pl.szczodrzynski.edziennik.utils.models.Date;
import pl.szczodrzynski.edziennik.models.Endpoint; import pl.szczodrzynski.edziennik.utils.models.Endpoint;
import pl.szczodrzynski.edziennik.models.Time; import pl.szczodrzynski.edziennik.utils.models.Time;
import pl.szczodrzynski.edziennik.models.Week; import pl.szczodrzynski.edziennik.utils.models.Week;
import pl.szczodrzynski.edziennik.utils.Utils; import pl.szczodrzynski.edziennik.utils.Utils;
import static java.net.HttpURLConnection.HTTP_BAD_REQUEST; import static java.net.HttpURLConnection.HTTP_BAD_REQUEST;
@ -86,44 +86,44 @@ import static java.net.HttpURLConnection.HTTP_GONE;
import static java.net.HttpURLConnection.HTTP_NOT_FOUND; import static java.net.HttpURLConnection.HTTP_NOT_FOUND;
import static java.net.HttpURLConnection.HTTP_OK; import static java.net.HttpURLConnection.HTTP_OK;
import static java.net.HttpURLConnection.HTTP_UNAUTHORIZED; import static java.net.HttpURLConnection.HTTP_UNAUTHORIZED;
import static pl.szczodrzynski.edziennik.api.AppError.CODE_INVALID_LOGIN; import static pl.szczodrzynski.edziennik.data.api.AppError.CODE_INVALID_LOGIN;
import static pl.szczodrzynski.edziennik.api.AppError.CODE_LIBRUS_DISCONNECTED; import static pl.szczodrzynski.edziennik.data.api.AppError.CODE_LIBRUS_DISCONNECTED;
import static pl.szczodrzynski.edziennik.api.AppError.CODE_LIBRUS_NOT_ACTIVATED; import static pl.szczodrzynski.edziennik.data.api.AppError.CODE_LIBRUS_NOT_ACTIVATED;
import static pl.szczodrzynski.edziennik.api.AppError.CODE_MAINTENANCE; import static pl.szczodrzynski.edziennik.data.api.AppError.CODE_MAINTENANCE;
import static pl.szczodrzynski.edziennik.api.AppError.CODE_OTHER; import static pl.szczodrzynski.edziennik.data.api.AppError.CODE_OTHER;
import static pl.szczodrzynski.edziennik.api.AppError.CODE_PROFILE_NOT_FOUND; import static pl.szczodrzynski.edziennik.data.api.AppError.CODE_PROFILE_NOT_FOUND;
import static pl.szczodrzynski.edziennik.api.AppError.CODE_SYNERGIA_NOT_ACTIVATED; import static pl.szczodrzynski.edziennik.data.api.AppError.CODE_SYNERGIA_NOT_ACTIVATED;
import static pl.szczodrzynski.edziennik.datamodels.Attendance.TYPE_ABSENT; import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_ABSENT;
import static pl.szczodrzynski.edziennik.datamodels.Attendance.TYPE_ABSENT_EXCUSED; import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_ABSENT_EXCUSED;
import static pl.szczodrzynski.edziennik.datamodels.Attendance.TYPE_BELATED; import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_BELATED;
import static pl.szczodrzynski.edziennik.datamodels.Attendance.TYPE_PRESENT; import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_PRESENT;
import static pl.szczodrzynski.edziennik.datamodels.Attendance.TYPE_RELEASED; import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_RELEASED;
import static pl.szczodrzynski.edziennik.datamodels.Event.TYPE_PT_MEETING; import static pl.szczodrzynski.edziennik.data.db.modules.events.Event.TYPE_PT_MEETING;
import static pl.szczodrzynski.edziennik.datamodels.Event.TYPE_TEACHER_ABSENCE; import static pl.szczodrzynski.edziennik.data.db.modules.events.Event.TYPE_TEACHER_ABSENCE;
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_NORMAL; import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_NORMAL;
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_SEMESTER1_FINAL; import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_SEMESTER1_FINAL;
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_SEMESTER1_PROPOSED; import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_SEMESTER1_PROPOSED;
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_SEMESTER2_FINAL; import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_SEMESTER2_FINAL;
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_SEMESTER2_PROPOSED; import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_SEMESTER2_PROPOSED;
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_YEAR_FINAL; import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_YEAR_FINAL;
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_YEAR_PROPOSED; import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_YEAR_PROPOSED;
import static pl.szczodrzynski.edziennik.datamodels.LessonChange.TYPE_CANCELLED; import static pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonChange.TYPE_CANCELLED;
import static pl.szczodrzynski.edziennik.datamodels.LessonChange.TYPE_CHANGE; import static pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonChange.TYPE_CHANGE;
import static pl.szczodrzynski.edziennik.datamodels.Message.TYPE_RECEIVED; import static pl.szczodrzynski.edziennik.data.db.modules.messages.Message.TYPE_RECEIVED;
import static pl.szczodrzynski.edziennik.datamodels.Message.TYPE_SENT; import static pl.szczodrzynski.edziennik.data.db.modules.messages.Message.TYPE_SENT;
import static pl.szczodrzynski.edziennik.datamodels.Notice.TYPE_NEGATIVE; import static pl.szczodrzynski.edziennik.data.db.modules.notices.Notice.TYPE_NEGATIVE;
import static pl.szczodrzynski.edziennik.datamodels.Notice.TYPE_NEUTRAL; import static pl.szczodrzynski.edziennik.data.db.modules.notices.Notice.TYPE_NEUTRAL;
import static pl.szczodrzynski.edziennik.datamodels.Notice.TYPE_POSITIVE; import static pl.szczodrzynski.edziennik.data.db.modules.notices.Notice.TYPE_POSITIVE;
import static pl.szczodrzynski.edziennik.datamodels.Teacher.TYPE_EDUCATOR; import static pl.szczodrzynski.edziennik.data.db.modules.teachers.Teacher.TYPE_EDUCATOR;
import static pl.szczodrzynski.edziennik.datamodels.Teacher.TYPE_LIBRARIAN; import static pl.szczodrzynski.edziennik.data.db.modules.teachers.Teacher.TYPE_LIBRARIAN;
import static pl.szczodrzynski.edziennik.datamodels.Teacher.TYPE_OTHER; import static pl.szczodrzynski.edziennik.data.db.modules.teachers.Teacher.TYPE_OTHER;
import static pl.szczodrzynski.edziennik.datamodels.Teacher.TYPE_PARENTS_COUNCIL; import static pl.szczodrzynski.edziennik.data.db.modules.teachers.Teacher.TYPE_PARENTS_COUNCIL;
import static pl.szczodrzynski.edziennik.datamodels.Teacher.TYPE_PEDAGOGUE; import static pl.szczodrzynski.edziennik.data.db.modules.teachers.Teacher.TYPE_PEDAGOGUE;
import static pl.szczodrzynski.edziennik.datamodels.Teacher.TYPE_SCHOOL_ADMIN; import static pl.szczodrzynski.edziennik.data.db.modules.teachers.Teacher.TYPE_SCHOOL_ADMIN;
import static pl.szczodrzynski.edziennik.datamodels.Teacher.TYPE_SCHOOL_PARENTS_COUNCIL; import static pl.szczodrzynski.edziennik.data.db.modules.teachers.Teacher.TYPE_SCHOOL_PARENTS_COUNCIL;
import static pl.szczodrzynski.edziennik.datamodels.Teacher.TYPE_SECRETARIAT; import static pl.szczodrzynski.edziennik.data.db.modules.teachers.Teacher.TYPE_SECRETARIAT;
import static pl.szczodrzynski.edziennik.datamodels.Teacher.TYPE_SUPER_ADMIN; import static pl.szczodrzynski.edziennik.data.db.modules.teachers.Teacher.TYPE_SUPER_ADMIN;
import static pl.szczodrzynski.edziennik.datamodels.Teacher.TYPE_TEACHER; import static pl.szczodrzynski.edziennik.data.db.modules.teachers.Teacher.TYPE_TEACHER;
import static pl.szczodrzynski.edziennik.utils.Utils.bs; import static pl.szczodrzynski.edziennik.utils.Utils.bs;
import static pl.szczodrzynski.edziennik.utils.Utils.c; import static pl.szczodrzynski.edziennik.utils.Utils.c;
import static pl.szczodrzynski.edziennik.utils.Utils.contains; import static pl.szczodrzynski.edziennik.utils.Utils.contains;
@ -297,8 +297,8 @@ public class Librus implements EdziennikInterface {
targetEndpoints.add("Homework"); targetEndpoints.add("Homework");
targetEndpoints.add("LuckyNumbers"); targetEndpoints.add("LuckyNumbers");
targetEndpoints.add("Notices"); targetEndpoints.add("Notices");
targetEndpoints.add("AttendancesTypes"); targetEndpoints.add("AttendanceTypes");
targetEndpoints.add("Attendances"); targetEndpoints.add("Attendance");
targetEndpoints.add("Announcements"); targetEndpoints.add("Announcements");
targetEndpoints.add("PtMeetings"); targetEndpoints.add("PtMeetings");
@ -371,9 +371,9 @@ public class Librus implements EdziennikInterface {
case FEATURE_NOTICES: case FEATURE_NOTICES:
targetEndpoints.add("Notices"); targetEndpoints.add("Notices");
break; break;
case FEATURE_ATTENDANCES: case FEATURE_ATTENDANCE:
targetEndpoints.add("AttendancesTypes"); targetEndpoints.add("AttendanceTypes");
targetEndpoints.add("Attendances"); targetEndpoints.add("Attendance");
break; break;
case FEATURE_MESSAGES_INBOX: case FEATURE_MESSAGES_INBOX:
if (!hasMessagesLogin) { if (!hasMessagesLogin) {
@ -527,11 +527,11 @@ public class Librus implements EdziennikInterface {
case "Notices": case "Notices":
getNotices(); getNotices();
break; break;
case "AttendancesTypes": case "AttendanceTypes":
getAttendancesTypes(); getAttendanceTypes();
break; break;
case "Attendances": case "Attendance":
getAttendances(); getAttendance();
break; break;
case "Announcements": case "Announcements":
getAnnouncements(); getAnnouncements();
@ -2888,11 +2888,11 @@ public class Librus implements EdziennikInterface {
} }
private SparseArray<Pair<Integer, String>> attendanceTypes = new SparseArray<>(); private SparseArray<Pair<Integer, String>> attendanceTypes = new SparseArray<>();
private void getAttendancesTypes() { private void getAttendanceTypes() {
callback.onActionStarted(R.string.sync_action_syncing_attendance_types); callback.onActionStarted(R.string.sync_action_syncing_attendance_types);
apiRequest("Attendances/Types", data -> { apiRequest("Attendances/Types", data -> {
if (data == null) { if (data == null) {
r("finish", "AttendancesTypes"); r("finish", "AttendanceTypes");
return; return;
} }
try { try {
@ -2907,7 +2907,7 @@ public class Librus implements EdziennikInterface {
) )
); );
} }
r("finish", "AttendancesTypes"); r("finish", "AttendanceTypes");
} }
catch (Exception e) { catch (Exception e) {
finishWithError(new AppError(TAG, 2782, CODE_OTHER, e, data)); finishWithError(new AppError(TAG, 2782, CODE_OTHER, e, data));
@ -2915,18 +2915,18 @@ public class Librus implements EdziennikInterface {
}); });
} }
private void getAttendances() { private void getAttendance() {
callback.onActionStarted(R.string.sync_action_syncing_attendances); callback.onActionStarted(R.string.sync_action_syncing_attendance);
apiRequest("Attendances"+(fullSync ? "" : "?dateFrom="+ Date.getToday().stepForward(0, -1, 0).getStringY_m_d()), data -> { apiRequest("Attendances"+(fullSync ? "" : "?dateFrom="+ Date.getToday().stepForward(0, -1, 0).getStringY_m_d()), data -> {
if (data == null) { if (data == null) {
r("finish", "Attendances"); r("finish", "Attendance");
return; return;
} }
try { 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(); JsonObject attendance = attendanceEl.getAsJsonObject();
int type = attendance.getAsJsonObject("Type").get("Id").getAsInt(); 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)); metadataList.add(new Metadata(profileId, Metadata.TYPE_ATTENDANCE, attendanceObject.id, profile.getEmpty(), profile.getEmpty(), addedDate));
} }
} }
r("finish", "Attendances"); r("finish", "Attendance");
} }
catch (Exception e) { catch (Exception e) {
finishWithError(new AppError(TAG, 2872, CODE_OTHER, e, data)); 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("Homework", new Endpoint("Homework",true, false, profile.getChangedEndpoints()));
configurableEndpoints.put("LuckyNumbers", new Endpoint("LuckyNumbers",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("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("Announcements", new Endpoint("Announcements",true, true, profile.getChangedEndpoints()));
configurableEndpoints.put("PtMeetings", new Endpoint("PtMeetings",true, true, profile.getChangedEndpoints())); configurableEndpoints.put("PtMeetings", new Endpoint("PtMeetings",true, true, profile.getChangedEndpoints()));
configurableEndpoints.put("TeacherFreeDays", new Endpoint("TeacherFreeDays",false, false, profile.getChangedEndpoints())); configurableEndpoints.put("TeacherFreeDays", new Endpoint("TeacherFreeDays",false, false, profile.getChangedEndpoints()));

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.api; package pl.szczodrzynski.edziennik.data.api;
import android.content.Context; import android.content.Context;
import android.graphics.Color; import android.graphics.Color;
@ -40,59 +40,59 @@ import im.wangchao.mhttp.callback.TextCallbackHandler;
import pl.szczodrzynski.edziennik.App; import pl.szczodrzynski.edziennik.App;
import pl.szczodrzynski.edziennik.BuildConfig; import pl.szczodrzynski.edziennik.BuildConfig;
import pl.szczodrzynski.edziennik.R; import pl.szczodrzynski.edziennik.R;
import pl.szczodrzynski.edziennik.api.interfaces.AttachmentGetCallback; import pl.szczodrzynski.edziennik.data.api.interfaces.AttachmentGetCallback;
import pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface; import pl.szczodrzynski.edziennik.data.api.interfaces.EdziennikInterface;
import pl.szczodrzynski.edziennik.api.interfaces.LoginCallback; import pl.szczodrzynski.edziennik.data.api.interfaces.LoginCallback;
import pl.szczodrzynski.edziennik.api.interfaces.MessageGetCallback; import pl.szczodrzynski.edziennik.data.api.interfaces.MessageGetCallback;
import pl.szczodrzynski.edziennik.api.interfaces.RecipientListGetCallback; import pl.szczodrzynski.edziennik.data.api.interfaces.RecipientListGetCallback;
import pl.szczodrzynski.edziennik.api.interfaces.SyncCallback; import pl.szczodrzynski.edziennik.data.api.interfaces.SyncCallback;
import pl.szczodrzynski.edziennik.datamodels.Attendance; import pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance;
import pl.szczodrzynski.edziennik.datamodels.Event; import pl.szczodrzynski.edziennik.data.db.modules.events.Event;
import pl.szczodrzynski.edziennik.datamodels.Grade; import pl.szczodrzynski.edziennik.data.db.modules.grades.Grade;
import pl.szczodrzynski.edziennik.datamodels.GradeCategory; import pl.szczodrzynski.edziennik.data.db.modules.grades.GradeCategory;
import pl.szczodrzynski.edziennik.datamodels.Lesson; import pl.szczodrzynski.edziennik.data.db.modules.lessons.Lesson;
import pl.szczodrzynski.edziennik.datamodels.LessonChange; import pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonChange;
import pl.szczodrzynski.edziennik.datamodels.LoginStore; import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore;
import pl.szczodrzynski.edziennik.datamodels.LuckyNumber; import pl.szczodrzynski.edziennik.data.db.modules.luckynumber.LuckyNumber;
import pl.szczodrzynski.edziennik.datamodels.Message; import pl.szczodrzynski.edziennik.data.db.modules.messages.Message;
import pl.szczodrzynski.edziennik.datamodels.MessageFull; import pl.szczodrzynski.edziennik.data.db.modules.messages.MessageFull;
import pl.szczodrzynski.edziennik.datamodels.MessageRecipient; import pl.szczodrzynski.edziennik.data.db.modules.messages.MessageRecipient;
import pl.szczodrzynski.edziennik.datamodels.MessageRecipientFull; import pl.szczodrzynski.edziennik.data.db.modules.messages.MessageRecipientFull;
import pl.szczodrzynski.edziennik.datamodels.Metadata; import pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata;
import pl.szczodrzynski.edziennik.datamodels.Notice; import pl.szczodrzynski.edziennik.data.db.modules.notices.Notice;
import pl.szczodrzynski.edziennik.datamodels.Profile; import pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile;
import pl.szczodrzynski.edziennik.datamodels.ProfileFull; import pl.szczodrzynski.edziennik.data.db.modules.profiles.ProfileFull;
import pl.szczodrzynski.edziennik.datamodels.Subject; import pl.szczodrzynski.edziennik.data.db.modules.subjects.Subject;
import pl.szczodrzynski.edziennik.datamodels.Teacher; import pl.szczodrzynski.edziennik.data.db.modules.teachers.Teacher;
import pl.szczodrzynski.edziennik.datamodels.Team; import pl.szczodrzynski.edziennik.data.db.modules.teams.Team;
import pl.szczodrzynski.edziennik.messages.MessagesComposeInfo; import pl.szczodrzynski.edziennik.ui.modules.messages.MessagesComposeInfo;
import pl.szczodrzynski.edziennik.models.Date; import pl.szczodrzynski.edziennik.utils.models.Date;
import pl.szczodrzynski.edziennik.models.Endpoint; import pl.szczodrzynski.edziennik.utils.models.Endpoint;
import pl.szczodrzynski.edziennik.models.Time; import pl.szczodrzynski.edziennik.utils.models.Time;
import pl.szczodrzynski.edziennik.models.Week; import pl.szczodrzynski.edziennik.utils.models.Week;
import static pl.szczodrzynski.edziennik.api.AppError.CODE_INVALID_LOGIN; import static pl.szczodrzynski.edziennik.data.api.AppError.CODE_INVALID_LOGIN;
import static pl.szczodrzynski.edziennik.api.AppError.CODE_MAINTENANCE; import static pl.szczodrzynski.edziennik.data.api.AppError.CODE_MAINTENANCE;
import static pl.szczodrzynski.edziennik.api.AppError.CODE_OTHER; import static pl.szczodrzynski.edziennik.data.api.AppError.CODE_OTHER;
import static pl.szczodrzynski.edziennik.datamodels.Attendance.TYPE_ABSENT; import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_ABSENT;
import static pl.szczodrzynski.edziennik.datamodels.Attendance.TYPE_ABSENT_EXCUSED; import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_ABSENT_EXCUSED;
import static pl.szczodrzynski.edziennik.datamodels.Attendance.TYPE_BELATED; import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_BELATED;
import static pl.szczodrzynski.edziennik.datamodels.Attendance.TYPE_CUSTOM; import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_CUSTOM;
import static pl.szczodrzynski.edziennik.datamodels.Attendance.TYPE_PRESENT; import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_PRESENT;
import static pl.szczodrzynski.edziennik.datamodels.Attendance.TYPE_RELEASED; import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_RELEASED;
import static pl.szczodrzynski.edziennik.datamodels.Event.TYPE_DEFAULT; import static pl.szczodrzynski.edziennik.data.db.modules.events.Event.TYPE_DEFAULT;
import static pl.szczodrzynski.edziennik.datamodels.Event.TYPE_EXAM; import static pl.szczodrzynski.edziennik.data.db.modules.events.Event.TYPE_EXAM;
import static pl.szczodrzynski.edziennik.datamodels.Event.TYPE_SHORT_QUIZ; import static pl.szczodrzynski.edziennik.data.db.modules.events.Event.TYPE_SHORT_QUIZ;
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_SEMESTER1_FINAL; import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_SEMESTER1_FINAL;
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_SEMESTER1_PROPOSED; import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_SEMESTER1_PROPOSED;
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_SEMESTER2_FINAL; import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_SEMESTER2_FINAL;
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_SEMESTER2_PROPOSED; import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_SEMESTER2_PROPOSED;
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_YEAR_FINAL; import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_YEAR_FINAL;
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_YEAR_PROPOSED; import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_YEAR_PROPOSED;
import static pl.szczodrzynski.edziennik.datamodels.LoginStore.LOGIN_TYPE_MOBIDZIENNIK; import static pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore.LOGIN_TYPE_MOBIDZIENNIK;
import static pl.szczodrzynski.edziennik.datamodels.Message.TYPE_DELETED; import static pl.szczodrzynski.edziennik.data.db.modules.messages.Message.TYPE_DELETED;
import static pl.szczodrzynski.edziennik.datamodels.Message.TYPE_RECEIVED; import static pl.szczodrzynski.edziennik.data.db.modules.messages.Message.TYPE_RECEIVED;
import static pl.szczodrzynski.edziennik.datamodels.Message.TYPE_SENT; import static pl.szczodrzynski.edziennik.data.db.modules.messages.Message.TYPE_SENT;
import static pl.szczodrzynski.edziennik.utils.Utils.bs; import static pl.szczodrzynski.edziennik.utils.Utils.bs;
import static pl.szczodrzynski.edziennik.utils.Utils.crc16; import static pl.szczodrzynski.edziennik.utils.Utils.crc16;
import static pl.szczodrzynski.edziennik.utils.Utils.d; import static pl.szczodrzynski.edziennik.utils.Utils.d;
@ -150,7 +150,7 @@ public class Mobidziennik implements EdziennikInterface {
private String loginPassword = null; private String loginPassword = null;
private int studentId = -1; 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) { private boolean prepare(@NonNull Context activityContext, @NonNull SyncCallback callback, int profileId, @Nullable Profile profile, @NonNull LoginStore loginStore) {
this.activityContext = activityContext; this.activityContext = activityContext;
@ -171,7 +171,7 @@ public class Mobidziennik implements EdziennikInterface {
return false; return false;
} }
this.studentId = profile == null ? -1 : profile.getStudentData("studentId", -1); 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"); fakeLogin = BuildConfig.DEBUG && loginUsername.toLowerCase().startsWith("fake");
teamList = profileId == -1 ? new ArrayList<>() : app.db.teamDao().getAllNow(profileId); teamList = profileId == -1 ? new ArrayList<>() : app.db.teamDao().getAllNow(profileId);
@ -204,7 +204,7 @@ public class Mobidziennik implements EdziennikInterface {
targetEndpoints = new ArrayList<>(); targetEndpoints = new ArrayList<>();
targetEndpoints.add("GetData"); targetEndpoints.add("GetData");
targetEndpoints.add("ProcessData"); targetEndpoints.add("ProcessData");
targetEndpoints.add("Attendances"); targetEndpoints.add("Attendance");
targetEndpoints.add("ClassCalendar"); targetEndpoints.add("ClassCalendar");
targetEndpoints.add("GradeDetails"); targetEndpoints.add("GradeDetails");
targetEndpoints.add("NoticeDetails"); targetEndpoints.add("NoticeDetails");
@ -256,8 +256,8 @@ public class Mobidziennik implements EdziennikInterface {
case FEATURE_NOTICES: case FEATURE_NOTICES:
targetEndpoints.add("NoticeDetails"); targetEndpoints.add("NoticeDetails");
break; break;
case FEATURE_ATTENDANCES: case FEATURE_ATTENDANCE:
targetEndpoints.add("Attendances"); targetEndpoints.add("Attendance");
break; break;
case FEATURE_MESSAGES_INBOX: case FEATURE_MESSAGES_INBOX:
targetEndpoints.add("MessagesInbox"); targetEndpoints.add("MessagesInbox");
@ -314,8 +314,8 @@ public class Mobidziennik implements EdziennikInterface {
case "NoticeDetails": case "NoticeDetails":
getNoticeDetails(); getNoticeDetails();
break; break;
case "Attendances": case "Attendance":
getAttendances(); getAttendance();
break; break;
case "Messages": case "Messages":
getAllMessages(); getAllMessages();
@ -597,7 +597,7 @@ public class Mobidziennik implements EdziennikInterface {
processLessons(table); processLessons(table);
} }
if (i == 16) { if (i == 16) {
processAttendances(table); processAttendance(table);
} }
if (i == 17) { if (i == 17) {
processNotices(table); processNotices(table);
@ -1051,20 +1051,20 @@ public class Mobidziennik implements EdziennikInterface {
this.lessonId = lessonId; this.lessonId = lessonId;
} }
} }
private Date attendancesCheckDate = Week.getWeekStart(); private Date attendanceCheckDate = Week.getWeekStart();
private void getAttendances() { private void getAttendance() {
r("finish", "Attendances"); r("finish", "Attendance");
// TODO: 2019-09-10 please download attendances from /dziennik/frekwencja. /mobile does not work above v13.0 // TODO: 2019-09-10 please download attendance from /dziennik/frekwencja. /mobile does not work above v13.0
if (true) { if (true) {
return; return;
} }
callback.onActionStarted(R.string.sync_action_syncing_attendances); callback.onActionStarted(R.string.sync_action_syncing_attendance);
d(TAG, "Get attendances for week "+attendancesCheckDate.getStringY_m_d()); d(TAG, "Get attendance for week "+ attendanceCheckDate.getStringY_m_d());
Request.builder() Request.builder()
.url(fakeLogin ? "https://szkolny.eu/mobimobi/mobi_mod_frekwencja.php" : "https://" + loginServerName + ".mobidziennik.pl/mobile/frekwencja") .url(fakeLogin ? "https://szkolny.eu/mobimobi/mobi_mod_frekwencja.php" : "https://" + loginServerName + ".mobidziennik.pl/mobile/frekwencja")
.userAgent(System.getProperty("http.agent")) .userAgent(System.getProperty("http.agent"))
.addParameter("uczen", studentId) .addParameter("uczen", studentId)
.addParameter("data_poniedzialek", attendancesCheckDate.getStringY_m_d()) .addParameter("data_poniedzialek", attendanceCheckDate.getStringY_m_d())
.post() .post()
.callback(new TextCallbackHandler() { .callback(new TextCallbackHandler() {
@Override @Override
@ -1076,11 +1076,11 @@ public class Mobidziennik implements EdziennikInterface {
public void onSuccess(String data, Response response) { public void onSuccess(String data, Response response) {
// just skip any failures here // just skip any failures here
if (data == null || data.equals("")) { if (data == null || data.equals("")) {
r("finish", "Attendances"); r("finish", "Attendance");
return; return;
} }
if (data.contains("nie-pamietam-hasla")) { if (data.contains("nie-pamietam-hasla")) {
r("finish", "Attendances"); r("finish", "Attendance");
return; return;
} }
@ -1135,7 +1135,7 @@ public class Mobidziennik implements EdziennikInterface {
continue; continue;
AttendanceLessonRange range = ranges.get(currentIndex); 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); long addedDate = date.combineWith(range.startTime);
int markerIndex = 0; int markerIndex = 0;
@ -1201,7 +1201,7 @@ public class Mobidziennik implements EdziennikInterface {
markerIndex++; markerIndex++;
attendanceList.add(attendanceObject); attendanceList.add(attendanceObject);
if (attendanceObject.type != TYPE_PRESENT) { 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)); 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) { } catch (Exception e) {
Crashlytics.logException(e); Crashlytics.logException(e);
e.printStackTrace(); e.printStackTrace();
if (onlyFeature == FEATURE_ATTENDANCES) if (onlyFeature == FEATURE_ATTENDANCE)
finishWithError(new AppError(TAG, 955, CODE_OTHER, response, e, data)); finishWithError(new AppError(TAG, 955, CODE_OTHER, response, e, data));
else else
r("finish", "Attendances"); r("finish", "Attendance");
return; return;
} }
if (onlyFeature == FEATURE_ATTENDANCES) { if (onlyFeature == FEATURE_ATTENDANCE) {
// syncing attendances exclusively // syncing attendance exclusively
if (attendancesLastSync == 0) { if (attendanceLastSync == 0) {
// first sync - get attendances until it's start of the school year // first sync - get attendance until it's start of the school year
attendancesLastSync = profile.getSemesterStart(1).getInMillis(); attendanceLastSync = profile.getSemesterStart(1).getInMillis();
} }
Date lastSyncDate = Date.fromMillis(attendancesLastSync); Date lastSyncDate = Date.fromMillis(attendanceLastSync);
lastSyncDate.stepForward(0, 0, -7); lastSyncDate.stepForward(0, 0, -7);
if (lastSyncDate.getValue() < attendancesCheckDate.getValue()) { if (lastSyncDate.getValue() < attendanceCheckDate.getValue()) {
attendancesCheckDate.stepForward(0, 0, -7); attendanceCheckDate.stepForward(0, 0, -7);
r("get", "Attendances"); r("get", "Attendance");
} }
else { else {
profile.putStudentData("attendancesLastSync", System.currentTimeMillis()); profile.putStudentData("attendanceLastSync", System.currentTimeMillis());
r("finish", "Attendances"); r("finish", "Attendance");
} }
} }
else { else {
if (attendancesLastSync != 0) { if (attendanceLastSync != 0) {
// not a first sync // not a first sync
Date lastSyncDate = Date.fromMillis(attendancesLastSync); Date lastSyncDate = Date.fromMillis(attendanceLastSync);
lastSyncDate.stepForward(0, 0, 2); lastSyncDate.stepForward(0, 0, 2);
if (lastSyncDate.getValue() >= attendancesCheckDate.getValue()) { if (lastSyncDate.getValue() >= attendanceCheckDate.getValue()) {
profile.putStudentData("attendancesLastSync", System.currentTimeMillis()); 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) if (true)
return; return;
String[] attendances = table.split("\n"); String[] attendanceList = table.split("\n");
for (String attendanceStr: attendances) for (String attendanceStr: attendanceList)
{ {
if (attendanceStr.isEmpty()) { if (attendanceStr.isEmpty()) {
continue; continue;
@ -1718,7 +1718,7 @@ public class Mobidziennik implements EdziennikInterface {
mobiLesson.date, mobiLesson.date,
mobiLesson.startTime, mobiLesson.startTime,
type); type);
attendanceList.add(attendanceObject); this.attendanceList.add(attendanceObject);
metadataList.add(new Metadata(profileId, Metadata.TYPE_ATTENDANCE, attendanceObject.id, profile.getEmpty(), profile.getEmpty(), System.currentTimeMillis())); metadataList.add(new Metadata(profileId, Metadata.TYPE_ATTENDANCE, attendanceObject.id, profile.getEmpty(), profile.getEmpty(), System.currentTimeMillis()));
} }
} }

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.api; package pl.szczodrzynski.edziennik.data.api;
import android.content.Context; import android.content.Context;
import android.os.Build; import android.os.Build;
@ -35,57 +35,57 @@ import okhttp3.OkHttpClient;
import okio.Buffer; import okio.Buffer;
import pl.szczodrzynski.edziennik.App; import pl.szczodrzynski.edziennik.App;
import pl.szczodrzynski.edziennik.R; import pl.szczodrzynski.edziennik.R;
import pl.szczodrzynski.edziennik.api.interfaces.AttachmentGetCallback; import pl.szczodrzynski.edziennik.data.api.interfaces.AttachmentGetCallback;
import pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface; import pl.szczodrzynski.edziennik.data.api.interfaces.EdziennikInterface;
import pl.szczodrzynski.edziennik.api.interfaces.LoginCallback; import pl.szczodrzynski.edziennik.data.api.interfaces.LoginCallback;
import pl.szczodrzynski.edziennik.api.interfaces.MessageGetCallback; import pl.szczodrzynski.edziennik.data.api.interfaces.MessageGetCallback;
import pl.szczodrzynski.edziennik.api.interfaces.RecipientListGetCallback; import pl.szczodrzynski.edziennik.data.api.interfaces.RecipientListGetCallback;
import pl.szczodrzynski.edziennik.api.interfaces.SyncCallback; import pl.szczodrzynski.edziennik.data.api.interfaces.SyncCallback;
import pl.szczodrzynski.edziennik.datamodels.Attendance; import pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance;
import pl.szczodrzynski.edziennik.datamodels.Event; import pl.szczodrzynski.edziennik.data.db.modules.events.Event;
import pl.szczodrzynski.edziennik.datamodels.Grade; import pl.szczodrzynski.edziennik.data.db.modules.grades.Grade;
import pl.szczodrzynski.edziennik.datamodels.GradeCategory; import pl.szczodrzynski.edziennik.data.db.modules.grades.GradeCategory;
import pl.szczodrzynski.edziennik.datamodels.Lesson; import pl.szczodrzynski.edziennik.data.db.modules.lessons.Lesson;
import pl.szczodrzynski.edziennik.datamodels.LessonChange; import pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonChange;
import pl.szczodrzynski.edziennik.datamodels.LoginStore; import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore;
import pl.szczodrzynski.edziennik.datamodels.Message; import pl.szczodrzynski.edziennik.data.db.modules.messages.Message;
import pl.szczodrzynski.edziennik.datamodels.MessageFull; import pl.szczodrzynski.edziennik.data.db.modules.messages.MessageFull;
import pl.szczodrzynski.edziennik.datamodels.MessageRecipient; import pl.szczodrzynski.edziennik.data.db.modules.messages.MessageRecipient;
import pl.szczodrzynski.edziennik.datamodels.MessageRecipientFull; import pl.szczodrzynski.edziennik.data.db.modules.messages.MessageRecipientFull;
import pl.szczodrzynski.edziennik.datamodels.Metadata; import pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata;
import pl.szczodrzynski.edziennik.datamodels.Notice; import pl.szczodrzynski.edziennik.data.db.modules.notices.Notice;
import pl.szczodrzynski.edziennik.datamodels.Profile; import pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile;
import pl.szczodrzynski.edziennik.datamodels.ProfileFull; import pl.szczodrzynski.edziennik.data.db.modules.profiles.ProfileFull;
import pl.szczodrzynski.edziennik.datamodels.Subject; import pl.szczodrzynski.edziennik.data.db.modules.subjects.Subject;
import pl.szczodrzynski.edziennik.datamodels.Teacher; import pl.szczodrzynski.edziennik.data.db.modules.teachers.Teacher;
import pl.szczodrzynski.edziennik.datamodels.Team; import pl.szczodrzynski.edziennik.data.db.modules.teams.Team;
import pl.szczodrzynski.edziennik.messages.MessagesComposeInfo; import pl.szczodrzynski.edziennik.ui.modules.messages.MessagesComposeInfo;
import pl.szczodrzynski.edziennik.models.Date; import pl.szczodrzynski.edziennik.utils.models.Date;
import pl.szczodrzynski.edziennik.models.Endpoint; import pl.szczodrzynski.edziennik.utils.models.Endpoint;
import pl.szczodrzynski.edziennik.models.Time; import pl.szczodrzynski.edziennik.utils.models.Time;
import pl.szczodrzynski.edziennik.models.Week; import pl.szczodrzynski.edziennik.utils.models.Week;
import pl.szczodrzynski.edziennik.utils.Utils; import pl.szczodrzynski.edziennik.utils.Utils;
import static pl.szczodrzynski.edziennik.api.AppError.CODE_OTHER; import static pl.szczodrzynski.edziennik.data.api.AppError.CODE_OTHER;
import static pl.szczodrzynski.edziennik.datamodels.Attendance.TYPE_ABSENT; import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_ABSENT;
import static pl.szczodrzynski.edziennik.datamodels.Attendance.TYPE_ABSENT_EXCUSED; import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_ABSENT_EXCUSED;
import static pl.szczodrzynski.edziennik.datamodels.Attendance.TYPE_BELATED; import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_BELATED;
import static pl.szczodrzynski.edziennik.datamodels.Attendance.TYPE_BELATED_EXCUSED; import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_BELATED_EXCUSED;
import static pl.szczodrzynski.edziennik.datamodels.Attendance.TYPE_PRESENT; import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_PRESENT;
import static pl.szczodrzynski.edziennik.datamodels.Attendance.TYPE_RELEASED; import static pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance.TYPE_RELEASED;
import static pl.szczodrzynski.edziennik.datamodels.Event.TYPE_EXAM; import static pl.szczodrzynski.edziennik.data.db.modules.events.Event.TYPE_EXAM;
import static pl.szczodrzynski.edziennik.datamodels.Event.TYPE_SHORT_QUIZ; import static pl.szczodrzynski.edziennik.data.db.modules.events.Event.TYPE_SHORT_QUIZ;
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_SEMESTER1_FINAL; import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_SEMESTER1_FINAL;
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_SEMESTER1_PROPOSED; import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_SEMESTER1_PROPOSED;
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_SEMESTER2_FINAL; import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_SEMESTER2_FINAL;
import static pl.szczodrzynski.edziennik.datamodels.Grade.TYPE_SEMESTER2_PROPOSED; import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_SEMESTER2_PROPOSED;
import static pl.szczodrzynski.edziennik.datamodels.LessonChange.TYPE_CANCELLED; import static pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonChange.TYPE_CANCELLED;
import static pl.szczodrzynski.edziennik.datamodels.LessonChange.TYPE_CHANGE; import static pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonChange.TYPE_CHANGE;
import static pl.szczodrzynski.edziennik.datamodels.LoginStore.LOGIN_TYPE_VULCAN; import static pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore.LOGIN_TYPE_VULCAN;
import static pl.szczodrzynski.edziennik.datamodels.Message.TYPE_RECEIVED; import static pl.szczodrzynski.edziennik.data.db.modules.messages.Message.TYPE_RECEIVED;
import static pl.szczodrzynski.edziennik.datamodels.Message.TYPE_SENT; import static pl.szczodrzynski.edziennik.data.db.modules.messages.Message.TYPE_SENT;
import static pl.szczodrzynski.edziennik.datamodels.Metadata.TYPE_MESSAGE; import static pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata.TYPE_MESSAGE;
import static pl.szczodrzynski.edziennik.datamodels.Notice.TYPE_NEUTRAL; import static pl.szczodrzynski.edziennik.data.db.modules.notices.Notice.TYPE_NEUTRAL;
import static pl.szczodrzynski.edziennik.utils.Utils.c; import static pl.szczodrzynski.edziennik.utils.Utils.c;
import static pl.szczodrzynski.edziennik.utils.Utils.crc16; import static pl.szczodrzynski.edziennik.utils.Utils.crc16;
import static pl.szczodrzynski.edziennik.utils.Utils.d; import static pl.szczodrzynski.edziennik.utils.Utils.d;
@ -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_EVENTS = "mobile-api/Uczen.v3.Uczen/Sprawdziany";
private static final String ENDPOINT_HOMEWORK = "mobile-api/Uczen.v3.Uczen/ZadaniaDomowe"; 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_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_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_SENT = "mobile-api/Uczen.v3.Uczen/WiadomosciWyslane";
private static final String ENDPOINT_MESSAGES_CHANGE_STATUS = "mobile-api/Uczen.v3.Uczen/ZmienStatusWiadomosci"; 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("Events");
targetEndpoints.add("Homework"); targetEndpoints.add("Homework");
targetEndpoints.add("Notices"); targetEndpoints.add("Notices");
targetEndpoints.add("Attendances"); targetEndpoints.add("Attendance");
targetEndpoints.add("MessagesInbox"); targetEndpoints.add("MessagesInbox");
targetEndpoints.add("MessagesOutbox"); targetEndpoints.add("MessagesOutbox");
targetEndpoints.add("Finish"); targetEndpoints.add("Finish");
@ -303,8 +303,8 @@ public class Vulcan implements EdziennikInterface {
case FEATURE_NOTICES: case FEATURE_NOTICES:
targetEndpoints.add("Notices"); targetEndpoints.add("Notices");
break; break;
case FEATURE_ATTENDANCES: case FEATURE_ATTENDANCE:
targetEndpoints.add("Attendances"); targetEndpoints.add("Attendance");
break; break;
case FEATURE_MESSAGES_INBOX: case FEATURE_MESSAGES_INBOX:
targetEndpoints.add("MessagesInbox"); targetEndpoints.add("MessagesInbox");
@ -386,8 +386,8 @@ public class Vulcan implements EdziennikInterface {
case "Notices": case "Notices":
getNotices(); getNotices();
break; break;
case "Attendances": case "Attendance":
getAttendances(); getAttendance();
break; break;
case "MessagesInbox": case "MessagesInbox":
getMessagesInbox(); getMessagesInbox();
@ -1459,18 +1459,18 @@ public class Vulcan implements EdziennikInterface {
}); });
} }
private void getAttendances() { private void getAttendance() {
callback.onActionStarted(R.string.sync_action_syncing_attendances); callback.onActionStarted(R.string.sync_action_syncing_attendance);
JsonObject json = new JsonObject(); JsonObject json = new JsonObject();
json.addProperty("DataPoczatkowa", true ? getCurrentSemesterStartDate().getStringY_m_d() : oneMonthBack.getStringY_m_d()); json.addProperty("DataPoczatkowa", true ? getCurrentSemesterStartDate().getStringY_m_d() : oneMonthBack.getStringY_m_d());
json.addProperty("DataKoncowa", getCurrentSemesterEndDate().getStringY_m_d()); json.addProperty("DataKoncowa", getCurrentSemesterEndDate().getStringY_m_d());
json.addProperty("IdOddzial", studentClassId); json.addProperty("IdOddzial", studentClassId);
json.addProperty("IdUczen", studentId); json.addProperty("IdUczen", studentId);
json.addProperty("IdOkresKlasyfikacyjny", studentSemesterId); json.addProperty("IdOkresKlasyfikacyjny", studentSemesterId);
apiRequest(schoolSymbol+"/"+ENDPOINT_ATTENDANCES, json, result -> { apiRequest(schoolSymbol+"/"+ ENDPOINT_ATTENDANCE, json, result -> {
JsonArray attendances = result.getAsJsonObject("Data").getAsJsonArray("Frekwencje"); JsonArray attendanceList = result.getAsJsonObject("Data").getAsJsonArray("Frekwencje");
for (JsonElement attendanceEl: attendances) { for (JsonElement attendanceEl: attendanceList) {
JsonObject attendance = attendanceEl.getAsJsonObject(); JsonObject attendance = attendanceEl.getAsJsonObject();
Pair<Integer, String> attendanceCategory = attendanceCategories.get(attendance.get("IdKategoria").getAsInt()); Pair<Integer, String> attendanceCategory = attendanceCategories.get(attendance.get("IdKategoria").getAsInt());
@ -1497,12 +1497,12 @@ public class Vulcan implements EdziennikInterface {
lessonRanges.get(attendance.get("IdPoraLekcji").getAsInt()).first, lessonRanges.get(attendance.get("IdPoraLekcji").getAsInt()).first,
type); type);
attendanceList.add(attendanceObject); this.attendanceList.add(attendanceObject);
if (attendanceObject.type != TYPE_PRESENT) { if (attendanceObject.type != TYPE_PRESENT) {
metadataList.add(new Metadata(profileId, Metadata.TYPE_ATTENDANCE, attendanceObject.id, profile.getEmpty(), profile.getEmpty(), attendanceObject.lessonDate.combineWith(attendanceObject.startTime))); 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");
}); });
} }

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.api.interfaces; package pl.szczodrzynski.edziennik.data.api.interfaces;
import im.wangchao.mhttp.Request; import im.wangchao.mhttp.Request;

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.api.interfaces; package pl.szczodrzynski.edziennik.data.api.interfaces;
import android.content.Context; import android.content.Context;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
@ -6,13 +6,13 @@ import androidx.annotation.Nullable;
import java.util.Map; import java.util.Map;
import pl.szczodrzynski.edziennik.datamodels.LoginStore; import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore;
import pl.szczodrzynski.edziennik.datamodels.Message; import pl.szczodrzynski.edziennik.data.db.modules.messages.MessageFull;
import pl.szczodrzynski.edziennik.datamodels.MessageFull; import pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile;
import pl.szczodrzynski.edziennik.datamodels.Profile; import pl.szczodrzynski.edziennik.data.db.modules.profiles.ProfileFull;
import pl.szczodrzynski.edziennik.datamodels.ProfileFull; import pl.szczodrzynski.edziennik.data.db.modules.teachers.Teacher;
import pl.szczodrzynski.edziennik.messages.MessagesComposeInfo; import pl.szczodrzynski.edziennik.ui.modules.messages.MessagesComposeInfo;
import pl.szczodrzynski.edziennik.models.Endpoint; import pl.szczodrzynski.edziennik.utils.models.Endpoint;
public interface EdziennikInterface { public interface EdziennikInterface {
@ -36,7 +36,7 @@ public interface EdziennikInterface {
int FEATURE_GRADES = 3; int FEATURE_GRADES = 3;
int FEATURE_HOMEWORK = 4; int FEATURE_HOMEWORK = 4;
int FEATURE_NOTICES = 5; int FEATURE_NOTICES = 5;
int FEATURE_ATTENDANCES = 6; int FEATURE_ATTENDANCE = 6;
int FEATURE_MESSAGES_INBOX = 7; int FEATURE_MESSAGES_INBOX = 7;
int FEATURE_MESSAGES_OUTBOX = 8; int FEATURE_MESSAGES_OUTBOX = 8;
int FEATURE_ANNOUNCEMENTS = 9; int FEATURE_ANNOUNCEMENTS = 9;
@ -60,7 +60,7 @@ public interface EdziennikInterface {
* *
* Updates a database-saved {@code teacherList} with {@code loginId}s. * Updates a database-saved {@code teacherList} with {@code loginId}s.
* *
* A {@link pl.szczodrzynski.edziennik.datamodels.Teacher} is considered as a recipient when its {@code loginId} is not null. * A {@link Teacher} is considered as a recipient when its {@code loginId} is not null.
* *
* May be executed on any thread. * May be executed on any thread.
* *

View File

@ -1,10 +1,10 @@
package pl.szczodrzynski.edziennik.api.interfaces; package pl.szczodrzynski.edziennik.data.api.interfaces;
import android.content.Context; import android.content.Context;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import pl.szczodrzynski.edziennik.api.AppError; import pl.szczodrzynski.edziennik.data.api.AppError;
public interface ErrorCallback { public interface ErrorCallback {
void onError(Context activityContext, @NonNull AppError error); void onError(Context activityContext, @NonNull AppError error);

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.api.interfaces; package pl.szczodrzynski.edziennik.data.api.interfaces;
public interface LoginCallback { public interface LoginCallback {
void onSuccess(); void onSuccess();

View File

@ -1,7 +1,6 @@
package pl.szczodrzynski.edziennik.api.interfaces; package pl.szczodrzynski.edziennik.data.api.interfaces;
import pl.szczodrzynski.edziennik.datamodels.Message; import pl.szczodrzynski.edziennik.data.db.modules.messages.MessageFull;
import pl.szczodrzynski.edziennik.datamodels.MessageFull;
/** /**
* Callback containing a {@link MessageFull} which already has its {@code body} and {@code recipients}. * Callback containing a {@link MessageFull} which already has its {@code body} and {@code recipients}.

View File

@ -0,0 +1,9 @@
package pl.szczodrzynski.edziennik.data.api.interfaces;
import java.util.List;
import pl.szczodrzynski.edziennik.data.db.modules.messages.MessageFull;
public interface MessageListCallback {
void onSuccess(List<MessageFull> messageList);
}

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.api.interfaces; package pl.szczodrzynski.edziennik.data.api.interfaces;
import androidx.annotation.StringRes; import androidx.annotation.StringRes;

View File

@ -0,0 +1,9 @@
package pl.szczodrzynski.edziennik.data.api.interfaces;
import java.util.List;
import pl.szczodrzynski.edziennik.data.db.modules.teachers.Teacher;
public interface RecipientListGetCallback {
void onSuccess(List<Teacher> teacherList);
}

View File

@ -1,15 +1,12 @@
package pl.szczodrzynski.edziennik.api.interfaces; package pl.szczodrzynski.edziennik.data.api.interfaces;
import android.content.Context; import android.content.Context;
import java.util.List; import java.util.List;
import androidx.annotation.StringRes; import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore;
import pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile;
import pl.szczodrzynski.edziennik.api.AppError; import pl.szczodrzynski.edziennik.data.db.modules.profiles.ProfileFull;
import pl.szczodrzynski.edziennik.datamodels.LoginStore;
import pl.szczodrzynski.edziennik.datamodels.Profile;
import pl.szczodrzynski.edziennik.datamodels.ProfileFull;
/** /**
* A callback used for error reporting, progress information. * A callback used for error reporting, progress information.

View File

@ -0,0 +1,6 @@
package pl.szczodrzynski.edziennik.data.api.v2
import pl.szczodrzynski.edziennik.data.api.AppError
import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore
data class ApiLoginResult(val loginStore: LoginStore, val error: AppError?)

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.api.v2 package pl.szczodrzynski.edziennik.data.api.v2
const val FEATURE_ALL = 0 const val FEATURE_ALL = 0
const val FEATURE_TIMETABLE = 1 const val FEATURE_TIMETABLE = 1
@ -6,7 +6,7 @@ const val FEATURE_AGENDA = 2
const val FEATURE_GRADES = 3 const val FEATURE_GRADES = 3
const val FEATURE_HOMEWORK = 4 const val FEATURE_HOMEWORK = 4
const val FEATURE_NOTICES = 5 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_INBOX = 7
const val FEATURE_MESSAGES_OUTBOX = 8 const val FEATURE_MESSAGES_OUTBOX = 8
const val FEATURE_ANNOUNCEMENTS = 9 const val FEATURE_ANNOUNCEMENTS = 9

View File

@ -0,0 +1,6 @@
package pl.szczodrzynski.edziennik.data.api.v2
import pl.szczodrzynski.edziennik.data.api.AppError
import pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile
data class FirstLoginResult(val profileList: ArrayList<Profile>, val error: AppError?)

View File

@ -1,26 +1,26 @@
package pl.szczodrzynski.edziennik.api.v2.librus package pl.szczodrzynski.edziennik.data.api.v2.librus
import android.content.Context import android.content.Context
import pl.szczodrzynski.edziennik.App import pl.szczodrzynski.edziennik.App
import pl.szczodrzynski.edziennik.api.AppError import pl.szczodrzynski.edziennik.data.api.AppError
import pl.szczodrzynski.edziennik.api.AppError.* import pl.szczodrzynski.edziennik.data.api.AppError.*
import pl.szczodrzynski.edziennik.api.interfaces.* import pl.szczodrzynski.edziennik.data.api.interfaces.*
import pl.szczodrzynski.edziennik.api.v2.LOGIN_MODE_LIBRUS_EMAIL import pl.szczodrzynski.edziennik.data.api.v2.LOGIN_MODE_LIBRUS_EMAIL
import pl.szczodrzynski.edziennik.api.v2.LOGIN_MODE_LIBRUS_JST import pl.szczodrzynski.edziennik.data.api.v2.LOGIN_MODE_LIBRUS_JST
import pl.szczodrzynski.edziennik.api.v2.LOGIN_MODE_LIBRUS_SYNERGIA import pl.szczodrzynski.edziennik.data.api.v2.LOGIN_MODE_LIBRUS_SYNERGIA
import pl.szczodrzynski.edziennik.api.v2.librus.firstlogin.FirstLoginLibrus import pl.szczodrzynski.edziennik.data.api.v2.librus.firstlogin.FirstLoginLibrus
import pl.szczodrzynski.edziennik.api.v2.librus.firstlogin.FirstLoginSynergia import pl.szczodrzynski.edziennik.data.api.v2.librus.firstlogin.FirstLoginSynergia
import pl.szczodrzynski.edziennik.api.v2.librus.login.LoginJst import pl.szczodrzynski.edziennik.data.api.v2.librus.login.LoginJst
import pl.szczodrzynski.edziennik.api.v2.librus.login.LoginLibrus import pl.szczodrzynski.edziennik.data.api.v2.librus.login.LoginLibrus
import pl.szczodrzynski.edziennik.api.v2.librus.login.LoginSynergia import pl.szczodrzynski.edziennik.data.api.v2.librus.login.LoginSynergia
import pl.szczodrzynski.edziennik.api.v2.librus.login.SynergiaTokenExtractor import pl.szczodrzynski.edziennik.data.api.v2.librus.login.SynergiaTokenExtractor
import pl.szczodrzynski.edziennik.api.v2.models.DataStore import pl.szczodrzynski.edziennik.data.api.v2.models.DataStore
import pl.szczodrzynski.edziennik.datamodels.LoginStore import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore
import pl.szczodrzynski.edziennik.datamodels.MessageFull import pl.szczodrzynski.edziennik.data.db.modules.messages.MessageFull
import pl.szczodrzynski.edziennik.datamodels.Profile import pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile
import pl.szczodrzynski.edziennik.datamodels.ProfileFull import pl.szczodrzynski.edziennik.data.db.modules.profiles.ProfileFull
import pl.szczodrzynski.edziennik.messages.MessagesComposeInfo import pl.szczodrzynski.edziennik.ui.modules.messages.MessagesComposeInfo
import pl.szczodrzynski.edziennik.models.Endpoint import pl.szczodrzynski.edziennik.utils.models.Endpoint
import pl.szczodrzynski.edziennik.utils.Utils.d import pl.szczodrzynski.edziennik.utils.Utils.d
import java.lang.Exception import java.lang.Exception

View File

@ -0,0 +1,10 @@
package pl.szczodrzynski.edziennik.data.api.v2.librus.data
import pl.szczodrzynski.edziennik.App
import pl.szczodrzynski.edziennik.data.api.interfaces.ProgressCallback
import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore
import pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile
class DataLibrus(val app: App, val profile: Profile, val loginStore: LoginStore, val callback: ProgressCallback, val onSuccess: () -> Unit) {
}

View File

@ -0,0 +1,12 @@
package pl.szczodrzynski.edziennik.data.api.v2.librus.firstlogin
import pl.szczodrzynski.edziennik.App
import pl.szczodrzynski.edziennik.data.api.interfaces.ProgressCallback
import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore
import pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile
class FirstLoginLibrus(val app: App, val loginStore: LoginStore, val progressCallback: ProgressCallback, val onSuccess: (profileList: List<Profile>) -> Unit) {
init {
}
}

View File

@ -0,0 +1,12 @@
package pl.szczodrzynski.edziennik.data.api.v2.librus.firstlogin
import pl.szczodrzynski.edziennik.App
import pl.szczodrzynski.edziennik.data.api.interfaces.ProgressCallback
import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore
import pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile
class FirstLoginSynergia(val app: App, val loginStore: LoginStore, val progressCallback: ProgressCallback, val onSuccess: (profileList: List<Profile>) -> Unit) {
init {
}
}

View File

@ -1,9 +1,8 @@
package pl.szczodrzynski.edziennik.api.v2.librus.login package pl.szczodrzynski.edziennik.data.api.v2.librus.login
import pl.szczodrzynski.edziennik.App import pl.szczodrzynski.edziennik.App
import pl.szczodrzynski.edziennik.api.interfaces.ProgressCallback import pl.szczodrzynski.edziennik.data.api.interfaces.ProgressCallback
import pl.szczodrzynski.edziennik.api.v2.ApiLoginResult import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore
import pl.szczodrzynski.edziennik.datamodels.LoginStore
class LoginJst(val app: App, val loginStore: LoginStore, val callback: ProgressCallback, val onSuccess: () -> Unit) { class LoginJst(val app: App, val loginStore: LoginStore, val callback: ProgressCallback, val onSuccess: () -> Unit) {
companion object { companion object {

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.api.v2.librus.login package pl.szczodrzynski.edziennik.data.api.v2.librus.login
import android.util.Pair import android.util.Pair
import com.google.gson.JsonObject import com.google.gson.JsonObject
@ -9,11 +9,11 @@ import im.wangchao.mhttp.callback.JsonCallbackHandler
import im.wangchao.mhttp.callback.TextCallbackHandler import im.wangchao.mhttp.callback.TextCallbackHandler
import pl.szczodrzynski.edziennik.App import pl.szczodrzynski.edziennik.App
import pl.szczodrzynski.edziennik.R import pl.szczodrzynski.edziennik.R
import pl.szczodrzynski.edziennik.api.AppError import pl.szczodrzynski.edziennik.data.api.AppError
import pl.szczodrzynski.edziennik.api.AppError.* import pl.szczodrzynski.edziennik.data.api.AppError.*
import pl.szczodrzynski.edziennik.api.interfaces.ProgressCallback import pl.szczodrzynski.edziennik.data.api.interfaces.ProgressCallback
import pl.szczodrzynski.edziennik.api.v2.* import pl.szczodrzynski.edziennik.data.api.v2.*
import pl.szczodrzynski.edziennik.datamodels.LoginStore import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore
import pl.szczodrzynski.edziennik.getInt import pl.szczodrzynski.edziennik.getInt
import pl.szczodrzynski.edziennik.getString import pl.szczodrzynski.edziennik.getString
import pl.szczodrzynski.edziennik.utils.Utils.c import pl.szczodrzynski.edziennik.utils.Utils.c

View File

@ -1,8 +1,8 @@
package pl.szczodrzynski.edziennik.api.v2.librus.login package pl.szczodrzynski.edziennik.data.api.v2.librus.login
import pl.szczodrzynski.edziennik.App import pl.szczodrzynski.edziennik.App
import pl.szczodrzynski.edziennik.api.interfaces.ProgressCallback import pl.szczodrzynski.edziennik.data.api.interfaces.ProgressCallback
import pl.szczodrzynski.edziennik.datamodels.LoginStore import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore
class LoginSynergia(val app: App, val loginStore: LoginStore, val callback: ProgressCallback, val onSuccess: () -> Unit) { class LoginSynergia(val app: App, val loginStore: LoginStore, val callback: ProgressCallback, val onSuccess: () -> Unit) {
companion object { companion object {

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.api.v2.librus.login package pl.szczodrzynski.edziennik.data.api.v2.librus.login
import com.google.gson.JsonNull import com.google.gson.JsonNull
import com.google.gson.JsonObject import com.google.gson.JsonObject
@ -6,13 +6,13 @@ import im.wangchao.mhttp.Request
import im.wangchao.mhttp.Response import im.wangchao.mhttp.Response
import im.wangchao.mhttp.callback.JsonCallbackHandler import im.wangchao.mhttp.callback.JsonCallbackHandler
import pl.szczodrzynski.edziennik.* import pl.szczodrzynski.edziennik.*
import pl.szczodrzynski.edziennik.api.AppError import pl.szczodrzynski.edziennik.data.api.AppError
import pl.szczodrzynski.edziennik.api.AppError.* import pl.szczodrzynski.edziennik.data.api.AppError.*
import pl.szczodrzynski.edziennik.api.v2.LIBRUS_USER_AGENT import pl.szczodrzynski.edziennik.data.api.v2.LIBRUS_USER_AGENT
import pl.szczodrzynski.edziennik.api.interfaces.ProgressCallback import pl.szczodrzynski.edziennik.data.api.interfaces.ProgressCallback
import pl.szczodrzynski.edziennik.api.v2.LIBRUS_ACCOUNT_URL import pl.szczodrzynski.edziennik.data.api.v2.LIBRUS_ACCOUNT_URL
import pl.szczodrzynski.edziennik.datamodels.LoginStore import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore
import pl.szczodrzynski.edziennik.datamodels.Profile import pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile
import pl.szczodrzynski.edziennik.utils.Utils.d import pl.szczodrzynski.edziennik.utils.Utils.d
import java.net.HttpURLConnection.* import java.net.HttpURLConnection.*

View File

@ -1,10 +1,25 @@
package pl.szczodrzynski.edziennik.api.v2.models package pl.szczodrzynski.edziennik.data.api.v2.models
import android.util.LongSparseArray import android.util.LongSparseArray
import androidx.core.util.forEach import androidx.core.util.forEach
import androidx.core.util.isNotEmpty import androidx.core.util.isNotEmpty
import pl.szczodrzynski.edziennik.datamodels.* import pl.szczodrzynski.edziennik.data.db.AppDb
import pl.szczodrzynski.edziennik.models.Date import pl.szczodrzynski.edziennik.data.db.modules.announcements.Announcement
import pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance
import pl.szczodrzynski.edziennik.data.db.modules.events.Event
import pl.szczodrzynski.edziennik.data.db.modules.events.EventType
import pl.szczodrzynski.edziennik.data.db.modules.grades.Grade
import pl.szczodrzynski.edziennik.data.db.modules.grades.GradeCategory
import pl.szczodrzynski.edziennik.data.db.modules.lessons.Lesson
import pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonChange
import pl.szczodrzynski.edziennik.data.db.modules.messages.Message
import pl.szczodrzynski.edziennik.data.db.modules.messages.MessageRecipient
import pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata
import pl.szczodrzynski.edziennik.data.db.modules.notices.Notice
import pl.szczodrzynski.edziennik.data.db.modules.subjects.Subject
import pl.szczodrzynski.edziennik.data.db.modules.teachers.Teacher
import pl.szczodrzynski.edziennik.data.db.modules.teams.Team
import pl.szczodrzynski.edziennik.utils.models.Date
data class DataStore(private val appDb: AppDb, val profileId: Int) { data class DataStore(private val appDb: AppDb, val profileId: Int) {
val teacherList: LongSparseArray<Teacher> = LongSparseArray() val teacherList: LongSparseArray<Teacher> = LongSparseArray()

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.api.v2.models package pl.szczodrzynski.edziennik.data.api.v2.models
data class Feature(val featureId: Int, val loginOptions: Map<Int, List<Int>>) { data class Feature(val featureId: Int, val loginOptions: Map<Int, List<Int>>) {

View File

@ -1,6 +1,6 @@
package pl.szczodrzynski.edziennik.api.v2.models package pl.szczodrzynski.edziennik.data.api.v2.models
import pl.szczodrzynski.edziennik.api.v2.* import pl.szczodrzynski.edziennik.data.api.v2.*
val Features = listOf( val Features = listOf(
Feature(FEATURE_TIMETABLE, mapOf( Feature(FEATURE_TIMETABLE, mapOf(

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db;
import androidx.sqlite.db.SupportSQLiteDatabase; import androidx.sqlite.db.SupportSQLiteDatabase;
import androidx.room.Database; import androidx.room.Database;
@ -6,7 +6,53 @@ import androidx.room.Room;
import androidx.room.RoomDatabase; import androidx.room.RoomDatabase;
import androidx.room.TypeConverters; import androidx.room.TypeConverters;
import androidx.room.migration.Migration; import androidx.room.migration.Migration;
import pl.szczodrzynski.edziennik.models.Date;
import pl.szczodrzynski.edziennik.data.db.modules.announcements.Announcement;
import pl.szczodrzynski.edziennik.data.db.modules.announcements.AnnouncementDao;
import pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance;
import pl.szczodrzynski.edziennik.data.db.modules.attendance.AttendanceDao;
import pl.szczodrzynski.edziennik.data.db.converters.ConverterDate;
import pl.szczodrzynski.edziennik.data.db.converters.ConverterJsonObject;
import pl.szczodrzynski.edziennik.data.db.converters.ConverterListLong;
import pl.szczodrzynski.edziennik.data.db.converters.ConverterListString;
import pl.szczodrzynski.edziennik.data.db.converters.ConverterTime;
import pl.szczodrzynski.edziennik.data.db.modules.debuglog.DebugLog;
import pl.szczodrzynski.edziennik.data.db.modules.debuglog.DebugLogDao;
import pl.szczodrzynski.edziennik.data.db.modules.events.Event;
import pl.szczodrzynski.edziennik.data.db.modules.events.EventDao;
import pl.szczodrzynski.edziennik.data.db.modules.events.EventType;
import pl.szczodrzynski.edziennik.data.db.modules.events.EventTypeDao;
import pl.szczodrzynski.edziennik.data.db.modules.feedback.FeedbackMessage;
import pl.szczodrzynski.edziennik.data.db.modules.feedback.FeedbackMessageDao;
import pl.szczodrzynski.edziennik.data.db.modules.grades.Grade;
import pl.szczodrzynski.edziennik.data.db.modules.grades.GradeCategory;
import pl.szczodrzynski.edziennik.data.db.modules.grades.GradeCategoryDao;
import pl.szczodrzynski.edziennik.data.db.modules.grades.GradeDao;
import pl.szczodrzynski.edziennik.data.db.modules.lessons.Lesson;
import pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonChange;
import pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonChangeDao;
import pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonDao;
import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore;
import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStoreDao;
import pl.szczodrzynski.edziennik.data.db.modules.luckynumber.LuckyNumber;
import pl.szczodrzynski.edziennik.data.db.modules.luckynumber.LuckyNumberDao;
import pl.szczodrzynski.edziennik.data.db.modules.messages.Message;
import pl.szczodrzynski.edziennik.data.db.modules.messages.MessageDao;
import pl.szczodrzynski.edziennik.data.db.modules.messages.MessageRecipient;
import pl.szczodrzynski.edziennik.data.db.modules.messages.MessageRecipientDao;
import pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata;
import pl.szczodrzynski.edziennik.data.db.modules.metadata.MetadataDao;
import pl.szczodrzynski.edziennik.data.db.modules.notices.Notice;
import pl.szczodrzynski.edziennik.data.db.modules.notices.NoticeDao;
import pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile;
import pl.szczodrzynski.edziennik.data.db.modules.profiles.ProfileDao;
import pl.szczodrzynski.edziennik.data.db.modules.subjects.Subject;
import pl.szczodrzynski.edziennik.data.db.modules.subjects.SubjectDao;
import pl.szczodrzynski.edziennik.data.db.modules.teachers.Teacher;
import pl.szczodrzynski.edziennik.data.db.modules.teachers.TeacherDao;
import pl.szczodrzynski.edziennik.data.db.modules.teams.Team;
import pl.szczodrzynski.edziennik.data.db.modules.teams.TeamDao;
import pl.szczodrzynski.edziennik.utils.models.Date;
import android.content.Context; import android.content.Context;

View File

@ -1,8 +1,8 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.converters;
import androidx.room.TypeConverter; import androidx.room.TypeConverter;
import pl.szczodrzynski.edziennik.models.Date; import pl.szczodrzynski.edziennik.utils.models.Date;
public class ConverterDate { public class ConverterDate {

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.converters;
import androidx.room.TypeConverter; import androidx.room.TypeConverter;

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.converters;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.converters;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;

View File

@ -1,8 +1,8 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.converters;
import androidx.room.TypeConverter; import androidx.room.TypeConverter;
import pl.szczodrzynski.edziennik.models.Time; import pl.szczodrzynski.edziennik.utils.models.Time;
public class ConverterTime { public class ConverterTime {

View File

@ -1,11 +1,11 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.announcements;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.room.ColumnInfo; import androidx.room.ColumnInfo;
import androidx.room.Entity; import androidx.room.Entity;
import androidx.room.Ignore; import androidx.room.Ignore;
import androidx.room.Index; import androidx.room.Index;
import pl.szczodrzynski.edziennik.models.Date; import pl.szczodrzynski.edziennik.utils.models.Date;
@Entity(tableName = "announcements", @Entity(tableName = "announcements",
primaryKeys = {"profileId", "announcementId"}, primaryKeys = {"profileId", "announcementId"},

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.announcements;
import java.util.List; import java.util.List;
@ -11,7 +11,9 @@ import androidx.room.RawQuery;
import androidx.sqlite.db.SimpleSQLiteQuery; import androidx.sqlite.db.SimpleSQLiteQuery;
import androidx.sqlite.db.SupportSQLiteQuery; import androidx.sqlite.db.SupportSQLiteQuery;
import static pl.szczodrzynski.edziennik.datamodels.Metadata.TYPE_ANNOUNCEMENT; import pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata;
import static pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata.TYPE_ANNOUNCEMENT;
@Dao @Dao
public abstract class AnnouncementDao { public abstract class AnnouncementDao {

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.announcements;
public class AnnouncementFull extends Announcement { public class AnnouncementFull extends Announcement {
public String teacherFullName = ""; public String teacherFullName = "";

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.attendance;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.room.ColumnInfo; import androidx.room.ColumnInfo;
@ -6,8 +6,8 @@ import androidx.room.Entity;
import androidx.room.Ignore; import androidx.room.Ignore;
import androidx.room.Index; import androidx.room.Index;
import pl.szczodrzynski.edziennik.models.Date; import pl.szczodrzynski.edziennik.utils.models.Date;
import pl.szczodrzynski.edziennik.models.Time; import pl.szczodrzynski.edziennik.utils.models.Time;
@Entity(tableName = "attendances", @Entity(tableName = "attendances",
primaryKeys = {"profileId", "attendanceId", "attendanceLessonDate", "attendanceStartTime"}, primaryKeys = {"profileId", "attendanceId", "attendanceLessonDate", "attendanceStartTime"},

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.attendance;
import androidx.lifecycle.LiveData; import androidx.lifecycle.LiveData;
import androidx.sqlite.db.SimpleSQLiteQuery; import androidx.sqlite.db.SimpleSQLiteQuery;
@ -8,12 +8,11 @@ import androidx.room.Insert;
import androidx.room.OnConflictStrategy; import androidx.room.OnConflictStrategy;
import androidx.room.Query; import androidx.room.Query;
import androidx.room.RawQuery; import androidx.room.RawQuery;
import pl.szczodrzynski.edziennik.models.Date; import pl.szczodrzynski.edziennik.utils.models.Date;
import java.util.List; import java.util.List;
import static pl.szczodrzynski.edziennik.datamodels.Attendance.TYPE_PRESENT; import static pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata.TYPE_ATTENDANCE;
import static pl.szczodrzynski.edziennik.datamodels.Metadata.TYPE_ATTENDANCE;
@Dao @Dao
public abstract class AttendanceDao { public abstract class AttendanceDao {

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.attendance;
public class AttendanceFull extends Attendance { public class AttendanceFull extends Attendance {
public String teacherFullName = ""; public String teacherFullName = "";

View File

@ -1,7 +1,6 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.debuglog;
import androidx.room.Entity; import androidx.room.Entity;
import androidx.room.Index;
import androidx.room.PrimaryKey; import androidx.room.PrimaryKey;
import static pl.szczodrzynski.edziennik.utils.Utils.d; import static pl.szczodrzynski.edziennik.utils.Utils.d;

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.debuglog;
import androidx.room.Dao; import androidx.room.Dao;
import androidx.room.Insert; import androidx.room.Insert;

View File

@ -1,11 +1,11 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.events;
import androidx.room.ColumnInfo; import androidx.room.ColumnInfo;
import androidx.room.Entity; import androidx.room.Entity;
import androidx.room.Ignore; import androidx.room.Ignore;
import androidx.room.Index; import androidx.room.Index;
import pl.szczodrzynski.edziennik.models.Date; import pl.szczodrzynski.edziennik.utils.models.Date;
import pl.szczodrzynski.edziennik.models.Time; import pl.szczodrzynski.edziennik.utils.models.Time;
@Entity(tableName = "events", @Entity(tableName = "events",
primaryKeys = {"profileId", "eventId"}, primaryKeys = {"profileId", "eventId"},

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.events;
import androidx.lifecycle.LiveData; import androidx.lifecycle.LiveData;
import androidx.sqlite.db.SimpleSQLiteQuery; import androidx.sqlite.db.SimpleSQLiteQuery;
@ -14,12 +14,12 @@ import android.util.Log;
import java.util.List; import java.util.List;
import pl.szczodrzynski.edziennik.models.Date; import pl.szczodrzynski.edziennik.utils.models.Date;
import pl.szczodrzynski.edziennik.models.Time; import pl.szczodrzynski.edziennik.utils.models.Time;
import static pl.szczodrzynski.edziennik.datamodels.Metadata.TYPE_EVENT; import static pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata.TYPE_EVENT;
import static pl.szczodrzynski.edziennik.datamodels.Metadata.TYPE_HOMEWORK; import static pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata.TYPE_HOMEWORK;
import static pl.szczodrzynski.edziennik.datamodels.Metadata.TYPE_LESSON_CHANGE; import static pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata.TYPE_LESSON_CHANGE;
@Dao @Dao
public abstract class EventDao { public abstract class EventDao {

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.events;
public class EventFull extends Event { public class EventFull extends Event {
public String typeName = ""; public String typeName = "";

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.events;
import android.graphics.Color; import android.graphics.Color;

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.events;
import java.util.List; import java.util.List;

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.feedback;
import androidx.room.Entity; import androidx.room.Entity;
import androidx.room.Ignore; import androidx.room.Ignore;

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.feedback;
import java.util.List; import java.util.List;

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.feedback;
public class FeedbackMessageWithCount extends FeedbackMessage { public class FeedbackMessageWithCount extends FeedbackMessage {
public int messageCount = 0; public int messageCount = 0;

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.grades;
import androidx.room.ColumnInfo; import androidx.room.ColumnInfo;
import androidx.room.Entity; import androidx.room.Entity;

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.grades;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.grades;
import java.util.List; import java.util.List;

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.grades;
import androidx.lifecycle.LiveData; import androidx.lifecycle.LiveData;
import androidx.sqlite.db.SimpleSQLiteQuery; import androidx.sqlite.db.SimpleSQLiteQuery;
@ -14,7 +14,7 @@ import android.util.SparseIntArray;
import java.util.List; import java.util.List;
import static pl.szczodrzynski.edziennik.datamodels.Metadata.TYPE_GRADE; import static pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata.TYPE_GRADE;
@Dao @Dao
public abstract class GradeDao { public abstract class GradeDao {

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.grades;
public class GradeFull extends Grade { public class GradeFull extends Grade {
//public String category = ""; //public String category = "";

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.lessons;
import java.util.List; import java.util.List;
@ -8,8 +8,8 @@ import androidx.room.Ignore;
import androidx.room.Index; import androidx.room.Index;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import pl.szczodrzynski.edziennik.models.Time; import pl.szczodrzynski.edziennik.utils.models.Time;
import pl.szczodrzynski.edziennik.models.Week; import pl.szczodrzynski.edziennik.utils.models.Week;
@Entity(tableName = "lessons", @Entity(tableName = "lessons",
primaryKeys = {"profileId", "lessonWeekDay", "lessonStartTime", "lessonEndTime"}, primaryKeys = {"profileId", "lessonWeekDay", "lessonStartTime", "lessonEndTime"},

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.lessons;
import androidx.room.ColumnInfo; import androidx.room.ColumnInfo;
import androidx.room.Entity; import androidx.room.Entity;
@ -7,8 +7,8 @@ import androidx.annotation.NonNull;
import java.util.List; import java.util.List;
import pl.szczodrzynski.edziennik.models.Date; import pl.szczodrzynski.edziennik.utils.models.Date;
import pl.szczodrzynski.edziennik.models.Time; import pl.szczodrzynski.edziennik.utils.models.Time;
@Entity(tableName = "lessonChanges", @Entity(tableName = "lessonChanges",
primaryKeys = {"profileId", "lessonChangeDate", "lessonChangeStartTime", "lessonChangeEndTime"}, primaryKeys = {"profileId", "lessonChangeDate", "lessonChangeStartTime", "lessonChangeEndTime"},

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.lessons;
import androidx.lifecycle.LiveData; import androidx.lifecycle.LiveData;
import androidx.sqlite.db.SimpleSQLiteQuery; import androidx.sqlite.db.SimpleSQLiteQuery;
@ -11,10 +11,10 @@ import androidx.room.RawQuery;
import java.util.List; import java.util.List;
import pl.szczodrzynski.edziennik.models.Date; import pl.szczodrzynski.edziennik.utils.models.Date;
import pl.szczodrzynski.edziennik.models.db.LessonChangeCounter; import pl.szczodrzynski.edziennik.utils.models.db.LessonChangeCounter;
import static pl.szczodrzynski.edziennik.datamodels.Metadata.TYPE_LESSON_CHANGE; import static pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata.TYPE_LESSON_CHANGE;
import static pl.szczodrzynski.edziennik.utils.Utils.d; import static pl.szczodrzynski.edziennik.utils.Utils.d;
@Dao @Dao

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.lessons;
public class LessonChangeFull extends LessonChange { public class LessonChangeFull extends LessonChange {
/*public String changeTeacherFullName = ""; /*public String changeTeacherFullName = "";

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.lessons;
import androidx.lifecycle.LiveData; import androidx.lifecycle.LiveData;
import androidx.sqlite.db.SimpleSQLiteQuery; import androidx.sqlite.db.SimpleSQLiteQuery;
@ -9,12 +9,11 @@ import androidx.room.OnConflictStrategy;
import androidx.room.Query; import androidx.room.Query;
import androidx.room.RawQuery; import androidx.room.RawQuery;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import android.util.Log;
import java.util.List; import java.util.List;
import pl.szczodrzynski.edziennik.models.Date; import pl.szczodrzynski.edziennik.utils.models.Date;
import pl.szczodrzynski.edziennik.models.Time; import pl.szczodrzynski.edziennik.utils.models.Time;
@Dao @Dao
public abstract class LessonDao { public abstract class LessonDao {

View File

@ -1,15 +1,15 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.lessons;
import androidx.room.ColumnInfo; import androidx.room.ColumnInfo;
import android.content.Context; import android.content.Context;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import pl.szczodrzynski.edziennik.R; import pl.szczodrzynski.edziennik.R;
import pl.szczodrzynski.edziennik.models.Date; import pl.szczodrzynski.edziennik.utils.models.Date;
import static pl.szczodrzynski.edziennik.datamodels.LessonChange.TYPE_ADDED; import static pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonChange.TYPE_ADDED;
import static pl.szczodrzynski.edziennik.datamodels.LessonChange.TYPE_CANCELLED; import static pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonChange.TYPE_CANCELLED;
import static pl.szczodrzynski.edziennik.datamodels.LessonChange.TYPE_CHANGE; import static pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonChange.TYPE_CHANGE;
import static pl.szczodrzynski.edziennik.utils.Utils.bs; import static pl.szczodrzynski.edziennik.utils.Utils.bs;
public class LessonFull extends Lesson { public class LessonFull extends Lesson {

View File

@ -1,16 +1,17 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.login;
import android.os.Bundle; import android.os.Bundle;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.room.ColumnInfo; import androidx.room.ColumnInfo;
import androidx.room.Entity; import androidx.room.Entity;
import androidx.annotation.NonNull;
import androidx.room.Ignore; import androidx.room.Ignore;
import com.google.gson.JsonElement; import com.google.gson.JsonElement;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import pl.szczodrzynski.edziennik.data.db.modules.profiles.ProfileFull;
@Entity(tableName = "loginStores", @Entity(tableName = "loginStores",
primaryKeys = {"loginStoreId"}) primaryKeys = {"loginStoreId"})
public class LoginStore { public class LoginStore {

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.login;
import androidx.lifecycle.LiveData; import androidx.lifecycle.LiveData;
import androidx.room.Dao; import androidx.room.Dao;
@ -8,6 +8,8 @@ import androidx.room.Query;
import java.util.List; import java.util.List;
import pl.szczodrzynski.edziennik.data.db.modules.profiles.ProfileFull;
@Dao @Dao
public abstract class LoginStoreDao { public abstract class LoginStoreDao {
@Insert(onConflict = OnConflictStrategy.REPLACE) @Insert(onConflict = OnConflictStrategy.REPLACE)

View File

@ -1,10 +1,10 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.luckynumber;
import androidx.room.ColumnInfo; import androidx.room.ColumnInfo;
import androidx.room.Entity; import androidx.room.Entity;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import pl.szczodrzynski.edziennik.models.Date; import pl.szczodrzynski.edziennik.utils.models.Date;
@Entity(tableName = "luckyNumbers", @Entity(tableName = "luckyNumbers",
primaryKeys = {"profileId", "luckyNumberDate"}) primaryKeys = {"profileId", "luckyNumberDate"})

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.luckynumber;
import androidx.lifecycle.LiveData; import androidx.lifecycle.LiveData;
import androidx.room.Dao; import androidx.room.Dao;
@ -8,7 +8,7 @@ import androidx.room.Query;
import java.util.List; import java.util.List;
import pl.szczodrzynski.edziennik.models.Date; import pl.szczodrzynski.edziennik.utils.models.Date;
@Dao @Dao
public interface LuckyNumberDao { public interface LuckyNumberDao {

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.messages;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.messages;
import java.util.List; import java.util.List;
@ -11,10 +11,12 @@ import androidx.room.RawQuery;
import androidx.sqlite.db.SimpleSQLiteQuery; import androidx.sqlite.db.SimpleSQLiteQuery;
import androidx.sqlite.db.SupportSQLiteQuery; import androidx.sqlite.db.SupportSQLiteQuery;
import static pl.szczodrzynski.edziennik.datamodels.Message.TYPE_DELETED; import pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata;
import static pl.szczodrzynski.edziennik.datamodels.Message.TYPE_RECEIVED;
import static pl.szczodrzynski.edziennik.datamodels.Message.TYPE_SENT; import static pl.szczodrzynski.edziennik.data.db.modules.messages.Message.TYPE_DELETED;
import static pl.szczodrzynski.edziennik.datamodels.Metadata.TYPE_MESSAGE; import static pl.szczodrzynski.edziennik.data.db.modules.messages.Message.TYPE_RECEIVED;
import static pl.szczodrzynski.edziennik.data.db.modules.messages.Message.TYPE_SENT;
import static pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata.TYPE_MESSAGE;
@Dao @Dao
public abstract class MessageDao { public abstract class MessageDao {

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.messages;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.messages;
import androidx.room.ColumnInfo; import androidx.room.ColumnInfo;
import androidx.room.Entity; import androidx.room.Entity;

View File

@ -1,8 +1,7 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.messages;
import java.util.List; import java.util.List;
import androidx.lifecycle.LiveData;
import androidx.room.Dao; import androidx.room.Dao;
import androidx.room.Insert; import androidx.room.Insert;
import androidx.room.OnConflictStrategy; import androidx.room.OnConflictStrategy;
@ -11,8 +10,6 @@ import androidx.room.RawQuery;
import androidx.sqlite.db.SimpleSQLiteQuery; import androidx.sqlite.db.SimpleSQLiteQuery;
import androidx.sqlite.db.SupportSQLiteQuery; import androidx.sqlite.db.SupportSQLiteQuery;
import static pl.szczodrzynski.edziennik.datamodels.Metadata.TYPE_MESSAGE;
@Dao @Dao
public abstract class MessageRecipientDao { public abstract class MessageRecipientDao {
@Query("DELETE FROM messageRecipients WHERE profileId = :profileId") @Query("DELETE FROM messageRecipients WHERE profileId = :profileId")

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.messages;
public class MessageRecipientFull extends MessageRecipient { public class MessageRecipientFull extends MessageRecipient {
public String fullName = null; public String fullName = null;

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.metadata;
import androidx.room.ColumnInfo; import androidx.room.ColumnInfo;
import androidx.room.Entity; import androidx.room.Entity;

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.metadata;
import androidx.lifecycle.LiveData; import androidx.lifecycle.LiveData;
import androidx.room.Dao; import androidx.room.Dao;
@ -9,16 +9,24 @@ import androidx.room.Transaction;
import java.util.List; import java.util.List;
import pl.szczodrzynski.edziennik.models.db.UnreadCounter; import pl.szczodrzynski.edziennik.data.db.modules.notices.Notice;
import pl.szczodrzynski.edziennik.data.db.modules.announcements.Announcement;
import pl.szczodrzynski.edziennik.data.db.modules.attendance.Attendance;
import pl.szczodrzynski.edziennik.data.db.modules.events.Event;
import pl.szczodrzynski.edziennik.data.db.modules.grades.Grade;
import pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonChange;
import pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonFull;
import pl.szczodrzynski.edziennik.data.db.modules.messages.Message;
import pl.szczodrzynski.edziennik.utils.models.db.UnreadCounter;
import static pl.szczodrzynski.edziennik.datamodels.Metadata.TYPE_ANNOUNCEMENT; import static pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata.TYPE_ANNOUNCEMENT;
import static pl.szczodrzynski.edziennik.datamodels.Metadata.TYPE_ATTENDANCE; import static pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata.TYPE_ATTENDANCE;
import static pl.szczodrzynski.edziennik.datamodels.Metadata.TYPE_EVENT; import static pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata.TYPE_EVENT;
import static pl.szczodrzynski.edziennik.datamodels.Metadata.TYPE_GRADE; import static pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata.TYPE_GRADE;
import static pl.szczodrzynski.edziennik.datamodels.Metadata.TYPE_HOMEWORK; import static pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata.TYPE_HOMEWORK;
import static pl.szczodrzynski.edziennik.datamodels.Metadata.TYPE_LESSON_CHANGE; import static pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata.TYPE_LESSON_CHANGE;
import static pl.szczodrzynski.edziennik.datamodels.Metadata.TYPE_MESSAGE; import static pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata.TYPE_MESSAGE;
import static pl.szczodrzynski.edziennik.datamodels.Metadata.TYPE_NOTICE; import static pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata.TYPE_NOTICE;
@Dao @Dao
public abstract class MetadataDao { public abstract class MetadataDao {
@ -196,7 +204,7 @@ public abstract class MetadataDao {
public abstract void deleteUnusedNotices(int profileId); 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);") @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);") @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); public abstract void deleteUnusedEvents(int profileId);
@ -217,7 +225,7 @@ public abstract class MetadataDao {
public void deleteUnused(int profileId) { public void deleteUnused(int profileId) {
deleteUnusedGrades(profileId); deleteUnusedGrades(profileId);
deleteUnusedNotices(profileId); deleteUnusedNotices(profileId);
deleteUnusedAttendances(profileId); deleteUnusedAttendance(profileId);
deleteUnusedEvents(profileId); deleteUnusedEvents(profileId);
deleteUnusedHomework(profileId); deleteUnusedHomework(profileId);
deleteUnusedLessonChanges(profileId); deleteUnusedLessonChanges(profileId);

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.notices;
import androidx.room.ColumnInfo; import androidx.room.ColumnInfo;
import androidx.room.Entity; import androidx.room.Entity;

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.notices;
import androidx.lifecycle.LiveData; import androidx.lifecycle.LiveData;
import androidx.sqlite.db.SimpleSQLiteQuery; import androidx.sqlite.db.SimpleSQLiteQuery;
@ -11,7 +11,9 @@ import androidx.room.RawQuery;
import java.util.List; import java.util.List;
import static pl.szczodrzynski.edziennik.datamodels.Metadata.TYPE_NOTICE; import pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata;
import static pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata.TYPE_NOTICE;
@Dao @Dao
public abstract class NoticeDao { public abstract class NoticeDao {

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.notices;
public class NoticeFull extends Notice { public class NoticeFull extends Notice {
public String teacherFullName = ""; public String teacherFullName = "";

View File

@ -1,27 +1,22 @@
package pl.szczodrzynski.edziennik.datamodels package pl.szczodrzynski.edziennik.data.db.modules.profiles
import androidx.room.ColumnInfo import androidx.room.ColumnInfo
import androidx.room.Entity import androidx.room.Entity
import android.content.Context import android.content.Context
import android.graphics.BitmapFactory
import android.graphics.PorterDuff import android.graphics.PorterDuff
import android.graphics.PorterDuffColorFilter import android.graphics.PorterDuffColorFilter
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.media.ThumbnailUtils
import android.net.ConnectivityManager import android.net.ConnectivityManager
import android.net.NetworkInfo
import android.widget.ImageView import android.widget.ImageView
import androidx.core.graphics.drawable.RoundedBitmapDrawable
import androidx.core.graphics.drawable.RoundedBitmapDrawableFactory import androidx.core.graphics.drawable.RoundedBitmapDrawableFactory
import com.google.gson.JsonElement
import com.google.gson.JsonObject import com.google.gson.JsonObject
import androidx.room.Ignore import androidx.room.Ignore
import pl.droidsonroids.gif.GifDrawable import pl.droidsonroids.gif.GifDrawable
import pl.szczodrzynski.edziennik.colorFromName import pl.szczodrzynski.edziennik.colorFromName
import pl.szczodrzynski.edziennik.models.Date import pl.szczodrzynski.edziennik.utils.models.Date
import pl.szczodrzynski.navlib.ImageHolder import pl.szczodrzynski.navlib.ImageHolder
import pl.szczodrzynski.navlib.R import pl.szczodrzynski.navlib.R
import pl.szczodrzynski.navlib.drawer.IDrawerProfile import pl.szczodrzynski.navlib.drawer.IDrawerProfile

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.profiles;
import androidx.lifecycle.LiveData; import androidx.lifecycle.LiveData;
import androidx.room.Dao; import androidx.room.Dao;
@ -8,7 +8,7 @@ import androidx.room.Query;
import java.util.List; import java.util.List;
import static pl.szczodrzynski.edziennik.datamodels.Profile.REGISTRATION_ENABLED; import static pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile.REGISTRATION_ENABLED;
@Dao @Dao
public interface ProfileDao { public interface ProfileDao {

View File

@ -1,17 +1,18 @@
package pl.szczodrzynski.edziennik.datamodels package pl.szczodrzynski.edziennik.data.db.modules.profiles
import android.content.Context import android.content.Context
import androidx.room.ColumnInfo import androidx.room.ColumnInfo
import com.google.gson.JsonObject import com.google.gson.JsonObject
import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_AGENDA 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_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_GRADES
import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_HOMEWORK 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_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.MainActivity.Companion.DRAWER_ITEM_TIMETABLE
import pl.szczodrzynski.edziennik.datamodels.LoginStore.* import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore
import pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore.*
import java.util.* import java.util.*
class ProfileFull : Profile { class ProfileFull : Profile {
@ -51,8 +52,8 @@ class ProfileFull : Profile {
fragmentIds.add(DRAWER_ITEM_GRADES) fragmentIds.add(DRAWER_ITEM_GRADES)
fragmentIds.add(DRAWER_ITEM_MESSAGES) fragmentIds.add(DRAWER_ITEM_MESSAGES)
fragmentIds.add(DRAWER_ITEM_HOMEWORK) fragmentIds.add(DRAWER_ITEM_HOMEWORK)
fragmentIds.add(DRAWER_ITEM_NOTICES) fragmentIds.add(DRAWER_ITEM_BEHAVIOUR)
fragmentIds.add(DRAWER_ITEM_ATTENDANCES) fragmentIds.add(DRAWER_ITEM_ATTENDANCE)
return fragmentIds return fragmentIds
} }
LOGIN_TYPE_LIBRUS -> { LOGIN_TYPE_LIBRUS -> {
@ -62,8 +63,8 @@ class ProfileFull : Profile {
fragmentIds.add(DRAWER_ITEM_GRADES) fragmentIds.add(DRAWER_ITEM_GRADES)
fragmentIds.add(DRAWER_ITEM_MESSAGES) fragmentIds.add(DRAWER_ITEM_MESSAGES)
fragmentIds.add(DRAWER_ITEM_HOMEWORK) fragmentIds.add(DRAWER_ITEM_HOMEWORK)
fragmentIds.add(DRAWER_ITEM_NOTICES) fragmentIds.add(DRAWER_ITEM_BEHAVIOUR)
fragmentIds.add(DRAWER_ITEM_ATTENDANCES) fragmentIds.add(DRAWER_ITEM_ATTENDANCE)
fragmentIds.add(DRAWER_ITEM_ANNOUNCEMENTS) fragmentIds.add(DRAWER_ITEM_ANNOUNCEMENTS)
return fragmentIds return fragmentIds
} }
@ -73,8 +74,8 @@ class ProfileFull : Profile {
fragmentIds.add(DRAWER_ITEM_AGENDA) fragmentIds.add(DRAWER_ITEM_AGENDA)
fragmentIds.add(DRAWER_ITEM_GRADES) fragmentIds.add(DRAWER_ITEM_GRADES)
fragmentIds.add(DRAWER_ITEM_MESSAGES) fragmentIds.add(DRAWER_ITEM_MESSAGES)
fragmentIds.add(DRAWER_ITEM_NOTICES) fragmentIds.add(DRAWER_ITEM_BEHAVIOUR)
fragmentIds.add(DRAWER_ITEM_ATTENDANCES) fragmentIds.add(DRAWER_ITEM_ATTENDANCE)
fragmentIds.add(DRAWER_ITEM_ANNOUNCEMENTS) fragmentIds.add(DRAWER_ITEM_ANNOUNCEMENTS)
return fragmentIds return fragmentIds
} }

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.subjects;
import java.util.List; import java.util.List;

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.subjects;
import androidx.lifecycle.LiveData; import androidx.lifecycle.LiveData;
import androidx.room.Dao; import androidx.room.Dao;

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.teachers;
import android.content.Context; import android.content.Context;
import android.graphics.Bitmap; import android.graphics.Bitmap;
@ -6,7 +6,6 @@ import android.graphics.Bitmap;
import java.util.List; import java.util.List;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.room.ColumnInfo; import androidx.room.ColumnInfo;
import androidx.room.Entity; import androidx.room.Entity;
import androidx.room.Ignore; import androidx.room.Ignore;

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.teachers;
import androidx.lifecycle.LiveData; import androidx.lifecycle.LiveData;
import androidx.room.Dao; import androidx.room.Dao;

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.teams;
import androidx.room.ColumnInfo; import androidx.room.ColumnInfo;
import androidx.room.Entity; import androidx.room.Entity;

View File

@ -1,4 +1,4 @@
package pl.szczodrzynski.edziennik.datamodels; package pl.szczodrzynski.edziennik.data.db.modules.teams;
import androidx.lifecycle.LiveData; import androidx.lifecycle.LiveData;
import androidx.room.Dao; import androidx.room.Dao;

View File

@ -16,10 +16,10 @@ import im.wangchao.mhttp.ThreadMode;
import im.wangchao.mhttp.callback.JsonCallbackHandler; import im.wangchao.mhttp.callback.JsonCallbackHandler;
import pl.szczodrzynski.edziennik.App; import pl.szczodrzynski.edziennik.App;
import pl.szczodrzynski.edziennik.BuildConfig; import pl.szczodrzynski.edziennik.BuildConfig;
import pl.szczodrzynski.edziennik.datamodels.ProfileFull; import pl.szczodrzynski.edziennik.data.db.modules.profiles.ProfileFull;
import pl.szczodrzynski.edziennik.utils.Utils; import pl.szczodrzynski.edziennik.utils.Utils;
import static pl.szczodrzynski.edziennik.datamodels.Profile.REGISTRATION_ENABLED; import static pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile.REGISTRATION_ENABLED;
public class ServerRequest { public class ServerRequest {
private App app; private App app;

Some files were not shown because too many files have changed in this diff Show More