<?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/rootLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="?conversation_menu_background_color">

    <TextView
        android:id="@+id/titleText"
        android:layout_width="match_parent"
        android:layout_height="@dimen/setting_button_height"
        android:gravity="center_horizontal|center_vertical"
        android:text="@string/activity_create_group_title"
        android:textColor="?android:textColorPrimary"
        android:textSize="@dimen/very_large_font_size"
        android:textStyle="bold"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <ImageView
        android:id="@+id/backButton"
        android:background="?selectableItemBackgroundBorderless"
        android:padding="@dimen/small_spacing"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/small_spacing"
        android:clickable="true"
        android:contentDescription="@string/new_conversation_dialog_back_button_content_description"
        android:focusable="true"
        android:src="@drawable/ic_arrow_left_24"
        app:layout_constraintBottom_toBottomOf="@id/titleText"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="@id/titleText"
        app:tint="?android:textColorPrimary"/>

    <ImageView
        android:id="@+id/closeButton"
        android:background="?selectableItemBackgroundBorderless"
        android:padding="@dimen/small_spacing"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginEnd="@dimen/small_spacing"
        android:clickable="true"
        android:contentDescription="@string/new_conversation_dialog_close_button_content_description"
        android:focusable="true"
        android:src="@drawable/ic_baseline_close_24"
        app:layout_constraintBottom_toBottomOf="@id/titleText"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toTopOf="@id/titleText" />

    <EditText
        android:id="@+id/nameEditText"
        style="@style/SmallSessionEditText"
        android:layout_width="match_parent"
        android:layout_height="64dp"
        android:layout_marginLeft="@dimen/large_spacing"
        android:layout_marginTop="@dimen/medium_spacing"
        android:layout_marginRight="@dimen/large_spacing"
        android:layout_marginBottom="@dimen/medium_spacing"
        android:contentDescription="@string/AccessibilityId_group_name_input"
        android:hint="@string/activity_create_closed_group_edit_text_hint"
        android:maxLength="30"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/titleText" />

    <org.thoughtcrime.securesms.keyboard.emoji.KeyboardPageSearchView
        android:id="@+id/contactSearch"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_marginTop="@dimen/medium_spacing"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/nameEditText"
        app:search_bar_tint="?conversationMenuSearchBackgroundColor"
        app:search_icon_tint="?conversationMenuSearchTintColor"
        app:search_hint="@string/search_contacts_hint"
        app:show_always="true" />

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/recyclerView"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_marginTop="@dimen/small_spacing"
        android:layout_marginBottom="@dimen/large_spacing"
        app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintBottom_toTopOf="@id/createClosedGroupButton"
        app:layout_constraintTop_toBottomOf="@id/contactSearch"
        tools:itemCount="5"
        tools:listitem="@layout/view_user" />

    <Button
        android:id="@+id/createClosedGroupButton"
        style="@style/Widget.Session.Button.Common.ProminentOutline"
        android:layout_width="196dp"
        android:layout_height="@dimen/medium_button_height"
        android:layout_marginVertical="@dimen/large_spacing"
        android:contentDescription="@string/AccessibilityId_create_group"
        android:text="@string/activity_create_group_create_button_title"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/recyclerView"/>

    <androidx.constraintlayout.widget.Group
        android:id="@+id/mainContentGroup"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:visibility="gone"
        app:constraint_referenced_ids="nameEditText, contactSearch, recyclerView, createClosedGroupButton"
        tools:visibility="visible" />

    <TextView
        android:id="@+id/emptyStateMessageTextView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/activity_create_closed_group_empty_state_message"
        android:textColor="?android:textColorPrimary"
        android:textSize="@dimen/medium_font_size"
        app:layout_constraintBottom_toTopOf="@id/createNewPrivateChatButton"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/titleText" />

    <Button
        android:id="@+id/createNewPrivateChatButton"
        style="@style/Widget.Session.Button.Common.ProminentOutline"
        android:layout_width="196dp"
        android:layout_height="@dimen/medium_button_height"
        android:layout_marginVertical="@dimen/medium_spacing"
        android:text="@string/activity_create_closed_group_empty_state_button_title"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/emptyStateMessageTextView" />

    <androidx.constraintlayout.widget.Group
        android:id="@+id/emptyStateGroup"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:constraint_referenced_ids="emptyStateMessageTextView, createNewPrivateChatButton"
        tools:visibility="gone" />

    <RelativeLayout
        android:id="@+id/loaderContainer"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:alpha="0"
        android:background="#A4000000"
        android:visibility="gone"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <com.github.ybq.android.spinkit.SpinKitView
            style="@style/SpinKitView.Large.ThreeBounce"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:layout_marginTop="8dp"
            app:SpinKit_Color="@android:color/white" />

    </RelativeLayout>

</androidx.constraintlayout.widget.ConstraintLayout>
