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

    <eu.faircode.email.ViewCardOptional
        android:id="@+id/card"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <androidx.constraintlayout.widget.ConstraintLayout
            android:id="@+id/clItem"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="?attr/activatableItemBackground"
            android:foreground="?attr/selectableItemBackground">

            <eu.faircode.email.ViewStripe
                android:id="@+id/vwColor"
                android:layout_width="6dp"
                android:layout_height="0dp"
                android:background="?attr/colorAccent"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent" />

            <ImageView
                android:id="@+id/ivState"
                android:layout_width="24dp"
                android:layout_height="24dp"
                android:layout_marginStart="6dp"
                android:contentDescription="@string/title_legend_connection_state"
                app:layout_constraintBottom_toBottomOf="@+id/tvName"
                app:layout_constraintStart_toEndOf="@id/vwColor"
                app:layout_constraintTop_toTopOf="@+id/tvName"
                app:srcCompat="@drawable/baseline_cloud_off_24" />

            <ImageView
                android:id="@+id/ivReadOnly"
                android:layout_width="24dp"
                android:layout_height="24dp"
                android:layout_marginStart="6dp"
                app:layout_constraintStart_toEndOf="@id/vwColor"
                app:layout_constraintTop_toTopOf="@+id/tvType"
                app:srcCompat="@drawable/baseline_visibility_24" />

            <View
                android:id="@+id/vwLevel"
                android:layout_width="0dp"
                android:layout_height="0dp"
                app:layout_constraintBottom_toBottomOf="@+id/tvKeywords"
                app:layout_constraintStart_toEndOf="@id/ivState"
                app:layout_constraintTop_toTopOf="parent" />

            <ImageButton
                android:id="@+id/ibExpander"
                android:layout_width="wrap_content"
                android:layout_height="0dp"
                android:layout_gravity="center_vertical|center_horizontal"
                android:background="?android:attr/selectableItemBackgroundBorderless"
                android:contentDescription="@string/title_legend_expander"
                android:paddingStart="12dp"
                android:paddingEnd="12dp"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintStart_toEndOf="@+id/vwLevel"
                app:layout_constraintTop_toTopOf="parent"
                app:srcCompat="@drawable/expander" />

            <ImageView
                android:id="@+id/ivUnified"
                android:layout_width="30dp"
                android:layout_height="24dp"
                android:contentDescription="@string/title_unified_folder"
                android:paddingEnd="6dp"
                app:layout_constraintBottom_toBottomOf="@+id/tvName"
                app:layout_constraintStart_toEndOf="@id/ibExpander"
                app:layout_constraintTop_toTopOf="@+id/tvName"
                app:srcCompat="@drawable/baseline_folder_special_24" />

            <ImageView
                android:id="@+id/ivSubscribed"
                android:layout_width="30dp"
                android:layout_height="24dp"
                android:contentDescription="@string/title_legend_subscribed"
                android:paddingEnd="6dp"
                app:layout_constraintBottom_toBottomOf="@+id/tvName"
                app:layout_constraintStart_toEndOf="@id/ivUnified"
                app:layout_constraintTop_toTopOf="@+id/tvName"
                app:srcCompat="@drawable/baseline_bookmark_24" />

            <ImageView
                android:id="@+id/ivRule"
                android:layout_width="30dp"
                android:layout_height="24dp"
                android:contentDescription="@string/title_edit_rules"
                android:paddingEnd="6dp"
                app:layout_constraintBottom_toBottomOf="@+id/tvName"
                app:layout_constraintStart_toEndOf="@id/ivSubscribed"
                app:layout_constraintTop_toTopOf="@+id/tvName"
                app:srcCompat="@drawable/baseline_filter_list_24" />

            <ImageView
                android:id="@+id/ivNotify"
                android:layout_width="30dp"
                android:layout_height="24dp"
                android:contentDescription="@string/title_legend_notify"
                android:paddingEnd="6dp"
                app:layout_constraintBottom_toBottomOf="@+id/tvName"
                app:layout_constraintStart_toEndOf="@id/ivRule"
                app:layout_constraintTop_toTopOf="@+id/tvName"
                app:srcCompat="@drawable/baseline_notifications_24" />

            <eu.faircode.email.FixedTextView
                android:id="@+id/tvName"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_marginEnd="6dp"
                android:ellipsize="middle"
                android:gravity="center_vertical"
                android:minHeight="24dp"
                android:singleLine="true"
                android:text="Name"
                android:textAppearance="@style/TextAppearance.AppCompat.Medium"
                app:layout_constraintEnd_toStartOf="@+id/tvMessages"
                app:layout_constraintStart_toEndOf="@id/ivNotify"
                app:layout_constraintTop_toTopOf="parent" />

            <eu.faircode.email.FixedTextView
                android:id="@+id/tvMessages"
                android:layout_width="wrap_content"
                android:layout_height="24dp"
                android:layout_marginEnd="6dp"
                android:gravity="center_vertical"
                android:text="123"
                android:textAppearance="@android:style/TextAppearance.Small"
                app:layout_constraintBottom_toBottomOf="@+id/tvName"
                app:layout_constraintEnd_toStartOf="@+id/ivMessages"
                app:layout_constraintTop_toTopOf="@+id/tvName" />

            <ImageView
                android:id="@+id/ivMessages"
                android:layout_width="24dp"
                android:layout_height="24dp"
                android:layout_marginEnd="6dp"
                app:layout_constraintBottom_toBottomOf="@+id/tvName"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintTop_toTopOf="@+id/tvName"
                app:srcCompat="@drawable/baseline_mail_outline_24" />

            <ImageView
                android:id="@+id/ivType"
                android:layout_width="30dp"
                android:layout_height="24dp"
                android:paddingEnd="6dp"
                app:layout_constraintBottom_toBottomOf="@+id/tvType"
                app:layout_constraintStart_toEndOf="@id/ibExpander"
                app:layout_constraintTop_toTopOf="@+id/tvType"
                app:srcCompat="@drawable/baseline_inbox_24" />

            <eu.faircode.email.FixedTextView
                android:id="@+id/tvType"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="3dp"
                android:gravity="center_vertical"
                android:maxLines="1"
                android:minHeight="24dp"
                android:text="type"
                android:textAppearance="@android:style/TextAppearance.Small"
                android:textStyle="italic"
                app:layout_constraintStart_toEndOf="@id/ivType"
                app:layout_constraintTop_toBottomOf="@id/tvName" />

            <eu.faircode.email.FixedTextView
                android:id="@+id/tvTotal"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_marginStart="6dp"
                android:layout_marginEnd="6dp"
                android:gravity="center_vertical"
                android:maxLines="1"
                android:minHeight="24dp"
                android:text="12,345"
                android:textAppearance="@android:style/TextAppearance.Small"
                android:textStyle="italic"
                app:layout_constraintEnd_toStartOf="@+id/tvAfter"
                app:layout_constraintStart_toEndOf="@id/tvType"
                app:layout_constraintTop_toTopOf="@id/tvType" />

            <eu.faircode.email.FixedTextView
                android:id="@+id/tvAfter"
                android:layout_width="wrap_content"
                android:layout_height="24dp"
                android:layout_marginEnd="6dp"
                android:gravity="center_vertical"
                android:text="30"
                android:textAppearance="@android:style/TextAppearance.Small"
                app:layout_constraintBottom_toBottomOf="@id/tvType"
                app:layout_constraintEnd_toStartOf="@+id/ivSync"
                app:layout_constraintTop_toTopOf="@+id/tvType" />

            <ImageView
                android:id="@+id/ivSync"
                android:layout_width="24dp"
                android:layout_height="24dp"
                android:layout_marginEnd="6dp"
                app:layout_constraintBottom_toBottomOf="@id/tvType"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintTop_toTopOf="@+id/tvType"
                app:srcCompat="@drawable/baseline_sync_24" />

            <eu.faircode.email.FixedTextView
                android:id="@+id/tvKeywords"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_marginTop="3dp"
                android:layout_marginEnd="6dp"
                android:gravity="center_vertical"
                android:minHeight="24dp"
                android:text="Keywords"
                android:textAppearance="@android:style/TextAppearance.Small"
                app:layout_constraintEnd_toStartOf="@id/tvFlagged"
                app:layout_constraintStart_toEndOf="@id/ibExpander"
                app:layout_constraintTop_toBottomOf="@id/tvType" />

            <eu.faircode.email.FixedTextView
                android:id="@+id/tvFlagged"
                android:layout_width="wrap_content"
                android:layout_height="24dp"
                android:layout_marginEnd="6dp"
                android:gravity="center_vertical"
                android:text="3"
                android:textAppearance="@android:style/TextAppearance.Small"
                app:layout_constraintBottom_toBottomOf="@id/tvKeywords"
                app:layout_constraintEnd_toStartOf="@+id/ibFlagged"
                app:layout_constraintTop_toTopOf="@+id/tvKeywords" />

            <ImageView
                android:id="@+id/ibFlagged"
                android:layout_width="24dp"
                android:layout_height="24dp"
                android:layout_marginEnd="6dp"
                android:background="?android:attr/selectableItemBackgroundBorderless"
                android:contentDescription="@string/title_flag"
                app:layout_constraintBottom_toBottomOf="@id/tvKeywords"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintTop_toTopOf="@+id/tvKeywords"
                app:srcCompat="@drawable/baseline_star_24" />

            <eu.faircode.email.FixedTextView
                android:id="@+id/tvError"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_marginTop="3dp"
                android:layout_marginEnd="6dp"
                android:text="error"
                android:textAppearance="@style/TextAppearance.AppCompat.Small"
                android:textColor="?attr/colorWarning"
                android:textIsSelectable="true"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toEndOf="@id/ibExpander"
                app:layout_constraintTop_toBottomOf="@id/tvKeywords" />

            <Button
                android:id="@+id/btnHelp"
                style="?android:attr/buttonStyleSmall"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:backgroundTint="?attr/colorInfoBackground"
                android:text="@string/title_setup_help"
                android:textColor="?attr/colorInfoForeground"
                android:textStyle="bold"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintTop_toBottomOf="@id/tvError" />

            <androidx.constraintlayout.widget.Group
                android:id="@+id/grpFlagged"
                android:layout_width="0dp"
                android:layout_height="0dp"
                app:constraint_referenced_ids="tvFlagged,ibFlagged" />

            <androidx.constraintlayout.widget.Group
                android:id="@+id/grpExtended"
                android:layout_width="0dp"
                android:layout_height="0dp"
                app:constraint_referenced_ids="ivType,tvType,tvTotal,tvAfter,ivSync" />
        </androidx.constraintlayout.widget.ConstraintLayout>
    </eu.faircode.email.ViewCardOptional>
</FrameLayout>
