Merge branch 'develop' into feature/teacher-absence

This commit is contained in:
Kacper Ziubryniewicz 2019-09-29 16:09:38 +02:00
commit b17675ec0c
6 changed files with 47 additions and 6 deletions

View File

@ -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)
}
/* _____ _ _

View File

@ -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

View File

@ -101,6 +101,6 @@ class HomeworkFragment : Fragment() {
})
activity.gainAttention()
activity.collapseFab()
activity.gainAttentionFAB()
}
}

View File

@ -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

View File

@ -852,4 +852,6 @@
<string name="messages_compose_menu_save_draft">Save draft</string>
<string name="messages_compose_menu_send">Send</string>
<string name="agenda_teacher_absence">Teachers absence</string>
<string name="sync_action_syncing_grade_comments">Getting grade comments</string>
<string name="sync_action_syncing_school_free_days">Getting school free days</string>
</resources>

View File

@ -909,4 +909,5 @@
<string name="homework_tab_past">Minione</string>
<string name="homework_no_data">Brak zadań domowych.</string>
<string name="agenda_teacher_absence">Nieobecność nauczycieli</string>
<string name="sync_action_syncing_grade_comments">Pobieranie komentarzy ocen</string>
</resources>