<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout 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"
    tools:context="eu.faircode.email.ActivityCompose">

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="eu.faircode.email.BehaviorBottomPadding">

        <eu.faircode.email.ScrollViewEx
            android:layout_width="match_parent"
            android:layout_height="0dp"
            app:layout_constraintBottom_toTopOf="@+id/media_bar"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent">

            <androidx.constraintlayout.widget.ConstraintLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <Spinner
                    android:id="@+id/spIdentity"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="6dp"
                    android:layout_marginTop="6dp"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="parent" />

                <eu.faircode.email.EditTextPlain
                    android:id="@+id/etExtra"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="6dp"
                    android:layout_marginTop="12dp"
                    android:background="@null"
                    android:hint="user"
                    android:inputType="text"
                    android:textAppearance="@style/TextAppearance.AppCompat.Medium"
                    app:layout_constraintEnd_toStartOf="@+id/tvDomain"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toBottomOf="@id/spIdentity" />

                <eu.faircode.email.FixedTextView
                    android:id="@+id/tvDomain"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginEnd="12dp"
                    android:text="\@example.com"
                    android:textAppearance="@style/TextAppearance.AppCompat.Small"
                    app:layout_constraintBottom_toBottomOf="@+id/etExtra"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toEndOf="@id/etExtra"
                    app:layout_constraintTop_toTopOf="@+id/etExtra" />

                <ImageView
                    android:id="@+id/ivToLegend"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="6dp"
                    android:contentDescription="@string/title_to"
                    app:layout_constraintBottom_toBottomOf="@+id/etTo"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="@+id/etTo"
                    app:srcCompat="@drawable/baseline_person_24" />

                <MultiAutoCompleteTextView
                    android:id="@+id/etTo"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="6dp"
                    android:layout_marginTop="12dp"
                    android:background="@null"
                    android:hint="@string/title_to"
                    android:imeOptions="actionNext"
                    android:inputType="textEmailAddress"
                    android:textAppearance="@style/TextAppearance.AppCompat.Medium"
                    app:layout_constraintEnd_toStartOf="@+id/ivToAdd"
                    app:layout_constraintStart_toEndOf="@id/ivToLegend"
                    app:layout_constraintTop_toBottomOf="@id/etExtra" />

                <ImageButton
                    android:id="@+id/ivToAdd"
                    android:layout_width="24dp"
                    android:layout_height="24dp"
                    android:layout_marginEnd="6dp"
                    android:background="?android:attr/selectableItemBackgroundBorderless"
                    android:contentDescription="@string/title_legend_pick"
                    app:layout_constraintBottom_toBottomOf="@id/etTo"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toEndOf="@id/etTo"
                    app:layout_constraintTop_toTopOf="@+id/etTo"
                    app:srcCompat="@drawable/baseline_person_add_24" />

                <ImageView
                    android:id="@+id/ivCcLegend"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="6dp"
                    android:contentDescription="@string/title_cc"
                    app:layout_constraintBottom_toBottomOf="@+id/etCc"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="@+id/etCc"
                    app:srcCompat="@drawable/baseline_people_24" />

                <MultiAutoCompleteTextView
                    android:id="@+id/etCc"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="6dp"
                    android:layout_marginTop="12dp"
                    android:background="@null"
                    android:hint="@string/title_cc"
                    android:imeOptions="actionNext"
                    android:inputType="textEmailAddress"
                    android:textAppearance="@style/TextAppearance.AppCompat.Medium"
                    app:layout_constraintEnd_toStartOf="@+id/ivCcAdd"
                    app:layout_constraintStart_toEndOf="@id/ivCcLegend"
                    app:layout_constraintTop_toBottomOf="@+id/etTo" />

                <ImageButton
                    android:id="@+id/ivCcAdd"
                    android:layout_width="24dp"
                    android:layout_height="24dp"
                    android:layout_marginEnd="6dp"
                    android:background="?android:attr/selectableItemBackgroundBorderless"
                    android:contentDescription="@string/title_legend_pick"
                    app:layout_constraintBottom_toBottomOf="@id/etCc"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toEndOf="@id/etCc"
                    app:layout_constraintTop_toTopOf="@+id/etCc"
                    app:srcCompat="@drawable/baseline_person_add_24" />

                <ImageView
                    android:id="@+id/ivBccLegend"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="6dp"
                    android:contentDescription="@string/title_bcc"
                    app:layout_constraintBottom_toBottomOf="@id/etBcc"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="@+id/etBcc"
                    app:srcCompat="@drawable/baseline_people_outline_24" />

                <MultiAutoCompleteTextView
                    android:id="@+id/etBcc"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="6dp"
                    android:layout_marginTop="12dp"
                    android:background="@null"
                    android:hint="@string/title_bcc"
                    android:imeOptions="actionNext"
                    android:inputType="textEmailAddress"
                    android:textAppearance="@style/TextAppearance.AppCompat.Medium"
                    app:layout_constraintEnd_toStartOf="@+id/ivBccAdd"
                    app:layout_constraintStart_toEndOf="@id/ivBccLegend"
                    app:layout_constraintTop_toBottomOf="@+id/etCc" />

                <ImageButton
                    android:id="@+id/ivBccAdd"
                    android:layout_width="24dp"
                    android:layout_height="24dp"
                    android:layout_marginEnd="6dp"
                    android:background="?android:attr/selectableItemBackgroundBorderless"
                    android:contentDescription="@string/title_legend_pick"
                    app:layout_constraintBottom_toBottomOf="@id/etBcc"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toEndOf="@id/etBcc"
                    app:layout_constraintTop_toTopOf="@+id/etBcc"
                    app:srcCompat="@drawable/baseline_person_add_24" />

                <eu.faircode.email.EditTextPlain
                    android:id="@+id/etSubject"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="6dp"
                    android:layout_marginTop="12dp"
                    android:background="@null"
                    android:hint="@string/title_subject"
                    android:imeOptions="actionNext"
                    android:inputType="textEmailSubject|textCapSentences|textAutoCorrect"
                    android:textAppearance="@style/TextAppearance.AppCompat.Medium"
                    app:layout_constraintEnd_toStartOf="@+id/ivCcBcc"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toBottomOf="@+id/etBcc" />

                <ImageButton
                    android:id="@+id/ivCcBcc"
                    android:layout_width="24dp"
                    android:layout_height="24dp"
                    android:layout_marginEnd="6dp"
                    android:background="?android:attr/selectableItemBackgroundBorderless"
                    android:contentDescription="@string/title_show_addresses"
                    app:layout_constraintBottom_toBottomOf="@id/etSubject"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toEndOf="@id/etSubject"
                    app:layout_constraintTop_toTopOf="@+id/etSubject"
                    app:srcCompat="@drawable/baseline_people_24" />

                <View
                    android:id="@+id/vSeparatorAttachments"
                    android:layout_width="0dp"
                    android:layout_height="1dp"
                    android:layout_marginTop="6dp"
                    android:background="?attr/colorSeparator"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toBottomOf="@id/etSubject" />

                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/rvAttachment"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="6dp"
                    android:layout_marginTop="6dp"
                    android:layout_marginEnd="6dp"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toBottomOf="@+id/vSeparatorAttachments" />

                <eu.faircode.email.FixedTextView
                    android:id="@+id/tvNoInternetAttachments"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="6dp"
                    android:text="@string/title_no_internet"
                    android:textAppearance="@style/TextAppearance.AppCompat.Small"
                    app:layout_constraintEnd_toEndOf="@id/rvAttachment"
                    app:layout_constraintStart_toStartOf="@id/rvAttachment"
                    app:layout_constraintTop_toBottomOf="@id/rvAttachment" />

                <ImageButton
                    android:id="@+id/ibCloseUnusedImagesHint"
                    android:layout_width="wrap_content"
                    android:layout_height="0dp"
                    android:background="?android:attr/selectableItemBackgroundBorderless"
                    android:contentDescription="@string/title_no_format"
                    app:layout_constraintBottom_toBottomOf="@+id/tvUnusedImagesHint"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="@+id/tvUnusedImagesHint"
                    app:srcCompat="@drawable/baseline_close_24" />

                <eu.faircode.email.FixedTextView
                    android:id="@+id/tvUnusedImagesHint"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="6dp"
                    android:layout_marginTop="6dp"
                    android:layout_marginEnd="6dp"
                    android:text="@string/title_unused_inline"
                    android:textAppearance="@style/TextAppearance.AppCompat.Small"
                    android:textStyle="italic"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toEndOf="@id/ibCloseUnusedImagesHint"
                    app:layout_constraintTop_toBottomOf="@id/tvNoInternetAttachments" />

                <View
                    android:id="@+id/vSeparator"
                    android:layout_width="0dp"
                    android:layout_height="1dp"
                    android:layout_marginTop="6dp"
                    android:background="?attr/colorSeparator"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toBottomOf="@+id/ibCloseUnusedImagesHint" />

                <eu.faircode.email.EditTextCompose
                    android:id="@+id/etBody"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="6dp"
                    android:layout_marginTop="6dp"
                    android:layout_marginEnd="6dp"
                    android:background="@null"
                    android:fontFamily="monospace"
                    android:gravity="top"
                    android:hint="@string/title_body_hint"
                    android:imeOptions="actionNone|flagNoEnterAction"
                    android:inputType="textCapSentences|textMultiLine|textAutoCorrect"
                    android:minHeight="120dp"
                    android:textAppearance="@style/TextAppearance.AppCompat.Small"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toBottomOf="@id/vSeparator" />

                <eu.faircode.email.FixedTextView
                    android:id="@+id/tvNoInternet"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/title_no_internet"
                    android:textAppearance="@style/TextAppearance.AppCompat.Small"
                    app:layout_constraintBottom_toBottomOf="@id/etBody"
                    app:layout_constraintEnd_toEndOf="@id/etBody"
                    app:layout_constraintStart_toStartOf="@id/etBody"
                    app:layout_constraintTop_toTopOf="@id/etBody" />

                <View
                    android:id="@+id/vSeparatorBody"
                    android:layout_width="0dp"
                    android:layout_height="1dp"
                    android:layout_marginTop="6dp"
                    android:background="?attr/colorSeparator"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toBottomOf="@+id/etBody" />

                <eu.faircode.email.FixedTextView
                    android:id="@+id/tvSignature"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="6dp"
                    android:layout_marginTop="6dp"
                    android:layout_marginEnd="6dp"
                    android:fontFamily="monospace"
                    android:minHeight="24dp"
                    android:text="Signature"
                    android:textAppearance="@style/TextAppearance.AppCompat.Small"
                    android:textIsSelectable="true"
                    app:layout_constraintEnd_toStartOf="@+id/cbSignature"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toBottomOf="@id/vSeparatorBody" />

                <CheckBox
                    android:id="@+id/cbSignature"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginEnd="6dp"
                    app:layout_constraintBottom_toBottomOf="@+id/tvSignature"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintTop_toTopOf="@+id/tvSignature" />

                <View
                    android:id="@+id/vSeparatorSignature"
                    android:layout_width="0dp"
                    android:layout_height="1dp"
                    android:layout_marginTop="6dp"
                    android:background="?attr/colorSeparator"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toBottomOf="@+id/tvSignature" />

                <ImageButton
                    android:id="@+id/ibCloseRefHint"
                    android:layout_width="wrap_content"
                    android:layout_height="0dp"
                    android:background="?android:attr/selectableItemBackgroundBorderless"
                    android:contentDescription="@string/title_no_format"
                    app:layout_constraintBottom_toBottomOf="@+id/tvReferenceHint"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="@+id/tvReferenceHint"
                    app:srcCompat="@drawable/baseline_close_24" />

                <eu.faircode.email.FixedTextView
                    android:id="@+id/tvReferenceHint"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="6dp"
                    android:layout_marginTop="6dp"
                    android:layout_marginEnd="6dp"
                    android:text="@string/title_no_format"
                    android:textAppearance="@style/TextAppearance.AppCompat.Small"
                    android:textStyle="italic"
                    app:layout_constraintEnd_toStartOf="@+id/ibReferenceEdit"
                    app:layout_constraintStart_toEndOf="@id/ibCloseRefHint"
                    app:layout_constraintTop_toBottomOf="@id/vSeparatorSignature" />

                <ImageButton
                    android:id="@+id/ibReferenceEdit"
                    android:layout_width="36dp"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="6dp"
                    android:layout_marginEnd="6dp"
                    android:background="?android:attr/selectableItemBackgroundBorderless"
                    android:contentDescription="@string/title_legend_edit"
                    android:padding="3dp"
                    app:layout_constraintEnd_toStartOf="@+id/ibReferenceImages"
                    app:layout_constraintTop_toBottomOf="@id/vSeparatorSignature"
                    app:srcCompat="@drawable/baseline_edit_24" />

                <ImageButton
                    android:id="@+id/ibReferenceImages"
                    android:layout_width="36dp"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="6dp"
                    android:layout_marginEnd="6dp"
                    android:background="?android:attr/selectableItemBackgroundBorderless"
                    android:contentDescription="@string/title_legend_show_images"
                    android:padding="3dp"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintTop_toBottomOf="@id/vSeparatorSignature"
                    app:srcCompat="@drawable/baseline_image_24" />

                <androidx.constraintlayout.widget.Barrier
                    android:id="@+id/barrier_reference"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    app:barrierDirection="bottom"
                    app:constraint_referenced_ids="ibCloseRefHint,tvReferenceHint,ibReferenceEdit,ibReferenceImages" />

                <eu.faircode.email.FixedTextView
                    android:id="@+id/tvReference"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="6dp"
                    android:layout_marginTop="6dp"
                    android:layout_marginEnd="6dp"
                    android:fontFamily="monospace"
                    android:hyphenationFrequency="none"
                    android:textAppearance="@style/TextAppearance.AppCompat.Small"
                    android:textIsSelectable="true"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toBottomOf="@id/barrier_reference" />

                <androidx.constraintlayout.widget.Group
                    android:id="@+id/grpHeader"
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    app:constraint_referenced_ids="spIdentity,ivToLegend,etTo,ivToAdd,etSubject,vSeparator" />

                <androidx.constraintlayout.widget.Group
                    android:id="@+id/grpExtra"
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    app:constraint_referenced_ids="etExtra,tvDomain" />

                <androidx.constraintlayout.widget.Group
                    android:id="@+id/grpAddresses"
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    app:constraint_referenced_ids="ivCcLegend,etCc,ivCcAdd,ivBccLegend,etBcc,ivBccAdd" />

                <androidx.constraintlayout.widget.Group
                    android:id="@+id/grpAttachments"
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    app:constraint_referenced_ids="vSeparatorAttachments,rvAttachment" />

                <androidx.constraintlayout.widget.Group
                    android:id="@+id/grpUnusedImagesHint"
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    app:constraint_referenced_ids="ibCloseUnusedImagesHint,tvUnusedImagesHint" />

                <androidx.constraintlayout.widget.Group
                    android:id="@+id/grpBody"
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    app:constraint_referenced_ids="vSeparatorBody,etBody" />

                <androidx.constraintlayout.widget.Group
                    android:id="@+id/grpSignature"
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    app:constraint_referenced_ids="vSeparatorSignature,tvSignature,cbSignature" />

                <androidx.constraintlayout.widget.Group
                    android:id="@+id/grpReferenceHint"
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    app:constraint_referenced_ids="ibCloseRefHint,tvReferenceHint" />
            </androidx.constraintlayout.widget.ConstraintLayout>
        </eu.faircode.email.ScrollViewEx>

        <com.google.android.material.bottomnavigation.BottomNavigationView
            android:id="@+id/style_bar"
            android:layout_width="0dp"
            android:layout_height="36dp"
            android:layout_marginBottom="1dp"
            android:background="?attr/colorActionBackground"
            app:itemIconTint="@color/action_foreground"
            app:itemTextColor="@color/action_foreground"
            app:labelVisibilityMode="unlabeled"
            app:layout_constraintBottom_toTopOf="@+id/media_bar"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:menu="@menu/action_compose_style" />

        <com.google.android.material.bottomnavigation.BottomNavigationView
            android:id="@+id/media_bar"
            android:layout_width="0dp"
            android:layout_height="36dp"
            android:background="?attr/colorActionBackground"
            app:itemIconTint="@color/action_foreground"
            app:itemTextColor="@color/action_foreground"
            app:labelVisibilityMode="unlabeled"
            app:layout_constraintBottom_toTopOf="@+id/bottom_navigation"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:menu="@menu/action_compose_media" />

        <com.google.android.material.bottomnavigation.BottomNavigationView
            android:id="@+id/bottom_navigation"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:background="?attr/colorPrimary"
            app:itemIconTint="@color/action_foreground"
            app:itemTextColor="@color/action_foreground"
            app:labelVisibilityMode="labeled"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:menu="@menu/action_compose" />

        <eu.faircode.email.ContentLoadingProgressBar
            android:id="@+id/pbWait"
            style="@style/Base.Widget.AppCompat.ProgressBar"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:indeterminate="true"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />
    </androidx.constraintlayout.widget.ConstraintLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>