<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout 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/coordinatorLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/roomList"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="?android:colorBackground"
        android:overScrollMode="always"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"
        tools:listitem="@layout/item_room_to_add_in_space" />

    <com.google.android.material.appbar.AppBarLayout
        android:id="@+id/appBarLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_behavior="im.vector.app.core.utils.ToggleableAppBarLayoutBehavior">

        <com.google.android.material.appbar.CollapsingToolbarLayout
            android:id="@+id/spaceExploreCollapsingToolbarLayout"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:contentScrim="?android:colorBackground"
            app:layout_scrollFlags="scroll|exitUntilCollapsed|enterAlways|snap"
            app:scrimAnimationDuration="250"
            app:scrimVisibleHeightTrigger="120dp"
            app:titleEnabled="false"
            app:toolbarId="@id/toolbar">

            <androidx.appcompat.widget.LinearLayoutCompat
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="?attr/actionBarSize"
                android:minHeight="0dp"
                android:orientation="vertical"
                android:paddingHorizontal="16dp">

                <TextView
                    android:id="@+id/spaceLeavePromptTitle"
                    style="@style/TextAppearance.Vector.Body.Medium"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="24dp"
                    android:text="@string/space_leave_prompt_msg_with_name" />

                <TextView
                    android:id="@+id/spaceLeavePromptDescription"
                    style="@style/TextAppearance.Vector.Body"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/space_leave_prompt_msg_only_you"
                    android:textColor="?vctr_content_secondary" />

                <TextView
                    android:id="@+id/spaceLeaveRadioButtonsTitle"
                    style="@style/TextAppearance.Vector.Subtitle.Medium"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="16dp"
                    android:text="@string/space_leave_radio_buttons_title"
                    android:textAllCaps="true"
                    android:textColor="?vctr_content_primary" />

                <RadioGroup
                    android:id="@+id/spaceLeaveSelectGroup"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal"
                    android:weightSum="2">

                    <androidx.appcompat.widget.AppCompatRadioButton
                        android:id="@+id/spaceLeaveSelectAll"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:text="@string/space_leave_radio_button_all" />

                    <androidx.appcompat.widget.AppCompatRadioButton
                        android:id="@+id/spaceLeaveSelectNone"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:text="@string/space_leave_radio_button_none" />

                    <!--                    This view should never be visible! There are three possible states but only two buttons by design.-->
                    <!--                    Third button is needed to make radiogroup work as expected, it's selected, but never shown-->
                    <androidx.appcompat.widget.AppCompatRadioButton
                        android:id="@+id/spaceLeaveSelectSemi"
                        android:layout_width="0dp"
                        android:layout_height="0dp"
                        android:visibility="gone" />
                </RadioGroup>

            </androidx.appcompat.widget.LinearLayoutCompat>

            <com.google.android.material.appbar.MaterialToolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                app:layout_collapseMode="pin"
                app:title="Leave space" />
        </com.google.android.material.appbar.CollapsingToolbarLayout>

    </com.google.android.material.appbar.AppBarLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:background="@color/palette_white"
        android:elevation="2dp"
        android:orientation="horizontal"
        android:padding="8dp"
        app:layout_behavior="com.google.android.material.behavior.HideBottomViewOnScrollBehavior">

        <Button
            android:id="@+id/spaceLeaveCancel"
            style="@style/Widget.Vector.Button.Text"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginEnd="16dp"
            android:layout_weight="1"
            android:text="@string/action_cancel" />

        <Button
            android:id="@+id/spaceLeaveButton"
            style="@style/Widget.Vector.Button.Destructive"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="@string/leave_space" />
    </LinearLayout>

</androidx.coordinatorlayout.widget.CoordinatorLayout>
