<?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/constr_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginStart="8dp"
        android:layout_marginEnd="8dp"
        android:layout_marginBottom="8dp"
        android:orientation="vertical"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:paddingTop="8dp"
            android:paddingBottom="8dp">

            <androidx.constraintlayout.widget.ConstraintLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent">

                <TextView
                    android:id="@+id/textView4"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="Track length"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="parent" />

                <TextView
                    android:id="@+id/trackLengthTextView"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintTop_toTopOf="parent" />
            </androidx.constraintlayout.widget.ConstraintLayout>

            <SeekBar
                android:id="@+id/trackLengthSeekBar"
                style="@android:style/Widget.Material.SeekBar"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:max="250"
                android:min="1"
                android:progress="50" />

            <androidx.constraintlayout.widget.ConstraintLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent">

                <TextView
                    android:id="@+id/textView3"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Number of vehicles"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="parent" />

                <TextView
                    android:id="@+id/noOfVehiclesTextView"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintTop_toTopOf="parent" />
            </androidx.constraintlayout.widget.ConstraintLayout>

            <SeekBar
                android:id="@+id/noOfVehiclesSeekBar"
                style="@style/Widget.AppCompat.SeekBar"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:max="250"
                android:min="1"
                android:progress="3" />

            <androidx.constraintlayout.widget.ConstraintLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent">

                <TextView
                    android:id="@+id/textView5"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="Maximum velocity"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="parent" />

                <TextView
                    android:id="@+id/maxVeloTextView"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    app:layout_constraintEnd_toEndOf="@+id/textView5"
                    app:layout_constraintTop_toTopOf="parent" />
            </androidx.constraintlayout.widget.ConstraintLayout>

            <SeekBar
                android:id="@+id/maxVelocitySeekBar"
                style="@style/Widget.AppCompat.SeekBar.Discrete"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:max="10"
                android:progress="3" />

            <androidx.constraintlayout.widget.ConstraintLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent">

                <TextView
                    android:id="@+id/brakeProbLabel"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="Brake probability"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="parent" />

                <TextView
                    android:id="@+id/brakeProbTextView"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    app:layout_constraintEnd_toEndOf="@+id/brakeProbLabel"
                    app:layout_constraintTop_toTopOf="parent" />
            </androidx.constraintlayout.widget.ConstraintLayout>

            <SeekBar
                android:id="@+id/brakeProbabilitySeekBar"
                style="@style/Widget.AppCompat.SeekBar.Discrete"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:max="20"
                android:min="0"
                android:progress="6" />

        </LinearLayout>

        <View
            android:id="@+id/divider"
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="?android:attr/listDivider" />

        <TableLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingTop="8dp"
            android:paddingBottom="8dp">

            <TableRow
                android:layout_width="match_parent"
                android:layout_height="match_parent" >

                <TextView
                    android:id="@+id/textView7"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Steps" />

                <TextView
                    android:id="@+id/textView9"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text=" " />

                <TextView
                    android:id="@+id/stepsTextView"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="0" />
            </TableRow>

            <TableRow
                android:layout_width="match_parent"
                android:layout_height="match_parent">

                <TextView
                    android:id="@+id/textView2"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="Average velocity (overall):" />

                <TextView
                    android:id="@+id/textView10"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text=" " />

                <TextView
                    android:id="@+id/avgVeloOverallView"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="0.0" />
            </TableRow>

            <TableRow
                android:layout_width="match_parent"
                android:layout_height="match_parent">

                <TextView
                    android:id="@+id/textView"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="Average velocity (last step):" />

                <TextView
                    android:id="@+id/textView11"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text=" " />

                <TextView
                    android:id="@+id/avgVeloLastView"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="0.0" />

            </TableRow>

            <TableRow
                android:layout_width="match_parent"
                android:layout_height="match_parent" >

                <TextView
                    android:id="@+id/textView14"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Delayed average velocity:" />

                <TextView
                    android:id="@+id/textView13"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text=" " />

                <TextView
                    android:id="@+id/delayedAvgTextView"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="0.0" />
            </TableRow>

        </TableLayout>

        <View
            android:id="@+id/divider2"
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="?android:attr/listDivider" />

        <androidx.constraintlayout.widget.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:paddingTop="8dp"
            android:paddingBottom="8dp">

            <LinearLayout
                android:id="@+id/trackViewStack"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:orientation="vertical"
                app:layout_constraintBottom_toTopOf="@+id/constraintLayout2"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent">

            </LinearLayout>

            <androidx.constraintlayout.widget.ConstraintLayout
                android:id="@+id/constraintLayout2"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                app:layout_constraintBottom_toTopOf="@+id/constraintLayout"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent">

                <TextView
                    android:id="@+id/textView8"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Frameskip"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="parent" />

                <SeekBar
                    android:id="@+id/frameskipSeekBar"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:max="1000"
                    app:layout_constraintEnd_toStartOf="@id/frameSkipTextView"
                    app:layout_constraintStart_toEndOf="@id/textView8"
                    app:layout_constraintTop_toTopOf="parent" />

                <TextView
                    android:id="@+id/frameSkipTextView"
                    android:layout_width="50dp"
                    android:layout_height="wrap_content"
                    android:gravity="right"
                    android:text="0"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintTop_toTopOf="parent" />
            </androidx.constraintlayout.widget.ConstraintLayout>

            <androidx.constraintlayout.widget.ConstraintLayout
                android:id="@+id/constraintLayout"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                app:layout_constraintBottom_toTopOf="@+id/linearLayout"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent">

                <TextView
                    android:id="@+id/textView6"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Delay:        "
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="parent" />

                <SeekBar
                    android:id="@+id/simDelaySeekBar"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:max="500"
                    android:min="0"
                    app:layout_constraintEnd_toStartOf="@+id/simDelayTextView"
                    app:layout_constraintStart_toEndOf="@+id/textView6"
                    app:layout_constraintTop_toTopOf="parent" />

                <TextView
                    android:id="@+id/simDelayTextView"
                    android:layout_width="50dp"
                    android:layout_height="wrap_content"
                    android:gravity="right"
                    android:text="0"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintTop_toTopOf="parent" />
            </androidx.constraintlayout.widget.ConstraintLayout>

            <LinearLayout
                android:id="@+id/linearLayout"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:paddingTop="8dp"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="parent">

                <Button
                    android:id="@+id/playButton"
                    style="@style/Widget.AppCompat.Button.Borderless"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:onClick="onPlayButtonClick"
                    android:text="Play" />

                <Button
                    android:id="@+id/stepButton"
                    style="@style/Widget.AppCompat.Button.Borderless"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:onClick="onStepButtonClick"
                    android:text="Step" />

                <Button
                    android:id="@+id/stopButton"
                    style="@style/Widget.AppCompat.Button.Borderless"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:enabled="false"
                    android:onClick="onStopButtonClick"
                    android:text="Stop" />

                <Button
                    android:id="@+id/clearButton"
                    style="@style/Widget.AppCompat.Button.Borderless"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:onClick="onClearButtonClick"
                    android:text="clear" />

            </LinearLayout>

        </androidx.constraintlayout.widget.ConstraintLayout>

    </LinearLayout>

</androidx.constraintlayout.widget.ConstraintLayout>