<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/mainStreamLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".stream.StreamActivity"
    android:keepScreenOn="true">

    <com.metallic.chiaki.stream.AspectRatioFrameLayout
        android:id="@+id/aspectRatioLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="center">
        <SurfaceView
            android:id="@+id/surfaceView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"/>
    </com.metallic.chiaki.stream.AspectRatioFrameLayout>

    <ProgressBar
        android:id="@+id/progressBar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"/>

    <fragment
        android:id="@+id/controlsFragment"
        android:name="com.metallic.chiaki.touchcontrols.DefaultTouchControlsFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

    <fragment
        android:id="@+id/touchpadOnlyFragment"
        android:name="com.metallic.chiaki.touchcontrols.TouchpadOnlyFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/overlay"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true">

        <androidx.constraintlayout.widget.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:layout_constraintBottom_toBottomOf="parent"
            android:background="@color/stream_overlay_background"
            android:padding="8dp"
            android:clickable="true"
            android:focusable="false">

            <com.google.android.material.switchmaterial.SwitchMaterial
                android:id="@+id/onScreenControlsSwitch"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintBottom_toBottomOf="parent"
                android:text="On-Screen Controls"
                app:switchPadding="8dp"
                android:layout_marginLeft="8dp"
                android:textColor="@color/stream_text"/>

            <com.google.android.material.switchmaterial.SwitchMaterial
                android:id="@+id/touchpadOnlySwitch"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginStart="200dp"
                android:text="Touchpad only"
                android:textColor="@color/stream_text"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:switchPadding="8dp" />

            <com.google.android.material.button.MaterialButtonToggleGroup
                android:id="@+id/displayModeToggle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginEnd="8dp"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:singleSelection="true"
                app:selectionRequired="true"
                app:checkedButton="@id/display_mode_normal_button">

                <com.google.android.material.button.MaterialButton
                    style="@style/Widget.MaterialComponents.Button.OutlinedButton"
                    android:id="@+id/display_mode_normal_button"
                    android:layout_width="60dp"
                    android:layout_height="wrap_content"
                    app:icon="@drawable/ic_display_normal"
                    app:iconTint="@color/stream_material_button_icon_tint"
                    app:strokeColor="@color/stream_text"/>
                <com.google.android.material.button.MaterialButton
                    style="@style/Widget.MaterialComponents.Button.OutlinedButton"
                    android:id="@+id/display_mode_zoom_button"
                    android:layout_width="60dp"
                    android:layout_height="wrap_content"
                    app:icon="@drawable/ic_display_zoom"
                    app:iconTint="@color/stream_material_button_icon_tint"
                    app:strokeColor="@color/stream_text"/>
                <com.google.android.material.button.MaterialButton
                    style="@style/Widget.MaterialComponents.Button.OutlinedButton"
                    android:id="@+id/display_mode_stretch_button"
                    android:layout_width="60dp"
                    android:layout_height="wrap_content"
                    app:icon="@drawable/ic_display_stretch"
                    app:iconTint="@color/stream_material_button_icon_tint"
                    app:strokeColor="@color/stream_text"/>

        </com.google.android.material.button.MaterialButtonToggleGroup>

    </androidx.constraintlayout.widget.ConstraintLayout>

</androidx.constraintlayout.widget.ConstraintLayout>

</FrameLayout>