Aktuelle Prozentzahl in der Notenübersich hinzugefügt (Ohne Beschreibungstext)

This commit is contained in:
Joshua
2018-07-14 23:28:38 +02:00
parent f052e18d63
commit eb72dcf8c1
4 changed files with 15 additions and 2 deletions

View File

@@ -84,8 +84,9 @@ public class ModDetailGradebookAdapter extends RecyclerView.Adapter<RecyclerView
switch (data.first) { switch (data.first) {
case TYPE_TOTAL: case TYPE_TOTAL:
HeaderViewHolder h = (HeaderViewHolder) holder; HeaderViewHolder h = (HeaderViewHolder) holder;
h.mCaption.setText(R.string.hello_blank_fragment); //String s = R.string.Current_percentage; +": "+String.format("%.2f", mValue.getGradebookPercent()*100) +" %";
break; h.mCaption.setText(String.format("%.2f", mValue.getGradebookPercent()*100) +" %");//R.string.gradebook +": "+String.format("%.2f", mValue.getGradebookPercent()*100) +" %"
break;
case TYPE_GRADE: case TYPE_GRADE:
int index = data.second / 1024; int index = data.second / 1024;
GradebookViewHolder i = (GradebookViewHolder) holder; GradebookViewHolder i = (GradebookViewHolder) holder;

View File

@@ -199,6 +199,16 @@ public class Modules implements Iterable<Modules.Module>, Serializable {
throw new AssertionError("Do not use this constructor!"); throw new AssertionError("Do not use this constructor!");
}*/ }*/
public float getGradebookPercent(){
float maxPoint = 0;
float userPoint = 0;
for (Gradebook g : gradebook){
maxPoint += g.getMaxPoints();
userPoint += g.getPoints();
}
return userPoint/maxPoint;
}
private Module(String semester, HashSet<String> lvNumber, String title, HashSet<Lecturer> lecturer, String type, String description, String ID) { private Module(String semester, HashSet<String> lvNumber, String title, HashSet<Lecturer> lecturer, String type, String description, String ID) {
semester = semester.replace("SS", "S"); semester = semester.replace("SS", "S");
semester = semester.replaceAll("[0-9]{2}([0-9]{2})", "$1"); semester = semester.replaceAll("[0-9]{2}([0-9]{2})", "$1");

View File

@@ -31,4 +31,5 @@
<string name="past_events">Vergangene Veranstaltungen</string> <string name="past_events">Vergangene Veranstaltungen</string>
<string name="events">Veranstaltungen</string> <string name="events">Veranstaltungen</string>
<string name="gradebook">Noten</string> <string name="gradebook">Noten</string>
<string name="Current_percentage">Aktuelle Prozentzahl</string>
</resources> </resources>

View File

@@ -37,4 +37,5 @@
<string name="past_events">Past Events</string> <string name="past_events">Past Events</string>
<string name="events">Events</string> <string name="events">Events</string>
<string name="gradebook">Gradebook</string> <string name="gradebook">Gradebook</string>
<string name="Current_percentage">Current Percentage</string>
</resources> </resources>