<?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:fresco="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/attachment_container"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:animateLayoutChanges="true"
    android:background="?android:attr/selectableItemBackground"
    android:clickable="true"
    android:focusable="true"
    android:paddingStart="@dimen/screen_edge_left_and_right_padding"
    android:paddingEnd="@dimen/screen_edge_left_and_right_padding"
    android:paddingBottom="@dimen/message_item_top_and_bottom_padding">

    <androidx.constraintlayout.widget.Guideline
        android:id="@+id/guideline"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        app:layout_constraintGuide_begin="56dp" />

    <!-- File attachments (image, video, audio) -->
    <TextView
        android:id="@+id/file_name"
        style="@style/Message.TextView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:visibility="gone"
        app:layout_constraintStart_toStartOf="@id/guideline"
        tools:text="Filename.png"
        tools:visibility="visible"/>

    <TextView
        android:id="@+id/file_description"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:visibility="gone"
        app:layout_constraintStart_toStartOf="@id/guideline"
        app:layout_constraintTop_toBottomOf="@id/file_name"
        tools:text="Some description"
        tools:visibility="visible"/>

    <com.facebook.drawee.view.SimpleDraweeView
        android:id="@+id/image_attachment"
        android:layout_width="0dp"
        android:layout_height="150dp"
        android:visibility="gone"
        app:layout_constraintStart_toStartOf="@id/guideline"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toBottomOf="@id/file_description"
        fresco:actualImageScaleType="centerCrop"
        fresco:placeholderImage="@drawable/image_dummy"
        tools:background="@drawable/image_dummy"
        tools:visibility="visible"/>

    <FrameLayout
        android:id="@+id/audio_video_attachment"
        android:layout_width="0dp"
        android:layout_height="150dp"
        android:background="@color/colorBlack"
        android:visibility="gone"
        android:clickable="true"
        android:focusable="true"
        app:layout_constraintStart_toStartOf="@id/guideline"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toBottomOf="@id/image_attachment"
        tools:visibility="gone">

        <ImageView
            android:id="@+id/play_button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:src="@drawable/exo_controls_play" />
    </FrameLayout>

    <TextView
        android:id="@+id/file_text"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:visibility="gone"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="@id/guideline"
        app:layout_constraintTop_toBottomOf="@id/audio_video_attachment"
        tools:text="Some text"
        tools:visibility="visible"/>

    <TextView
        android:id="@+id/text_file_name"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:textColor="@color/colorAccent"
        android:textAppearance="@style/TextAppearance.AppCompat.Body2"
        android:drawableStart="@drawable/ic_files_24dp"
        android:drawablePadding="6dp"
        android:visibility="gone"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="@id/guideline"
        app:layout_constraintTop_toBottomOf="@id/file_text"
        android:textDirection="locale"
        tools:text="This is a very, very, very long filename, to test how the layout will work on very very very long filenames.pdf"
        tools:visibility="visible" />
    <!-- END File attachments -->

    <ImageView
        android:id="@+id/quote_bar"
        android:layout_width="4dp"
        android:layout_height="0dp"
        android:src="@drawable/quote_vertical_gray_bar"
        android:scaleType="fitXY"
        android:visibility="gone"
        app:layout_constraintBottom_toBottomOf="@+id/actions_list"
        app:layout_constraintStart_toStartOf="@id/guideline"
        app:layout_constraintTop_toBottomOf="@id/text_file_name"
        tools:visibility="visible"/>

    <!-- Message attachment -->
    <TextView
        android:id="@+id/text_sender"
        style="@style/Sender.Name.TextView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="8dp"
        android:textColor="@color/colorPrimary"
        android:visibility="gone"
        app:layout_constraintStart_toEndOf="@+id/quote_bar"
        app:layout_constraintTop_toBottomOf="@id/text_file_name"
        tools:text="Ronald Perkins" />

    <TextView
        android:id="@+id/text_message_time"
        style="@style/ChatList.Timestamp.TextView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="10dp"
        android:visibility="gone"
        app:layout_constraintBottom_toBottomOf="@+id/text_sender"
        app:layout_constraintStart_toEndOf="@+id/text_sender"
        app:layout_constraintTop_toTopOf="@+id/text_sender"
        tools:text="11:45 PM" />

    <TextView
        android:id="@+id/text_content"
        style="@style/Message.Quote.TextView"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:visibility="gone"
        app:layout_constraintBottom_toTopOf="@id/text_view_more"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="@+id/text_sender"
        app:layout_constraintTop_toBottomOf="@+id/text_sender"
        tools:text="This is a multiline chat message from Bertie that will take more than just one line of text. I have sure that everything is amazing!" />

    <TextView
        android:id="@+id/text_view_more"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:gravity="end"
        android:textColor="@color/darkGray"
        android:textSize="14sp"
        android:visibility="gone"
        app:layout_constraintEnd_toEndOf="@+id/text_content"
        app:layout_constraintStart_toEndOf="@id/guideline"
        app:layout_constraintTop_toBottomOf="@+id/text_content"
        tools:text="Visualizar mais" />

    <!-- END Message attachment -->

    <!-- author -->
    <com.facebook.drawee.view.SimpleDraweeView
        android:id="@+id/author_icon"
        android:layout_width="8dp"
        android:layout_height="8dp"
        android:layout_marginTop="6dp"
        android:layout_marginStart="8dp"
        android:visibility="gone"
        app:layout_constraintTop_toBottomOf="@id/text_view_more"
        app:layout_constraintStart_toStartOf="@id/guideline"
        tools:src="@tools:sample/avatars"
        tools:visibility="visible"/>

    <TextView
        android:id="@+id/text_author_name"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="4dp"
        android:textColor="@color/colorAccent"
        android:textAppearance="@style/TextAppearance.AppCompat.Body2"
        android:visibility="gone"
        app:layout_constraintTop_toBottomOf="@id/text_view_more"
        app:layout_constraintStart_toEndOf="@id/author_icon"
        app:layout_constraintEnd_toEndOf="parent"
        tools:text="#5571 - User profile from SSO must not have password change option"
        tools:visibility="visible"/>
    <!-- END author -->

    <!-- TEXT -->
    <TextView
        android:id="@+id/file_name_not_file_type"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="8dp"
        android:textColor="@color/colorAccent"
        android:textAppearance="@style/TextAppearance.AppCompat.Body2"
        android:visibility="gone"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="@id/guideline"
        app:layout_constraintTop_toBottomOf="@id/text_author_name"
        android:textDirection="locale"
        tools:text="This is a very, very, very long filename, to test how the layout will work on very very very long filenames.pdf"
        tools:visibility="visible" />
    <TextView
        android:id="@+id/attachment_text"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="8dp"
        android:textAppearance="@style/TextAppearance.AppCompat.Body1"
        android:visibility="gone"
        app:layout_constraintTop_toBottomOf="@id/file_name_not_file_type"
        app:layout_constraintStart_toStartOf="@id/guideline"
        app:layout_constraintEnd_toEndOf="parent"
        tools:text="#5571 - User profile from SSO must not have password change option"
        tools:visibility="visible"/>
    <!-- END TEXT -->

    <!-- Fields -->
    <TextView
        android:id="@+id/text_fields"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:visibility="gone"
        android:layout_marginStart="8dp"
        android:layout_marginTop="4dp"
        app:layout_constraintTop_toBottomOf="@id/attachment_text"
        app:layout_constraintStart_toEndOf="@id/guideline"
        app:layout_constraintEnd_toEndOf="parent"
        tools:text="line1\nline2\n\nline3\nline4"
        tools:visibility="visible"/>
    <!-- END Fields -->

    <!-- Actions -->
    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/actions_list"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="8dp"
        android:textAppearance="@style/TextAppearance.AppCompat.Body2"
        android:textColor="@color/colorAccent"
        android:textDirection="locale"
        android:visibility="gone"
        app:layout_constraintEnd_toEndOf="@id/title"
        app:layout_constraintStart_toEndOf="@id/guideline"
        app:layout_constraintTop_toBottomOf="@id/text_fields" />

    <include
        layout="@layout/layout_reactions"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        app:layout_constraintStart_toStartOf="@id/guideline"
        app:layout_constraintTop_toBottomOf="@+id/actions_list" />

</androidx.constraintlayout.widget.ConstraintLayout>
