<?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:layout_width="match_parent"
    android:layout_height="match_parent"
    android:focusableInTouchMode="true">

    <com.google.android.material.appbar.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@null"
        android:elevation="0dp"
        app:elevation="0dp">

        <com.google.android.material.appbar.CollapsingToolbarLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:layout_scrollFlags="scroll">

            <androidx.constraintlayout.widget.ConstraintLayout
                android:id="@+id/settings_parent"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <com.google.android.material.textfield.TextInputLayout
                    android:id="@+id/title_edit_input_layout"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:animateLayoutChanges="true"
                    android:hint="@string/title"
                    android:visibility="gone"
                    app:boxBackgroundColor="@android:color/transparent"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="parent"
                    app:suffixText="@string/save"
                    app:suffixTextColor="@color/blue_600"
                    tools:visibility="visible">

                    <com.google.android.material.textfield.TextInputEditText
                        android:id="@+id/title_edit"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:autofillHints="no"
                        android:inputType="text"
                        android:maxLength="2200"
                        android:scrollHorizontally="false"
                        tools:text="test" />

                </com.google.android.material.textfield.TextInputLayout>

                <androidx.appcompat.widget.AppCompatTextView
                    android:id="@+id/mute_messages_label"
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    android:background="?selectableItemBackground"
                    android:gravity="center_vertical"
                    android:paddingStart="16dp"
                    android:paddingEnd="16dp"
                    android:text="@string/mute_messages"
                    android:textAppearance="@style/TextAppearance.MaterialComponents.Body1"
                    android:textColor="?android:textColorPrimary"
                    app:layout_constraintBottom_toBottomOf="@id/mute_messages"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="@id/mute_messages" />

                <com.google.android.material.switchmaterial.SwitchMaterial
                    android:id="@+id/mute_messages"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="4dp"
                    android:layout_marginEnd="8dp"
                    android:paddingStart="0dp"
                    android:paddingEnd="8dp"
                    app:layout_constraintBottom_toTopOf="@id/mute_mentions"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintTop_toBottomOf="@id/title_edit_input_layout" />

                <androidx.appcompat.widget.AppCompatTextView
                    android:id="@+id/mute_mentions_label"
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    android:gravity="center_vertical"
                    android:paddingStart="16dp"
                    android:paddingEnd="16dp"
                    android:text="@string/mute_mentions"
                    android:textAppearance="@style/TextAppearance.MaterialComponents.Body1"
                    android:textColor="?android:textColorPrimary"
                    app:layout_constraintBottom_toBottomOf="@id/mute_mentions"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="@id/mute_mentions" />

                <com.google.android.material.switchmaterial.SwitchMaterial
                    android:id="@+id/mute_mentions"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="4dp"
                    android:layout_marginEnd="8dp"
                    android:paddingStart="0dp"
                    android:paddingEnd="8dp"
                    app:layout_constraintBottom_toTopOf="@id/approval_required"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintTop_toBottomOf="@id/mute_messages" />

                <androidx.appcompat.widget.AppCompatTextView
                    android:id="@+id/approval_required_label"
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    android:gravity="center_vertical"
                    android:paddingStart="16dp"
                    android:paddingEnd="16dp"
                    android:text="@string/approval_required_for_new_members"
                    android:textAppearance="@style/TextAppearance.MaterialComponents.Body1"
                    android:textColor="?android:textColorPrimary"
                    app:layout_constraintBottom_toBottomOf="@id/approval_required"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="@id/approval_required" />

                <com.google.android.material.switchmaterial.SwitchMaterial
                    android:id="@+id/approval_required"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="4dp"
                    android:layout_marginEnd="8dp"
                    android:paddingStart="0dp"
                    android:paddingEnd="8dp"
                    app:layout_constraintBottom_toTopOf="@id/leave"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintTop_toBottomOf="@id/mute_mentions" />

                <androidx.appcompat.widget.AppCompatTextView
                    android:id="@+id/leave"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="4dp"
                    android:background="?selectableItemBackground"
                    android:gravity="center_vertical"
                    android:paddingStart="16dp"
                    android:paddingTop="12dp"
                    android:paddingEnd="16dp"
                    android:paddingBottom="12dp"
                    android:text="@string/dms_action_leave"
                    android:textAppearance="@style/TextAppearance.MaterialComponents.Body1"
                    android:textColor="@color/red_600"
                    app:layout_constraintBottom_toTopOf="@id/end"
                    app:layout_constraintTop_toBottomOf="@id/approval_required" />

                <androidx.appcompat.widget.AppCompatTextView
                    android:id="@+id/end"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="4dp"
                    android:background="?selectableItemBackground"
                    android:gravity="center_vertical"
                    android:paddingStart="16dp"
                    android:paddingTop="12dp"
                    android:paddingEnd="16dp"
                    android:paddingBottom="12dp"
                    android:text="@string/dms_action_end"
                    android:textAppearance="@style/TextAppearance.MaterialComponents.Body1"
                    android:textColor="@color/red_600"
                    app:layout_constraintBottom_toTopOf="@id/pending_members_header"
                    app:layout_constraintTop_toBottomOf="@id/leave" />

                <androidx.appcompat.widget.AppCompatTextView
                    android:id="@+id/pending_members_header"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:paddingLeft="16dp"
                    android:paddingTop="16dp"
                    android:paddingRight="16dp"
                    android:paddingBottom="8dp"
                    android:text="@string/requests"
                    android:textAppearance="@style/TextAppearance.MaterialComponents.Body2"
                    android:textColor="?colorAccent"
                    android:textStyle="bold"
                    app:layout_constraintBottom_toTopOf="@id/pending_members"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toBottomOf="@id/end" />

                <androidx.appcompat.widget.AppCompatTextView
                    android:id="@+id/pending_members_admin_only"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:paddingLeft="16dp"
                    android:paddingRight="16dp"
                    android:text="@string/admins_only"
                    android:textAppearance="@style/TextAppearance.MaterialComponents.Caption"
                    app:layout_constraintBaseline_toBaselineOf="@id/pending_members_header"
                    app:layout_constraintEnd_toEndOf="parent" />

                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/pending_members"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    app:layout_constraintBottom_toTopOf="@id/add_members"
                    app:layout_constraintTop_toBottomOf="@id/pending_members_header"
                    tools:itemCount="2"
                    tools:listitem="@layout/layout_dm_user_item" />

                <androidx.appcompat.widget.AppCompatTextView
                    android:id="@+id/add_members"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="4dp"
                    android:background="?selectableItemBackground"
                    android:gravity="center_vertical"
                    android:paddingStart="16dp"
                    android:paddingTop="12dp"
                    android:paddingEnd="16dp"
                    android:paddingBottom="12dp"
                    android:text="@string/add_members"
                    android:textAppearance="@style/TextAppearance.MaterialComponents.Body1"
                    android:textColor="?android:textColorPrimary"
                    app:drawableStartCompat="@drawable/ic_add"
                    app:drawableTint="?android:textColorPrimary"
                    app:layout_constraintBottom_toBottomOf="parent"
                    app:layout_constraintTop_toBottomOf="@id/pending_members" />

                <androidx.constraintlayout.widget.Group
                    android:id="@+id/pending_members_group"
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    android:visibility="gone"
                    app:constraint_referenced_ids="pending_members,pending_members_admin_only,pending_members_header"
                    tools:visibility="visible" />

                <androidx.constraintlayout.widget.Group
                    android:id="@+id/group_settings"
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    app:constraint_referenced_ids="title_edit_input_layout, mute_mentions_label, mute_mentions, leave, end, add_members, approval_required, approval_required_label" />
            </androidx.constraintlayout.widget.ConstraintLayout>

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

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/users"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"
        tools:listitem="@layout/layout_dm_user_item" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>