Better gradebook item visualization
This commit is contained in:
@@ -14,7 +14,6 @@ import de.sebse.fuplanner.R;
|
||||
import de.sebse.fuplanner.services.KVV.types.Gradebook;
|
||||
import de.sebse.fuplanner.services.KVV.types.Modules;
|
||||
import de.sebse.fuplanner.tools.ui.CustomViewHolder;
|
||||
import de.sebse.fuplanner.tools.ui.ItemViewHolder;
|
||||
|
||||
public class ModDetailGradebookAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
private static final int TYPE_TOTAL = 0;
|
||||
@@ -61,8 +60,8 @@ public class ModDetailGradebookAdapter extends RecyclerView.Adapter<RecyclerView
|
||||
return new HeaderViewHolder(view);
|
||||
case TYPE_GRADE:
|
||||
view = LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.list_all_items, parent, false);
|
||||
return new ItemViewHolder(view);
|
||||
.inflate(R.layout.list_modetails_gradebook, parent, false);
|
||||
return new GradebookViewHolder(view);
|
||||
default:
|
||||
//noinspection ConstantConditions
|
||||
return null;
|
||||
@@ -89,12 +88,12 @@ public class ModDetailGradebookAdapter extends RecyclerView.Adapter<RecyclerView
|
||||
break;
|
||||
case TYPE_GRADE:
|
||||
int index = data.second / 1024;
|
||||
ItemViewHolder i = (ItemViewHolder) holder;
|
||||
GradebookViewHolder i = (GradebookViewHolder) holder;
|
||||
Gradebook gradebook = mValue.gradebook.get(index);
|
||||
|
||||
i.mTitle.setText(gradebook.getItemName());
|
||||
i.mSubLeft.setText(String.valueOf(gradebook.getPoints()));
|
||||
i.mSubRight.setText(String.valueOf(gradebook.getMaxPoints()));
|
||||
i.mGrade.setText(String.valueOf(gradebook.getPoints()));
|
||||
i.mGradeMax.setText(String.valueOf(gradebook.getMaxPoints()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -132,4 +131,21 @@ public class ModDetailGradebookAdapter extends RecyclerView.Adapter<RecyclerView
|
||||
}
|
||||
|
||||
|
||||
private class GradebookViewHolder extends RecyclerView.ViewHolder {
|
||||
private final TextView mGrade;
|
||||
private final TextView mGradeMax;
|
||||
private final TextView mTitle;
|
||||
|
||||
GradebookViewHolder(View view) {
|
||||
super(view);
|
||||
mTitle = view.findViewById(R.id.title);
|
||||
mGrade = view.findViewById(R.id.grade);
|
||||
mGradeMax = view.findViewById(R.id.grade_max);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + " '" + mTitle.getText() + " '" + mGrade.getText() + " '" + mGradeMax.getText() + "'";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
53
app/src/main/res/layout/list_modetails_gradebook.xml
Normal file
53
app/src/main/res/layout/list_modetails_gradebook.xml
Normal file
@@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:padding="5dip" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textStyle="bold"
|
||||
android:typeface="sans"
|
||||
tools:text="Test this new stuff!" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/grade"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/title"
|
||||
android:layout_marginTop="5dip"
|
||||
android:textColor="#343434"
|
||||
android:textSize="12sp"
|
||||
tools:text="8"
|
||||
android:layout_toLeftOf="@id/slash"
|
||||
android:layout_toStartOf="@id/slash"
|
||||
android:layout_alignTop="@id/title" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/slash"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/title"
|
||||
android:textColor="#343434"
|
||||
android:textSize="30sp"
|
||||
android:text="/"
|
||||
android:layout_toLeftOf="@id/grade_max"
|
||||
android:layout_toStartOf="@id/grade_max"
|
||||
android:layout_alignTop="@id/title" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/grade_max"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBaseline="@id/slash"
|
||||
android:layout_alignBottom="@id/slash"
|
||||
android:textColor="#343434"
|
||||
android:textSize="12sp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
tools:text="10" />
|
||||
</RelativeLayout>
|
||||
Reference in New Issue
Block a user