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

    <View
        android:id="@+id/media_gallery_status_bar_background"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        app:layout_constraintBottom_toTopOf="@id/media_gallery_toolbar"
        app:layout_constraintTop_toTopOf="parent" />

    <androidx.appcompat.widget.Toolbar
        android:id="@+id/media_gallery_toolbar"
        android:layout_width="match_parent"
        android:layout_height="@dimen/signal_m3_toolbar_height"
        android:minHeight="@dimen/signal_m3_toolbar_height"
        app:layout_constraintTop_toTopOf="parent"
        app:menu="@menu/v2_media_gallery_fragment_toolbar_menu"
        app:navigationIcon="@drawable/ic_arrow_left_24"
        app:title="@string/AttachmentKeyboard_gallery"
        app:titleTextAppearance="@style/Signal.Text.TitleLarge" />

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/media_gallery_grid"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
        app:layout_constraintBottom_toTopOf="@id/media_gallery_bottom_bar_barrier"
        app:layout_constraintTop_toBottomOf="@id/media_gallery_toolbar"
        app:spanCount="4"
        tools:itemCount="36"
        tools:listitem="@layout/v2_media_gallery_item" />

    <View
        android:id="@+id/bottom_bar_shade"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:background="@color/signal_colorSurface"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintTop_toTopOf="@id/media_gallery_bottom_bar_barrier" />

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/media_gallery_selected"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:paddingTop="10dp"
        android:paddingBottom="10dp"
        app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toStartOf="@id/media_gallery_count_button"
        app:layout_constraintStart_toStartOf="parent"
        tools:listitem="@layout/v2_media_selection_item" />

    <View
        android:id="@+id/persistent_fade"
        android:layout_width="53dp"
        android:layout_height="0dp"
        android:background="@drawable/persistent_fading_edge"
        app:layout_constraintBottom_toBottomOf="@id/media_gallery_selected"
        app:layout_constraintEnd_toEndOf="@id/media_gallery_selected"
        app:layout_constraintTop_toTopOf="@id/media_gallery_selected" />

    <org.thoughtcrime.securesms.mediasend.v2.MediaCountIndicatorButton
        android:id="@+id/media_gallery_count_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginEnd="16dp"
        android:background="@drawable/v2_media_count_indicator_background"
        android:minHeight="44dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toEndOf="@id/media_gallery_selected"
        app:layout_constraintTop_toTopOf="@id/media_gallery_selected" />

    <androidx.constraintlayout.widget.Group
        android:id="@+id/media_gallery_bottom_bar_group"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:visibility="gone"
        app:constraint_referenced_ids="media_gallery_selected,media_gallery_count_button"
        tools:visibility="visible" />

    <androidx.constraintlayout.widget.Barrier
        android:id="@+id/media_gallery_bottom_bar_barrier"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:barrierDirection="top"
        app:constraint_referenced_ids="media_gallery_count_button,media_gallery_selected" />

</androidx.constraintlayout.widget.ConstraintLayout>