<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    tools:viewBindingIgnore="true"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <androidx.viewpager2.widget.ViewPager2
        android:id="@+id/media_pager"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

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

        <View
            android:id="@+id/controls_shade"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:alpha="0"
            android:background="@color/signal_dark_colorBackground_92"
            android:visibility="gone"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintTop_toTopOf="@id/add_a_message_barrier"
            tools:alpha="1"
            tools:visibility="visible" />

        <org.thoughtcrime.securesms.components.emoji.SimpleEmojiTextView
            android:id="@+id/recipient"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="15dp"
            android:layout_marginEnd="16dp"
            android:alpha="0"
            android:background="@drawable/image_editor_hud_clear_all_background"
            android:drawablePadding="4dp"
            android:maxLines="1"
            android:paddingStart="14dp"
            android:paddingTop="8dp"
            android:paddingEnd="14dp"
            android:paddingBottom="8dp"
            android:textAppearance="@style/TextAppearance.Signal.Body2"
            android:textColor="@color/core_white"
            android:visibility="gone"
            app:drawableStartCompat="@drawable/ic_arrow_right_16"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            tools:alpha="1"
            tools:text="Sam"
            tools:visibility="visible" />

        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/selection_recycler"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="15dp"
            android:alpha="0"
            android:clipToPadding="false"
            android:orientation="horizontal"
            android:paddingStart="8dp"
            android:paddingEnd="8dp"
            android:visibility="gone"
            app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
            app:layout_constraintBottom_toTopOf="@id/controls_shade"
            tools:alpha="1"
            tools:listitem="@layout/v2_media_review_selected_item"
            tools:visibility="visible" />

        <com.google.android.material.imageview.ShapeableImageView
            android:id="@+id/add_media"
            android:layout_width="48dp"
            android:layout_height="48dp"
            android:layout_marginStart="10dp"
            android:layout_marginBottom="15dp"
            android:alpha="0"
            android:background="@drawable/media_gallery_button_background"
            android:padding="4dp"
            android:scaleType="centerInside"
            android:visibility="gone"
            app:layout_constraintBottom_toTopOf="@+id/controls_shade"
            app:layout_constraintStart_toStartOf="parent"
            app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.Signal.Circle"
            app:srcCompat="@drawable/ic_add_media_22"
            tools:alpha="1"
            tools:visibility="visible" />

        <ViewSwitcher
            android:id="@+id/view_once_toggle"
            android:layout_width="48dp"
            android:layout_height="48dp"
            android:layout_marginEnd="20dp"
            android:layout_marginBottom="15dp"
            android:alpha="0"
            android:animateFirstView="false"
            android:inAnimation="@anim/fade_in"
            android:outAnimation="@anim/fade_out"
            android:visibility="gone"
            app:layout_constraintBottom_toTopOf="@+id/controls_shade"
            app:layout_constraintEnd_toEndOf="parent"
            tools:alpha="1"
            tools:visibility="visible">

            <com.google.android.material.imageview.ShapeableImageView
                android:layout_width="40dp"
                android:layout_height="40dp"
                android:layout_gravity="center"
                android:background="@drawable/media_gallery_button_background"
                android:scaleType="centerInside"
                app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.Signal.Circle"
                app:srcCompat="@drawable/ic_view_infinite_24"
                app:tint="@color/core_white" />

            <com.google.android.material.imageview.ShapeableImageView
                android:layout_width="40dp"
                android:layout_height="40dp"
                android:layout_gravity="center"
                android:background="@drawable/media_gallery_button_background"
                android:scaleType="centerInside"
                app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.Signal.Circle"
                app:srcCompat="@drawable/ic_view_once_24"
                app:tint="@color/core_white" />

        </ViewSwitcher>

        <org.thoughtcrime.securesms.components.emoji.EmojiTextView
            android:id="@+id/view_once_message"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="16dp"
            android:alpha="0"
            android:gravity="center"
            android:minHeight="48dp"
            android:text="@string/MediaReviewFragment__view_once_message"
            android:textAppearance="@style/Signal.Text.Body"
            android:textColor="@color/transparent_white_60"
            app:layout_constraintBottom_toTopOf="@id/button_barrier"
            tools:alpha="1" />

        <org.thoughtcrime.securesms.components.emoji.EmojiTextView
            android:id="@+id/add_a_message"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="16dp"
            android:alpha="0"
            android:gravity="center"
            android:minHeight="48dp"
            android:text="@string/MediaReviewFragment__add_a_message"
            android:textAppearance="@style/Signal.Text.Body"
            android:textColor="@color/core_white"
            app:layout_constraintBottom_toTopOf="@id/button_barrier"
            tools:alpha="1" />

        <org.thoughtcrime.securesms.components.emoji.EmojiTextView
            android:id="@+id/add_a_message_entry"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginStart="16dp"
            android:layout_marginTop="12dp"
            android:layout_marginEnd="16dp"
            android:layout_marginBottom="20dp"
            android:background="@drawable/rounded_rectangle_secondary_dark"
            android:cursorVisible="false"
            android:enabled="false"
            android:focusable="false"
            android:gravity="start|center_vertical"
            android:inputType="none"
            android:maxLines="3"
            android:minHeight="36dp"
            android:paddingStart="12dp"
            android:paddingTop="6dp"
            android:paddingEnd="12dp"
            android:paddingBottom="6dp"
            android:textAppearance="@style/Signal.Text.Body"
            android:textColor="@color/core_white"
            android:visibility="gone"
            app:layout_constraintBottom_toTopOf="@id/button_barrier"
            app:layout_constraintTop_toTopOf="@id/add_a_message_barrier"
            tools:visibility="visible" />

        <androidx.constraintlayout.widget.Barrier
            android:id="@+id/add_a_message_barrier"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:barrierDirection="top"
            app:constraint_referenced_ids="add_a_message,add_a_message_entry,view_once_message" />

        <androidx.constraintlayout.widget.Barrier
            android:id="@+id/button_barrier"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:barrierDirection="top"
            app:constraint_referenced_ids="crop_and_rotate_tool,draw_tool,quality_selector,save_to_media,send"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent" />

        <com.google.android.material.imageview.ShapeableImageView
            android:id="@+id/draw_tool"
            android:layout_width="48dp"
            android:layout_height="48dp"
            android:layout_marginStart="10dp"
            android:layout_marginBottom="16dp"
            android:alpha="0"
            android:background="@drawable/media_gallery_button_background"
            android:padding="6dp"
            android:scaleType="centerInside"
            android:translationY="48dp"
            android:visibility="gone"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.Signal.Circle"
            app:srcCompat="@drawable/ic_draw_24"
            app:tint="@color/signal_dark_colorOnSurface"
            tools:alpha="1"
            tools:translationY="0dp"
            tools:visibility="visible" />

        <com.google.android.material.imageview.ShapeableImageView
            android:id="@+id/crop_and_rotate_tool"
            android:layout_width="48dp"
            android:layout_height="48dp"
            android:layout_marginStart="12dp"
            android:layout_marginBottom="16dp"
            android:alpha="0"
            android:background="@drawable/media_gallery_button_background"
            android:padding="4dp"
            android:scaleType="centerInside"
            android:translationY="48dp"
            android:visibility="gone"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintStart_toEndOf="@id/draw_tool"
            app:layout_goneMarginStart="10dp"
            app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.Signal.Circle"
            app:srcCompat="@drawable/ic_crop_rotate_24"
            app:tint="@color/signal_dark_colorOnSurface"
            tools:alpha="1"
            tools:translationY="0dp"
            tools:visibility="visible" />

        <com.google.android.material.imageview.ShapeableImageView
            android:id="@+id/quality_selector"
            android:layout_width="48dp"
            android:layout_height="48dp"
            android:layout_marginStart="12dp"
            android:layout_marginBottom="16dp"
            android:alpha="0"
            android:background="@drawable/media_gallery_button_background"
            android:padding="4dp"
            android:scaleType="centerInside"
            android:translationY="48dp"
            android:visibility="gone"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintStart_toEndOf="@id/crop_and_rotate_tool"
            app:layout_goneMarginStart="10dp"
            app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.Signal.Circle"
            app:srcCompat="@drawable/ic_sq_24"
            app:tint="@color/signal_dark_colorOnSurface"
            tools:alpha="1"
            tools:translationY="0dp"
            tools:visibility="visible" />

        <com.google.android.material.imageview.ShapeableImageView
            android:id="@+id/save_to_media"
            android:layout_width="48dp"
            android:layout_height="48dp"
            android:layout_marginStart="12dp"
            android:layout_marginBottom="16dp"
            android:background="@drawable/media_gallery_button_background"
            android:padding="4dp"
            android:scaleType="centerInside"
            android:translationY="48dp"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintStart_toEndOf="@id/quality_selector"
            app:layout_goneMarginStart="10dp"
            app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.Signal.Circle"
            app:srcCompat="@drawable/ic_save_24"
            app:tint="@color/signal_dark_colorOnSurface"
            tools:translationY="0dp" />

        <com.google.android.material.imageview.ShapeableImageView
            android:id="@+id/send"
            android:layout_width="48dp"
            android:layout_height="48dp"
            android:layout_marginStart="12dp"
            android:layout_marginEnd="10dp"
            android:layout_marginBottom="16dp"
            android:background="@color/signal_colorOnSecondaryContainer"
            android:padding="4dp"
            android:scaleType="centerInside"
            android:translationY="48dp"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintHorizontal_bias="1"
            app:layout_constraintStart_toEndOf="@id/save_to_media"
            app:layout_goneMarginStart="10dp"
            app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.Signal.Circle"
            app:srcCompat="@drawable/ic_arrow_end_24"
            app:tint="@color/signal_colorSecondaryContainer"
            tools:translationY="0dp" />

    </androidx.constraintlayout.widget.ConstraintLayout>

    <org.thoughtcrime.securesms.util.views.TouchInterceptingFrameLayout
        android:id="@+id/progress_wrapper"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:alpha="0"
        android:background="@color/transparent_black_60"
        android:visibility="gone"
        tools:alpha="1"
        tools:visibility="visible">

        <ProgressBar
            android:id="@+id/progress"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:indeterminate="true"
            android:indeterminateBehavior="cycle" />
    </org.thoughtcrime.securesms.util.views.TouchInterceptingFrameLayout>

</FrameLayout>