<?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:tools="http://schemas.android.com/tools"
    android:id="@+id/category_header_layout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/list_item_selector"
    android:gravity="center_vertical">

    <Space
        android:id="@+id/start_space"
        android:layout_width="6dp"
        android:layout_height="1dp"
        app:layout_constraintBottom_toBottomOf="@+id/category_title"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="@+id/category_title" />

    <ImageView
        android:id="@+id/checkbox"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="2dp"
        android:clickable="true"
        android:contentDescription="@string/select_all"
        android:focusable="true"
        android:padding="5dp"
        android:src="@drawable/ic_check_circle_24dp"
        android:visibility="gone"
        app:layout_constraintBottom_toBottomOf="@+id/category_title"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="@+id/category_title"
        tools:tint="?attr/colorAccent"
        tools:visibility="gone" />

    <ImageView
        android:id="@+id/collapse_arrow"
        android:layout_width="14dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="8dp"
        android:contentDescription="@string/select_all"
        android:src="@drawable/ic_expand_less_24dp"
        app:tint="?android:textColorPrimary"
        app:layout_constraintBottom_toBottomOf="@+id/category_title"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="@+id/category_title" />

    <androidx.constraintlayout.widget.Barrier
        android:id="@+id/start_barrier"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:barrierDirection="right"
        app:constraint_referenced_ids="start_space,collapse_arrow,checkbox" />

    <Space
        android:id="@+id/space"
        android:layout_width="0dp"
        android:layout_height="20dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toStartOf="@id/category_sort"
        app:layout_constraintStart_toEndOf="@id/category_title"
        app:layout_constraintWidth_min="1dp" />

    <TextView
        android:id="@+id/category_title"
        style="@style/TextAppearance.MaterialComponents.Headline6"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="28dp"
        android:layout_marginBottom="6dp"
        android:background="@drawable/square_ripple"
        android:drawablePadding="6dp"
        android:ellipsize="end"
        android:gravity="center|start"
        android:inputType="none"
        android:maxLines="2"
        android:paddingStart="0dp"
        android:paddingTop="4dp"
        android:paddingEnd="4dp"
        android:paddingBottom="4dp"
        android:textColor="?android:textColorPrimary"
        android:textSize="18sp"
        app:layout_constrainedWidth="true"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toStartOf="@id/space"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintStart_toEndOf="@+id/start_barrier"
        app:layout_constraintTop_toTopOf="parent"
        tools:text="Title dfdsfsfsfsfsfdsfsfsfs" />


    <TextView
        android:id="@+id/category_sort"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginEnd="0dp"
        android:background="@drawable/square_ripple"
        android:clickable="true"
        android:drawableEnd="@drawable/ic_sort_24dp"
        android:drawablePadding="6dp"
        android:drawableTint="?android:textColorPrimary"
        android:ellipsize="start"
        android:focusable="true"
        android:gravity="center|end"
        android:maxLines="2"
        android:padding="6dp"
        android:textAlignment="textEnd"
        android:textAppearance="@style/TextAppearance.MaterialComponents.Body2"
        android:textColor="?android:attr/textColorPrimary"
        android:textSize="12sp"
        android:textStyle="normal"
        app:layout_constrainedWidth="true"
        app:layout_constraintBottom_toBottomOf="@id/category_title"
        app:layout_constraintEnd_toStartOf="@id/update_button"
        app:layout_constraintHorizontal_bias="1.0"
        app:layout_constraintStart_toEndOf="@id/space"
        app:layout_constraintTop_toTopOf="@id/category_title"
        tools:text="Drag and Drop" />

    <ImageButton
        android:id="@+id/update_button"
        style="@style/Theme.Widget.ImageBorderless"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginEnd="6dp"
        android:clickable="true"
        android:focusable="true"
        android:padding="4dp"
        android:src="@drawable/ic_refresh_24dp"
        app:tint="?android:textColorPrimary"
        android:tooltipText="@string/update"
        app:layout_constraintBottom_toBottomOf="@id/category_title"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toEndOf="@id/category_sort"
        app:layout_constraintTop_toTopOf="@id/category_title" />

    <ProgressBar
        android:id="@+id/cat_progress"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_margin="5dp"
        android:visibility="gone"
        app:layout_constraintBottom_toBottomOf="@id/update_button"
        app:layout_constraintEnd_toEndOf="@id/update_button"
        app:layout_constraintStart_toStartOf="@id/update_button"
        app:layout_constraintTop_toTopOf="@id/update_button"
        tools:visibility="visible" />
</androidx.constraintlayout.widget.ConstraintLayout>