<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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/composerLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:background="@drawable/bg_composer_rich_bottom_sheet">

    <FrameLayout
        android:id="@+id/bottomSheetHandle"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent">

        <View
            android:layout_width="36dp"
            android:layout_height="5dp"
            android:layout_gravity="center_horizontal"
            android:layout_marginTop="8dp"
            android:background="@drawable/bottomsheet_handle" />

    </FrameLayout>

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

        <ImageButton
            android:id="@+id/attachmentButton"
            android:layout_width="60dp"
            android:layout_height="56dp"
            android:background="?android:attr/selectableItemBackgroundBorderless"
            android:contentDescription="@string/option_send_files"
            android:src="@drawable/ic_rich_composer_add"
            app:layout_constraintVertical_bias="1"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_goneMarginBottom="56dp"
            tools:ignore="MissingPrefix,RtlSymmetry" />

        <!-- Constraints are updated programmatically -->
        <FrameLayout
            android:id="@+id/composerEditTextOuterBorder"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:minHeight="40dp"
            android:layout_marginTop="8dp"
            android:layout_marginBottom="8dp"
            android:layout_marginHorizontal="12dp"
            app:layout_constraintVertical_bias="0"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintBottom_toTopOf="@id/sendButton"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintEnd_toEndOf="parent" />

        <androidx.appcompat.widget.AppCompatImageView
            android:id="@+id/composerModeIconView"
            android:layout_width="11dp"
            android:layout_height="11dp"
            tools:src="@drawable/ic_quote"
            android:layout_marginStart="12dp"
            app:layout_constraintTop_toTopOf="@id/composerModeTitleView"
            app:layout_constraintBottom_toBottomOf="@id/composerModeTitleView"
            app:layout_constraintStart_toStartOf="@id/composerEditTextOuterBorder"
            app:tint="?vctr_content_tertiary" />

        <TextView android:id="@+id/composerModeTitleView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="6dp"
            android:layout_marginTop="8dp"
            android:paddingBottom="2dp"
            android:fontFamily="sans-serif-medium"
            tools:text="Editing"
            style="@style/BottomSheetItemTime"
            app:layout_constraintTop_toTopOf="@id/composerEditTextOuterBorder"
            app:layout_constraintStart_toEndOf="@id/composerModeIconView" />

        <ImageButton android:id="@+id/composerModeCloseView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/ic_composer_rich_text_editor_close"
            android:background="?android:selectableItemBackground"
            android:layout_marginEnd="12dp"
            android:contentDescription="@string/action_close"
            app:layout_constraintTop_toTopOf="@id/composerModeIconView"
            app:layout_constraintEnd_toEndOf="@id/composerEditTextOuterBorder" />

        <androidx.constraintlayout.widget.Barrier
            android:id="@+id/composerModeBarrier"
            android:layout_width="0dp"
            android:layout_height="0dp"
            app:barrierDirection="bottom"
            app:constraint_referenced_ids="composerModeIconView,composerModeTitleView,composerModeCloseView" />

        <androidx.constraintlayout.widget.Group
            android:id="@+id/composerModeGroup"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:visibility="gone"
            tools:visibility="visible"
            app:constraint_referenced_ids="composerModeIconView,composerModeTitleView,composerModeCloseView" />

        <io.element.android.wysiwyg.EditorEditText
            android:id="@+id/richTextComposerEditText"
            style="@style/Widget.Vector.EditText.RichTextComposer"
            android:layout_width="0dp"
            android:layout_height="0dp"
            app:layout_constraintHeight_default="wrap"
            android:gravity="top"
            android:hint="@string/room_message_placeholder"
            android:nextFocusLeft="@id/richTextComposerEditText"
            android:nextFocusUp="@id/richTextComposerEditText"
            android:layout_marginStart="12dp"
            android:imeOptions="flagNoExtractUi"
            app:layout_constraintVertical_bias="0"
            app:layout_constraintBottom_toBottomOf="@id/composerEditTextOuterBorder"
            app:layout_constraintEnd_toStartOf="@id/composerFullScreenButton"
            app:layout_constraintStart_toStartOf="@id/composerEditTextOuterBorder"
            app:layout_constraintTop_toBottomOf="@id/composerModeBarrier"
            app:bulletRadius="4sp"
            app:bulletGap="8sp"
            app:codeBlockBackgroundDrawable="@drawable/bg_code_block"
            app:inlineCodeSingleLineBg="@drawable/bg_inline_code_single_line"
            app:inlineCodeMultiLineBgLeft="@drawable/bg_inline_code_multi_line_left"
            app:inlineCodeMultiLineBgMid="@drawable/bg_inline_code_multi_line_mid"
            app:inlineCodeMultiLineBgRight="@drawable/bg_inline_code_multi_line_right"
            tools:text="@tools:sample/lorem/random" />

        <com.google.android.material.textfield.TextInputEditText
            android:id="@+id/plainTextComposerEditText"
            style="@style/Widget.Vector.EditText.RichTextComposer"
            android:layout_width="0dp"
            android:layout_height="0dp"
            app:layout_constraintHeight_default="wrap"
            android:visibility="gone"
            android:hint="@string/room_message_placeholder"
            android:nextFocusLeft="@id/plainTextComposerEditText"
            android:nextFocusUp="@id/plainTextComposerEditText"
            android:layout_marginStart="12dp"
            android:gravity="top"
            android:imeOptions="flagNoExtractUi"
            app:layout_constraintVertical_bias="0"
            app:layout_constraintBottom_toBottomOf="@id/composerEditTextOuterBorder"
            app:layout_constraintEnd_toStartOf="@id/composerFullScreenButton"
            app:layout_constraintStart_toStartOf="@id/composerEditTextOuterBorder"
            app:layout_constraintTop_toBottomOf="@id/composerModeBarrier"
            tools:text="@tools:sample/lorem/random" />

        <ImageButton
            android:id="@+id/composerFullScreenButton"
            android:layout_width="40dp"
            android:layout_height="40dp"
            android:layout_marginEnd="4dp"
            app:layout_constraintEnd_toEndOf="@id/composerEditTextOuterBorder"
            app:layout_constraintTop_toBottomOf="@id/composerModeBarrier"
            app:layout_constraintBottom_toBottomOf="@id/composerEditTextOuterBorder"
            app:layout_constraintVertical_bias="0"
            android:src="@drawable/ic_composer_full_screen"
            android:background="?android:attr/selectableItemBackgroundBorderless"
            android:contentDescription="@string/rich_text_editor_full_screen_toggle" />

        <ImageButton
            android:id="@+id/sendButton"
            android:layout_width="56dp"
            android:layout_height="56dp"
            android:paddingEnd="4dp"
            android:contentDescription="@string/action_send"
            android:scaleType="center"
            android:src="@drawable/ic_rich_composer_send"
            android:visibility="invisible"
            android:background="?android:attr/selectableItemBackgroundBorderless"
            app:layout_constraintTop_toBottomOf="@id/composerEditTextOuterBorder"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintVertical_bias="1"
            tools:ignore="MissingPrefix,RtlSymmetry"
            tools:visibility="visible" />

        <HorizontalScrollView android:id="@+id/richTextMenuScrollView"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:minHeight="52dp"
            android:requiresFadingEdge="horizontal"
            android:fadingEdgeLength="28dp"
            app:layout_constraintTop_toBottomOf="@id/composerEditTextOuterBorder"
            app:layout_constraintStart_toEndOf="@id/attachmentButton"
            app:layout_constraintEnd_toStartOf="@id/sendButton"
            app:layout_constraintBottom_toBottomOf="parent"
            android:fillViewport="true">

            <LinearLayout
                android:id="@+id/richTextMenu"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:orientation="horizontal"
                android:paddingVertical="4dp">

            </LinearLayout>

        </HorizontalScrollView>

    </androidx.constraintlayout.widget.ConstraintLayout>

</LinearLayout>
