mirror of
https://github.com/szkolny-eu/szkolny-android.git
synced 2025-06-21 01:23:03 +02:00
[UI] Refactor homework fragment and fix typos
This commit is contained in:
@ -86,7 +86,7 @@ import static pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface.FEATU
|
||||
import static pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface.FEATURE_ANNOUNCEMENTS;
|
||||
import static pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface.FEATURE_ATTENDANCES;
|
||||
import static pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface.FEATURE_GRADES;
|
||||
import static pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface.FEATURE_HOMEWORKS;
|
||||
import static pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface.FEATURE_HOMEWORK;
|
||||
import static pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface.FEATURE_MESSAGES_INBOX;
|
||||
import static pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface.FEATURE_MESSAGES_OUTBOX;
|
||||
import static pl.szczodrzynski.edziennik.api.interfaces.EdziennikInterface.FEATURE_NOTICES;
|
||||
@ -306,7 +306,7 @@ public class Edziennik {
|
||||
app.notifier.add(new Notification(app.getContext(), text)
|
||||
.withProfileData(profile.getId(), profile.getName())
|
||||
.withType(event.type == TYPE_HOMEWORK ? Notification.TYPE_NEW_HOMEWORK : Notification.TYPE_NEW_EVENT)
|
||||
.withFragmentRedirect(event.type == TYPE_HOMEWORK ? MainActivity.DRAWER_ITEM_HOMEWORKS : MainActivity.DRAWER_ITEM_AGENDA)
|
||||
.withFragmentRedirect(event.type == TYPE_HOMEWORK ? MainActivity.DRAWER_ITEM_HOMEWORK : MainActivity.DRAWER_ITEM_AGENDA)
|
||||
.withLongExtra("eventId", event.id)
|
||||
.withLongExtra("eventDate", event.eventDate.getValue())
|
||||
.withAddedDate(event.addedDate)
|
||||
@ -521,7 +521,7 @@ public class Edziennik {
|
||||
app.notifier.add(new Notification(app.getContext(), app.getString(R.string.notification_shared_event_format, event.sharedByName, type != null ? type.name : "wydarzenie", event.eventDate == null ? "nieznana data" : event.eventDate.getFormattedString(), event.topic))
|
||||
.withProfileData(profile.getId(), profile.getName())
|
||||
.withType(event.type == TYPE_HOMEWORK ? Notification.TYPE_NEW_SHARED_HOMEWORK : Notification.TYPE_NEW_SHARED_EVENT)
|
||||
.withFragmentRedirect(event.type == TYPE_HOMEWORK ? MainActivity.DRAWER_ITEM_HOMEWORKS : MainActivity.DRAWER_ITEM_AGENDA)
|
||||
.withFragmentRedirect(event.type == TYPE_HOMEWORK ? MainActivity.DRAWER_ITEM_HOMEWORK : MainActivity.DRAWER_ITEM_AGENDA)
|
||||
.withLongExtra("eventDate", event.eventDate.getValue())
|
||||
);
|
||||
}
|
||||
@ -858,7 +858,7 @@ public class Edziennik {
|
||||
FEATURE_TIMETABLE,
|
||||
FEATURE_AGENDA,
|
||||
FEATURE_GRADES,
|
||||
FEATURE_HOMEWORKS,
|
||||
FEATURE_HOMEWORK,
|
||||
FEATURE_NOTICES,
|
||||
FEATURE_ATTENDANCES,
|
||||
FEATURE_MESSAGES_INBOX,
|
||||
|
@ -235,8 +235,8 @@ public class Iuczniowie implements EdziennikInterface {
|
||||
targetEndpoints.add("Grades");
|
||||
targetEndpoints.add("PropositionGrades");
|
||||
break;
|
||||
case FEATURE_HOMEWORKS:
|
||||
targetEndpoints.add("Homeworks");
|
||||
case FEATURE_HOMEWORK:
|
||||
targetEndpoints.add("Homework");
|
||||
break;
|
||||
case FEATURE_NOTICES:
|
||||
targetEndpoints.add("Notices");
|
||||
|
@ -294,7 +294,7 @@ public class Librus implements EdziennikInterface {
|
||||
|
||||
targetEndpoints.add("Events");
|
||||
targetEndpoints.add("CustomTypes");
|
||||
targetEndpoints.add("Homeworks");
|
||||
targetEndpoints.add("Homework");
|
||||
targetEndpoints.add("LuckyNumbers");
|
||||
targetEndpoints.add("Notices");
|
||||
targetEndpoints.add("AttendancesTypes");
|
||||
@ -365,8 +365,8 @@ public class Librus implements EdziennikInterface {
|
||||
targetEndpoints.add("TextGrades");
|
||||
targetEndpoints.add("BehaviourGrades");
|
||||
break;
|
||||
case FEATURE_HOMEWORKS:
|
||||
targetEndpoints.add("Homeworks");
|
||||
case FEATURE_HOMEWORK:
|
||||
targetEndpoints.add("Homework");
|
||||
break;
|
||||
case FEATURE_NOTICES:
|
||||
targetEndpoints.add("Notices");
|
||||
@ -518,8 +518,8 @@ public class Librus implements EdziennikInterface {
|
||||
case "CustomTypes":
|
||||
getCustomTypes();
|
||||
break;
|
||||
case "Homeworks":
|
||||
getHomeworks();
|
||||
case "Homework":
|
||||
getHomework();
|
||||
break;
|
||||
case "LuckyNumbers":
|
||||
getLuckyNumbers();
|
||||
@ -2722,21 +2722,21 @@ public class Librus implements EdziennikInterface {
|
||||
});
|
||||
}
|
||||
|
||||
private void getHomeworks() {
|
||||
private void getHomework() {
|
||||
if (!premium) {
|
||||
r("finish", "Homeworks");
|
||||
r("finish", "Homework");
|
||||
return;
|
||||
}
|
||||
callback.onActionStarted(R.string.sync_action_syncing_homework);
|
||||
apiRequest("HomeWorkAssignments", data -> {
|
||||
if (data == null) {
|
||||
r("finish", "Homeworks");
|
||||
r("finish", "Homework");
|
||||
return;
|
||||
}
|
||||
JsonArray homeworks = data.get("HomeWorkAssignments").getAsJsonArray();
|
||||
JsonArray homeworkList = data.get("HomeWorkAssignments").getAsJsonArray();
|
||||
//d("Got Grades: "+events.toString());
|
||||
try {
|
||||
for (JsonElement homeworkEl : homeworks) {
|
||||
for (JsonElement homeworkEl : homeworkList) {
|
||||
JsonObject homework = homeworkEl.getAsJsonObject();
|
||||
|
||||
JsonElement el;
|
||||
@ -2787,7 +2787,7 @@ public class Librus implements EdziennikInterface {
|
||||
eventList.add(eventObject);
|
||||
metadataList.add(new Metadata(profileId, Metadata.TYPE_EVENT, eventObject.id, profile.getEmpty(), profile.getEmpty(), addedDate.getInMillis()));
|
||||
}
|
||||
r("finish", "Homeworks");
|
||||
r("finish", "Homework");
|
||||
}
|
||||
catch (Exception e) {
|
||||
finishWithError(new AppError(TAG, 2648, CODE_OTHER, e, data));
|
||||
@ -3377,7 +3377,7 @@ public class Librus implements EdziennikInterface {
|
||||
configurableEndpoints.put("Grades", new Endpoint("Grades",true, false, profile.getChangedEndpoints()));
|
||||
configurableEndpoints.put("PointGrades", new Endpoint("PointGrades",true, false, profile.getChangedEndpoints()));
|
||||
configurableEndpoints.put("Events", new Endpoint("Events",true, false, profile.getChangedEndpoints()));
|
||||
configurableEndpoints.put("Homeworks", new Endpoint("Homeworks",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("Notices", new Endpoint("Notices",true, false, profile.getChangedEndpoints()));
|
||||
configurableEndpoints.put("Attendances", new Endpoint("Attendances",true, false, profile.getChangedEndpoints()));
|
||||
|
@ -609,7 +609,7 @@ public class Mobidziennik implements EdziennikInterface {
|
||||
processEvents(table);
|
||||
}
|
||||
if (i == 23) {
|
||||
processHomeworks(table);
|
||||
processHomework(table);
|
||||
}
|
||||
if (i == 24) {
|
||||
processTimetable(table);
|
||||
@ -1891,11 +1891,11 @@ public class Mobidziennik implements EdziennikInterface {
|
||||
}
|
||||
}
|
||||
|
||||
private void processHomeworks(String table)
|
||||
private void processHomework(String table)
|
||||
{
|
||||
String[] homeworks = table.split("\n");
|
||||
String[] homeworkList = table.split("\n");
|
||||
Date today = Date.getToday();
|
||||
for (String homeworkStr: homeworks)
|
||||
for (String homeworkStr: homeworkList)
|
||||
{
|
||||
if (homeworkStr.isEmpty()) {
|
||||
continue;
|
||||
|
@ -108,7 +108,7 @@ public class Vulcan implements EdziennikInterface {
|
||||
private static final String ENDPOINT_GRADES = "mobile-api/Uczen.v3.Uczen/Oceny";
|
||||
private static final String ENDPOINT_GRADES_PROPOSITIONS = "mobile-api/Uczen.v3.Uczen/OcenyPodsumowanie";
|
||||
private static final String ENDPOINT_EVENTS = "mobile-api/Uczen.v3.Uczen/Sprawdziany";
|
||||
private static final String ENDPOINT_HOMEWORKS = "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_ATTENDANCES = "mobile-api/Uczen.v3.Uczen/Frekwencje";
|
||||
private static final String ENDPOINT_MESSAGES_RECEIVED = "mobile-api/Uczen.v3.Uczen/WiadomosciOdebrane";
|
||||
@ -259,7 +259,7 @@ public class Vulcan implements EdziennikInterface {
|
||||
targetEndpoints.add("Grades");
|
||||
targetEndpoints.add("ProposedGrades");
|
||||
targetEndpoints.add("Events");
|
||||
targetEndpoints.add("Homeworks");
|
||||
targetEndpoints.add("Homework");
|
||||
targetEndpoints.add("Notices");
|
||||
targetEndpoints.add("Attendances");
|
||||
targetEndpoints.add("MessagesInbox");
|
||||
@ -297,8 +297,8 @@ public class Vulcan implements EdziennikInterface {
|
||||
targetEndpoints.add("Grades");
|
||||
targetEndpoints.add("ProposedGrades");
|
||||
break;
|
||||
case FEATURE_HOMEWORKS:
|
||||
targetEndpoints.add("Homeworks");
|
||||
case FEATURE_HOMEWORK:
|
||||
targetEndpoints.add("Homework");
|
||||
break;
|
||||
case FEATURE_NOTICES:
|
||||
targetEndpoints.add("Notices");
|
||||
@ -380,8 +380,8 @@ public class Vulcan implements EdziennikInterface {
|
||||
case "Events":
|
||||
getEvents();
|
||||
break;
|
||||
case "Homeworks":
|
||||
getHomeworks();
|
||||
case "Homework":
|
||||
getHomework();
|
||||
break;
|
||||
case "Notices":
|
||||
getNotices();
|
||||
@ -1374,7 +1374,7 @@ public class Vulcan implements EdziennikInterface {
|
||||
});
|
||||
}
|
||||
|
||||
private void getHomeworks() {
|
||||
private void getHomework() {
|
||||
callback.onActionStarted(R.string.sync_action_syncing_homework);
|
||||
JsonObject json = new JsonObject();
|
||||
json.addProperty("DataPoczatkowa", profile.getEmpty() ? getCurrentSemesterStartDate().getStringY_m_d() : oneMonthBack.getStringY_m_d());
|
||||
@ -1382,10 +1382,10 @@ public class Vulcan implements EdziennikInterface {
|
||||
json.addProperty("IdOddzial", studentClassId);
|
||||
json.addProperty("IdUczen", studentId);
|
||||
json.addProperty("IdOkresKlasyfikacyjny", studentSemesterId);
|
||||
apiRequest(schoolSymbol+"/"+ENDPOINT_HOMEWORKS, json, result -> {
|
||||
JsonArray homeworks = result.getAsJsonArray("Data");
|
||||
apiRequest(schoolSymbol+"/"+ ENDPOINT_HOMEWORK, json, result -> {
|
||||
JsonArray homeworkList = result.getAsJsonArray("Data");
|
||||
|
||||
for (JsonElement homeworkEl: homeworks) {
|
||||
for (JsonElement homeworkEl: homeworkList) {
|
||||
JsonObject homework = homeworkEl.getAsJsonObject();
|
||||
|
||||
int id = homework.get("Id").getAsInt();
|
||||
@ -1419,7 +1419,7 @@ public class Vulcan implements EdziennikInterface {
|
||||
eventList.add(eventObject);
|
||||
metadataList.add(new Metadata(profileId, Metadata.TYPE_HOMEWORK, eventObject.id, profile.getEmpty(), profile.getEmpty(), System.currentTimeMillis()));
|
||||
}
|
||||
r("finish", "Homeworks");
|
||||
r("finish", "Homework");
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ public interface EdziennikInterface {
|
||||
int FEATURE_TIMETABLE = 1;
|
||||
int FEATURE_AGENDA = 2;
|
||||
int FEATURE_GRADES = 3;
|
||||
int FEATURE_HOMEWORKS = 4;
|
||||
int FEATURE_HOMEWORK = 4;
|
||||
int FEATURE_NOTICES = 5;
|
||||
int FEATURE_ATTENDANCES = 6;
|
||||
int FEATURE_MESSAGES_INBOX = 7;
|
||||
|
@ -4,7 +4,7 @@ const val FEATURE_ALL = 0
|
||||
const val FEATURE_TIMETABLE = 1
|
||||
const val FEATURE_AGENDA = 2
|
||||
const val FEATURE_GRADES = 3
|
||||
const val FEATURE_HOMEWORKS = 4
|
||||
const val FEATURE_HOMEWORK = 4
|
||||
const val FEATURE_NOTICES = 5
|
||||
const val FEATURE_ATTENDANCES = 6
|
||||
const val FEATURE_MESSAGES_INBOX = 7
|
||||
|
Reference in New Issue
Block a user