diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/MainActivity.kt b/app/src/main/java/pl/szczodrzynski/edziennik/MainActivity.kt index 3d931e25..e2835336 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/MainActivity.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/MainActivity.kt @@ -755,7 +755,7 @@ class MainActivity : AppCompatActivity() { drawer.setSelection(target.id, fireOnClick = false) navView.toolbar.setTitle(target.title ?: target.name) navView.bottomBar.fabEnable = false - navView.bottomBar.fabExtended = true + navView.bottomBar.fabExtended = false navView.bottomBar.setFabOnClickListener(null) Log.d("NavDebug", "Navigating from ${navTarget.fragmentClass?.java?.simpleName} to ${target.fragmentClass?.java?.simpleName}") @@ -868,10 +868,16 @@ class MainActivity : AppCompatActivity() { }, 2000) } - fun collapseFab() { + fun gainAttentionFAB() { + navView.bottomBar.fabExtended = false + + b.navView.postDelayed({ + navView.bottomBar.fabExtended = true + }, 1000) + b.navView.postDelayed({ navView.bottomBar.fabExtended = false - }, 2000) + }, 3000) } /* _____ _ _ diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Librus.java b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Librus.java index 0887267f..f79f21d5 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Librus.java +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Librus.java @@ -294,6 +294,7 @@ public class Librus implements EdziennikInterface { targetEndpoints.add("DescriptiveGrades"); targetEndpoints.add("TextGrades"); targetEndpoints.add("BehaviourGrades"); + targetEndpoints.add("GradesComments"); targetEndpoints.add("Events"); targetEndpoints.add("TeacherFreeDays"); @@ -369,6 +370,8 @@ public class Librus implements EdziennikInterface { targetEndpoints.add("DescriptiveGrades"); targetEndpoints.add("TextGrades"); targetEndpoints.add("BehaviourGrades"); + + targetEndpoints.add("GradesComments"); break; case FEATURE_HOMEWORK: targetEndpoints.add("Homework"); @@ -514,6 +517,9 @@ public class Librus implements EdziennikInterface { case "TextGrades": getTextGrades(); break; + case "GradesComments": + getGradesComments(); + break; case "BehaviourGrades": getBehaviourGrades(); break; @@ -1977,6 +1983,32 @@ public class Librus implements EdziennikInterface { }); } + private void getGradesComments() { + callback.onActionStarted(R.string.sync_action_syncing_grade_comments); + apiRequest("Grades/Comments", data -> { + if (data == null) { + r("finish", "GradesComments"); + return; + } + + JsonArray comments = data.get("Comments").getAsJsonArray(); + for (JsonElement commentEl : comments) { + JsonObject comment = commentEl.getAsJsonObject(); + long gradeId = comment.get("Grade").getAsJsonObject().get("Id").getAsLong(); + String text = comment.get("Text").getAsString(); + + for (Grade grade : gradeList) { + if (grade.id == gradeId) { + grade.description = text; + break; + } + } + } + + r("finish", "GradesComments"); + }); + } + private void getPointGradesCategories() { if (!fullSync || !enablePointGrades) { // cancel every not-full sync; no need to download categories again diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/homework/HomeworkFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/homework/HomeworkFragment.kt index 9ccd97ce..5afdd9a6 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/homework/HomeworkFragment.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/homework/HomeworkFragment.kt @@ -101,6 +101,6 @@ class HomeworkFragment : Fragment() { }) activity.gainAttention() - activity.collapseFab() + activity.gainAttentionFAB() } } diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/homework/HomeworkListFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/homework/HomeworkListFragment.kt index 22da31a5..e0f2daba 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/homework/HomeworkListFragment.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/homework/HomeworkListFragment.kt @@ -47,8 +47,8 @@ class HomeworkListFragment : Fragment() { } val layoutManager = LinearLayoutManager(context) - layoutManager.reverseLayout = false - layoutManager.stackFromEnd = false + layoutManager.reverseLayout = true + layoutManager.stackFromEnd = true b.homeworkView.setHasFixedSize(true) b.homeworkView.layoutManager = layoutManager diff --git a/app/src/main/res/values-en/strings.xml b/app/src/main/res/values-en/strings.xml index 068666e5..87ad1860 100644 --- a/app/src/main/res/values-en/strings.xml +++ b/app/src/main/res/values-en/strings.xml @@ -852,4 +852,6 @@ Save draft Send Teachers absence + Getting grade comments + Getting school free days diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index dc7a4fb9..e617bdd3 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -909,4 +909,5 @@ Minione Brak zadań domowych. Nieobecność nauczycieli + Pobieranie komentarzy ocen