<?xml version="1.0" encoding="utf-8"?>

<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/gradesSubjectRoot"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="?android:attr/selectableItemBackground"
    android:clickable="true"
    android:focusable="true"
    android:paddingTop="8dp"
    android:paddingBottom="8dp">

    <TextView
        android:id="@+id/gradesSubjectTitle"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="8dp"
        android:layout_marginLeft="8dp"
        android:layout_marginEnd="8dp"
        android:layout_marginRight="8dp"
        android:text="@string/loading"
        android:textAppearance="@style/NavView.TextView.Title"
        app:layout_constraintEnd_toStartOf="@+id/gradesSubjectExpandIndicator"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        tools:text="{SUBJECT_NAME}" />

    <LinearLayout
        android:id="@+id/gradesSubjectPreviewContainer"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="8dp"
        android:layout_marginLeft="8dp"
        android:layout_marginTop="8dp"
        android:layout_marginEnd="8dp"
        android:layout_marginRight="8dp"
        android:orientation="horizontal"
        tools:visibility="gone"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/gradesSubjectTitle">

        <TextView
            android:id="@+id/gradesSubjectPreviewSemester"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginEnd="5dp"
            android:layout_marginRight="5dp"
            android:textStyle="italic"
            android:visibility="gone"
            tools:text="Semestr 1"
            tools:visibility="visible" />

        <LinearLayout
            android:id="@+id/gradesSubjectPreviewContent"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:orientation="horizontal">

        </LinearLayout>

        <TextView
            android:id="@+id/gradesSubjectPreviewAverage"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="5dp"
            android:layout_marginRight="5dp"
            tools:text="4.70" />

        <TextView
            android:id="@+id/gradesSubjectPreviewProposed"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginEnd="5dp"
            android:layout_marginRight="5dp"
            android:background="@drawable/bg_rounded_4dp_outline"
            android:paddingLeft="5dp"
            android:paddingRight="5dp"
            android:textColor="@android:color/white"
            android:textStyle="bold"
            android:visibility="gone"
            tools:text="4"
            tools:visibility="visible" />

        <TextView
            android:id="@+id/gradesSubjectPreviewFinal"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginEnd="5dp"
            android:layout_marginRight="5dp"
            android:background="@drawable/bg_rounded_4dp"
            android:paddingLeft="5dp"
            android:paddingRight="5dp"
            android:textColor="@color/black"
            android:textStyle="bold"
            android:visibility="gone"
            tools:text="5"
            tools:visibility="visible" />

        <TextView
            android:id="@+id/gradesSubjectPreviewYearAverage"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="5dp"
            android:visibility="gone"
            tools:visibility="visible"
            tools:text="4.70"
            android:layout_marginEnd="5dp" />

        <TextView
            android:id="@+id/gradesSubjectPreviewYearProposed"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginEnd="5dp"
            android:layout_marginRight="5dp"
            android:background="@drawable/bg_rounded_4dp_outline"
            android:paddingLeft="5dp"
            android:paddingRight="5dp"
            android:textColor="@android:color/white"
            android:textStyle="bold"
            android:visibility="gone"
            tools:text="4"
            tools:visibility="visible" />

        <TextView
            android:id="@+id/gradesSubjectPreviewYearFinal"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginEnd="5dp"
            android:layout_marginRight="5dp"
            android:background="@drawable/bg_rounded_4dp"
            android:paddingLeft="5dp"
            android:paddingRight="5dp"
            android:textColor="@color/black"
            android:textStyle="bold"
            android:visibility="gone"
            tools:text="5"
            tools:visibility="visible" />

    </LinearLayout>

    <LinearLayout
        android:id="@+id/gradesSubjectContent"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginTop="8dp"
        android:orientation="vertical"
        android:visibility="gone"
        tools:visibility="visible"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="1.0"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/gradesSubjectTitle">


        <LinearLayout
            android:id="@+id/gradesSubjectSemester2Header"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="?android:attr/selectableItemBackground"
            android:clickable="true"
            android:focusable="true"
            android:orientation="horizontal">

            <com.mikepenz.iconics.view.IconicsImageView
                android:id="@+id/gradesSubjectSemester2ExpandIndicator"
                android:layout_width="36dp"
                android:layout_height="36dp"
                android:layout_gravity="center_vertical"
                android:layout_marginStart="8dp"
                android:layout_marginLeft="8dp"
                android:padding="8dp"
                app:iiv_color="?android:textColorSecondary"
                app:iiv_icon="cmd-menu-down"
                tools:srcCompat="@tools:sample/avatars" />

            <TextView
                android:id="@+id/gradesSubjectSemester2Title"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical"
                android:layout_marginStart="8dp"
                android:layout_marginLeft="8dp"
                android:layout_weight="1"
                android:ellipsize="start"
                android:singleLine="true"
                android:textAppearance="@style/NavView.TextView.Medium"
                android:text="@string/grades_semester2_header" />

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical"
                android:gravity="end"
                android:orientation="vertical">

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal">

                    <TextView
                        android:id="@+id/gradesSubjectYearAverage"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_marginEnd="5dp"
                        android:layout_marginRight="5dp"
                        android:layout_weight="1"
                        tools:text="koniec roku: 4.70" />

                    <TextView
                        android:id="@+id/gradesSubjectYearProposed"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginEnd="5dp"
                        android:layout_marginRight="5dp"
                        android:background="@drawable/bg_rounded_4dp_outline"
                        android:paddingLeft="5dp"
                        android:paddingRight="5dp"
                        android:textColor="@android:color/white"
                        android:textStyle="bold"
                        tools:text="4" />

                    <TextView
                        android:id="@+id/gradesSubjectYearFinal"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginEnd="5dp"
                        android:layout_marginRight="5dp"
                        android:background="@drawable/bg_rounded_4dp"
                        android:paddingLeft="5dp"
                        android:paddingRight="5dp"
                        android:textColor="@color/black"
                        android:textStyle="bold"
                        tools:text="5" />
                </LinearLayout>

                <Space
                    android:layout_width="match_parent"
                    android:layout_height="5dp" />

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal">

                    <TextView
                        android:id="@+id/gradesSubjectSemester2Average"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_marginEnd="5dp"
                        android:layout_marginRight="5dp"
                        android:layout_weight="1"
                        tools:text="semestr 2: 5.00" />

                    <TextView
                        android:id="@+id/gradesSubjectSemester2Proposed"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginEnd="5dp"
                        android:layout_marginRight="5dp"
                        android:background="@drawable/bg_rounded_4dp_outline"
                        android:paddingLeft="5dp"
                        android:paddingRight="5dp"
                        android:textColor="@android:color/white"
                        android:textStyle="bold"
                        tools:text="5" />

                    <TextView
                        android:id="@+id/gradesSubjectSemester2Final"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginEnd="5dp"
                        android:layout_marginRight="5dp"
                        android:background="@drawable/bg_rounded_4dp"
                        android:paddingLeft="5dp"
                        android:paddingRight="5dp"
                        android:textColor="@color/black"
                        android:textStyle="bold"
                        tools:text="5" />
                </LinearLayout>

            </LinearLayout>

            <com.mikepenz.iconics.view.IconicsImageView
                android:id="@+id/gradesSubjectSemester2EditButton"
                android:layout_width="36dp"
                android:layout_height="36dp"
                android:layout_gravity="center_vertical"
                android:background="?selectableItemBackground"
                android:padding="8dp"
                app:iiv_color="?android:textColorSecondary"
                app:iiv_icon="cmd-pencil"
                tools:srcCompat="@tools:sample/avatars" />

        </LinearLayout>

        <LinearLayout
            android:id="@+id/gradesSubjectSemester2Container"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:visibility="visible">

            <androidx.core.widget.NestedScrollView
                android:id="@+id/gradesSubjectSemester2Nest"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/gradesSubjectSemester2Content"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    tools:itemCount="3"
                    tools:listitem="@layout/row_grades_list_item" />

            </androidx.core.widget.NestedScrollView>
        </LinearLayout>

        <LinearLayout
            android:id="@+id/gradesSubjectSemester1Header"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="?android:attr/selectableItemBackground"
            android:clickable="true"
            android:focusable="true"
            android:orientation="horizontal">

            <com.mikepenz.iconics.view.IconicsImageView
                android:id="@+id/gradesSubjectSemester1ExpandIndicator"
                android:layout_width="36dp"
                android:layout_height="36dp"
                android:layout_gravity="center_vertical"
                android:layout_marginStart="8dp"
                android:layout_marginLeft="8dp"
                android:padding="8dp"
                app:iiv_color="?android:textColorSecondary"
                app:iiv_icon="cmd-menu-down"
                tools:srcCompat="@tools:sample/avatars" />

            <TextView
                android:id="@+id/gradesSubjectSemester1Title"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical"
                android:layout_marginStart="8dp"
                android:layout_marginLeft="8dp"
                android:layout_weight="1"
                android:ellipsize="start"
                android:singleLine="true"
                android:textAppearance="@style/NavView.TextView.Medium"
                android:text="@string/grades_semester1_header"/>

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical"
                android:gravity="end"
                android:orientation="vertical">

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal">

                    <TextView
                        android:id="@+id/gradesSubjectSemester1Average"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_marginEnd="5dp"
                        android:layout_marginRight="5dp"
                        android:layout_weight="1"
                        tools:text="semestr 1: 0.63" />

                    <TextView
                        android:id="@+id/gradesSubjectSemester1Proposed"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginEnd="5dp"
                        android:layout_marginRight="5dp"
                        android:background="@drawable/bg_rounded_4dp_outline"
                        android:paddingLeft="5dp"
                        android:paddingRight="5dp"
                        android:textColor="@android:color/white"
                        android:textStyle="bold"
                        tools:text="1" />

                    <TextView
                        android:id="@+id/gradesSubjectSemester1Final"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginEnd="5dp"
                        android:layout_marginRight="5dp"
                        android:background="@drawable/bg_rounded_4dp"
                        android:paddingLeft="5dp"
                        android:paddingRight="5dp"
                        android:textColor="@color/black"
                        android:textStyle="bold"
                        tools:text="2" />
                </LinearLayout>

            </LinearLayout>

            <com.mikepenz.iconics.view.IconicsImageView
                android:id="@+id/gradesSubjectSemester1EditButton"
                android:layout_width="36dp"
                android:layout_height="36dp"
                android:layout_gravity="center_vertical"
                android:background="?selectableItemBackground"
                android:padding="8dp"
                app:iiv_color="?android:textColorSecondary"
                app:iiv_icon="cmd-pencil"
                tools:srcCompat="@tools:sample/avatars" />

        </LinearLayout>

        <LinearLayout
            android:id="@+id/gradesSubjectSemester1Container"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:visibility="gone"
            tools:visibility="visible">

            <androidx.core.widget.NestedScrollView
                android:id="@+id/gradesSubjectSemester1Nest"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/gradesSubjectSemester1Content"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    tools:itemCount="5"
                    tools:listitem="@layout/row_grades_list_item" />

            </androidx.core.widget.NestedScrollView>

        </LinearLayout>

    </LinearLayout>

    <com.mikepenz.iconics.view.IconicsImageView
        android:id="@+id/gradesSubjectExpandIndicator"
        android:layout_width="36dp"
        android:layout_height="36dp"
        android:layout_marginEnd="8dp"
        android:layout_marginRight="8dp"
        android:padding="8dp"
        app:iiv_color="?android:textColorSecondary"
        app:iiv_icon="cmd-menu-down"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        tools:srcCompat="@tools:sample/avatars[0]" />

</androidx.constraintlayout.widget.ConstraintLayout>